diff --git a/.eslintrc.yml b/.eslintrc.yml index 6d2449637b..c2b9bf99a7 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -15,6 +15,11 @@ parser: '@typescript-eslint/parser' parserOptions: ecmaVersion: 2018 sourceType: module + project: + - './tsconfig.json' +ignorePatterns: # mirrors tsconfig.json's exclude + - '**/__tests__' + - '**/*.d.ts' plugins: - '@typescript-eslint' - prettier @@ -70,6 +75,10 @@ rules: "@typescript-eslint/consistent-type-imports": - error + + "@typescript-eslint/no-floating-promises": + - error + "@typescript-eslint/naming-convention": - error diff --git a/NEWS.md b/NEWS.md index 0c1bc19666..e72729b9ab 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # shiny (development version) +## Possibly breaking changes + +* Closed #3899: The JS functions `Shiny.renderContent()` and `Shiny.bindAll()` are now asynchronous. These changes were motivated by the recent push toward making dynamic UI rendering asynchronous (and should've happened when it was first introduced in Shiny v1.7.5). The vast majority of user code using these functions should continue to work as before, but some code may break if it relies on these functions being synchronous (i.e., blocking downstream operations until completion). In this case, consider `await`-ing the downstream operations (or placing in a `.then()` callback). (#3929) + ## New features and improvements * Updated `selectizeInput()`'s selectize.js dependency from v0.12.4 to v0.15.2. In addition to many bug fixes and improvements, this update also adds several new [plugin options](https://selectize.dev/docs/demos/plugins). (#3875) diff --git a/inst/www/shared/shiny.js b/inst/www/shared/shiny.js index 908a37da20..aeff68aa39 100644 --- a/inst/www/shared/shiny.js +++ b/inst/www/shared/shiny.js @@ -3227,194 +3227,6 @@ } }); - // node_modules/core-js/internals/iterator-close.js - var require_iterator_close = __commonJS({ - "node_modules/core-js/internals/iterator-close.js": function(exports, module) { - var call8 = require_function_call(); - var anObject10 = require_an_object(); - var getMethod5 = require_get_method(); - module.exports = function(iterator, kind, value) { - var innerResult, innerError; - anObject10(iterator); - try { - innerResult = getMethod5(iterator, "return"); - if (!innerResult) { - if (kind === "throw") - throw value; - return value; - } - innerResult = call8(innerResult, iterator); - } catch (error) { - innerError = true; - innerResult = error; - } - if (kind === "throw") - throw value; - if (innerError) - throw innerResult; - anObject10(innerResult); - return value; - }; - } - }); - - // node_modules/core-js/internals/call-with-safe-iteration-closing.js - var require_call_with_safe_iteration_closing = __commonJS({ - "node_modules/core-js/internals/call-with-safe-iteration-closing.js": function(exports, module) { - var anObject10 = require_an_object(); - var iteratorClose = require_iterator_close(); - module.exports = function(iterator, fn, value, ENTRIES) { - try { - return ENTRIES ? fn(anObject10(value)[0], value[1]) : fn(value); - } catch (error) { - iteratorClose(iterator, "throw", error); - } - }; - } - }); - - // node_modules/core-js/internals/is-array-iterator-method.js - var require_is_array_iterator_method = __commonJS({ - "node_modules/core-js/internals/is-array-iterator-method.js": function(exports, module) { - var wellKnownSymbol6 = require_well_known_symbol(); - var Iterators = require_iterators(); - var ITERATOR2 = wellKnownSymbol6("iterator"); - var ArrayPrototype = Array.prototype; - module.exports = function(it) { - return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR2] === it); - }; - } - }); - - // node_modules/core-js/internals/get-iterator-method.js - var require_get_iterator_method = __commonJS({ - "node_modules/core-js/internals/get-iterator-method.js": function(exports, module) { - var classof = require_classof(); - var getMethod5 = require_get_method(); - var isNullOrUndefined5 = require_is_null_or_undefined(); - var Iterators = require_iterators(); - var wellKnownSymbol6 = require_well_known_symbol(); - var ITERATOR2 = wellKnownSymbol6("iterator"); - module.exports = function(it) { - if (!isNullOrUndefined5(it)) - return getMethod5(it, ITERATOR2) || getMethod5(it, "@@iterator") || Iterators[classof(it)]; - }; - } - }); - - // node_modules/core-js/internals/get-iterator.js - var require_get_iterator = __commonJS({ - "node_modules/core-js/internals/get-iterator.js": function(exports, module) { - var call8 = require_function_call(); - var aCallable2 = require_a_callable(); - var anObject10 = require_an_object(); - var tryToString = require_try_to_string(); - var getIteratorMethod = require_get_iterator_method(); - var $TypeError = TypeError; - module.exports = function(argument, usingIterator) { - var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; - if (aCallable2(iteratorMethod)) - return anObject10(call8(iteratorMethod, argument)); - throw $TypeError(tryToString(argument) + " is not iterable"); - }; - } - }); - - // node_modules/core-js/internals/array-from.js - var require_array_from = __commonJS({ - "node_modules/core-js/internals/array-from.js": function(exports, module) { - "use strict"; - var bind2 = require_function_bind_context(); - var call8 = require_function_call(); - var toObject5 = require_to_object(); - var callWithSafeIterationClosing = require_call_with_safe_iteration_closing(); - var isArrayIteratorMethod = require_is_array_iterator_method(); - var isConstructor2 = require_is_constructor(); - var lengthOfArrayLike4 = require_length_of_array_like(); - var createProperty5 = require_create_property(); - var getIterator = require_get_iterator(); - var getIteratorMethod = require_get_iterator_method(); - var $Array2 = Array; - module.exports = function from2(arrayLike) { - var O = toObject5(arrayLike); - var IS_CONSTRUCTOR = isConstructor2(this); - var argumentsLength = arguments.length; - var mapfn = argumentsLength > 1 ? arguments[1] : void 0; - var mapping = mapfn !== void 0; - if (mapping) - mapfn = bind2(mapfn, argumentsLength > 2 ? arguments[2] : void 0); - var iteratorMethod = getIteratorMethod(O); - var index = 0; - var length, result, step, iterator, next2, value; - if (iteratorMethod && !(this === $Array2 && isArrayIteratorMethod(iteratorMethod))) { - iterator = getIterator(O, iteratorMethod); - next2 = iterator.next; - result = IS_CONSTRUCTOR ? new this() : []; - for (; !(step = call8(next2, iterator)).done; index++) { - value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; - createProperty5(result, index, value); - } - } else { - length = lengthOfArrayLike4(O); - result = IS_CONSTRUCTOR ? new this(length) : $Array2(length); - for (; length > index; index++) { - value = mapping ? mapfn(O[index], index) : O[index]; - createProperty5(result, index, value); - } - } - result.length = index; - return result; - }; - } - }); - - // node_modules/core-js/internals/check-correctness-of-iteration.js - var require_check_correctness_of_iteration = __commonJS({ - "node_modules/core-js/internals/check-correctness-of-iteration.js": function(exports, module) { - var wellKnownSymbol6 = require_well_known_symbol(); - var ITERATOR2 = wellKnownSymbol6("iterator"); - var SAFE_CLOSING = false; - try { - called = 0; - iteratorWithReturn = { - next: function() { - return { done: !!called++ }; - }, - "return": function() { - SAFE_CLOSING = true; - } - }; - iteratorWithReturn[ITERATOR2] = function() { - return this; - }; - Array.from(iteratorWithReturn, function() { - throw 2; - }); - } catch (error) { - } - var called; - var iteratorWithReturn; - module.exports = function(exec2, SKIP_CLOSING) { - if (!SKIP_CLOSING && !SAFE_CLOSING) - return false; - var ITERATION_SUPPORT = false; - try { - var object = {}; - object[ITERATOR2] = function() { - return { - next: function() { - return { done: ITERATION_SUPPORT = true }; - } - }; - }; - exec2(object); - } catch (error) { - } - return ITERATION_SUPPORT; - }; - } - }); - // node_modules/core-js/internals/engine-is-node.js var require_engine_is_node = __commonJS({ "node_modules/core-js/internals/engine-is-node.js": function(exports, module) { @@ -4123,42 +3935,120 @@ } }); - // node_modules/core-js/internals/iterate.js - var require_iterate = __commonJS({ - "node_modules/core-js/internals/iterate.js": function(exports, module) { - var bind2 = require_function_bind_context(); + // node_modules/core-js/internals/is-array-iterator-method.js + var require_is_array_iterator_method = __commonJS({ + "node_modules/core-js/internals/is-array-iterator-method.js": function(exports, module) { + var wellKnownSymbol6 = require_well_known_symbol(); + var Iterators = require_iterators(); + var ITERATOR2 = wellKnownSymbol6("iterator"); + var ArrayPrototype = Array.prototype; + module.exports = function(it) { + return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR2] === it); + }; + } + }); + + // node_modules/core-js/internals/get-iterator-method.js + var require_get_iterator_method = __commonJS({ + "node_modules/core-js/internals/get-iterator-method.js": function(exports, module) { + var classof = require_classof(); + var getMethod5 = require_get_method(); + var isNullOrUndefined5 = require_is_null_or_undefined(); + var Iterators = require_iterators(); + var wellKnownSymbol6 = require_well_known_symbol(); + var ITERATOR2 = wellKnownSymbol6("iterator"); + module.exports = function(it) { + if (!isNullOrUndefined5(it)) + return getMethod5(it, ITERATOR2) || getMethod5(it, "@@iterator") || Iterators[classof(it)]; + }; + } + }); + + // node_modules/core-js/internals/get-iterator.js + var require_get_iterator = __commonJS({ + "node_modules/core-js/internals/get-iterator.js": function(exports, module) { var call8 = require_function_call(); + var aCallable2 = require_a_callable(); var anObject10 = require_an_object(); var tryToString = require_try_to_string(); - var isArrayIteratorMethod = require_is_array_iterator_method(); - var lengthOfArrayLike4 = require_length_of_array_like(); - var isPrototypeOf3 = require_object_is_prototype_of(); - var getIterator = require_get_iterator(); var getIteratorMethod = require_get_iterator_method(); - var iteratorClose = require_iterator_close(); var $TypeError = TypeError; - var Result = function(stopped, result) { - this.stopped = stopped; - this.result = result; + module.exports = function(argument, usingIterator) { + var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; + if (aCallable2(iteratorMethod)) + return anObject10(call8(iteratorMethod, argument)); + throw $TypeError(tryToString(argument) + " is not iterable"); }; - var ResultPrototype = Result.prototype; - module.exports = function(iterable, unboundFunction, options) { - var that = options && options.that; - var AS_ENTRIES = !!(options && options.AS_ENTRIES); - var IS_RECORD = !!(options && options.IS_RECORD); - var IS_ITERATOR = !!(options && options.IS_ITERATOR); - var INTERRUPTED = !!(options && options.INTERRUPTED); - var fn = bind2(unboundFunction, that); - var iterator, iterFn, index, length, result, next2, step; - var stop = function(condition) { - if (iterator) - iteratorClose(iterator, "normal", condition); - return new Result(true, condition); - }; - var callFn = function(value) { - if (AS_ENTRIES) { - anObject10(value); - return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); + } + }); + + // node_modules/core-js/internals/iterator-close.js + var require_iterator_close = __commonJS({ + "node_modules/core-js/internals/iterator-close.js": function(exports, module) { + var call8 = require_function_call(); + var anObject10 = require_an_object(); + var getMethod5 = require_get_method(); + module.exports = function(iterator, kind, value) { + var innerResult, innerError; + anObject10(iterator); + try { + innerResult = getMethod5(iterator, "return"); + if (!innerResult) { + if (kind === "throw") + throw value; + return value; + } + innerResult = call8(innerResult, iterator); + } catch (error) { + innerError = true; + innerResult = error; + } + if (kind === "throw") + throw value; + if (innerError) + throw innerResult; + anObject10(innerResult); + return value; + }; + } + }); + + // node_modules/core-js/internals/iterate.js + var require_iterate = __commonJS({ + "node_modules/core-js/internals/iterate.js": function(exports, module) { + var bind2 = require_function_bind_context(); + var call8 = require_function_call(); + var anObject10 = require_an_object(); + var tryToString = require_try_to_string(); + var isArrayIteratorMethod = require_is_array_iterator_method(); + var lengthOfArrayLike4 = require_length_of_array_like(); + var isPrototypeOf3 = require_object_is_prototype_of(); + var getIterator = require_get_iterator(); + var getIteratorMethod = require_get_iterator_method(); + var iteratorClose = require_iterator_close(); + var $TypeError = TypeError; + var Result = function(stopped, result) { + this.stopped = stopped; + this.result = result; + }; + var ResultPrototype = Result.prototype; + module.exports = function(iterable, unboundFunction, options) { + var that = options && options.that; + var AS_ENTRIES = !!(options && options.AS_ENTRIES); + var IS_RECORD = !!(options && options.IS_RECORD); + var IS_ITERATOR = !!(options && options.IS_ITERATOR); + var INTERRUPTED = !!(options && options.INTERRUPTED); + var fn = bind2(unboundFunction, that); + var iterator, iterFn, index, length, result, next2, step; + var stop = function(condition) { + if (iterator) + iteratorClose(iterator, "normal", condition); + return new Result(true, condition); + }; + var callFn = function(value) { + if (AS_ENTRIES) { + anObject10(value); + return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); } return INTERRUPTED ? fn(value, stop) : fn(value); }; @@ -4195,6 +4085,53 @@ } }); + // node_modules/core-js/internals/check-correctness-of-iteration.js + var require_check_correctness_of_iteration = __commonJS({ + "node_modules/core-js/internals/check-correctness-of-iteration.js": function(exports, module) { + var wellKnownSymbol6 = require_well_known_symbol(); + var ITERATOR2 = wellKnownSymbol6("iterator"); + var SAFE_CLOSING = false; + try { + called = 0; + iteratorWithReturn = { + next: function() { + return { done: !!called++ }; + }, + "return": function() { + SAFE_CLOSING = true; + } + }; + iteratorWithReturn[ITERATOR2] = function() { + return this; + }; + Array.from(iteratorWithReturn, function() { + throw 2; + }); + } catch (error) { + } + var called; + var iteratorWithReturn; + module.exports = function(exec2, SKIP_CLOSING) { + if (!SKIP_CLOSING && !SAFE_CLOSING) + return false; + var ITERATION_SUPPORT = false; + try { + var object = {}; + object[ITERATOR2] = function() { + return { + next: function() { + return { done: ITERATION_SUPPORT = true }; + } + }; + }; + exec2(object); + } catch (error) { + } + return ITERATION_SUPPORT; + }; + } + }); + // node_modules/core-js/internals/promise-statics-incorrect-iteration.js var require_promise_statics_incorrect_iteration = __commonJS({ "node_modules/core-js/internals/promise-statics-incorrect-iteration.js": function(exports, module) { @@ -4365,6 +4302,69 @@ } }); + // node_modules/core-js/internals/call-with-safe-iteration-closing.js + var require_call_with_safe_iteration_closing = __commonJS({ + "node_modules/core-js/internals/call-with-safe-iteration-closing.js": function(exports, module) { + var anObject10 = require_an_object(); + var iteratorClose = require_iterator_close(); + module.exports = function(iterator, fn, value, ENTRIES) { + try { + return ENTRIES ? fn(anObject10(value)[0], value[1]) : fn(value); + } catch (error) { + iteratorClose(iterator, "throw", error); + } + }; + } + }); + + // node_modules/core-js/internals/array-from.js + var require_array_from = __commonJS({ + "node_modules/core-js/internals/array-from.js": function(exports, module) { + "use strict"; + var bind2 = require_function_bind_context(); + var call8 = require_function_call(); + var toObject5 = require_to_object(); + var callWithSafeIterationClosing = require_call_with_safe_iteration_closing(); + var isArrayIteratorMethod = require_is_array_iterator_method(); + var isConstructor2 = require_is_constructor(); + var lengthOfArrayLike4 = require_length_of_array_like(); + var createProperty5 = require_create_property(); + var getIterator = require_get_iterator(); + var getIteratorMethod = require_get_iterator_method(); + var $Array2 = Array; + module.exports = function from2(arrayLike) { + var O = toObject5(arrayLike); + var IS_CONSTRUCTOR = isConstructor2(this); + var argumentsLength = arguments.length; + var mapfn = argumentsLength > 1 ? arguments[1] : void 0; + var mapping = mapfn !== void 0; + if (mapping) + mapfn = bind2(mapfn, argumentsLength > 2 ? arguments[2] : void 0); + var iteratorMethod = getIteratorMethod(O); + var index = 0; + var length, result, step, iterator, next2, value; + if (iteratorMethod && !(this === $Array2 && isArrayIteratorMethod(iteratorMethod))) { + iterator = getIterator(O, iteratorMethod); + next2 = iterator.next; + result = IS_CONSTRUCTOR ? new this() : []; + for (; !(step = call8(next2, iterator)).done; index++) { + value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; + createProperty5(result, index, value); + } + } else { + length = lengthOfArrayLike4(O); + result = IS_CONSTRUCTOR ? new this(length) : $Array2(length); + for (; length > index; index++) { + value = mapping ? mapfn(O[index], index) : O[index]; + createProperty5(result, index, value); + } + } + result.length = index; + return result; + }; + } + }); + // node_modules/core-js/internals/same-value.js var require_same_value = __commonJS({ "node_modules/core-js/internals/same-value.js": function(exports, module) { @@ -8656,399 +8656,448 @@ // srcts/src/bindings/input/selectInput.ts var import_es_json_stringify = __toESM(require_es_json_stringify()); - var import_es_array_iterator13 = __toESM(require_es_array_iterator()); + var import_es_array_iterator14 = __toESM(require_es_array_iterator()); var import_jquery15 = __toESM(require_jquery()); // srcts/src/utils/eval.ts var indirectEval = eval; + // node_modules/core-js/modules/es.promise.js + require_es_promise_constructor(); + require_es_promise_all(); + require_es_promise_catch(); + require_es_promise_race(); + require_es_promise_reject(); + require_es_promise_resolve(); + // srcts/src/shiny/initedMethods.ts - var fullShinyObj; - function setShinyObj(shiny) { - fullShinyObj = shiny; - } - function validateShinyHasBeenSet() { - if (typeof fullShinyObj === "undefined") { - throw "Shiny has not finish initialization yet. Please wait for the 'shiny-initialized' event."; + var import_es_array_iterator13 = __toESM(require_es_array_iterator()); + + // node_modules/core-js/modules/es.symbol.async-iterator.js + var defineWellKnownSymbol3 = require_well_known_symbol_define(); + defineWellKnownSymbol3("asyncIterator"); + + // node_modules/core-js/modules/es.symbol.to-string-tag.js + var getBuiltIn2 = require_get_built_in(); + var defineWellKnownSymbol4 = require_well_known_symbol_define(); + var setToStringTag2 = require_set_to_string_tag(); + defineWellKnownSymbol4("toStringTag"); + setToStringTag2(getBuiltIn2("Symbol"), "Symbol"); + + // node_modules/core-js/modules/es.json.to-string-tag.js + var global7 = require_global(); + var setToStringTag3 = require_set_to_string_tag(); + setToStringTag3(global7.JSON, "JSON", true); + + // node_modules/core-js/modules/es.math.to-string-tag.js + var setToStringTag4 = require_set_to_string_tag(); + setToStringTag4(Math, "Math", true); + + // node_modules/core-js/modules/es.array.reverse.js + var $36 = require_export(); + var uncurryThis7 = require_function_uncurry_this(); + var isArray3 = require_is_array(); + var nativeReverse = uncurryThis7([].reverse); + var test = [1, 2]; + $36({ target: "Array", proto: true, forced: String(test) === String(test.reverse()) }, { + reverse: function reverse() { + if (isArray3(this)) + this.length = this.length; + return nativeReverse(this); } - return fullShinyObj; - } - function shinySetInputValue(name, value, opts) { - validateShinyHasBeenSet().setInputValue(name, value, opts); - } - function shinyShinyApp() { - return validateShinyHasBeenSet().shinyapp; - } - function setShinyUser(user) { - validateShinyHasBeenSet().user = user; - } - function shinyForgetLastInputValue(name) { - validateShinyHasBeenSet().forgetLastInputValue(name); - } - function shinyBindAll(scope) { - validateShinyHasBeenSet().bindAll(scope); - } - function shinyUnbindAll(scope) { - var includeSelf = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - validateShinyHasBeenSet().unbindAll(scope, includeSelf); + }); + + // srcts/src/shiny/initedMethods.ts + function _typeof13(obj) { + "@babel/helpers - typeof"; + return _typeof13 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { + return typeof obj2; + } : function(obj2) { + return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }, _typeof13(obj); } - function shinyInitializeInputs(scope) { - validateShinyHasBeenSet().initializeInputs(scope); - } - function shinyAppBindOutput(id, binding) { - shinyShinyApp().bindOutput(id, binding); - } - function shinyAppUnbindOutput(id, binding) { - return shinyShinyApp().unbindOutput(id, binding); - } - function getShinyOnCustomMessage() { - return validateShinyHasBeenSet().oncustommessage; - } - var fileInputBinding; - function getFileInputBinding() { - return fileInputBinding; - } - function setFileInputBinding(fileInputBinding_) { - fileInputBinding = fileInputBinding_; - } - function getShinyCreateWebsocket() { - return validateShinyHasBeenSet().createSocket; - } - - // srcts/src/bindings/input/selectInput.ts - function _typeof13(obj) { - "@babel/helpers - typeof"; - return _typeof13 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { - return typeof obj2; - } : function(obj2) { - return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }, _typeof13(obj); - } - function _classCallCheck13(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - function _defineProperties13(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, _toPropertyKey13(descriptor.key), descriptor); + function _regeneratorRuntime() { + "use strict"; + _regeneratorRuntime = function _regeneratorRuntime13() { + return exports; + }; + var exports = {}, Op = Object.prototype, hasOwn4 = Op.hasOwnProperty, defineProperty3 = Object.defineProperty || function(obj, key, desc) { + obj[key] = desc.value; + }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + function define(obj, key, value) { + return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }), obj[key]; } - } - function _createClass13(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties13(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties13(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { writable: false }); - return Constructor; - } - function _toPropertyKey13(arg) { - var key = _toPrimitive13(arg, "string"); - return _typeof13(key) === "symbol" ? key : String(key); - } - function _toPrimitive13(input, hint) { - if (_typeof13(input) !== "object" || input === null) - return input; - var prim = input[Symbol.toPrimitive]; - if (prim !== void 0) { - var res = prim.call(input, hint || "default"); - if (_typeof13(res) !== "object") - return res; - throw new TypeError("@@toPrimitive must return a primitive value."); + try { + define({}, ""); + } catch (err) { + define = function define2(obj, key, value) { + return obj[key] = value; + }; } - return (hint === "string" ? String : Number)(input); - } - function _inherits11(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + function wrap(innerFn, outerFn, self2, tryLocsList) { + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); + return defineProperty3(generator, "_invoke", { value: makeInvokeMethod(innerFn, self2, context) }), generator; } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); - Object.defineProperty(subClass, "prototype", { writable: false }); - if (superClass) - _setPrototypeOf11(subClass, superClass); - } - function _setPrototypeOf11(o, p) { - _setPrototypeOf11 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf21(o2, p2) { - o2.__proto__ = p2; - return o2; - }; - return _setPrototypeOf11(o, p); - } - function _createSuper11(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct11(); - return function _createSuperInternal() { - var Super = _getPrototypeOf11(Derived), result; - if (hasNativeReflectConstruct) { - var NewTarget = _getPrototypeOf11(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; } - return _possibleConstructorReturn11(this, result); - }; - } - function _possibleConstructorReturn11(self2, call8) { - if (call8 && (_typeof13(call8) === "object" || typeof call8 === "function")) { - return call8; - } else if (call8 !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); } - return _assertThisInitialized11(self2); - } - function _assertThisInitialized11(self2) { - if (self2 === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + exports.wrap = wrap; + var ContinueSentinel = {}; + function Generator() { } - return self2; - } - function _isNativeReflectConstruct11() { - if (typeof Reflect === "undefined" || !Reflect.construct) - return false; - if (Reflect.construct.sham) - return false; - if (typeof Proxy === "function") - return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { - })); - return true; - } catch (e) { - return false; + function GeneratorFunction() { } - } - function _getPrototypeOf11(o) { - _getPrototypeOf11 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf21(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }; - return _getPrototypeOf11(o); - } - function getLabelNode7(el) { - var escapedId = $escape(el.id); - if (isSelectize(el)) { - escapedId += "-selectized"; + function GeneratorFunctionPrototype() { } - return (0, import_jquery15.default)(el).parent().parent().find('label[for="' + escapedId + '"]'); - } - function isSelectize(el) { - var config = (0, import_jquery15.default)(el).parent().find('script[data-for="' + $escape(el.id) + '"]'); - return config.length > 0; - } - var SelectInputBinding = /* @__PURE__ */ function(_InputBinding) { - _inherits11(SelectInputBinding2, _InputBinding); - var _super = _createSuper11(SelectInputBinding2); - function SelectInputBinding2() { - _classCallCheck13(this, SelectInputBinding2); - return _super.apply(this, arguments); + var IteratorPrototype = {}; + define(IteratorPrototype, iteratorSymbol, function() { + return this; + }); + var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values2([]))); + NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn4.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); + var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + define(prototype, method, function(arg) { + return this._invoke(method, arg); + }); + }); } - _createClass13(SelectInputBinding2, [{ - key: "find", - value: function find2(scope) { - return (0, import_jquery15.default)(scope).find("select"); - } - }, { - key: "getType", - value: function getType(el) { - var $el = (0, import_jquery15.default)(el); - if (!$el.hasClass("symbol")) { - return null; - } - if ($el.attr("multiple") === "multiple") { - return "shiny.symbolList"; - } else { - return "shiny.symbol"; + function AsyncIterator(generator, PromiseImpl) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if ("throw" !== record.type) { + var result = record.arg, value = result.value; + return value && "object" == _typeof13(value) && hasOwn4.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value2) { + invoke("next", value2, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }) : PromiseImpl.resolve(value).then(function(unwrapped) { + result.value = unwrapped, resolve(result); + }, function(error) { + return invoke("throw", error, resolve, reject); + }); } + reject(record.arg); } - }, { - key: "getId", - value: function getId(el) { - return InputBinding.prototype.getId.call(this, el) || el.name; - } - }, { - key: "getValue", - value: function getValue(el) { - return (0, import_jquery15.default)(el).val(); - } - }, { - key: "setValue", - value: function setValue(el, value) { - if (!isSelectize(el)) { - (0, import_jquery15.default)(el).val(value); - } else { - var selectize = this._selectize(el); - selectize === null || selectize === void 0 ? void 0 : selectize.setValue(value); + var previousPromise; + defineProperty3(this, "_invoke", { value: function value(method, arg) { + function callInvokeWithMethodAndArg() { + return new PromiseImpl(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); } - } - }, { - key: "getState", - value: function getState(el) { - var options = new Array(el.length); - for (var i = 0; i < el.length; i++) { - options[i] = { - value: el[i].value, - label: el[i].label - }; + return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } }); + } + function makeInvokeMethod(innerFn, self2, context) { + var state = "suspendedStart"; + return function(method, arg) { + if ("executing" === state) + throw new Error("Generator is already running"); + if ("completed" === state) { + if ("throw" === method) + throw arg; + return doneResult(); } - return { - label: getLabelNode7(el), - value: this.getValue(el), - options: options - }; - } - }, { - key: "receiveMessage", - value: function receiveMessage(el, data) { - var $el = (0, import_jquery15.default)(el); - if (hasDefinedProperty(data, "options")) { - var selectize = this._selectize(el); - selectize === null || selectize === void 0 ? void 0 : selectize.destroy(); - $el.empty().append(data.options); - this._selectize(el); - } - if (hasDefinedProperty(data, "config")) { - $el.parent().find('script[data-for="' + $escape(el.id) + '"]').replaceWith(data.config); - this._selectize(el, true); + for (context.method = method, context.arg = arg; ; ) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) + continue; + return delegateResult; + } + } + if ("next" === context.method) + context.sent = context._sent = context.arg; + else if ("throw" === context.method) { + if ("suspendedStart" === state) + throw state = "completed", context.arg; + context.dispatchException(context.arg); + } else + "return" === context.method && context.abrupt("return", context.arg); + state = "executing"; + var record = tryCatch(innerFn, self2, context); + if ("normal" === record.type) { + if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) + continue; + return { value: record.arg, done: context.done }; + } + "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } - if (hasDefinedProperty(data, "url")) { - var _selectize2 = this._selectize(el); - _selectize2.clearOptions(); - var loaded = false; - _selectize2.settings.load = function(query, callback) { - var settings = _selectize2.settings; - import_jquery15.default.ajax({ - url: data.url, - data: { - query: query, - field: JSON.stringify([settings.searchField]), - value: settings.valueField, - conju: settings.searchConjunction, - maxop: settings.maxOptions - }, - type: "GET", - error: function error() { - callback(); - }, - success: function success(res) { - import_jquery15.default.each(res, function(index, elem) { - var optgroupId = elem[settings.optgroupField || "optgroup"]; - var optgroup = {}; - optgroup[settings.optgroupLabelField || "label"] = optgroupId; - optgroup[settings.optgroupValueField || "value"] = optgroupId; - _selectize2.addOptionGroup(optgroupId, optgroup); - }); - callback(res); - if (!loaded) { - if (hasDefinedProperty(data, "value")) { - _selectize2.setValue(data.value); - } else if (settings.maxItems === 1) { - _selectize2.setValue(res[0].value); - } - } - loaded = true; - } - }); + }; + } + function maybeInvokeDelegate(delegate, context) { + var methodName = context.method, method = delegate.iterator[methodName]; + if (void 0 === method) + return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = void 0, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; + var record = tryCatch(method, delegate.iterator, context.arg); + if ("throw" === record.type) + return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; + var info = record.arg; + return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = void 0), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); + } + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); + } + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal", delete record.arg, entry.completion = record; + } + function Context(tryLocsList) { + this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(true); + } + function values2(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) + return iteratorMethod.call(iterable); + if ("function" == typeof iterable.next) + return iterable; + if (!isNaN(iterable.length)) { + var i = -1, next2 = function next3() { + for (; ++i < iterable.length; ) + if (hasOwn4.call(iterable, i)) + return next3.value = iterable[i], next3.done = false, next3; + return next3.value = void 0, next3.done = true, next3; }; - _selectize2.load(function(callback) { - _selectize2.settings.load.apply(_selectize2, ["", callback]); - }); - } else if (hasDefinedProperty(data, "value")) { - this.setValue(el, data.value); + return next2.next = next2; } - updateLabel(data.label, getLabelNode7(el)); - (0, import_jquery15.default)(el).trigger("change"); } - }, { - key: "subscribe", - value: function subscribe(el, callback) { - var _this = this; - (0, import_jquery15.default)(el).on( - "change.selectInputBinding", - function() { - if (el.nonempty && _this.getValue(el) === "") { - return; - } - callback(false); + return { next: doneResult }; + } + function doneResult() { + return { value: void 0, done: true }; + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty3(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: true }), defineProperty3(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: true }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) { + var ctor = "function" == typeof genFun && genFun.constructor; + return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); + }, exports.mark = function(genFun) { + return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; + }, exports.awrap = function(arg) { + return { __await: arg }; + }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() { + return this; + }), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self2, tryLocsList, PromiseImpl) { + void 0 === PromiseImpl && (PromiseImpl = Promise); + var iter = new AsyncIterator(wrap(innerFn, outerFn, self2, tryLocsList), PromiseImpl); + return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() { + return this; + }), define(Gp, "toString", function() { + return "[object Generator]"; + }), exports.keys = function(val) { + var object = Object(val), keys2 = []; + for (var key in object) + keys2.push(key); + return keys2.reverse(), function next2() { + for (; keys2.length; ) { + var key2 = keys2.pop(); + if (key2 in object) + return next2.value = key2, next2.done = false, next2; + } + return next2.done = true, next2; + }; + }, exports.values = values2, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = false, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(resetTryEntry), !skipTempReset) + for (var name in this) + "t" === name.charAt(0) && hasOwn4.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = void 0); + }, stop: function stop() { + this.done = true; + var rootRecord = this.tryEntries[0].completion; + if ("throw" === rootRecord.type) + throw rootRecord.arg; + return this.rval; + }, dispatchException: function dispatchException(exception) { + if (this.done) + throw exception; + var context = this; + function handle(loc, caught) { + return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = void 0), !!caught; + } + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i], record = entry.completion; + if ("root" === entry.tryLoc) + return handle("end"); + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn4.call(entry, "catchLoc"), hasFinally = hasOwn4.call(entry, "finallyLoc"); + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) + return handle(entry.catchLoc, true); + if (this.prev < entry.finallyLoc) + return handle(entry.finallyLoc); + } else if (hasCatch) { + if (this.prev < entry.catchLoc) + return handle(entry.catchLoc, true); + } else { + if (!hasFinally) + throw new Error("try statement without catch or finally"); + if (this.prev < entry.finallyLoc) + return handle(entry.finallyLoc); } - ); + } } - }, { - key: "unsubscribe", - value: function unsubscribe(el) { - (0, import_jquery15.default)(el).off(".selectInputBinding"); + }, abrupt: function abrupt(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && hasOwn4.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } } - }, { - key: "initialize", - value: function initialize(el) { - this._selectize(el); + finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); + var record = finallyEntry ? finallyEntry.completion : {}; + return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); + }, complete: function complete(record, afterLoc) { + if ("throw" === record.type) + throw record.arg; + return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; + }, finish: function finish(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) + return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } - }, { - key: "_selectize", - value: function _selectize(el) { - var update = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - if (!import_jquery15.default.fn.selectize) - return void 0; - var $el = (0, import_jquery15.default)(el); - var config = $el.parent().find('script[data-for="' + $escape(el.id) + '"]'); - if (config.length === 0) - return void 0; - var options = import_jquery15.default.extend({ - labelField: "label", - valueField: "value", - searchField: ["label"] - }, JSON.parse(config.html())); - if (typeof config.data("nonempty") !== "undefined") { - el.nonempty = true; - options = import_jquery15.default.extend(options, { - onItemRemove: function onItemRemove(value) { - if (this.getValue() === "") - (0, import_jquery15.default)("select#" + $escape(el.id)).empty().append((0, import_jquery15.default)("