{"version":3,"file":"application-Da3q2HM6.js","sources":["../../../app/assets/controllers/application/accordion_controller.js","../../../app/assets/controllers/application/autofocus_at_end_controller.js","../../../app/assets/controllers/application/autoscroll_controller.js","../../../app/assets/controllers/application/banner_controller.js","../../../node_modules/choices.js/public/assets/scripts/choices.js","../../../app/assets/controllers/application/choices_controller.js","../../../node_modules/stimulus-clipboard/dist/stimulus-clipboard.mjs","../../../app/assets/controllers/application/clipboard_controller.js","../../../app/assets/controllers/application/community/rules_controller.js","../../../app/assets/controllers/application/dependency_checkboxes_controller.js","../../../node_modules/tailwindcss-stimulus-components/dist/tailwindcss-stimulus-components.modern.js","../../../app/assets/controllers/application/drawer_controller.js","../../../node_modules/hotkeys-js/dist/hotkeys.esm.js","../../../node_modules/stimulus-dropdown/node_modules/stimulus-use/dist/index.js","../../../node_modules/stimulus-dropdown/dist/stimulus-dropdown.mjs","../../../app/assets/controllers/application/dropdown_extended_controller.js","../../../app/assets/controllers/application/flash_controller.js","../../../app/assets/controllers/application/folder_controller.js","../../../app/assets/controllers/application/form_leave_controller.js","../../../app/assets/controllers/application/frame_missing_reload_controller.js","../../../app/assets/controllers/application/gender_controller.js","../../../app/assets/controllers/application/helper_controller.js","../../../app/assets/controllers/application/highlight_controller.js","../../../app/assets/controllers/application/image_uploader_controller.js","../../../node_modules/lite-youtube-embed/src/lite-yt-embed.js","../../../app/assets/controllers/application/lazy_youtube_frame_controller.js","../../../node_modules/moment/dist/moment.js","../../../app/assets/controllers/application/local_time_controller.js","../../../app/assets/controllers/application/modal_controller.js","../../../app/assets/controllers/application/navigation_actions_controller.js","../../../app/assets/controllers/application/our_story_controller.js","../../../app/assets/controllers/application/read_more_controller.js","../../../app/assets/controllers/application/reveal_controller.js","../../../app/assets/controllers/application/review_rating_controller.js","../../../app/assets/controllers/application/scrollto_controller.js","../../../node_modules/lodash.debounce/index.js","../../../node_modules/stimulus-rails-autosave/dist/stimulus-rails-autosave.es.js","../../../app/assets/controllers/application/search_controller.js","../../../node_modules/@yaireo/tagify/dist/tagify.min.js","../../../app/assets/controllers/application/searchgeo_controller.js","../../../app/assets/controllers/application/sign_in_trigger_controller.js","../../../node_modules/tiny-slider/dist/tiny-slider.js","../../../app/assets/controllers/application/slider_controller.js","../../../node_modules/@stripe/stripe-js/dist/stripe.esm.js","../../../app/assets/controllers/application/stripe_controller.js","../../../node_modules/swiper/shared/ssr-window.esm.mjs","../../../node_modules/swiper/shared/utils.mjs","../../../node_modules/swiper/shared/swiper-core.mjs","../../../node_modules/swiper/modules/virtual.mjs","../../../node_modules/swiper/modules/keyboard.mjs","../../../node_modules/swiper/modules/mousewheel.mjs","../../../node_modules/swiper/shared/create-element-if-not-defined.mjs","../../../node_modules/swiper/modules/navigation.mjs","../../../node_modules/swiper/shared/classes-to-selector.mjs","../../../node_modules/swiper/modules/pagination.mjs","../../../node_modules/swiper/modules/scrollbar.mjs","../../../node_modules/swiper/modules/parallax.mjs","../../../node_modules/swiper/modules/zoom.mjs","../../../node_modules/swiper/modules/controller.mjs","../../../node_modules/swiper/modules/a11y.mjs","../../../node_modules/swiper/modules/history.mjs","../../../node_modules/swiper/modules/hash-navigation.mjs","../../../node_modules/swiper/modules/autoplay.mjs","../../../node_modules/swiper/modules/thumbs.mjs","../../../node_modules/swiper/modules/free-mode.mjs","../../../node_modules/swiper/modules/grid.mjs","../../../node_modules/swiper/modules/manipulation.mjs","../../../node_modules/swiper/shared/effect-init.mjs","../../../node_modules/swiper/shared/effect-target.mjs","../../../node_modules/swiper/shared/effect-virtual-transition-end.mjs","../../../node_modules/swiper/modules/effect-fade.mjs","../../../node_modules/swiper/modules/effect-cube.mjs","../../../node_modules/swiper/shared/create-shadow.mjs","../../../node_modules/swiper/modules/effect-flip.mjs","../../../node_modules/swiper/modules/effect-coverflow.mjs","../../../node_modules/swiper/modules/effect-creative.mjs","../../../node_modules/swiper/modules/effect-cards.mjs","../../../node_modules/swiper/swiper-bundle.mjs","../../../app/assets/controllers/application/swiper_controller.js","../../../app/assets/controllers/application/tagify_controller.js","../../../app/assets/controllers/application/tagify_google_places_controller.js","../../../node_modules/@popperjs/core/lib/enums.js","../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../node_modules/@popperjs/core/lib/utils/math.js","../../../node_modules/@popperjs/core/lib/utils/userAgent.js","../../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","../../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../../node_modules/@popperjs/core/lib/utils/within.js","../../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../../node_modules/@popperjs/core/lib/utils/debounce.js","../../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../../node_modules/@popperjs/core/lib/createPopper.js","../../../node_modules/@popperjs/core/lib/popper.js","../../../node_modules/tippy.js/dist/tippy.esm.js","../../../app/assets/controllers/application/tippy_controller.js","../../../app/assets/controllers/application/turbo_form_redirect_controller.js","../../../app/assets/controllers/application/turbo_redirect_controller.js","../../../node_modules/stimulus-character-counter/dist/stimulus-character-counter.mjs","../../../node_modules/@stimulus-library/controllers/dist/forms/focus_steal_controller.js","../../../node_modules/@stimulus-library/controllers/dist/forms/form_dirty_confirm_navigation_controller.js","../../../node_modules/stimulus-password-visibility/dist/stimulus-password-visibility.mjs","../../../node_modules/stimulus-textarea-autogrow/dist/stimulus-textarea-autogrow.mjs","../../../app/assets/controllers/application/index.js"],"sourcesContent":["import { Controller } from '@hotwired/stimulus';\n\nexport default class Accordion extends Controller {\n static targets = [ 'accordion' ];\n\n manageAccordionState(event) {\n this.notClickedBlocks = this.accordionTargets.filter(\n accordionBlock => accordionBlock.id !== event.currentTarget.parentNode.id\n );\n this.notClickedBlocks.forEach(notClickedBlock => notClickedBlock.classList.remove('accordion__block--open'));\n event.currentTarget.parentNode.classList.toggle('accordion__block--open');\n }\n}\n","import { Controller } from '@hotwired/stimulus';\n\nexport default class extends Controller {\n connect() {\n this.element?.focus();\n this.moveCursorToEnd();\n }\n\n moveCursorToEnd() {\n const input = this.element;\n const valueLength = input?.value?.length || 0;\n input?.setSelectionRange(valueLength, valueLength);\n }\n}\n","import { Controller } from '@hotwired/stimulus';\n\nexport default class extends Controller {\n connect(){\n this.element.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }\n}\n","import { Controller } from '@hotwired/stimulus';\n\nexport default class extends Controller {\n static targets = ['banner'];\n static values = {\n name: String,\n state: { type: String, default: 'closed' },\n days: { type: Number, default: 30 },\n errorId: String,\n paymentId: String,\n };\n\n connect() {\n if (this._shouldDeleteCookie()) {\n this._deleteCookie(this.nameValue);\n }\n this._isBannerClosedByUser() ? this._hide() : this._show();\n }\n\n close() {\n this._hide();\n this._setCookie();\n }\n\n _hide() {\n if (this.hasBannerTarget) {\n if (!this.bannerTarget.classList.contains('hidden')) {\n this.bannerTarget.classList.add('hidden');\n }\n }\n }\n\n _show() {\n if (this.hasBannerTarget) {\n if (this.bannerTarget.classList.contains('hidden')) {\n this.bannerTarget.classList.remove('hidden');\n }\n }\n }\n\n _shouldDeleteCookie() {\n return this.hasPaymentIdValue && this.paymentIdValue !== '' && this.hasNameValue;\n }\n\n _isBannerClosedByUser() {\n if (this.hasNameValue && this.hasErrorIdValue && this.errorIdValue !== '') {\n return this._getCookie(this.nameValue) === `${this.stateValue}_${this.errorIdValue}`;\n } else if (this.hasNameValue) {\n return this._getCookie(this.nameValue) === this.stateValue;\n }\n return false;\n }\n\n _getCookie(name) {\n const cookies = document.cookie.split('; ');\n for (var i = 0; i < cookies.length; i++) {\n var cookie = cookies[i].split('=');\n if (cookie[0] === name) {\n return decodeURIComponent(cookie[1]);\n }\n }\n return null;\n }\n\n _setCookie() {\n if (this.hasNameValue) {\n if (this.hasErrorIdValue && this.errorIdValue !== '') {\n console.log('setting error id cookie');\n this._setIdCookie(this.nameValue, this.stateValue, this.errorIdValue);\n } else {\n console.log('setting time cookie');\n this._setTimeCookie(this.nameValue, this.stateValue, this.daysValue);\n }\n }\n }\n\n _setIdCookie(name, state, id) {\n const expirationDate = new Date();\n expirationDate.setFullYear(expirationDate.getFullYear() + 1);\n document.cookie = `${name}=${state}_${id}; expires=${expirationDate.toUTCString()}; path=/`;\n }\n\n _setTimeCookie(name, state, days) {\n const expirationDate = new Date();\n expirationDate.setDate(expirationDate.getDate() + days);\n document.cookie = `${name}=${state}; expires=${expirationDate.toUTCString()}; path=/`;\n }\n\n _deleteCookie(name) {\n document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;\n }\n}\n","/*! choices.js v10.2.0 | © 2022 Josh Johnson | https://github.com/jshjohnson/Choices#readme */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Choices\"] = factory();\n\telse\n\t\troot[\"Choices\"] = factory();\n})(window, function() {\nreturn /******/ (function() { // webpackBootstrap\n/******/ \t\"use strict\";\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 282:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.clearChoices = exports.activateChoices = exports.filterChoices = exports.addChoice = void 0;\nvar constants_1 = __webpack_require__(883);\nvar addChoice = function (_a) {\n var value = _a.value,\n label = _a.label,\n id = _a.id,\n groupId = _a.groupId,\n disabled = _a.disabled,\n elementId = _a.elementId,\n customProperties = _a.customProperties,\n placeholder = _a.placeholder,\n keyCode = _a.keyCode;\n return {\n type: constants_1.ACTION_TYPES.ADD_CHOICE,\n value: value,\n label: label,\n id: id,\n groupId: groupId,\n disabled: disabled,\n elementId: elementId,\n customProperties: customProperties,\n placeholder: placeholder,\n keyCode: keyCode\n };\n};\nexports.addChoice = addChoice;\nvar filterChoices = function (results) {\n return {\n type: constants_1.ACTION_TYPES.FILTER_CHOICES,\n results: results\n };\n};\nexports.filterChoices = filterChoices;\nvar activateChoices = function (active) {\n if (active === void 0) {\n active = true;\n }\n return {\n type: constants_1.ACTION_TYPES.ACTIVATE_CHOICES,\n active: active\n };\n};\nexports.activateChoices = activateChoices;\nvar clearChoices = function () {\n return {\n type: constants_1.ACTION_TYPES.CLEAR_CHOICES\n };\n};\nexports.clearChoices = clearChoices;\n\n/***/ }),\n\n/***/ 783:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.addGroup = void 0;\nvar constants_1 = __webpack_require__(883);\nvar addGroup = function (_a) {\n var value = _a.value,\n id = _a.id,\n active = _a.active,\n disabled = _a.disabled;\n return {\n type: constants_1.ACTION_TYPES.ADD_GROUP,\n value: value,\n id: id,\n active: active,\n disabled: disabled\n };\n};\nexports.addGroup = addGroup;\n\n/***/ }),\n\n/***/ 464:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.highlightItem = exports.removeItem = exports.addItem = void 0;\nvar constants_1 = __webpack_require__(883);\nvar addItem = function (_a) {\n var value = _a.value,\n label = _a.label,\n id = _a.id,\n choiceId = _a.choiceId,\n groupId = _a.groupId,\n customProperties = _a.customProperties,\n placeholder = _a.placeholder,\n keyCode = _a.keyCode;\n return {\n type: constants_1.ACTION_TYPES.ADD_ITEM,\n value: value,\n label: label,\n id: id,\n choiceId: choiceId,\n groupId: groupId,\n customProperties: customProperties,\n placeholder: placeholder,\n keyCode: keyCode\n };\n};\nexports.addItem = addItem;\nvar removeItem = function (id, choiceId) {\n return {\n type: constants_1.ACTION_TYPES.REMOVE_ITEM,\n id: id,\n choiceId: choiceId\n };\n};\nexports.removeItem = removeItem;\nvar highlightItem = function (id, highlighted) {\n return {\n type: constants_1.ACTION_TYPES.HIGHLIGHT_ITEM,\n id: id,\n highlighted: highlighted\n };\n};\nexports.highlightItem = highlightItem;\n\n/***/ }),\n\n/***/ 137:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.setIsLoading = exports.resetTo = exports.clearAll = void 0;\nvar constants_1 = __webpack_require__(883);\nvar clearAll = function () {\n return {\n type: constants_1.ACTION_TYPES.CLEAR_ALL\n };\n};\nexports.clearAll = clearAll;\nvar resetTo = function (state) {\n return {\n type: constants_1.ACTION_TYPES.RESET_TO,\n state: state\n };\n};\nexports.resetTo = resetTo;\nvar setIsLoading = function (isLoading) {\n return {\n type: constants_1.ACTION_TYPES.SET_IS_LOADING,\n isLoading: isLoading\n };\n};\nexports.setIsLoading = setIsLoading;\n\n/***/ }),\n\n/***/ 373:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nvar __spreadArray = this && this.__spreadArray || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nvar __importDefault = this && this.__importDefault || function (mod) {\n return mod && mod.__esModule ? mod : {\n \"default\": mod\n };\n};\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nvar deepmerge_1 = __importDefault(__webpack_require__(996));\n/* eslint-disable @typescript-eslint/no-explicit-any */\nvar fuse_js_1 = __importDefault(__webpack_require__(221));\nvar choices_1 = __webpack_require__(282);\nvar groups_1 = __webpack_require__(783);\nvar items_1 = __webpack_require__(464);\nvar misc_1 = __webpack_require__(137);\nvar components_1 = __webpack_require__(520);\nvar constants_1 = __webpack_require__(883);\nvar defaults_1 = __webpack_require__(789);\nvar utils_1 = __webpack_require__(799);\nvar reducers_1 = __webpack_require__(655);\nvar store_1 = __importDefault(__webpack_require__(744));\nvar templates_1 = __importDefault(__webpack_require__(686));\n/** @see {@link http://browserhacks.com/#hack-acea075d0ac6954f275a70023906050c} */\nvar IS_IE11 = '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style;\nvar USER_DEFAULTS = {};\n/**\n * Choices\n * @author Josh Johnson\n */\nvar Choices = /** @class */function () {\n function Choices(element, userConfig) {\n if (element === void 0) {\n element = '[data-choice]';\n }\n if (userConfig === void 0) {\n userConfig = {};\n }\n var _this = this;\n if (userConfig.allowHTML === undefined) {\n console.warn('Deprecation warning: allowHTML will default to false in a future release. To render HTML in Choices, you will need to set it to true. Setting allowHTML will suppress this message.');\n }\n this.config = deepmerge_1.default.all([defaults_1.DEFAULT_CONFIG, Choices.defaults.options, userConfig],\n // When merging array configs, replace with a copy of the userConfig array,\n // instead of concatenating with the default array\n {\n arrayMerge: function (_, sourceArray) {\n return __spreadArray([], sourceArray, true);\n }\n });\n var invalidConfigOptions = (0, utils_1.diff)(this.config, defaults_1.DEFAULT_CONFIG);\n if (invalidConfigOptions.length) {\n console.warn('Unknown config option(s) passed', invalidConfigOptions.join(', '));\n }\n var passedElement = typeof element === 'string' ? document.querySelector(element) : element;\n if (!(passedElement instanceof HTMLInputElement || passedElement instanceof HTMLSelectElement)) {\n throw TypeError('Expected one of the following types text|select-one|select-multiple');\n }\n this._isTextElement = passedElement.type === constants_1.TEXT_TYPE;\n this._isSelectOneElement = passedElement.type === constants_1.SELECT_ONE_TYPE;\n this._isSelectMultipleElement = passedElement.type === constants_1.SELECT_MULTIPLE_TYPE;\n this._isSelectElement = this._isSelectOneElement || this._isSelectMultipleElement;\n this.config.searchEnabled = this._isSelectMultipleElement || this.config.searchEnabled;\n if (!['auto', 'always'].includes(\"\".concat(this.config.renderSelectedChoices))) {\n this.config.renderSelectedChoices = 'auto';\n }\n if (userConfig.addItemFilter && typeof userConfig.addItemFilter !== 'function') {\n var re = userConfig.addItemFilter instanceof RegExp ? userConfig.addItemFilter : new RegExp(userConfig.addItemFilter);\n this.config.addItemFilter = re.test.bind(re);\n }\n if (this._isTextElement) {\n this.passedElement = new components_1.WrappedInput({\n element: passedElement,\n classNames: this.config.classNames,\n delimiter: this.config.delimiter\n });\n } else {\n this.passedElement = new components_1.WrappedSelect({\n element: passedElement,\n classNames: this.config.classNames,\n template: function (data) {\n return _this._templates.option(data);\n }\n });\n }\n this.initialised = false;\n this._store = new store_1.default();\n this._initialState = reducers_1.defaultState;\n this._currentState = reducers_1.defaultState;\n this._prevState = reducers_1.defaultState;\n this._currentValue = '';\n this._canSearch = !!this.config.searchEnabled;\n this._isScrollingOnIe = false;\n this._highlightPosition = 0;\n this._wasTap = true;\n this._placeholderValue = this._generatePlaceholderValue();\n this._baseId = (0, utils_1.generateId)(this.passedElement.element, 'choices-');\n /**\n * setting direction in cases where it's explicitly set on passedElement\n * or when calculated direction is different from the document\n */\n this._direction = this.passedElement.dir;\n if (!this._direction) {\n var elementDirection = window.getComputedStyle(this.passedElement.element).direction;\n var documentDirection = window.getComputedStyle(document.documentElement).direction;\n if (elementDirection !== documentDirection) {\n this._direction = elementDirection;\n }\n }\n this._idNames = {\n itemChoice: 'item-choice'\n };\n if (this._isSelectElement) {\n // Assign preset groups from passed element\n this._presetGroups = this.passedElement.optionGroups;\n // Assign preset options from passed element\n this._presetOptions = this.passedElement.options;\n }\n // Assign preset choices from passed object\n this._presetChoices = this.config.choices;\n // Assign preset items from passed object first\n this._presetItems = this.config.items;\n // Add any values passed from attribute\n if (this.passedElement.value && this._isTextElement) {\n var splitValues = this.passedElement.value.split(this.config.delimiter);\n this._presetItems = this._presetItems.concat(splitValues);\n }\n // Create array of choices from option elements\n if (this.passedElement.options) {\n this.passedElement.options.forEach(function (option) {\n _this._presetChoices.push({\n value: option.value,\n label: option.innerHTML,\n selected: !!option.selected,\n disabled: option.disabled || option.parentNode.disabled,\n placeholder: option.value === '' || option.hasAttribute('placeholder'),\n customProperties: (0, utils_1.parseCustomProperties)(option.dataset.customProperties)\n });\n });\n }\n this._render = this._render.bind(this);\n this._onFocus = this._onFocus.bind(this);\n this._onBlur = this._onBlur.bind(this);\n this._onKeyUp = this._onKeyUp.bind(this);\n this._onKeyDown = this._onKeyDown.bind(this);\n this._onClick = this._onClick.bind(this);\n this._onTouchMove = this._onTouchMove.bind(this);\n this._onTouchEnd = this._onTouchEnd.bind(this);\n this._onMouseDown = this._onMouseDown.bind(this);\n this._onMouseOver = this._onMouseOver.bind(this);\n this._onFormReset = this._onFormReset.bind(this);\n this._onSelectKey = this._onSelectKey.bind(this);\n this._onEnterKey = this._onEnterKey.bind(this);\n this._onEscapeKey = this._onEscapeKey.bind(this);\n this._onDirectionKey = this._onDirectionKey.bind(this);\n this._onDeleteKey = this._onDeleteKey.bind(this);\n // If element has already been initialised with Choices, fail silently\n if (this.passedElement.isActive) {\n if (!this.config.silent) {\n console.warn('Trying to initialise Choices on element already initialised', {\n element: element\n });\n }\n this.initialised = true;\n return;\n }\n // Let's go\n this.init();\n }\n Object.defineProperty(Choices, \"defaults\", {\n get: function () {\n return Object.preventExtensions({\n get options() {\n return USER_DEFAULTS;\n },\n get templates() {\n return templates_1.default;\n }\n });\n },\n enumerable: false,\n configurable: true\n });\n Choices.prototype.init = function () {\n if (this.initialised) {\n return;\n }\n this._createTemplates();\n this._createElements();\n this._createStructure();\n this._store.subscribe(this._render);\n this._render();\n this._addEventListeners();\n var shouldDisable = !this.config.addItems || this.passedElement.element.hasAttribute('disabled');\n if (shouldDisable) {\n this.disable();\n }\n this.initialised = true;\n var callbackOnInit = this.config.callbackOnInit;\n // Run callback if it is a function\n if (callbackOnInit && typeof callbackOnInit === 'function') {\n callbackOnInit.call(this);\n }\n };\n Choices.prototype.destroy = function () {\n if (!this.initialised) {\n return;\n }\n this._removeEventListeners();\n this.passedElement.reveal();\n this.containerOuter.unwrap(this.passedElement.element);\n this.clearStore();\n if (this._isSelectElement) {\n this.passedElement.options = this._presetOptions;\n }\n this._templates = templates_1.default;\n this.initialised = false;\n };\n Choices.prototype.enable = function () {\n if (this.passedElement.isDisabled) {\n this.passedElement.enable();\n }\n if (this.containerOuter.isDisabled) {\n this._addEventListeners();\n this.input.enable();\n this.containerOuter.enable();\n }\n return this;\n };\n Choices.prototype.disable = function () {\n if (!this.passedElement.isDisabled) {\n this.passedElement.disable();\n }\n if (!this.containerOuter.isDisabled) {\n this._removeEventListeners();\n this.input.disable();\n this.containerOuter.disable();\n }\n return this;\n };\n Choices.prototype.highlightItem = function (item, runEvent) {\n if (runEvent === void 0) {\n runEvent = true;\n }\n if (!item || !item.id) {\n return this;\n }\n var id = item.id,\n _a = item.groupId,\n groupId = _a === void 0 ? -1 : _a,\n _b = item.value,\n value = _b === void 0 ? '' : _b,\n _c = item.label,\n label = _c === void 0 ? '' : _c;\n var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n this._store.dispatch((0, items_1.highlightItem)(id, true));\n if (runEvent) {\n this.passedElement.triggerEvent(constants_1.EVENTS.highlightItem, {\n id: id,\n value: value,\n label: label,\n groupValue: group && group.value ? group.value : null\n });\n }\n return this;\n };\n Choices.prototype.unhighlightItem = function (item) {\n if (!item || !item.id) {\n return this;\n }\n var id = item.id,\n _a = item.groupId,\n groupId = _a === void 0 ? -1 : _a,\n _b = item.value,\n value = _b === void 0 ? '' : _b,\n _c = item.label,\n label = _c === void 0 ? '' : _c;\n var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n this._store.dispatch((0, items_1.highlightItem)(id, false));\n this.passedElement.triggerEvent(constants_1.EVENTS.highlightItem, {\n id: id,\n value: value,\n label: label,\n groupValue: group && group.value ? group.value : null\n });\n return this;\n };\n Choices.prototype.highlightAll = function () {\n var _this = this;\n this._store.items.forEach(function (item) {\n return _this.highlightItem(item);\n });\n return this;\n };\n Choices.prototype.unhighlightAll = function () {\n var _this = this;\n this._store.items.forEach(function (item) {\n return _this.unhighlightItem(item);\n });\n return this;\n };\n Choices.prototype.removeActiveItemsByValue = function (value) {\n var _this = this;\n this._store.activeItems.filter(function (item) {\n return item.value === value;\n }).forEach(function (item) {\n return _this._removeItem(item);\n });\n return this;\n };\n Choices.prototype.removeActiveItems = function (excludedId) {\n var _this = this;\n this._store.activeItems.filter(function (_a) {\n var id = _a.id;\n return id !== excludedId;\n }).forEach(function (item) {\n return _this._removeItem(item);\n });\n return this;\n };\n Choices.prototype.removeHighlightedItems = function (runEvent) {\n var _this = this;\n if (runEvent === void 0) {\n runEvent = false;\n }\n this._store.highlightedActiveItems.forEach(function (item) {\n _this._removeItem(item);\n // If this action was performed by the user\n // trigger the event\n if (runEvent) {\n _this._triggerChange(item.value);\n }\n });\n return this;\n };\n Choices.prototype.showDropdown = function (preventInputFocus) {\n var _this = this;\n if (this.dropdown.isActive) {\n return this;\n }\n requestAnimationFrame(function () {\n _this.dropdown.show();\n _this.containerOuter.open(_this.dropdown.distanceFromTopWindow);\n if (!preventInputFocus && _this._canSearch) {\n _this.input.focus();\n }\n _this.passedElement.triggerEvent(constants_1.EVENTS.showDropdown, {});\n });\n return this;\n };\n Choices.prototype.hideDropdown = function (preventInputBlur) {\n var _this = this;\n if (!this.dropdown.isActive) {\n return this;\n }\n requestAnimationFrame(function () {\n _this.dropdown.hide();\n _this.containerOuter.close();\n if (!preventInputBlur && _this._canSearch) {\n _this.input.removeActiveDescendant();\n _this.input.blur();\n }\n _this.passedElement.triggerEvent(constants_1.EVENTS.hideDropdown, {});\n });\n return this;\n };\n Choices.prototype.getValue = function (valueOnly) {\n if (valueOnly === void 0) {\n valueOnly = false;\n }\n var values = this._store.activeItems.reduce(function (selectedItems, item) {\n var itemValue = valueOnly ? item.value : item;\n selectedItems.push(itemValue);\n return selectedItems;\n }, []);\n return this._isSelectOneElement ? values[0] : values;\n };\n Choices.prototype.setValue = function (items) {\n var _this = this;\n if (!this.initialised) {\n return this;\n }\n items.forEach(function (value) {\n return _this._setChoiceOrItem(value);\n });\n return this;\n };\n Choices.prototype.setChoiceByValue = function (value) {\n var _this = this;\n if (!this.initialised || this._isTextElement) {\n return this;\n }\n // If only one value has been passed, convert to array\n var choiceValue = Array.isArray(value) ? value : [value];\n // Loop through each value and\n choiceValue.forEach(function (val) {\n return _this._findAndSelectChoiceByValue(val);\n });\n return this;\n };\n /**\n * Set choices of select input via an array of objects (or function that returns array of object or promise of it),\n * a value field name and a label field name.\n * This behaves the same as passing items via the choices option but can be called after initialising Choices.\n * This can also be used to add groups of choices (see example 2); Optionally pass a true `replaceChoices` value to remove any existing choices.\n * Optionally pass a `customProperties` object to add additional data to your choices (useful when searching/filtering etc).\n *\n * **Input types affected:** select-one, select-multiple\n *\n * @example\n * ```js\n * const example = new Choices(element);\n *\n * example.setChoices([\n * {value: 'One', label: 'Label One', disabled: true},\n * {value: 'Two', label: 'Label Two', selected: true},\n * {value: 'Three', label: 'Label Three'},\n * ], 'value', 'label', false);\n * ```\n *\n * @example\n * ```js\n * const example = new Choices(element);\n *\n * example.setChoices(async () => {\n * try {\n * const items = await fetch('/items');\n * return items.json()\n * } catch(err) {\n * console.error(err)\n * }\n * });\n * ```\n *\n * @example\n * ```js\n * const example = new Choices(element);\n *\n * example.setChoices([{\n * label: 'Group one',\n * id: 1,\n * disabled: false,\n * choices: [\n * {value: 'Child One', label: 'Child One', selected: true},\n * {value: 'Child Two', label: 'Child Two', disabled: true},\n * {value: 'Child Three', label: 'Child Three'},\n * ]\n * },\n * {\n * label: 'Group two',\n * id: 2,\n * disabled: false,\n * choices: [\n * {value: 'Child Four', label: 'Child Four', disabled: true},\n * {value: 'Child Five', label: 'Child Five'},\n * {value: 'Child Six', label: 'Child Six', customProperties: {\n * description: 'Custom description about child six',\n * random: 'Another random custom property'\n * }},\n * ]\n * }], 'value', 'label', false);\n * ```\n */\n Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices) {\n var _this = this;\n if (choicesArrayOrFetcher === void 0) {\n choicesArrayOrFetcher = [];\n }\n if (value === void 0) {\n value = 'value';\n }\n if (label === void 0) {\n label = 'label';\n }\n if (replaceChoices === void 0) {\n replaceChoices = false;\n }\n if (!this.initialised) {\n throw new ReferenceError(\"setChoices was called on a non-initialized instance of Choices\");\n }\n if (!this._isSelectElement) {\n throw new TypeError(\"setChoices can't be used with INPUT based Choices\");\n }\n if (typeof value !== 'string' || !value) {\n throw new TypeError(\"value parameter must be a name of 'value' field in passed objects\");\n }\n // Clear choices if needed\n if (replaceChoices) {\n this.clearChoices();\n }\n if (typeof choicesArrayOrFetcher === 'function') {\n // it's a choices fetcher function\n var fetcher_1 = choicesArrayOrFetcher(this);\n if (typeof Promise === 'function' && fetcher_1 instanceof Promise) {\n // that's a promise\n // eslint-disable-next-line no-promise-executor-return\n return new Promise(function (resolve) {\n return requestAnimationFrame(resolve);\n }).then(function () {\n return _this._handleLoadingState(true);\n }).then(function () {\n return fetcher_1;\n }).then(function (data) {\n return _this.setChoices(data, value, label, replaceChoices);\n }).catch(function (err) {\n if (!_this.config.silent) {\n console.error(err);\n }\n }).then(function () {\n return _this._handleLoadingState(false);\n }).then(function () {\n return _this;\n });\n }\n // function returned something else than promise, let's check if it's an array of choices\n if (!Array.isArray(fetcher_1)) {\n throw new TypeError(\".setChoices first argument function must return either array of choices or Promise, got: \".concat(typeof fetcher_1));\n }\n // recursion with results, it's sync and choices were cleared already\n return this.setChoices(fetcher_1, value, label, false);\n }\n if (!Array.isArray(choicesArrayOrFetcher)) {\n throw new TypeError(\".setChoices must be called either with array of choices with a function resulting into Promise of array of choices\");\n }\n this.containerOuter.removeLoadingState();\n this._startLoading();\n choicesArrayOrFetcher.forEach(function (groupOrChoice) {\n if (groupOrChoice.choices) {\n _this._addGroup({\n id: groupOrChoice.id ? parseInt(\"\".concat(groupOrChoice.id), 10) : null,\n group: groupOrChoice,\n valueKey: value,\n labelKey: label\n });\n } else {\n var choice = groupOrChoice;\n _this._addChoice({\n value: choice[value],\n label: choice[label],\n isSelected: !!choice.selected,\n isDisabled: !!choice.disabled,\n placeholder: !!choice.placeholder,\n customProperties: choice.customProperties\n });\n }\n });\n this._stopLoading();\n return this;\n };\n Choices.prototype.clearChoices = function () {\n this._store.dispatch((0, choices_1.clearChoices)());\n return this;\n };\n Choices.prototype.clearStore = function () {\n this._store.dispatch((0, misc_1.clearAll)());\n return this;\n };\n Choices.prototype.clearInput = function () {\n var shouldSetInputWidth = !this._isSelectOneElement;\n this.input.clear(shouldSetInputWidth);\n if (!this._isTextElement && this._canSearch) {\n this._isSearching = false;\n this._store.dispatch((0, choices_1.activateChoices)(true));\n }\n return this;\n };\n Choices.prototype._render = function () {\n if (this._store.isLoading()) {\n return;\n }\n this._currentState = this._store.state;\n var stateChanged = this._currentState.choices !== this._prevState.choices || this._currentState.groups !== this._prevState.groups || this._currentState.items !== this._prevState.items;\n var shouldRenderChoices = this._isSelectElement;\n var shouldRenderItems = this._currentState.items !== this._prevState.items;\n if (!stateChanged) {\n return;\n }\n if (shouldRenderChoices) {\n this._renderChoices();\n }\n if (shouldRenderItems) {\n this._renderItems();\n }\n this._prevState = this._currentState;\n };\n Choices.prototype._renderChoices = function () {\n var _this = this;\n var _a = this._store,\n activeGroups = _a.activeGroups,\n activeChoices = _a.activeChoices;\n var choiceListFragment = document.createDocumentFragment();\n this.choiceList.clear();\n if (this.config.resetScrollPosition) {\n requestAnimationFrame(function () {\n return _this.choiceList.scrollToTop();\n });\n }\n // If we have grouped options\n if (activeGroups.length >= 1 && !this._isSearching) {\n // If we have a placeholder choice along with groups\n var activePlaceholders = activeChoices.filter(function (activeChoice) {\n return activeChoice.placeholder === true && activeChoice.groupId === -1;\n });\n if (activePlaceholders.length >= 1) {\n choiceListFragment = this._createChoicesFragment(activePlaceholders, choiceListFragment);\n }\n choiceListFragment = this._createGroupsFragment(activeGroups, activeChoices, choiceListFragment);\n } else if (activeChoices.length >= 1) {\n choiceListFragment = this._createChoicesFragment(activeChoices, choiceListFragment);\n }\n // If we have choices to show\n if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) {\n var activeItems = this._store.activeItems;\n var canAddItem = this._canAddItem(activeItems, this.input.value);\n // ...and we can select them\n if (canAddItem.response) {\n // ...append them and highlight the first choice\n this.choiceList.append(choiceListFragment);\n this._highlightChoice();\n } else {\n var notice = this._getTemplate('notice', canAddItem.notice);\n this.choiceList.append(notice);\n }\n } else {\n // Otherwise show a notice\n var dropdownItem = void 0;\n var notice = void 0;\n if (this._isSearching) {\n notice = typeof this.config.noResultsText === 'function' ? this.config.noResultsText() : this.config.noResultsText;\n dropdownItem = this._getTemplate('notice', notice, 'no-results');\n } else {\n notice = typeof this.config.noChoicesText === 'function' ? this.config.noChoicesText() : this.config.noChoicesText;\n dropdownItem = this._getTemplate('notice', notice, 'no-choices');\n }\n this.choiceList.append(dropdownItem);\n }\n };\n Choices.prototype._renderItems = function () {\n var activeItems = this._store.activeItems || [];\n this.itemList.clear();\n // Create a fragment to store our list items\n // (so we don't have to update the DOM for each item)\n var itemListFragment = this._createItemsFragment(activeItems);\n // If we have items to add, append them\n if (itemListFragment.childNodes) {\n this.itemList.append(itemListFragment);\n }\n };\n Choices.prototype._createGroupsFragment = function (groups, choices, fragment) {\n var _this = this;\n if (fragment === void 0) {\n fragment = document.createDocumentFragment();\n }\n var getGroupChoices = function (group) {\n return choices.filter(function (choice) {\n if (_this._isSelectOneElement) {\n return choice.groupId === group.id;\n }\n return choice.groupId === group.id && (_this.config.renderSelectedChoices === 'always' || !choice.selected);\n });\n };\n // If sorting is enabled, filter groups\n if (this.config.shouldSort) {\n groups.sort(this.config.sorter);\n }\n groups.forEach(function (group) {\n var groupChoices = getGroupChoices(group);\n if (groupChoices.length >= 1) {\n var dropdownGroup = _this._getTemplate('choiceGroup', group);\n fragment.appendChild(dropdownGroup);\n _this._createChoicesFragment(groupChoices, fragment, true);\n }\n });\n return fragment;\n };\n Choices.prototype._createChoicesFragment = function (choices, fragment, withinGroup) {\n var _this = this;\n if (fragment === void 0) {\n fragment = document.createDocumentFragment();\n }\n if (withinGroup === void 0) {\n withinGroup = false;\n }\n // Create a fragment to store our list items (so we don't have to update the DOM for each item)\n var _a = this.config,\n renderSelectedChoices = _a.renderSelectedChoices,\n searchResultLimit = _a.searchResultLimit,\n renderChoiceLimit = _a.renderChoiceLimit;\n var filter = this._isSearching ? utils_1.sortByScore : this.config.sorter;\n var appendChoice = function (choice) {\n var shouldRender = renderSelectedChoices === 'auto' ? _this._isSelectOneElement || !choice.selected : true;\n if (shouldRender) {\n var dropdownItem = _this._getTemplate('choice', choice, _this.config.itemSelectText);\n fragment.appendChild(dropdownItem);\n }\n };\n var rendererableChoices = choices;\n if (renderSelectedChoices === 'auto' && !this._isSelectOneElement) {\n rendererableChoices = choices.filter(function (choice) {\n return !choice.selected;\n });\n }\n // Split array into placeholders and \"normal\" choices\n var _b = rendererableChoices.reduce(function (acc, choice) {\n if (choice.placeholder) {\n acc.placeholderChoices.push(choice);\n } else {\n acc.normalChoices.push(choice);\n }\n return acc;\n }, {\n placeholderChoices: [],\n normalChoices: []\n }),\n placeholderChoices = _b.placeholderChoices,\n normalChoices = _b.normalChoices;\n // If sorting is enabled or the user is searching, filter choices\n if (this.config.shouldSort || this._isSearching) {\n normalChoices.sort(filter);\n }\n var choiceLimit = rendererableChoices.length;\n // Prepend placeholeder\n var sortedChoices = this._isSelectOneElement ? __spreadArray(__spreadArray([], placeholderChoices, true), normalChoices, true) : normalChoices;\n if (this._isSearching) {\n choiceLimit = searchResultLimit;\n } else if (renderChoiceLimit && renderChoiceLimit > 0 && !withinGroup) {\n choiceLimit = renderChoiceLimit;\n }\n // Add each choice to dropdown within range\n for (var i = 0; i < choiceLimit; i += 1) {\n if (sortedChoices[i]) {\n appendChoice(sortedChoices[i]);\n }\n }\n return fragment;\n };\n Choices.prototype._createItemsFragment = function (items, fragment) {\n var _this = this;\n if (fragment === void 0) {\n fragment = document.createDocumentFragment();\n }\n // Create fragment to add elements to\n var _a = this.config,\n shouldSortItems = _a.shouldSortItems,\n sorter = _a.sorter,\n removeItemButton = _a.removeItemButton;\n // If sorting is enabled, filter items\n if (shouldSortItems && !this._isSelectOneElement) {\n items.sort(sorter);\n }\n if (this._isTextElement) {\n // Update the value of the hidden input\n this.passedElement.value = items.map(function (_a) {\n var value = _a.value;\n return value;\n }).join(this.config.delimiter);\n } else {\n // Update the options of the hidden input\n this.passedElement.options = items;\n }\n var addItemToFragment = function (item) {\n // Create new list element\n var listItem = _this._getTemplate('item', item, removeItemButton);\n // Append it to list\n fragment.appendChild(listItem);\n };\n // Add each list item to list\n items.forEach(addItemToFragment);\n return fragment;\n };\n Choices.prototype._triggerChange = function (value) {\n if (value === undefined || value === null) {\n return;\n }\n this.passedElement.triggerEvent(constants_1.EVENTS.change, {\n value: value\n });\n };\n Choices.prototype._selectPlaceholderChoice = function (placeholderChoice) {\n this._addItem({\n value: placeholderChoice.value,\n label: placeholderChoice.label,\n choiceId: placeholderChoice.id,\n groupId: placeholderChoice.groupId,\n placeholder: placeholderChoice.placeholder\n });\n this._triggerChange(placeholderChoice.value);\n };\n Choices.prototype._handleButtonAction = function (activeItems, element) {\n if (!activeItems || !element || !this.config.removeItems || !this.config.removeItemButton) {\n return;\n }\n var itemId = element.parentNode && element.parentNode.dataset.id;\n var itemToRemove = itemId && activeItems.find(function (item) {\n return item.id === parseInt(itemId, 10);\n });\n if (!itemToRemove) {\n return;\n }\n // Remove item associated with button\n this._removeItem(itemToRemove);\n this._triggerChange(itemToRemove.value);\n if (this._isSelectOneElement && this._store.placeholderChoice) {\n this._selectPlaceholderChoice(this._store.placeholderChoice);\n }\n };\n Choices.prototype._handleItemAction = function (activeItems, element, hasShiftKey) {\n var _this = this;\n if (hasShiftKey === void 0) {\n hasShiftKey = false;\n }\n if (!activeItems || !element || !this.config.removeItems || this._isSelectOneElement) {\n return;\n }\n var passedId = element.dataset.id;\n // We only want to select one item with a click\n // so we deselect any items that aren't the target\n // unless shift is being pressed\n activeItems.forEach(function (item) {\n if (item.id === parseInt(\"\".concat(passedId), 10) && !item.highlighted) {\n _this.highlightItem(item);\n } else if (!hasShiftKey && item.highlighted) {\n _this.unhighlightItem(item);\n }\n });\n // Focus input as without focus, a user cannot do anything with a\n // highlighted item\n this.input.focus();\n };\n Choices.prototype._handleChoiceAction = function (activeItems, element) {\n if (!activeItems || !element) {\n return;\n }\n // If we are clicking on an option\n var id = element.dataset.id;\n var choice = id && this._store.getChoiceById(id);\n if (!choice) {\n return;\n }\n var passedKeyCode = activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : undefined;\n var hasActiveDropdown = this.dropdown.isActive;\n // Update choice keyCode\n choice.keyCode = passedKeyCode;\n this.passedElement.triggerEvent(constants_1.EVENTS.choice, {\n choice: choice\n });\n if (!choice.selected && !choice.disabled) {\n var canAddItem = this._canAddItem(activeItems, choice.value);\n if (canAddItem.response) {\n this._addItem({\n value: choice.value,\n label: choice.label,\n choiceId: choice.id,\n groupId: choice.groupId,\n customProperties: choice.customProperties,\n placeholder: choice.placeholder,\n keyCode: choice.keyCode\n });\n this._triggerChange(choice.value);\n }\n }\n this.clearInput();\n // We want to close the dropdown if we are dealing with a single select box\n if (hasActiveDropdown && this._isSelectOneElement) {\n this.hideDropdown(true);\n this.containerOuter.focus();\n }\n };\n Choices.prototype._handleBackspace = function (activeItems) {\n if (!this.config.removeItems || !activeItems) {\n return;\n }\n var lastItem = activeItems[activeItems.length - 1];\n var hasHighlightedItems = activeItems.some(function (item) {\n return item.highlighted;\n });\n // If editing the last item is allowed and there are not other selected items,\n // we can edit the item value. Otherwise if we can remove items, remove all selected items\n if (this.config.editItems && !hasHighlightedItems && lastItem) {\n this.input.value = lastItem.value;\n this.input.setWidth();\n this._removeItem(lastItem);\n this._triggerChange(lastItem.value);\n } else {\n if (!hasHighlightedItems) {\n // Highlight last item if none already highlighted\n this.highlightItem(lastItem, false);\n }\n this.removeHighlightedItems(true);\n }\n };\n Choices.prototype._startLoading = function () {\n this._store.dispatch((0, misc_1.setIsLoading)(true));\n };\n Choices.prototype._stopLoading = function () {\n this._store.dispatch((0, misc_1.setIsLoading)(false));\n };\n Choices.prototype._handleLoadingState = function (setLoading) {\n if (setLoading === void 0) {\n setLoading = true;\n }\n var placeholderItem = this.itemList.getChild(\".\".concat(this.config.classNames.placeholder));\n if (setLoading) {\n this.disable();\n this.containerOuter.addLoadingState();\n if (this._isSelectOneElement) {\n if (!placeholderItem) {\n placeholderItem = this._getTemplate('placeholder', this.config.loadingText);\n if (placeholderItem) {\n this.itemList.append(placeholderItem);\n }\n } else {\n placeholderItem.innerHTML = this.config.loadingText;\n }\n } else {\n this.input.placeholder = this.config.loadingText;\n }\n } else {\n this.enable();\n this.containerOuter.removeLoadingState();\n if (this._isSelectOneElement) {\n if (placeholderItem) {\n placeholderItem.innerHTML = this._placeholderValue || '';\n }\n } else {\n this.input.placeholder = this._placeholderValue || '';\n }\n }\n };\n Choices.prototype._handleSearch = function (value) {\n if (!this.input.isFocussed) {\n return;\n }\n var choices = this._store.choices;\n var _a = this.config,\n searchFloor = _a.searchFloor,\n searchChoices = _a.searchChoices;\n var hasUnactiveChoices = choices.some(function (option) {\n return !option.active;\n });\n // Check that we have a value to search and the input was an alphanumeric character\n if (value !== null && typeof value !== 'undefined' && value.length >= searchFloor) {\n var resultCount = searchChoices ? this._searchChoices(value) : 0;\n // Trigger search event\n this.passedElement.triggerEvent(constants_1.EVENTS.search, {\n value: value,\n resultCount: resultCount\n });\n } else if (hasUnactiveChoices) {\n // Otherwise reset choices to active\n this._isSearching = false;\n this._store.dispatch((0, choices_1.activateChoices)(true));\n }\n };\n Choices.prototype._canAddItem = function (activeItems, value) {\n var canAddItem = true;\n var notice = typeof this.config.addItemText === 'function' ? this.config.addItemText(value) : this.config.addItemText;\n if (!this._isSelectOneElement) {\n var isDuplicateValue = (0, utils_1.existsInArray)(activeItems, value);\n if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) {\n // If there is a max entry limit and we have reached that limit\n // don't update\n canAddItem = false;\n notice = typeof this.config.maxItemText === 'function' ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText;\n }\n if (!this.config.duplicateItemsAllowed && isDuplicateValue && canAddItem) {\n canAddItem = false;\n notice = typeof this.config.uniqueItemText === 'function' ? this.config.uniqueItemText(value) : this.config.uniqueItemText;\n }\n if (this._isTextElement && this.config.addItems && canAddItem && typeof this.config.addItemFilter === 'function' && !this.config.addItemFilter(value)) {\n canAddItem = false;\n notice = typeof this.config.customAddItemText === 'function' ? this.config.customAddItemText(value) : this.config.customAddItemText;\n }\n }\n return {\n response: canAddItem,\n notice: notice\n };\n };\n Choices.prototype._searchChoices = function (value) {\n var newValue = typeof value === 'string' ? value.trim() : value;\n var currentValue = typeof this._currentValue === 'string' ? this._currentValue.trim() : this._currentValue;\n if (newValue.length < 1 && newValue === \"\".concat(currentValue, \" \")) {\n return 0;\n }\n // If new value matches the desired length and is not the same as the current value with a space\n var haystack = this._store.searchableChoices;\n var needle = newValue;\n var options = Object.assign(this.config.fuseOptions, {\n keys: __spreadArray([], this.config.searchFields, true),\n includeMatches: true\n });\n var fuse = new fuse_js_1.default(haystack, options);\n var results = fuse.search(needle); // see https://github.com/krisk/Fuse/issues/303\n this._currentValue = newValue;\n this._highlightPosition = 0;\n this._isSearching = true;\n this._store.dispatch((0, choices_1.filterChoices)(results));\n return results.length;\n };\n Choices.prototype._addEventListeners = function () {\n var documentElement = document.documentElement;\n // capture events - can cancel event processing or propagation\n documentElement.addEventListener('touchend', this._onTouchEnd, true);\n this.containerOuter.element.addEventListener('keydown', this._onKeyDown, true);\n this.containerOuter.element.addEventListener('mousedown', this._onMouseDown, true);\n // passive events - doesn't call `preventDefault` or `stopPropagation`\n documentElement.addEventListener('click', this._onClick, {\n passive: true\n });\n documentElement.addEventListener('touchmove', this._onTouchMove, {\n passive: true\n });\n this.dropdown.element.addEventListener('mouseover', this._onMouseOver, {\n passive: true\n });\n if (this._isSelectOneElement) {\n this.containerOuter.element.addEventListener('focus', this._onFocus, {\n passive: true\n });\n this.containerOuter.element.addEventListener('blur', this._onBlur, {\n passive: true\n });\n }\n this.input.element.addEventListener('keyup', this._onKeyUp, {\n passive: true\n });\n this.input.element.addEventListener('focus', this._onFocus, {\n passive: true\n });\n this.input.element.addEventListener('blur', this._onBlur, {\n passive: true\n });\n if (this.input.element.form) {\n this.input.element.form.addEventListener('reset', this._onFormReset, {\n passive: true\n });\n }\n this.input.addEventListeners();\n };\n Choices.prototype._removeEventListeners = function () {\n var documentElement = document.documentElement;\n documentElement.removeEventListener('touchend', this._onTouchEnd, true);\n this.containerOuter.element.removeEventListener('keydown', this._onKeyDown, true);\n this.containerOuter.element.removeEventListener('mousedown', this._onMouseDown, true);\n documentElement.removeEventListener('click', this._onClick);\n documentElement.removeEventListener('touchmove', this._onTouchMove);\n this.dropdown.element.removeEventListener('mouseover', this._onMouseOver);\n if (this._isSelectOneElement) {\n this.containerOuter.element.removeEventListener('focus', this._onFocus);\n this.containerOuter.element.removeEventListener('blur', this._onBlur);\n }\n this.input.element.removeEventListener('keyup', this._onKeyUp);\n this.input.element.removeEventListener('focus', this._onFocus);\n this.input.element.removeEventListener('blur', this._onBlur);\n if (this.input.element.form) {\n this.input.element.form.removeEventListener('reset', this._onFormReset);\n }\n this.input.removeEventListeners();\n };\n Choices.prototype._onKeyDown = function (event) {\n var keyCode = event.keyCode;\n var activeItems = this._store.activeItems;\n var hasFocusedInput = this.input.isFocussed;\n var hasActiveDropdown = this.dropdown.isActive;\n var hasItems = this.itemList.hasChildren();\n var keyString = String.fromCharCode(keyCode);\n // eslint-disable-next-line no-control-regex\n var wasPrintableChar = /[^\\x00-\\x1F]/.test(keyString);\n var BACK_KEY = constants_1.KEY_CODES.BACK_KEY,\n DELETE_KEY = constants_1.KEY_CODES.DELETE_KEY,\n ENTER_KEY = constants_1.KEY_CODES.ENTER_KEY,\n A_KEY = constants_1.KEY_CODES.A_KEY,\n ESC_KEY = constants_1.KEY_CODES.ESC_KEY,\n UP_KEY = constants_1.KEY_CODES.UP_KEY,\n DOWN_KEY = constants_1.KEY_CODES.DOWN_KEY,\n PAGE_UP_KEY = constants_1.KEY_CODES.PAGE_UP_KEY,\n PAGE_DOWN_KEY = constants_1.KEY_CODES.PAGE_DOWN_KEY;\n if (!this._isTextElement && !hasActiveDropdown && wasPrintableChar) {\n this.showDropdown();\n if (!this.input.isFocussed) {\n /*\n We update the input value with the pressed key as\n the input was not focussed at the time of key press\n therefore does not have the value of the key.\n */\n this.input.value += event.key.toLowerCase();\n }\n }\n switch (keyCode) {\n case A_KEY:\n return this._onSelectKey(event, hasItems);\n case ENTER_KEY:\n return this._onEnterKey(event, activeItems, hasActiveDropdown);\n case ESC_KEY:\n return this._onEscapeKey(hasActiveDropdown);\n case UP_KEY:\n case PAGE_UP_KEY:\n case DOWN_KEY:\n case PAGE_DOWN_KEY:\n return this._onDirectionKey(event, hasActiveDropdown);\n case DELETE_KEY:\n case BACK_KEY:\n return this._onDeleteKey(event, activeItems, hasFocusedInput);\n default:\n }\n };\n Choices.prototype._onKeyUp = function (_a) {\n var target = _a.target,\n keyCode = _a.keyCode;\n var value = this.input.value;\n var activeItems = this._store.activeItems;\n var canAddItem = this._canAddItem(activeItems, value);\n var backKey = constants_1.KEY_CODES.BACK_KEY,\n deleteKey = constants_1.KEY_CODES.DELETE_KEY;\n // We are typing into a text input and have a value, we want to show a dropdown\n // notice. Otherwise hide the dropdown\n if (this._isTextElement) {\n var canShowDropdownNotice = canAddItem.notice && value;\n if (canShowDropdownNotice) {\n var dropdownItem = this._getTemplate('notice', canAddItem.notice);\n this.dropdown.element.innerHTML = dropdownItem.outerHTML;\n this.showDropdown(true);\n } else {\n this.hideDropdown(true);\n }\n } else {\n var wasRemovalKeyCode = keyCode === backKey || keyCode === deleteKey;\n var userHasRemovedValue = wasRemovalKeyCode && target && !target.value;\n var canReactivateChoices = !this._isTextElement && this._isSearching;\n var canSearch = this._canSearch && canAddItem.response;\n if (userHasRemovedValue && canReactivateChoices) {\n this._isSearching = false;\n this._store.dispatch((0, choices_1.activateChoices)(true));\n } else if (canSearch) {\n this._handleSearch(this.input.rawValue);\n }\n }\n this._canSearch = this.config.searchEnabled;\n };\n Choices.prototype._onSelectKey = function (event, hasItems) {\n var ctrlKey = event.ctrlKey,\n metaKey = event.metaKey;\n var hasCtrlDownKeyPressed = ctrlKey || metaKey;\n // If CTRL + A or CMD + A have been pressed and there are items to select\n if (hasCtrlDownKeyPressed && hasItems) {\n this._canSearch = false;\n var shouldHightlightAll = this.config.removeItems && !this.input.value && this.input.element === document.activeElement;\n if (shouldHightlightAll) {\n this.highlightAll();\n }\n }\n };\n Choices.prototype._onEnterKey = function (event, activeItems, hasActiveDropdown) {\n var target = event.target;\n var enterKey = constants_1.KEY_CODES.ENTER_KEY;\n var targetWasButton = target && target.hasAttribute('data-button');\n if (this._isTextElement && target && target.value) {\n var value = this.input.value;\n var canAddItem = this._canAddItem(activeItems, value);\n if (canAddItem.response) {\n this.hideDropdown(true);\n this._addItem({\n value: value\n });\n this._triggerChange(value);\n this.clearInput();\n }\n }\n if (targetWasButton) {\n this._handleButtonAction(activeItems, target);\n event.preventDefault();\n }\n if (hasActiveDropdown) {\n var highlightedChoice = this.dropdown.getChild(\".\".concat(this.config.classNames.highlightedState));\n if (highlightedChoice) {\n // add enter keyCode value\n if (activeItems[0]) {\n activeItems[0].keyCode = enterKey; // eslint-disable-line no-param-reassign\n }\n\n this._handleChoiceAction(activeItems, highlightedChoice);\n }\n event.preventDefault();\n } else if (this._isSelectOneElement) {\n this.showDropdown();\n event.preventDefault();\n }\n };\n Choices.prototype._onEscapeKey = function (hasActiveDropdown) {\n if (hasActiveDropdown) {\n this.hideDropdown(true);\n this.containerOuter.focus();\n }\n };\n Choices.prototype._onDirectionKey = function (event, hasActiveDropdown) {\n var keyCode = event.keyCode,\n metaKey = event.metaKey;\n var downKey = constants_1.KEY_CODES.DOWN_KEY,\n pageUpKey = constants_1.KEY_CODES.PAGE_UP_KEY,\n pageDownKey = constants_1.KEY_CODES.PAGE_DOWN_KEY;\n // If up or down key is pressed, traverse through options\n if (hasActiveDropdown || this._isSelectOneElement) {\n this.showDropdown();\n this._canSearch = false;\n var directionInt = keyCode === downKey || keyCode === pageDownKey ? 1 : -1;\n var skipKey = metaKey || keyCode === pageDownKey || keyCode === pageUpKey;\n var selectableChoiceIdentifier = '[data-choice-selectable]';\n var nextEl = void 0;\n if (skipKey) {\n if (directionInt > 0) {\n nextEl = this.dropdown.element.querySelector(\"\".concat(selectableChoiceIdentifier, \":last-of-type\"));\n } else {\n nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier);\n }\n } else {\n var currentEl = this.dropdown.element.querySelector(\".\".concat(this.config.classNames.highlightedState));\n if (currentEl) {\n nextEl = (0, utils_1.getAdjacentEl)(currentEl, selectableChoiceIdentifier, directionInt);\n } else {\n nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier);\n }\n }\n if (nextEl) {\n // We prevent default to stop the cursor moving\n // when pressing the arrow\n if (!(0, utils_1.isScrolledIntoView)(nextEl, this.choiceList.element, directionInt)) {\n this.choiceList.scrollToChildElement(nextEl, directionInt);\n }\n this._highlightChoice(nextEl);\n }\n // Prevent default to maintain cursor position whilst\n // traversing dropdown options\n event.preventDefault();\n }\n };\n Choices.prototype._onDeleteKey = function (event, activeItems, hasFocusedInput) {\n var target = event.target;\n // If backspace or delete key is pressed and the input has no value\n if (!this._isSelectOneElement && !target.value && hasFocusedInput) {\n this._handleBackspace(activeItems);\n event.preventDefault();\n }\n };\n Choices.prototype._onTouchMove = function () {\n if (this._wasTap) {\n this._wasTap = false;\n }\n };\n Choices.prototype._onTouchEnd = function (event) {\n var target = (event || event.touches[0]).target;\n var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target);\n if (touchWasWithinContainer) {\n var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element;\n if (containerWasExactTarget) {\n if (this._isTextElement) {\n this.input.focus();\n } else if (this._isSelectMultipleElement) {\n this.showDropdown();\n }\n }\n // Prevents focus event firing\n event.stopPropagation();\n }\n this._wasTap = true;\n };\n /**\n * Handles mousedown event in capture mode for containetOuter.element\n */\n Choices.prototype._onMouseDown = function (event) {\n var target = event.target;\n if (!(target instanceof HTMLElement)) {\n return;\n }\n // If we have our mouse down on the scrollbar and are on IE11...\n if (IS_IE11 && this.choiceList.element.contains(target)) {\n // check if click was on a scrollbar area\n var firstChoice = this.choiceList.element.firstElementChild;\n var isOnScrollbar = this._direction === 'ltr' ? event.offsetX >= firstChoice.offsetWidth : event.offsetX < firstChoice.offsetLeft;\n this._isScrollingOnIe = isOnScrollbar;\n }\n if (target === this.input.element) {\n return;\n }\n var item = target.closest('[data-button],[data-item],[data-choice]');\n if (item instanceof HTMLElement) {\n var hasShiftKey = event.shiftKey;\n var activeItems = this._store.activeItems;\n var dataset = item.dataset;\n if ('button' in dataset) {\n this._handleButtonAction(activeItems, item);\n } else if ('item' in dataset) {\n this._handleItemAction(activeItems, item, hasShiftKey);\n } else if ('choice' in dataset) {\n this._handleChoiceAction(activeItems, item);\n }\n }\n event.preventDefault();\n };\n /**\n * Handles mouseover event over this.dropdown\n * @param {MouseEvent} event\n */\n Choices.prototype._onMouseOver = function (_a) {\n var target = _a.target;\n if (target instanceof HTMLElement && 'choice' in target.dataset) {\n this._highlightChoice(target);\n }\n };\n Choices.prototype._onClick = function (_a) {\n var target = _a.target;\n var clickWasWithinContainer = this.containerOuter.element.contains(target);\n if (clickWasWithinContainer) {\n if (!this.dropdown.isActive && !this.containerOuter.isDisabled) {\n if (this._isTextElement) {\n if (document.activeElement !== this.input.element) {\n this.input.focus();\n }\n } else {\n this.showDropdown();\n this.containerOuter.focus();\n }\n } else if (this._isSelectOneElement && target !== this.input.element && !this.dropdown.element.contains(target)) {\n this.hideDropdown();\n }\n } else {\n var hasHighlightedItems = this._store.highlightedActiveItems.length > 0;\n if (hasHighlightedItems) {\n this.unhighlightAll();\n }\n this.containerOuter.removeFocusState();\n this.hideDropdown(true);\n }\n };\n Choices.prototype._onFocus = function (_a) {\n var _b;\n var _this = this;\n var target = _a.target;\n var focusWasWithinContainer = target && this.containerOuter.element.contains(target);\n if (!focusWasWithinContainer) {\n return;\n }\n var focusActions = (_b = {}, _b[constants_1.TEXT_TYPE] = function () {\n if (target === _this.input.element) {\n _this.containerOuter.addFocusState();\n }\n }, _b[constants_1.SELECT_ONE_TYPE] = function () {\n _this.containerOuter.addFocusState();\n if (target === _this.input.element) {\n _this.showDropdown(true);\n }\n }, _b[constants_1.SELECT_MULTIPLE_TYPE] = function () {\n if (target === _this.input.element) {\n _this.showDropdown(true);\n // If element is a select box, the focused element is the container and the dropdown\n // isn't already open, focus and show dropdown\n _this.containerOuter.addFocusState();\n }\n }, _b);\n focusActions[this.passedElement.element.type]();\n };\n Choices.prototype._onBlur = function (_a) {\n var _b;\n var _this = this;\n var target = _a.target;\n var blurWasWithinContainer = target && this.containerOuter.element.contains(target);\n if (blurWasWithinContainer && !this._isScrollingOnIe) {\n var activeItems = this._store.activeItems;\n var hasHighlightedItems_1 = activeItems.some(function (item) {\n return item.highlighted;\n });\n var blurActions = (_b = {}, _b[constants_1.TEXT_TYPE] = function () {\n if (target === _this.input.element) {\n _this.containerOuter.removeFocusState();\n if (hasHighlightedItems_1) {\n _this.unhighlightAll();\n }\n _this.hideDropdown(true);\n }\n }, _b[constants_1.SELECT_ONE_TYPE] = function () {\n _this.containerOuter.removeFocusState();\n if (target === _this.input.element || target === _this.containerOuter.element && !_this._canSearch) {\n _this.hideDropdown(true);\n }\n }, _b[constants_1.SELECT_MULTIPLE_TYPE] = function () {\n if (target === _this.input.element) {\n _this.containerOuter.removeFocusState();\n _this.hideDropdown(true);\n if (hasHighlightedItems_1) {\n _this.unhighlightAll();\n }\n }\n }, _b);\n blurActions[this.passedElement.element.type]();\n } else {\n // On IE11, clicking the scollbar blurs our input and thus\n // closes the dropdown. To stop this, we refocus our input\n // if we know we are on IE *and* are scrolling.\n this._isScrollingOnIe = false;\n this.input.element.focus();\n }\n };\n Choices.prototype._onFormReset = function () {\n this._store.dispatch((0, misc_1.resetTo)(this._initialState));\n };\n Choices.prototype._highlightChoice = function (el) {\n var _this = this;\n if (el === void 0) {\n el = null;\n }\n var choices = Array.from(this.dropdown.element.querySelectorAll('[data-choice-selectable]'));\n if (!choices.length) {\n return;\n }\n var passedEl = el;\n var highlightedChoices = Array.from(this.dropdown.element.querySelectorAll(\".\".concat(this.config.classNames.highlightedState)));\n // Remove any highlighted choices\n highlightedChoices.forEach(function (choice) {\n choice.classList.remove(_this.config.classNames.highlightedState);\n choice.setAttribute('aria-selected', 'false');\n });\n if (passedEl) {\n this._highlightPosition = choices.indexOf(passedEl);\n } else {\n // Highlight choice based on last known highlight location\n if (choices.length > this._highlightPosition) {\n // If we have an option to highlight\n passedEl = choices[this._highlightPosition];\n } else {\n // Otherwise highlight the option before\n passedEl = choices[choices.length - 1];\n }\n if (!passedEl) {\n passedEl = choices[0];\n }\n }\n passedEl.classList.add(this.config.classNames.highlightedState);\n passedEl.setAttribute('aria-selected', 'true');\n this.passedElement.triggerEvent(constants_1.EVENTS.highlightChoice, {\n el: passedEl\n });\n if (this.dropdown.isActive) {\n // IE11 ignores aria-label and blocks virtual keyboard\n // if aria-activedescendant is set without a dropdown\n this.input.setActiveDescendant(passedEl.id);\n this.containerOuter.setActiveDescendant(passedEl.id);\n }\n };\n Choices.prototype._addItem = function (_a) {\n var value = _a.value,\n _b = _a.label,\n label = _b === void 0 ? null : _b,\n _c = _a.choiceId,\n choiceId = _c === void 0 ? -1 : _c,\n _d = _a.groupId,\n groupId = _d === void 0 ? -1 : _d,\n _e = _a.customProperties,\n customProperties = _e === void 0 ? {} : _e,\n _f = _a.placeholder,\n placeholder = _f === void 0 ? false : _f,\n _g = _a.keyCode,\n keyCode = _g === void 0 ? -1 : _g;\n var passedValue = typeof value === 'string' ? value.trim() : value;\n var items = this._store.items;\n var passedLabel = label || passedValue;\n var passedOptionId = choiceId || -1;\n var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n var id = items ? items.length + 1 : 1;\n // If a prepended value has been passed, prepend it\n if (this.config.prependValue) {\n passedValue = this.config.prependValue + passedValue.toString();\n }\n // If an appended value has been passed, append it\n if (this.config.appendValue) {\n passedValue += this.config.appendValue.toString();\n }\n this._store.dispatch((0, items_1.addItem)({\n value: passedValue,\n label: passedLabel,\n id: id,\n choiceId: passedOptionId,\n groupId: groupId,\n customProperties: customProperties,\n placeholder: placeholder,\n keyCode: keyCode\n }));\n if (this._isSelectOneElement) {\n this.removeActiveItems(id);\n }\n // Trigger change event\n this.passedElement.triggerEvent(constants_1.EVENTS.addItem, {\n id: id,\n value: passedValue,\n label: passedLabel,\n customProperties: customProperties,\n groupValue: group && group.value ? group.value : null,\n keyCode: keyCode\n });\n };\n Choices.prototype._removeItem = function (item) {\n var id = item.id,\n value = item.value,\n label = item.label,\n customProperties = item.customProperties,\n choiceId = item.choiceId,\n groupId = item.groupId;\n var group = groupId && groupId >= 0 ? this._store.getGroupById(groupId) : null;\n if (!id || !choiceId) {\n return;\n }\n this._store.dispatch((0, items_1.removeItem)(id, choiceId));\n this.passedElement.triggerEvent(constants_1.EVENTS.removeItem, {\n id: id,\n value: value,\n label: label,\n customProperties: customProperties,\n groupValue: group && group.value ? group.value : null\n });\n };\n Choices.prototype._addChoice = function (_a) {\n var value = _a.value,\n _b = _a.label,\n label = _b === void 0 ? null : _b,\n _c = _a.isSelected,\n isSelected = _c === void 0 ? false : _c,\n _d = _a.isDisabled,\n isDisabled = _d === void 0 ? false : _d,\n _e = _a.groupId,\n groupId = _e === void 0 ? -1 : _e,\n _f = _a.customProperties,\n customProperties = _f === void 0 ? {} : _f,\n _g = _a.placeholder,\n placeholder = _g === void 0 ? false : _g,\n _h = _a.keyCode,\n keyCode = _h === void 0 ? -1 : _h;\n if (typeof value === 'undefined' || value === null) {\n return;\n }\n // Generate unique id\n var choices = this._store.choices;\n var choiceLabel = label || value;\n var choiceId = choices ? choices.length + 1 : 1;\n var choiceElementId = \"\".concat(this._baseId, \"-\").concat(this._idNames.itemChoice, \"-\").concat(choiceId);\n this._store.dispatch((0, choices_1.addChoice)({\n id: choiceId,\n groupId: groupId,\n elementId: choiceElementId,\n value: value,\n label: choiceLabel,\n disabled: isDisabled,\n customProperties: customProperties,\n placeholder: placeholder,\n keyCode: keyCode\n }));\n if (isSelected) {\n this._addItem({\n value: value,\n label: choiceLabel,\n choiceId: choiceId,\n customProperties: customProperties,\n placeholder: placeholder,\n keyCode: keyCode\n });\n }\n };\n Choices.prototype._addGroup = function (_a) {\n var _this = this;\n var group = _a.group,\n id = _a.id,\n _b = _a.valueKey,\n valueKey = _b === void 0 ? 'value' : _b,\n _c = _a.labelKey,\n labelKey = _c === void 0 ? 'label' : _c;\n var groupChoices = (0, utils_1.isType)('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION'));\n var groupId = id || Math.floor(new Date().valueOf() * Math.random());\n var isDisabled = group.disabled ? group.disabled : false;\n if (groupChoices) {\n this._store.dispatch((0, groups_1.addGroup)({\n value: group.label,\n id: groupId,\n active: true,\n disabled: isDisabled\n }));\n var addGroupChoices = function (choice) {\n var isOptDisabled = choice.disabled || choice.parentNode && choice.parentNode.disabled;\n _this._addChoice({\n value: choice[valueKey],\n label: (0, utils_1.isType)('Object', choice) ? choice[labelKey] : choice.innerHTML,\n isSelected: choice.selected,\n isDisabled: isOptDisabled,\n groupId: groupId,\n customProperties: choice.customProperties,\n placeholder: choice.placeholder\n });\n };\n groupChoices.forEach(addGroupChoices);\n } else {\n this._store.dispatch((0, groups_1.addGroup)({\n value: group.label,\n id: group.id,\n active: false,\n disabled: group.disabled\n }));\n }\n };\n Choices.prototype._getTemplate = function (template) {\n var _a;\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n return (_a = this._templates[template]).call.apply(_a, __spreadArray([this, this.config], args, false));\n };\n Choices.prototype._createTemplates = function () {\n var callbackOnCreateTemplates = this.config.callbackOnCreateTemplates;\n var userTemplates = {};\n if (callbackOnCreateTemplates && typeof callbackOnCreateTemplates === 'function') {\n userTemplates = callbackOnCreateTemplates.call(this, utils_1.strToEl);\n }\n this._templates = (0, deepmerge_1.default)(templates_1.default, userTemplates);\n };\n Choices.prototype._createElements = function () {\n this.containerOuter = new components_1.Container({\n element: this._getTemplate('containerOuter', this._direction, this._isSelectElement, this._isSelectOneElement, this.config.searchEnabled, this.passedElement.element.type, this.config.labelId),\n classNames: this.config.classNames,\n type: this.passedElement.element.type,\n position: this.config.position\n });\n this.containerInner = new components_1.Container({\n element: this._getTemplate('containerInner'),\n classNames: this.config.classNames,\n type: this.passedElement.element.type,\n position: this.config.position\n });\n this.input = new components_1.Input({\n element: this._getTemplate('input', this._placeholderValue),\n classNames: this.config.classNames,\n type: this.passedElement.element.type,\n preventPaste: !this.config.paste\n });\n this.choiceList = new components_1.List({\n element: this._getTemplate('choiceList', this._isSelectOneElement)\n });\n this.itemList = new components_1.List({\n element: this._getTemplate('itemList', this._isSelectOneElement)\n });\n this.dropdown = new components_1.Dropdown({\n element: this._getTemplate('dropdown'),\n classNames: this.config.classNames,\n type: this.passedElement.element.type\n });\n };\n Choices.prototype._createStructure = function () {\n // Hide original element\n this.passedElement.conceal();\n // Wrap input in container preserving DOM ordering\n this.containerInner.wrap(this.passedElement.element);\n // Wrapper inner container with outer container\n this.containerOuter.wrap(this.containerInner.element);\n if (this._isSelectOneElement) {\n this.input.placeholder = this.config.searchPlaceholderValue || '';\n } else if (this._placeholderValue) {\n this.input.placeholder = this._placeholderValue;\n this.input.setWidth();\n }\n this.containerOuter.element.appendChild(this.containerInner.element);\n this.containerOuter.element.appendChild(this.dropdown.element);\n this.containerInner.element.appendChild(this.itemList.element);\n if (!this._isTextElement) {\n this.dropdown.element.appendChild(this.choiceList.element);\n }\n if (!this._isSelectOneElement) {\n this.containerInner.element.appendChild(this.input.element);\n } else if (this.config.searchEnabled) {\n this.dropdown.element.insertBefore(this.input.element, this.dropdown.element.firstChild);\n }\n if (this._isSelectElement) {\n this._highlightPosition = 0;\n this._isSearching = false;\n this._startLoading();\n if (this._presetGroups.length) {\n this._addPredefinedGroups(this._presetGroups);\n } else {\n this._addPredefinedChoices(this._presetChoices);\n }\n this._stopLoading();\n }\n if (this._isTextElement) {\n this._addPredefinedItems(this._presetItems);\n }\n };\n Choices.prototype._addPredefinedGroups = function (groups) {\n var _this = this;\n // If we have a placeholder option\n var placeholderChoice = this.passedElement.placeholderOption;\n if (placeholderChoice && placeholderChoice.parentNode && placeholderChoice.parentNode.tagName === 'SELECT') {\n this._addChoice({\n value: placeholderChoice.value,\n label: placeholderChoice.innerHTML,\n isSelected: placeholderChoice.selected,\n isDisabled: placeholderChoice.disabled,\n placeholder: true\n });\n }\n groups.forEach(function (group) {\n return _this._addGroup({\n group: group,\n id: group.id || null\n });\n });\n };\n Choices.prototype._addPredefinedChoices = function (choices) {\n var _this = this;\n // If sorting is enabled or the user is searching, filter choices\n if (this.config.shouldSort) {\n choices.sort(this.config.sorter);\n }\n var hasSelectedChoice = choices.some(function (choice) {\n return choice.selected;\n });\n var firstEnabledChoiceIndex = choices.findIndex(function (choice) {\n return choice.disabled === undefined || !choice.disabled;\n });\n choices.forEach(function (choice, index) {\n var _a = choice.value,\n value = _a === void 0 ? '' : _a,\n label = choice.label,\n customProperties = choice.customProperties,\n placeholder = choice.placeholder;\n if (_this._isSelectElement) {\n // If the choice is actually a group\n if (choice.choices) {\n _this._addGroup({\n group: choice,\n id: choice.id || null\n });\n } else {\n /**\n * If there is a selected choice already or the choice is not the first in\n * the array, add each choice normally.\n *\n * Otherwise we pre-select the first enabled choice in the array (\"select-one\" only)\n */\n var shouldPreselect = _this._isSelectOneElement && !hasSelectedChoice && index === firstEnabledChoiceIndex;\n var isSelected = shouldPreselect ? true : choice.selected;\n var isDisabled = choice.disabled;\n _this._addChoice({\n value: value,\n label: label,\n isSelected: !!isSelected,\n isDisabled: !!isDisabled,\n placeholder: !!placeholder,\n customProperties: customProperties\n });\n }\n } else {\n _this._addChoice({\n value: value,\n label: label,\n isSelected: !!choice.selected,\n isDisabled: !!choice.disabled,\n placeholder: !!choice.placeholder,\n customProperties: customProperties\n });\n }\n });\n };\n Choices.prototype._addPredefinedItems = function (items) {\n var _this = this;\n items.forEach(function (item) {\n if (typeof item === 'object' && item.value) {\n _this._addItem({\n value: item.value,\n label: item.label,\n choiceId: item.id,\n customProperties: item.customProperties,\n placeholder: item.placeholder\n });\n }\n if (typeof item === 'string') {\n _this._addItem({\n value: item\n });\n }\n });\n };\n Choices.prototype._setChoiceOrItem = function (item) {\n var _this = this;\n var itemType = (0, utils_1.getType)(item).toLowerCase();\n var handleType = {\n object: function () {\n if (!item.value) {\n return;\n }\n // If we are dealing with a select input, we need to create an option first\n // that is then selected. For text inputs we can just add items normally.\n if (!_this._isTextElement) {\n _this._addChoice({\n value: item.value,\n label: item.label,\n isSelected: true,\n isDisabled: false,\n customProperties: item.customProperties,\n placeholder: item.placeholder\n });\n } else {\n _this._addItem({\n value: item.value,\n label: item.label,\n choiceId: item.id,\n customProperties: item.customProperties,\n placeholder: item.placeholder\n });\n }\n },\n string: function () {\n if (!_this._isTextElement) {\n _this._addChoice({\n value: item,\n label: item,\n isSelected: true,\n isDisabled: false\n });\n } else {\n _this._addItem({\n value: item\n });\n }\n }\n };\n handleType[itemType]();\n };\n Choices.prototype._findAndSelectChoiceByValue = function (value) {\n var _this = this;\n var choices = this._store.choices;\n // Check 'value' property exists and the choice isn't already selected\n var foundChoice = choices.find(function (choice) {\n return _this.config.valueComparer(choice.value, value);\n });\n if (foundChoice && !foundChoice.selected) {\n this._addItem({\n value: foundChoice.value,\n label: foundChoice.label,\n choiceId: foundChoice.id,\n groupId: foundChoice.groupId,\n customProperties: foundChoice.customProperties,\n placeholder: foundChoice.placeholder,\n keyCode: foundChoice.keyCode\n });\n }\n };\n Choices.prototype._generatePlaceholderValue = function () {\n if (this._isSelectElement && this.passedElement.placeholderOption) {\n var placeholderOption = this.passedElement.placeholderOption;\n return placeholderOption ? placeholderOption.text : null;\n }\n var _a = this.config,\n placeholder = _a.placeholder,\n placeholderValue = _a.placeholderValue;\n var dataset = this.passedElement.element.dataset;\n if (placeholder) {\n if (placeholderValue) {\n return placeholderValue;\n }\n if (dataset.placeholder) {\n return dataset.placeholder;\n }\n }\n return null;\n };\n return Choices;\n}();\nexports[\"default\"] = Choices;\n\n/***/ }),\n\n/***/ 613:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nvar utils_1 = __webpack_require__(799);\nvar constants_1 = __webpack_require__(883);\nvar Container = /** @class */function () {\n function Container(_a) {\n var element = _a.element,\n type = _a.type,\n classNames = _a.classNames,\n position = _a.position;\n this.element = element;\n this.classNames = classNames;\n this.type = type;\n this.position = position;\n this.isOpen = false;\n this.isFlipped = false;\n this.isFocussed = false;\n this.isDisabled = false;\n this.isLoading = false;\n this._onFocus = this._onFocus.bind(this);\n this._onBlur = this._onBlur.bind(this);\n }\n Container.prototype.addEventListeners = function () {\n this.element.addEventListener('focus', this._onFocus);\n this.element.addEventListener('blur', this._onBlur);\n };\n Container.prototype.removeEventListeners = function () {\n this.element.removeEventListener('focus', this._onFocus);\n this.element.removeEventListener('blur', this._onBlur);\n };\n /**\n * Determine whether container should be flipped based on passed\n * dropdown position\n */\n Container.prototype.shouldFlip = function (dropdownPos) {\n if (typeof dropdownPos !== 'number') {\n return false;\n }\n // If flip is enabled and the dropdown bottom position is\n // greater than the window height flip the dropdown.\n var shouldFlip = false;\n if (this.position === 'auto') {\n shouldFlip = !window.matchMedia(\"(min-height: \".concat(dropdownPos + 1, \"px)\")).matches;\n } else if (this.position === 'top') {\n shouldFlip = true;\n }\n return shouldFlip;\n };\n Container.prototype.setActiveDescendant = function (activeDescendantID) {\n this.element.setAttribute('aria-activedescendant', activeDescendantID);\n };\n Container.prototype.removeActiveDescendant = function () {\n this.element.removeAttribute('aria-activedescendant');\n };\n Container.prototype.open = function (dropdownPos) {\n this.element.classList.add(this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'true');\n this.isOpen = true;\n if (this.shouldFlip(dropdownPos)) {\n this.element.classList.add(this.classNames.flippedState);\n this.isFlipped = true;\n }\n };\n Container.prototype.close = function () {\n this.element.classList.remove(this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'false');\n this.removeActiveDescendant();\n this.isOpen = false;\n // A dropdown flips if it does not have space within the page\n if (this.isFlipped) {\n this.element.classList.remove(this.classNames.flippedState);\n this.isFlipped = false;\n }\n };\n Container.prototype.focus = function () {\n if (!this.isFocussed) {\n this.element.focus();\n }\n };\n Container.prototype.addFocusState = function () {\n this.element.classList.add(this.classNames.focusState);\n };\n Container.prototype.removeFocusState = function () {\n this.element.classList.remove(this.classNames.focusState);\n };\n Container.prototype.enable = function () {\n this.element.classList.remove(this.classNames.disabledState);\n this.element.removeAttribute('aria-disabled');\n if (this.type === constants_1.SELECT_ONE_TYPE) {\n this.element.setAttribute('tabindex', '0');\n }\n this.isDisabled = false;\n };\n Container.prototype.disable = function () {\n this.element.classList.add(this.classNames.disabledState);\n this.element.setAttribute('aria-disabled', 'true');\n if (this.type === constants_1.SELECT_ONE_TYPE) {\n this.element.setAttribute('tabindex', '-1');\n }\n this.isDisabled = true;\n };\n Container.prototype.wrap = function (element) {\n (0, utils_1.wrap)(element, this.element);\n };\n Container.prototype.unwrap = function (element) {\n if (this.element.parentNode) {\n // Move passed element outside this element\n this.element.parentNode.insertBefore(element, this.element);\n // Remove this element\n this.element.parentNode.removeChild(this.element);\n }\n };\n Container.prototype.addLoadingState = function () {\n this.element.classList.add(this.classNames.loadingState);\n this.element.setAttribute('aria-busy', 'true');\n this.isLoading = true;\n };\n Container.prototype.removeLoadingState = function () {\n this.element.classList.remove(this.classNames.loadingState);\n this.element.removeAttribute('aria-busy');\n this.isLoading = false;\n };\n Container.prototype._onFocus = function () {\n this.isFocussed = true;\n };\n Container.prototype._onBlur = function () {\n this.isFocussed = false;\n };\n return Container;\n}();\nexports[\"default\"] = Container;\n\n/***/ }),\n\n/***/ 217:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nvar Dropdown = /** @class */function () {\n function Dropdown(_a) {\n var element = _a.element,\n type = _a.type,\n classNames = _a.classNames;\n this.element = element;\n this.classNames = classNames;\n this.type = type;\n this.isActive = false;\n }\n Object.defineProperty(Dropdown.prototype, \"distanceFromTopWindow\", {\n /**\n * Bottom position of dropdown in viewport coordinates\n */\n get: function () {\n return this.element.getBoundingClientRect().bottom;\n },\n enumerable: false,\n configurable: true\n });\n Dropdown.prototype.getChild = function (selector) {\n return this.element.querySelector(selector);\n };\n /**\n * Show dropdown to user by adding active state class\n */\n Dropdown.prototype.show = function () {\n this.element.classList.add(this.classNames.activeState);\n this.element.setAttribute('aria-expanded', 'true');\n this.isActive = true;\n return this;\n };\n /**\n * Hide dropdown from user\n */\n Dropdown.prototype.hide = function () {\n this.element.classList.remove(this.classNames.activeState);\n this.element.setAttribute('aria-expanded', 'false');\n this.isActive = false;\n return this;\n };\n return Dropdown;\n}();\nexports[\"default\"] = Dropdown;\n\n/***/ }),\n\n/***/ 520:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nvar __importDefault = this && this.__importDefault || function (mod) {\n return mod && mod.__esModule ? mod : {\n \"default\": mod\n };\n};\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.WrappedSelect = exports.WrappedInput = exports.List = exports.Input = exports.Container = exports.Dropdown = void 0;\nvar dropdown_1 = __importDefault(__webpack_require__(217));\nexports.Dropdown = dropdown_1.default;\nvar container_1 = __importDefault(__webpack_require__(613));\nexports.Container = container_1.default;\nvar input_1 = __importDefault(__webpack_require__(11));\nexports.Input = input_1.default;\nvar list_1 = __importDefault(__webpack_require__(624));\nexports.List = list_1.default;\nvar wrapped_input_1 = __importDefault(__webpack_require__(541));\nexports.WrappedInput = wrapped_input_1.default;\nvar wrapped_select_1 = __importDefault(__webpack_require__(982));\nexports.WrappedSelect = wrapped_select_1.default;\n\n/***/ }),\n\n/***/ 11:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nvar utils_1 = __webpack_require__(799);\nvar constants_1 = __webpack_require__(883);\nvar Input = /** @class */function () {\n function Input(_a) {\n var element = _a.element,\n type = _a.type,\n classNames = _a.classNames,\n preventPaste = _a.preventPaste;\n this.element = element;\n this.type = type;\n this.classNames = classNames;\n this.preventPaste = preventPaste;\n this.isFocussed = this.element.isEqualNode(document.activeElement);\n this.isDisabled = element.disabled;\n this._onPaste = this._onPaste.bind(this);\n this._onInput = this._onInput.bind(this);\n this._onFocus = this._onFocus.bind(this);\n this._onBlur = this._onBlur.bind(this);\n }\n Object.defineProperty(Input.prototype, \"placeholder\", {\n set: function (placeholder) {\n this.element.placeholder = placeholder;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Input.prototype, \"value\", {\n get: function () {\n return (0, utils_1.sanitise)(this.element.value);\n },\n set: function (value) {\n this.element.value = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Input.prototype, \"rawValue\", {\n get: function () {\n return this.element.value;\n },\n enumerable: false,\n configurable: true\n });\n Input.prototype.addEventListeners = function () {\n this.element.addEventListener('paste', this._onPaste);\n this.element.addEventListener('input', this._onInput, {\n passive: true\n });\n this.element.addEventListener('focus', this._onFocus, {\n passive: true\n });\n this.element.addEventListener('blur', this._onBlur, {\n passive: true\n });\n };\n Input.prototype.removeEventListeners = function () {\n this.element.removeEventListener('input', this._onInput);\n this.element.removeEventListener('paste', this._onPaste);\n this.element.removeEventListener('focus', this._onFocus);\n this.element.removeEventListener('blur', this._onBlur);\n };\n Input.prototype.enable = function () {\n this.element.removeAttribute('disabled');\n this.isDisabled = false;\n };\n Input.prototype.disable = function () {\n this.element.setAttribute('disabled', '');\n this.isDisabled = true;\n };\n Input.prototype.focus = function () {\n if (!this.isFocussed) {\n this.element.focus();\n }\n };\n Input.prototype.blur = function () {\n if (this.isFocussed) {\n this.element.blur();\n }\n };\n Input.prototype.clear = function (setWidth) {\n if (setWidth === void 0) {\n setWidth = true;\n }\n if (this.element.value) {\n this.element.value = '';\n }\n if (setWidth) {\n this.setWidth();\n }\n return this;\n };\n /**\n * Set the correct input width based on placeholder\n * value or input value\n */\n Input.prototype.setWidth = function () {\n // Resize input to contents or placeholder\n var _a = this.element,\n style = _a.style,\n value = _a.value,\n placeholder = _a.placeholder;\n style.minWidth = \"\".concat(placeholder.length + 1, \"ch\");\n style.width = \"\".concat(value.length + 1, \"ch\");\n };\n Input.prototype.setActiveDescendant = function (activeDescendantID) {\n this.element.setAttribute('aria-activedescendant', activeDescendantID);\n };\n Input.prototype.removeActiveDescendant = function () {\n this.element.removeAttribute('aria-activedescendant');\n };\n Input.prototype._onInput = function () {\n if (this.type !== constants_1.SELECT_ONE_TYPE) {\n this.setWidth();\n }\n };\n Input.prototype._onPaste = function (event) {\n if (this.preventPaste) {\n event.preventDefault();\n }\n };\n Input.prototype._onFocus = function () {\n this.isFocussed = true;\n };\n Input.prototype._onBlur = function () {\n this.isFocussed = false;\n };\n return Input;\n}();\nexports[\"default\"] = Input;\n\n/***/ }),\n\n/***/ 624:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nvar constants_1 = __webpack_require__(883);\nvar List = /** @class */function () {\n function List(_a) {\n var element = _a.element;\n this.element = element;\n this.scrollPos = this.element.scrollTop;\n this.height = this.element.offsetHeight;\n }\n List.prototype.clear = function () {\n this.element.innerHTML = '';\n };\n List.prototype.append = function (node) {\n this.element.appendChild(node);\n };\n List.prototype.getChild = function (selector) {\n return this.element.querySelector(selector);\n };\n List.prototype.hasChildren = function () {\n return this.element.hasChildNodes();\n };\n List.prototype.scrollToTop = function () {\n this.element.scrollTop = 0;\n };\n List.prototype.scrollToChildElement = function (element, direction) {\n var _this = this;\n if (!element) {\n return;\n }\n var listHeight = this.element.offsetHeight;\n // Scroll position of dropdown\n var listScrollPosition = this.element.scrollTop + listHeight;\n var elementHeight = element.offsetHeight;\n // Distance from bottom of element to top of parent\n var elementPos = element.offsetTop + elementHeight;\n // Difference between the element and scroll position\n var destination = direction > 0 ? this.element.scrollTop + elementPos - listScrollPosition : element.offsetTop;\n requestAnimationFrame(function () {\n _this._animateScroll(destination, direction);\n });\n };\n List.prototype._scrollDown = function (scrollPos, strength, destination) {\n var easing = (destination - scrollPos) / strength;\n var distance = easing > 1 ? easing : 1;\n this.element.scrollTop = scrollPos + distance;\n };\n List.prototype._scrollUp = function (scrollPos, strength, destination) {\n var easing = (scrollPos - destination) / strength;\n var distance = easing > 1 ? easing : 1;\n this.element.scrollTop = scrollPos - distance;\n };\n List.prototype._animateScroll = function (destination, direction) {\n var _this = this;\n var strength = constants_1.SCROLLING_SPEED;\n var choiceListScrollTop = this.element.scrollTop;\n var continueAnimation = false;\n if (direction > 0) {\n this._scrollDown(choiceListScrollTop, strength, destination);\n if (choiceListScrollTop < destination) {\n continueAnimation = true;\n }\n } else {\n this._scrollUp(choiceListScrollTop, strength, destination);\n if (choiceListScrollTop > destination) {\n continueAnimation = true;\n }\n }\n if (continueAnimation) {\n requestAnimationFrame(function () {\n _this._animateScroll(destination, direction);\n });\n }\n };\n return List;\n}();\nexports[\"default\"] = List;\n\n/***/ }),\n\n/***/ 730:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nvar utils_1 = __webpack_require__(799);\nvar WrappedElement = /** @class */function () {\n function WrappedElement(_a) {\n var element = _a.element,\n classNames = _a.classNames;\n this.element = element;\n this.classNames = classNames;\n if (!(element instanceof HTMLInputElement) && !(element instanceof HTMLSelectElement)) {\n throw new TypeError('Invalid element passed');\n }\n this.isDisabled = false;\n }\n Object.defineProperty(WrappedElement.prototype, \"isActive\", {\n get: function () {\n return this.element.dataset.choice === 'active';\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(WrappedElement.prototype, \"dir\", {\n get: function () {\n return this.element.dir;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(WrappedElement.prototype, \"value\", {\n get: function () {\n return this.element.value;\n },\n set: function (value) {\n // you must define setter here otherwise it will be readonly property\n this.element.value = value;\n },\n enumerable: false,\n configurable: true\n });\n WrappedElement.prototype.conceal = function () {\n // Hide passed input\n this.element.classList.add(this.classNames.input);\n this.element.hidden = true;\n // Remove element from tab index\n this.element.tabIndex = -1;\n // Backup original styles if any\n var origStyle = this.element.getAttribute('style');\n if (origStyle) {\n this.element.setAttribute('data-choice-orig-style', origStyle);\n }\n this.element.setAttribute('data-choice', 'active');\n };\n WrappedElement.prototype.reveal = function () {\n // Reinstate passed element\n this.element.classList.remove(this.classNames.input);\n this.element.hidden = false;\n this.element.removeAttribute('tabindex');\n // Recover original styles if any\n var origStyle = this.element.getAttribute('data-choice-orig-style');\n if (origStyle) {\n this.element.removeAttribute('data-choice-orig-style');\n this.element.setAttribute('style', origStyle);\n } else {\n this.element.removeAttribute('style');\n }\n this.element.removeAttribute('data-choice');\n // Re-assign values - this is weird, I know\n // @todo Figure out why we need to do this\n this.element.value = this.element.value; // eslint-disable-line no-self-assign\n };\n\n WrappedElement.prototype.enable = function () {\n this.element.removeAttribute('disabled');\n this.element.disabled = false;\n this.isDisabled = false;\n };\n WrappedElement.prototype.disable = function () {\n this.element.setAttribute('disabled', '');\n this.element.disabled = true;\n this.isDisabled = true;\n };\n WrappedElement.prototype.triggerEvent = function (eventType, data) {\n (0, utils_1.dispatchEvent)(this.element, eventType, data);\n };\n return WrappedElement;\n}();\nexports[\"default\"] = WrappedElement;\n\n/***/ }),\n\n/***/ 541:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nvar __extends = this && this.__extends || function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null) throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\nvar __importDefault = this && this.__importDefault || function (mod) {\n return mod && mod.__esModule ? mod : {\n \"default\": mod\n };\n};\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nvar wrapped_element_1 = __importDefault(__webpack_require__(730));\nvar WrappedInput = /** @class */function (_super) {\n __extends(WrappedInput, _super);\n function WrappedInput(_a) {\n var element = _a.element,\n classNames = _a.classNames,\n delimiter = _a.delimiter;\n var _this = _super.call(this, {\n element: element,\n classNames: classNames\n }) || this;\n _this.delimiter = delimiter;\n return _this;\n }\n Object.defineProperty(WrappedInput.prototype, \"value\", {\n get: function () {\n return this.element.value;\n },\n set: function (value) {\n this.element.setAttribute('value', value);\n this.element.value = value;\n },\n enumerable: false,\n configurable: true\n });\n return WrappedInput;\n}(wrapped_element_1.default);\nexports[\"default\"] = WrappedInput;\n\n/***/ }),\n\n/***/ 982:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nvar __extends = this && this.__extends || function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null) throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\nvar __importDefault = this && this.__importDefault || function (mod) {\n return mod && mod.__esModule ? mod : {\n \"default\": mod\n };\n};\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nvar wrapped_element_1 = __importDefault(__webpack_require__(730));\nvar WrappedSelect = /** @class */function (_super) {\n __extends(WrappedSelect, _super);\n function WrappedSelect(_a) {\n var element = _a.element,\n classNames = _a.classNames,\n template = _a.template;\n var _this = _super.call(this, {\n element: element,\n classNames: classNames\n }) || this;\n _this.template = template;\n return _this;\n }\n Object.defineProperty(WrappedSelect.prototype, \"placeholderOption\", {\n get: function () {\n return this.element.querySelector('option[value=\"\"]') ||\n // Backward compatibility layer for the non-standard placeholder attribute supported in older versions.\n this.element.querySelector('option[placeholder]');\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(WrappedSelect.prototype, \"optionGroups\", {\n get: function () {\n return Array.from(this.element.getElementsByTagName('OPTGROUP'));\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(WrappedSelect.prototype, \"options\", {\n get: function () {\n return Array.from(this.element.options);\n },\n set: function (options) {\n var _this = this;\n var fragment = document.createDocumentFragment();\n var addOptionToFragment = function (data) {\n // Create a standard select option\n var option = _this.template(data);\n // Append it to fragment\n fragment.appendChild(option);\n };\n // Add each list item to list\n options.forEach(function (optionData) {\n return addOptionToFragment(optionData);\n });\n this.appendDocFragment(fragment);\n },\n enumerable: false,\n configurable: true\n });\n WrappedSelect.prototype.appendDocFragment = function (fragment) {\n this.element.innerHTML = '';\n this.element.appendChild(fragment);\n };\n return WrappedSelect;\n}(wrapped_element_1.default);\nexports[\"default\"] = WrappedSelect;\n\n/***/ }),\n\n/***/ 883:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.SCROLLING_SPEED = exports.SELECT_MULTIPLE_TYPE = exports.SELECT_ONE_TYPE = exports.TEXT_TYPE = exports.KEY_CODES = exports.ACTION_TYPES = exports.EVENTS = void 0;\nexports.EVENTS = {\n showDropdown: 'showDropdown',\n hideDropdown: 'hideDropdown',\n change: 'change',\n choice: 'choice',\n search: 'search',\n addItem: 'addItem',\n removeItem: 'removeItem',\n highlightItem: 'highlightItem',\n highlightChoice: 'highlightChoice',\n unhighlightItem: 'unhighlightItem'\n};\nexports.ACTION_TYPES = {\n ADD_CHOICE: 'ADD_CHOICE',\n FILTER_CHOICES: 'FILTER_CHOICES',\n ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',\n CLEAR_CHOICES: 'CLEAR_CHOICES',\n ADD_GROUP: 'ADD_GROUP',\n ADD_ITEM: 'ADD_ITEM',\n REMOVE_ITEM: 'REMOVE_ITEM',\n HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',\n CLEAR_ALL: 'CLEAR_ALL',\n RESET_TO: 'RESET_TO',\n SET_IS_LOADING: 'SET_IS_LOADING'\n};\nexports.KEY_CODES = {\n BACK_KEY: 46,\n DELETE_KEY: 8,\n ENTER_KEY: 13,\n A_KEY: 65,\n ESC_KEY: 27,\n UP_KEY: 38,\n DOWN_KEY: 40,\n PAGE_UP_KEY: 33,\n PAGE_DOWN_KEY: 34\n};\nexports.TEXT_TYPE = 'text';\nexports.SELECT_ONE_TYPE = 'select-one';\nexports.SELECT_MULTIPLE_TYPE = 'select-multiple';\nexports.SCROLLING_SPEED = 4;\n\n/***/ }),\n\n/***/ 789:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.DEFAULT_CONFIG = exports.DEFAULT_CLASSNAMES = void 0;\nvar utils_1 = __webpack_require__(799);\nexports.DEFAULT_CLASSNAMES = {\n containerOuter: 'choices',\n containerInner: 'choices__inner',\n input: 'choices__input',\n inputCloned: 'choices__input--cloned',\n list: 'choices__list',\n listItems: 'choices__list--multiple',\n listSingle: 'choices__list--single',\n listDropdown: 'choices__list--dropdown',\n item: 'choices__item',\n itemSelectable: 'choices__item--selectable',\n itemDisabled: 'choices__item--disabled',\n itemChoice: 'choices__item--choice',\n placeholder: 'choices__placeholder',\n group: 'choices__group',\n groupHeading: 'choices__heading',\n button: 'choices__button',\n activeState: 'is-active',\n focusState: 'is-focused',\n openState: 'is-open',\n disabledState: 'is-disabled',\n highlightedState: 'is-highlighted',\n selectedState: 'is-selected',\n flippedState: 'is-flipped',\n loadingState: 'is-loading',\n noResults: 'has-no-results',\n noChoices: 'has-no-choices'\n};\nexports.DEFAULT_CONFIG = {\n items: [],\n choices: [],\n silent: false,\n renderChoiceLimit: -1,\n maxItemCount: -1,\n addItems: true,\n addItemFilter: null,\n removeItems: true,\n removeItemButton: false,\n editItems: false,\n allowHTML: true,\n duplicateItemsAllowed: true,\n delimiter: ',',\n paste: true,\n searchEnabled: true,\n searchChoices: true,\n searchFloor: 1,\n searchResultLimit: 4,\n searchFields: ['label', 'value'],\n position: 'auto',\n resetScrollPosition: true,\n shouldSort: true,\n shouldSortItems: false,\n sorter: utils_1.sortByAlpha,\n placeholder: true,\n placeholderValue: null,\n searchPlaceholderValue: null,\n prependValue: null,\n appendValue: null,\n renderSelectedChoices: 'auto',\n loadingText: 'Loading...',\n noResultsText: 'No results found',\n noChoicesText: 'No choices to choose from',\n itemSelectText: 'Press to select',\n uniqueItemText: 'Only unique values can be added',\n customAddItemText: 'Only values matching specific conditions can be added',\n addItemText: function (value) {\n return \"Press Enter to add \\\"\".concat((0, utils_1.sanitise)(value), \"\\\"\");\n },\n maxItemText: function (maxItemCount) {\n return \"Only \".concat(maxItemCount, \" values can be added\");\n },\n valueComparer: function (value1, value2) {\n return value1 === value2;\n },\n fuseOptions: {\n includeScore: true\n },\n labelId: '',\n callbackOnInit: null,\n callbackOnCreateTemplates: null,\n classNames: exports.DEFAULT_CLASSNAMES\n};\n\n/***/ }),\n\n/***/ 18:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 978:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 948:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 359:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 285:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 533:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 187:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nvar __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = {\n enumerable: true,\n get: function () {\n return m[k];\n }\n };\n }\n Object.defineProperty(o, k2, desc);\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\nvar __exportStar = this && this.__exportStar || function (m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n__exportStar(__webpack_require__(18), exports);\n__exportStar(__webpack_require__(978), exports);\n__exportStar(__webpack_require__(948), exports);\n__exportStar(__webpack_require__(359), exports);\n__exportStar(__webpack_require__(285), exports);\n__exportStar(__webpack_require__(533), exports);\n__exportStar(__webpack_require__(287), exports);\n__exportStar(__webpack_require__(132), exports);\n__exportStar(__webpack_require__(837), exports);\n__exportStar(__webpack_require__(598), exports);\n__exportStar(__webpack_require__(369), exports);\n__exportStar(__webpack_require__(37), exports);\n__exportStar(__webpack_require__(47), exports);\n__exportStar(__webpack_require__(923), exports);\n__exportStar(__webpack_require__(876), exports);\n\n/***/ }),\n\n/***/ 287:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 132:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 837:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 598:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 37:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 369:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 47:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 923:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 876:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n\n/***/ }),\n\n/***/ 799:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.parseCustomProperties = exports.diff = exports.cloneObject = exports.existsInArray = exports.dispatchEvent = exports.sortByScore = exports.sortByAlpha = exports.strToEl = exports.sanitise = exports.isScrolledIntoView = exports.getAdjacentEl = exports.wrap = exports.isType = exports.getType = exports.generateId = exports.generateChars = exports.getRandomNumber = void 0;\nvar getRandomNumber = function (min, max) {\n return Math.floor(Math.random() * (max - min) + min);\n};\nexports.getRandomNumber = getRandomNumber;\nvar generateChars = function (length) {\n return Array.from({\n length: length\n }, function () {\n return (0, exports.getRandomNumber)(0, 36).toString(36);\n }).join('');\n};\nexports.generateChars = generateChars;\nvar generateId = function (element, prefix) {\n var id = element.id || element.name && \"\".concat(element.name, \"-\").concat((0, exports.generateChars)(2)) || (0, exports.generateChars)(4);\n id = id.replace(/(:|\\.|\\[|\\]|,)/g, '');\n id = \"\".concat(prefix, \"-\").concat(id);\n return id;\n};\nexports.generateId = generateId;\nvar getType = function (obj) {\n return Object.prototype.toString.call(obj).slice(8, -1);\n};\nexports.getType = getType;\nvar isType = function (type, obj) {\n return obj !== undefined && obj !== null && (0, exports.getType)(obj) === type;\n};\nexports.isType = isType;\nvar wrap = function (element, wrapper) {\n if (wrapper === void 0) {\n wrapper = document.createElement('div');\n }\n if (element.parentNode) {\n if (element.nextSibling) {\n element.parentNode.insertBefore(wrapper, element.nextSibling);\n } else {\n element.parentNode.appendChild(wrapper);\n }\n }\n return wrapper.appendChild(element);\n};\nexports.wrap = wrap;\nvar getAdjacentEl = function (startEl, selector, direction) {\n if (direction === void 0) {\n direction = 1;\n }\n var prop = \"\".concat(direction > 0 ? 'next' : 'previous', \"ElementSibling\");\n var sibling = startEl[prop];\n while (sibling) {\n if (sibling.matches(selector)) {\n return sibling;\n }\n sibling = sibling[prop];\n }\n return sibling;\n};\nexports.getAdjacentEl = getAdjacentEl;\nvar isScrolledIntoView = function (element, parent, direction) {\n if (direction === void 0) {\n direction = 1;\n }\n if (!element) {\n return false;\n }\n var isVisible;\n if (direction > 0) {\n // In view from bottom\n isVisible = parent.scrollTop + parent.offsetHeight >= element.offsetTop + element.offsetHeight;\n } else {\n // In view from top\n isVisible = element.offsetTop >= parent.scrollTop;\n }\n return isVisible;\n};\nexports.isScrolledIntoView = isScrolledIntoView;\nvar sanitise = function (value) {\n if (typeof value !== 'string') {\n return value;\n }\n return value.replace(/&/g, '&').replace(/>/g, '>').replace(/ -1) {\n return state.map(function (obj) {\n var choice = obj;\n if (choice.id === parseInt(\"\".concat(addItemAction_1.choiceId), 10)) {\n choice.selected = true;\n }\n return choice;\n });\n }\n return state;\n }\n case 'REMOVE_ITEM':\n {\n var removeItemAction_1 = action;\n // When an item is removed and it has an associated choice,\n // we want to re-enable it so it can be chosen again\n if (removeItemAction_1.choiceId && removeItemAction_1.choiceId > -1) {\n return state.map(function (obj) {\n var choice = obj;\n if (choice.id === parseInt(\"\".concat(removeItemAction_1.choiceId), 10)) {\n choice.selected = false;\n }\n return choice;\n });\n }\n return state;\n }\n case 'FILTER_CHOICES':\n {\n var filterChoicesAction_1 = action;\n return state.map(function (obj) {\n var choice = obj;\n // Set active state based on whether choice is\n // within filtered results\n choice.active = filterChoicesAction_1.results.some(function (_a) {\n var item = _a.item,\n score = _a.score;\n if (item.id === choice.id) {\n choice.score = score;\n return true;\n }\n return false;\n });\n return choice;\n });\n }\n case 'ACTIVATE_CHOICES':\n {\n var activateChoicesAction_1 = action;\n return state.map(function (obj) {\n var choice = obj;\n choice.active = activateChoicesAction_1.active;\n return choice;\n });\n }\n case 'CLEAR_CHOICES':\n {\n return exports.defaultState;\n }\n default:\n {\n return state;\n }\n }\n}\nexports[\"default\"] = choices;\n\n/***/ }),\n\n/***/ 871:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nvar __spreadArray = this && this.__spreadArray || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.defaultState = void 0;\nexports.defaultState = [];\nfunction groups(state, action) {\n if (state === void 0) {\n state = exports.defaultState;\n }\n if (action === void 0) {\n action = {};\n }\n switch (action.type) {\n case 'ADD_GROUP':\n {\n var addGroupAction = action;\n return __spreadArray(__spreadArray([], state, true), [{\n id: addGroupAction.id,\n value: addGroupAction.value,\n active: addGroupAction.active,\n disabled: addGroupAction.disabled\n }], false);\n }\n case 'CLEAR_CHOICES':\n {\n return [];\n }\n default:\n {\n return state;\n }\n }\n}\nexports[\"default\"] = groups;\n\n/***/ }),\n\n/***/ 655:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nvar __importDefault = this && this.__importDefault || function (mod) {\n return mod && mod.__esModule ? mod : {\n \"default\": mod\n };\n};\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.defaultState = void 0;\nvar redux_1 = __webpack_require__(791);\nvar items_1 = __importDefault(__webpack_require__(52));\nvar groups_1 = __importDefault(__webpack_require__(871));\nvar choices_1 = __importDefault(__webpack_require__(273));\nvar loading_1 = __importDefault(__webpack_require__(502));\nvar utils_1 = __webpack_require__(799);\nexports.defaultState = {\n groups: [],\n items: [],\n choices: [],\n loading: false\n};\nvar appReducer = (0, redux_1.combineReducers)({\n items: items_1.default,\n groups: groups_1.default,\n choices: choices_1.default,\n loading: loading_1.default\n});\nvar rootReducer = function (passedState, action) {\n var state = passedState;\n // If we are clearing all items, groups and options we reassign\n // state and then pass that state to our proper reducer. This isn't\n // mutating our actual state\n // See: http://stackoverflow.com/a/35641992\n if (action.type === 'CLEAR_ALL') {\n state = exports.defaultState;\n } else if (action.type === 'RESET_TO') {\n return (0, utils_1.cloneObject)(action.state);\n }\n return appReducer(state, action);\n};\nexports[\"default\"] = rootReducer;\n\n/***/ }),\n\n/***/ 52:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nvar __spreadArray = this && this.__spreadArray || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.defaultState = void 0;\nexports.defaultState = [];\nfunction items(state, action) {\n if (state === void 0) {\n state = exports.defaultState;\n }\n if (action === void 0) {\n action = {};\n }\n switch (action.type) {\n case 'ADD_ITEM':\n {\n var addItemAction = action;\n // Add object to items array\n var newState = __spreadArray(__spreadArray([], state, true), [{\n id: addItemAction.id,\n choiceId: addItemAction.choiceId,\n groupId: addItemAction.groupId,\n value: addItemAction.value,\n label: addItemAction.label,\n active: true,\n highlighted: false,\n customProperties: addItemAction.customProperties,\n placeholder: addItemAction.placeholder || false,\n keyCode: null\n }], false);\n return newState.map(function (obj) {\n var item = obj;\n item.highlighted = false;\n return item;\n });\n }\n case 'REMOVE_ITEM':\n {\n // Set item to inactive\n return state.map(function (obj) {\n var item = obj;\n if (item.id === action.id) {\n item.active = false;\n }\n return item;\n });\n }\n case 'HIGHLIGHT_ITEM':\n {\n var highlightItemAction_1 = action;\n return state.map(function (obj) {\n var item = obj;\n if (item.id === highlightItemAction_1.id) {\n item.highlighted = highlightItemAction_1.highlighted;\n }\n return item;\n });\n }\n default:\n {\n return state;\n }\n }\n}\nexports[\"default\"] = items;\n\n/***/ }),\n\n/***/ 502:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.defaultState = void 0;\nexports.defaultState = false;\nvar general = function (state, action) {\n if (state === void 0) {\n state = exports.defaultState;\n }\n if (action === void 0) {\n action = {};\n }\n switch (action.type) {\n case 'SET_IS_LOADING':\n {\n return action.isLoading;\n }\n default:\n {\n return state;\n }\n }\n};\nexports[\"default\"] = general;\n\n/***/ }),\n\n/***/ 744:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\n\nvar __spreadArray = this && this.__spreadArray || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nvar __importDefault = this && this.__importDefault || function (mod) {\n return mod && mod.__esModule ? mod : {\n \"default\": mod\n };\n};\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\n/* eslint-disable @typescript-eslint/no-explicit-any */\nvar redux_1 = __webpack_require__(791);\nvar index_1 = __importDefault(__webpack_require__(655));\nvar Store = /** @class */function () {\n function Store() {\n this._store = (0, redux_1.createStore)(index_1.default, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());\n }\n /**\n * Subscribe store to function call (wrapped Redux method)\n */\n Store.prototype.subscribe = function (onChange) {\n this._store.subscribe(onChange);\n };\n /**\n * Dispatch event to store (wrapped Redux method)\n */\n Store.prototype.dispatch = function (action) {\n this._store.dispatch(action);\n };\n Object.defineProperty(Store.prototype, \"state\", {\n /**\n * Get store object (wrapping Redux method)\n */\n get: function () {\n return this._store.getState();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"items\", {\n /**\n * Get items from store\n */\n get: function () {\n return this.state.items;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"activeItems\", {\n /**\n * Get active items from store\n */\n get: function () {\n return this.items.filter(function (item) {\n return item.active === true;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"highlightedActiveItems\", {\n /**\n * Get highlighted items from store\n */\n get: function () {\n return this.items.filter(function (item) {\n return item.active && item.highlighted;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"choices\", {\n /**\n * Get choices from store\n */\n get: function () {\n return this.state.choices;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"activeChoices\", {\n /**\n * Get active choices from store\n */\n get: function () {\n return this.choices.filter(function (choice) {\n return choice.active === true;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"selectableChoices\", {\n /**\n * Get selectable choices from store\n */\n get: function () {\n return this.choices.filter(function (choice) {\n return choice.disabled !== true;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"searchableChoices\", {\n /**\n * Get choices that can be searched (excluding placeholders)\n */\n get: function () {\n return this.selectableChoices.filter(function (choice) {\n return choice.placeholder !== true;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"placeholderChoice\", {\n /**\n * Get placeholder choice from store\n */\n get: function () {\n return __spreadArray([], this.choices, true).reverse().find(function (choice) {\n return choice.placeholder === true;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"groups\", {\n /**\n * Get groups from store\n */\n get: function () {\n return this.state.groups;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Store.prototype, \"activeGroups\", {\n /**\n * Get active groups from store\n */\n get: function () {\n var _a = this,\n groups = _a.groups,\n choices = _a.choices;\n return groups.filter(function (group) {\n var isActive = group.active === true && group.disabled === false;\n var hasActiveOptions = choices.some(function (choice) {\n return choice.active === true && choice.disabled === false;\n });\n return isActive && hasActiveOptions;\n }, []);\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Get loading state from store\n */\n Store.prototype.isLoading = function () {\n return this.state.loading;\n };\n /**\n * Get single choice by it's ID\n */\n Store.prototype.getChoiceById = function (id) {\n return this.activeChoices.find(function (choice) {\n return choice.id === parseInt(id, 10);\n });\n };\n /**\n * Get group by group id\n */\n Store.prototype.getGroupById = function (id) {\n return this.groups.find(function (group) {\n return group.id === id;\n });\n };\n return Store;\n}();\nexports[\"default\"] = Store;\n\n/***/ }),\n\n/***/ 686:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n\n/**\n * Helpers to create HTML elements used by Choices\n * Can be overridden by providing `callbackOnCreateTemplates` option\n */\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nvar templates = {\n containerOuter: function (_a, dir, isSelectElement, isSelectOneElement, searchEnabled, passedElementType, labelId) {\n var containerOuter = _a.classNames.containerOuter;\n var div = Object.assign(document.createElement('div'), {\n className: containerOuter\n });\n div.dataset.type = passedElementType;\n if (dir) {\n div.dir = dir;\n }\n if (isSelectOneElement) {\n div.tabIndex = 0;\n }\n if (isSelectElement) {\n div.setAttribute('role', searchEnabled ? 'combobox' : 'listbox');\n if (searchEnabled) {\n div.setAttribute('aria-autocomplete', 'list');\n }\n }\n div.setAttribute('aria-haspopup', 'true');\n div.setAttribute('aria-expanded', 'false');\n if (labelId) {\n div.setAttribute('aria-labelledby', labelId);\n }\n return div;\n },\n containerInner: function (_a) {\n var containerInner = _a.classNames.containerInner;\n return Object.assign(document.createElement('div'), {\n className: containerInner\n });\n },\n itemList: function (_a, isSelectOneElement) {\n var _b = _a.classNames,\n list = _b.list,\n listSingle = _b.listSingle,\n listItems = _b.listItems;\n return Object.assign(document.createElement('div'), {\n className: \"\".concat(list, \" \").concat(isSelectOneElement ? listSingle : listItems)\n });\n },\n placeholder: function (_a, value) {\n var _b;\n var allowHTML = _a.allowHTML,\n placeholder = _a.classNames.placeholder;\n return Object.assign(document.createElement('div'), (_b = {\n className: placeholder\n }, _b[allowHTML ? 'innerHTML' : 'innerText'] = value, _b));\n },\n item: function (_a, _b, removeItemButton) {\n var _c, _d;\n var allowHTML = _a.allowHTML,\n _e = _a.classNames,\n item = _e.item,\n button = _e.button,\n highlightedState = _e.highlightedState,\n itemSelectable = _e.itemSelectable,\n placeholder = _e.placeholder;\n var id = _b.id,\n value = _b.value,\n label = _b.label,\n customProperties = _b.customProperties,\n active = _b.active,\n disabled = _b.disabled,\n highlighted = _b.highlighted,\n isPlaceholder = _b.placeholder;\n var div = Object.assign(document.createElement('div'), (_c = {\n className: item\n }, _c[allowHTML ? 'innerHTML' : 'innerText'] = label, _c));\n Object.assign(div.dataset, {\n item: '',\n id: id,\n value: value,\n customProperties: customProperties\n });\n if (active) {\n div.setAttribute('aria-selected', 'true');\n }\n if (disabled) {\n div.setAttribute('aria-disabled', 'true');\n }\n if (isPlaceholder) {\n div.classList.add(placeholder);\n }\n div.classList.add(highlighted ? highlightedState : itemSelectable);\n if (removeItemButton) {\n if (disabled) {\n div.classList.remove(itemSelectable);\n }\n div.dataset.deletable = '';\n /** @todo This MUST be localizable, not hardcoded! */\n var REMOVE_ITEM_TEXT = 'Remove item';\n var removeButton = Object.assign(document.createElement('button'), (_d = {\n type: 'button',\n className: button\n }, _d[allowHTML ? 'innerHTML' : 'innerText'] = REMOVE_ITEM_TEXT, _d));\n removeButton.setAttribute('aria-label', \"\".concat(REMOVE_ITEM_TEXT, \": '\").concat(value, \"'\"));\n removeButton.dataset.button = '';\n div.appendChild(removeButton);\n }\n return div;\n },\n choiceList: function (_a, isSelectOneElement) {\n var list = _a.classNames.list;\n var div = Object.assign(document.createElement('div'), {\n className: list\n });\n if (!isSelectOneElement) {\n div.setAttribute('aria-multiselectable', 'true');\n }\n div.setAttribute('role', 'listbox');\n return div;\n },\n choiceGroup: function (_a, _b) {\n var _c;\n var allowHTML = _a.allowHTML,\n _d = _a.classNames,\n group = _d.group,\n groupHeading = _d.groupHeading,\n itemDisabled = _d.itemDisabled;\n var id = _b.id,\n value = _b.value,\n disabled = _b.disabled;\n var div = Object.assign(document.createElement('div'), {\n className: \"\".concat(group, \" \").concat(disabled ? itemDisabled : '')\n });\n div.setAttribute('role', 'group');\n Object.assign(div.dataset, {\n group: '',\n id: id,\n value: value\n });\n if (disabled) {\n div.setAttribute('aria-disabled', 'true');\n }\n div.appendChild(Object.assign(document.createElement('div'), (_c = {\n className: groupHeading\n }, _c[allowHTML ? 'innerHTML' : 'innerText'] = value, _c)));\n return div;\n },\n choice: function (_a, _b, selectText) {\n var _c;\n var allowHTML = _a.allowHTML,\n _d = _a.classNames,\n item = _d.item,\n itemChoice = _d.itemChoice,\n itemSelectable = _d.itemSelectable,\n selectedState = _d.selectedState,\n itemDisabled = _d.itemDisabled,\n placeholder = _d.placeholder;\n var id = _b.id,\n value = _b.value,\n label = _b.label,\n groupId = _b.groupId,\n elementId = _b.elementId,\n isDisabled = _b.disabled,\n isSelected = _b.selected,\n isPlaceholder = _b.placeholder;\n var div = Object.assign(document.createElement('div'), (_c = {\n id: elementId\n }, _c[allowHTML ? 'innerHTML' : 'innerText'] = label, _c.className = \"\".concat(item, \" \").concat(itemChoice), _c));\n if (isSelected) {\n div.classList.add(selectedState);\n }\n if (isPlaceholder) {\n div.classList.add(placeholder);\n }\n div.setAttribute('role', groupId && groupId > 0 ? 'treeitem' : 'option');\n Object.assign(div.dataset, {\n choice: '',\n id: id,\n value: value,\n selectText: selectText\n });\n if (isDisabled) {\n div.classList.add(itemDisabled);\n div.dataset.choiceDisabled = '';\n div.setAttribute('aria-disabled', 'true');\n } else {\n div.classList.add(itemSelectable);\n div.dataset.choiceSelectable = '';\n }\n return div;\n },\n input: function (_a, placeholderValue) {\n var _b = _a.classNames,\n input = _b.input,\n inputCloned = _b.inputCloned;\n var inp = Object.assign(document.createElement('input'), {\n type: 'search',\n name: 'search_terms',\n className: \"\".concat(input, \" \").concat(inputCloned),\n autocomplete: 'off',\n autocapitalize: 'off',\n spellcheck: false\n });\n inp.setAttribute('role', 'textbox');\n inp.setAttribute('aria-autocomplete', 'list');\n inp.setAttribute('aria-label', placeholderValue);\n return inp;\n },\n dropdown: function (_a) {\n var _b = _a.classNames,\n list = _b.list,\n listDropdown = _b.listDropdown;\n var div = document.createElement('div');\n div.classList.add(list, listDropdown);\n div.setAttribute('aria-expanded', 'false');\n return div;\n },\n notice: function (_a, innerText, type) {\n var _b;\n var allowHTML = _a.allowHTML,\n _c = _a.classNames,\n item = _c.item,\n itemChoice = _c.itemChoice,\n noResults = _c.noResults,\n noChoices = _c.noChoices;\n if (type === void 0) {\n type = '';\n }\n var classes = [item, itemChoice];\n if (type === 'no-choices') {\n classes.push(noChoices);\n } else if (type === 'no-results') {\n classes.push(noResults);\n }\n return Object.assign(document.createElement('div'), (_b = {}, _b[allowHTML ? 'innerHTML' : 'innerText'] = innerText, _b.className = classes.join(' '), _b));\n },\n option: function (_a) {\n var label = _a.label,\n value = _a.value,\n customProperties = _a.customProperties,\n active = _a.active,\n disabled = _a.disabled;\n var opt = new Option(label, value, false, active);\n if (customProperties) {\n opt.dataset.customProperties = \"\".concat(customProperties);\n }\n opt.disabled = !!disabled;\n return opt;\n }\n};\nexports[\"default\"] = templates;\n\n/***/ }),\n\n/***/ 996:\n/***/ (function(module) {\n\n\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn target.propertyIsEnumerable(symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n\n\n/***/ }),\n\n/***/ 221:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Fuse; }\n/* harmony export */ });\n/**\n * Fuse.js v6.6.2 - Lightweight fuzzy-search (http://fusejs.io)\n *\n * Copyright (c) 2022 Kiro Risk (http://kiro.me)\n * All Rights Reserved. Apache Software License 2.0\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n */\n\nfunction isArray(value) {\n return !Array.isArray\n ? getTag(value) === '[object Array]'\n : Array.isArray(value)\n}\n\n// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.js\nconst INFINITY = 1 / 0;\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value\n }\n let result = value + '';\n return result == '0' && 1 / value == -INFINITY ? '-0' : result\n}\n\nfunction toString(value) {\n return value == null ? '' : baseToString(value)\n}\n\nfunction isString(value) {\n return typeof value === 'string'\n}\n\nfunction isNumber(value) {\n return typeof value === 'number'\n}\n\n// Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js\nfunction isBoolean(value) {\n return (\n value === true ||\n value === false ||\n (isObjectLike(value) && getTag(value) == '[object Boolean]')\n )\n}\n\nfunction isObject(value) {\n return typeof value === 'object'\n}\n\n// Checks if `value` is object-like.\nfunction isObjectLike(value) {\n return isObject(value) && value !== null\n}\n\nfunction isDefined(value) {\n return value !== undefined && value !== null\n}\n\nfunction isBlank(value) {\n return !value.trim().length\n}\n\n// Gets the `toStringTag` of `value`.\n// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js\nfunction getTag(value) {\n return value == null\n ? value === undefined\n ? '[object Undefined]'\n : '[object Null]'\n : Object.prototype.toString.call(value)\n}\n\nconst EXTENDED_SEARCH_UNAVAILABLE = 'Extended search is not available';\n\nconst INCORRECT_INDEX_TYPE = \"Incorrect 'index' type\";\n\nconst LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) =>\n `Invalid value for key ${key}`;\n\nconst PATTERN_LENGTH_TOO_LARGE = (max) =>\n `Pattern length exceeds max of ${max}.`;\n\nconst MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`;\n\nconst INVALID_KEY_WEIGHT_VALUE = (key) =>\n `Property 'weight' in key '${key}' must be a positive integer`;\n\nconst hasOwn = Object.prototype.hasOwnProperty;\n\nclass KeyStore {\n constructor(keys) {\n this._keys = [];\n this._keyMap = {};\n\n let totalWeight = 0;\n\n keys.forEach((key) => {\n let obj = createKey(key);\n\n totalWeight += obj.weight;\n\n this._keys.push(obj);\n this._keyMap[obj.id] = obj;\n\n totalWeight += obj.weight;\n });\n\n // Normalize weights so that their sum is equal to 1\n this._keys.forEach((key) => {\n key.weight /= totalWeight;\n });\n }\n get(keyId) {\n return this._keyMap[keyId]\n }\n keys() {\n return this._keys\n }\n toJSON() {\n return JSON.stringify(this._keys)\n }\n}\n\nfunction createKey(key) {\n let path = null;\n let id = null;\n let src = null;\n let weight = 1;\n let getFn = null;\n\n if (isString(key) || isArray(key)) {\n src = key;\n path = createKeyPath(key);\n id = createKeyId(key);\n } else {\n if (!hasOwn.call(key, 'name')) {\n throw new Error(MISSING_KEY_PROPERTY('name'))\n }\n\n const name = key.name;\n src = name;\n\n if (hasOwn.call(key, 'weight')) {\n weight = key.weight;\n\n if (weight <= 0) {\n throw new Error(INVALID_KEY_WEIGHT_VALUE(name))\n }\n }\n\n path = createKeyPath(name);\n id = createKeyId(name);\n getFn = key.getFn;\n }\n\n return { path, id, weight, src, getFn }\n}\n\nfunction createKeyPath(key) {\n return isArray(key) ? key : key.split('.')\n}\n\nfunction createKeyId(key) {\n return isArray(key) ? key.join('.') : key\n}\n\nfunction get(obj, path) {\n let list = [];\n let arr = false;\n\n const deepGet = (obj, path, index) => {\n if (!isDefined(obj)) {\n return\n }\n if (!path[index]) {\n // If there's no path left, we've arrived at the object we care about.\n list.push(obj);\n } else {\n let key = path[index];\n\n const value = obj[key];\n\n if (!isDefined(value)) {\n return\n }\n\n // If we're at the last value in the path, and if it's a string/number/bool,\n // add it to the list\n if (\n index === path.length - 1 &&\n (isString(value) || isNumber(value) || isBoolean(value))\n ) {\n list.push(toString(value));\n } else if (isArray(value)) {\n arr = true;\n // Search each item in the array.\n for (let i = 0, len = value.length; i < len; i += 1) {\n deepGet(value[i], path, index + 1);\n }\n } else if (path.length) {\n // An object. Recurse further.\n deepGet(value, path, index + 1);\n }\n }\n };\n\n // Backwards compatibility (since path used to be a string)\n deepGet(obj, isString(path) ? path.split('.') : path, 0);\n\n return arr ? list : list[0]\n}\n\nconst MatchOptions = {\n // Whether the matches should be included in the result set. When `true`, each record in the result\n // set will include the indices of the matched characters.\n // These can consequently be used for highlighting purposes.\n includeMatches: false,\n // When `true`, the matching function will continue to the end of a search pattern even if\n // a perfect match has already been located in the string.\n findAllMatches: false,\n // Minimum number of characters that must be matched before a result is considered a match\n minMatchCharLength: 1\n};\n\nconst BasicOptions = {\n // When `true`, the algorithm continues searching to the end of the input even if a perfect\n // match is found before the end of the same input.\n isCaseSensitive: false,\n // When true, the matching function will continue to the end of a search pattern even if\n includeScore: false,\n // List of properties that will be searched. This also supports nested properties.\n keys: [],\n // Whether to sort the result list, by score\n shouldSort: true,\n // Default sort function: sort by ascending score, ascending index\n sortFn: (a, b) =>\n a.score === b.score ? (a.idx < b.idx ? -1 : 1) : a.score < b.score ? -1 : 1\n};\n\nconst FuzzyOptions = {\n // Approximately where in the text is the pattern expected to be found?\n location: 0,\n // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match\n // (of both letters and location), a threshold of '1.0' would match anything.\n threshold: 0.6,\n // Determines how close the match must be to the fuzzy location (specified above).\n // An exact letter match which is 'distance' characters away from the fuzzy location\n // would score as a complete mismatch. A distance of '0' requires the match be at\n // the exact location specified, a threshold of '1000' would require a perfect match\n // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.\n distance: 100\n};\n\nconst AdvancedOptions = {\n // When `true`, it enables the use of unix-like search commands\n useExtendedSearch: false,\n // The get function to use when fetching an object's properties.\n // The default will search nested paths *ie foo.bar.baz*\n getFn: get,\n // When `true`, search will ignore `location` and `distance`, so it won't matter\n // where in the string the pattern appears.\n // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score\n ignoreLocation: false,\n // When `true`, the calculation for the relevance score (used for sorting) will\n // ignore the field-length norm.\n // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm\n ignoreFieldNorm: false,\n // The weight to determine how much field length norm effects scoring.\n fieldNormWeight: 1\n};\n\nvar Config = {\n ...BasicOptions,\n ...MatchOptions,\n ...FuzzyOptions,\n ...AdvancedOptions\n};\n\nconst SPACE = /[^ ]+/g;\n\n// Field-length norm: the shorter the field, the higher the weight.\n// Set to 3 decimals to reduce index size.\nfunction norm(weight = 1, mantissa = 3) {\n const cache = new Map();\n const m = Math.pow(10, mantissa);\n\n return {\n get(value) {\n const numTokens = value.match(SPACE).length;\n\n if (cache.has(numTokens)) {\n return cache.get(numTokens)\n }\n\n // Default function is 1/sqrt(x), weight makes that variable\n const norm = 1 / Math.pow(numTokens, 0.5 * weight);\n\n // In place of `toFixed(mantissa)`, for faster computation\n const n = parseFloat(Math.round(norm * m) / m);\n\n cache.set(numTokens, n);\n\n return n\n },\n clear() {\n cache.clear();\n }\n }\n}\n\nclass FuseIndex {\n constructor({\n getFn = Config.getFn,\n fieldNormWeight = Config.fieldNormWeight\n } = {}) {\n this.norm = norm(fieldNormWeight, 3);\n this.getFn = getFn;\n this.isCreated = false;\n\n this.setIndexRecords();\n }\n setSources(docs = []) {\n this.docs = docs;\n }\n setIndexRecords(records = []) {\n this.records = records;\n }\n setKeys(keys = []) {\n this.keys = keys;\n this._keysMap = {};\n keys.forEach((key, idx) => {\n this._keysMap[key.id] = idx;\n });\n }\n create() {\n if (this.isCreated || !this.docs.length) {\n return\n }\n\n this.isCreated = true;\n\n // List is Array\n if (isString(this.docs[0])) {\n this.docs.forEach((doc, docIndex) => {\n this._addString(doc, docIndex);\n });\n } else {\n // List is Array\n this.docs.forEach((doc, docIndex) => {\n this._addObject(doc, docIndex);\n });\n }\n\n this.norm.clear();\n }\n // Adds a doc to the end of the index\n add(doc) {\n const idx = this.size();\n\n if (isString(doc)) {\n this._addString(doc, idx);\n } else {\n this._addObject(doc, idx);\n }\n }\n // Removes the doc at the specified index of the index\n removeAt(idx) {\n this.records.splice(idx, 1);\n\n // Change ref index of every subsquent doc\n for (let i = idx, len = this.size(); i < len; i += 1) {\n this.records[i].i -= 1;\n }\n }\n getValueForItemAtKeyId(item, keyId) {\n return item[this._keysMap[keyId]]\n }\n size() {\n return this.records.length\n }\n _addString(doc, docIndex) {\n if (!isDefined(doc) || isBlank(doc)) {\n return\n }\n\n let record = {\n v: doc,\n i: docIndex,\n n: this.norm.get(doc)\n };\n\n this.records.push(record);\n }\n _addObject(doc, docIndex) {\n let record = { i: docIndex, $: {} };\n\n // Iterate over every key (i.e, path), and fetch the value at that key\n this.keys.forEach((key, keyIndex) => {\n let value = key.getFn ? key.getFn(doc) : this.getFn(doc, key.path);\n\n if (!isDefined(value)) {\n return\n }\n\n if (isArray(value)) {\n let subRecords = [];\n const stack = [{ nestedArrIndex: -1, value }];\n\n while (stack.length) {\n const { nestedArrIndex, value } = stack.pop();\n\n if (!isDefined(value)) {\n continue\n }\n\n if (isString(value) && !isBlank(value)) {\n let subRecord = {\n v: value,\n i: nestedArrIndex,\n n: this.norm.get(value)\n };\n\n subRecords.push(subRecord);\n } else if (isArray(value)) {\n value.forEach((item, k) => {\n stack.push({\n nestedArrIndex: k,\n value: item\n });\n });\n } else ;\n }\n record.$[keyIndex] = subRecords;\n } else if (isString(value) && !isBlank(value)) {\n let subRecord = {\n v: value,\n n: this.norm.get(value)\n };\n\n record.$[keyIndex] = subRecord;\n }\n });\n\n this.records.push(record);\n }\n toJSON() {\n return {\n keys: this.keys,\n records: this.records\n }\n }\n}\n\nfunction createIndex(\n keys,\n docs,\n { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}\n) {\n const myIndex = new FuseIndex({ getFn, fieldNormWeight });\n myIndex.setKeys(keys.map(createKey));\n myIndex.setSources(docs);\n myIndex.create();\n return myIndex\n}\n\nfunction parseIndex(\n data,\n { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}\n) {\n const { keys, records } = data;\n const myIndex = new FuseIndex({ getFn, fieldNormWeight });\n myIndex.setKeys(keys);\n myIndex.setIndexRecords(records);\n return myIndex\n}\n\nfunction computeScore$1(\n pattern,\n {\n errors = 0,\n currentLocation = 0,\n expectedLocation = 0,\n distance = Config.distance,\n ignoreLocation = Config.ignoreLocation\n } = {}\n) {\n const accuracy = errors / pattern.length;\n\n if (ignoreLocation) {\n return accuracy\n }\n\n const proximity = Math.abs(expectedLocation - currentLocation);\n\n if (!distance) {\n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy\n }\n\n return accuracy + proximity / distance\n}\n\nfunction convertMaskToIndices(\n matchmask = [],\n minMatchCharLength = Config.minMatchCharLength\n) {\n let indices = [];\n let start = -1;\n let end = -1;\n let i = 0;\n\n for (let len = matchmask.length; i < len; i += 1) {\n let match = matchmask[i];\n if (match && start === -1) {\n start = i;\n } else if (!match && start !== -1) {\n end = i - 1;\n if (end - start + 1 >= minMatchCharLength) {\n indices.push([start, end]);\n }\n start = -1;\n }\n }\n\n // (i-1 - start) + 1 => i - start\n if (matchmask[i - 1] && i - start >= minMatchCharLength) {\n indices.push([start, i - 1]);\n }\n\n return indices\n}\n\n// Machine word size\nconst MAX_BITS = 32;\n\nfunction search(\n text,\n pattern,\n patternAlphabet,\n {\n location = Config.location,\n distance = Config.distance,\n threshold = Config.threshold,\n findAllMatches = Config.findAllMatches,\n minMatchCharLength = Config.minMatchCharLength,\n includeMatches = Config.includeMatches,\n ignoreLocation = Config.ignoreLocation\n } = {}\n) {\n if (pattern.length > MAX_BITS) {\n throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS))\n }\n\n const patternLen = pattern.length;\n // Set starting location at beginning text and initialize the alphabet.\n const textLen = text.length;\n // Handle the case when location > text.length\n const expectedLocation = Math.max(0, Math.min(location, textLen));\n // Highest score beyond which we give up.\n let currentThreshold = threshold;\n // Is there a nearby exact match? (speedup)\n let bestLocation = expectedLocation;\n\n // Performance: only computer matches when the minMatchCharLength > 1\n // OR if `includeMatches` is true.\n const computeMatches = minMatchCharLength > 1 || includeMatches;\n // A mask of the matches, used for building the indices\n const matchMask = computeMatches ? Array(textLen) : [];\n\n let index;\n\n // Get all exact matches, here for speed up\n while ((index = text.indexOf(pattern, bestLocation)) > -1) {\n let score = computeScore$1(pattern, {\n currentLocation: index,\n expectedLocation,\n distance,\n ignoreLocation\n });\n\n currentThreshold = Math.min(score, currentThreshold);\n bestLocation = index + patternLen;\n\n if (computeMatches) {\n let i = 0;\n while (i < patternLen) {\n matchMask[index + i] = 1;\n i += 1;\n }\n }\n }\n\n // Reset the best location\n bestLocation = -1;\n\n let lastBitArr = [];\n let finalScore = 1;\n let binMax = patternLen + textLen;\n\n const mask = 1 << (patternLen - 1);\n\n for (let i = 0; i < patternLen; i += 1) {\n // Scan for the best match; each iteration allows for one more error.\n // Run a binary search to determine how far from the match location we can stray\n // at this error level.\n let binMin = 0;\n let binMid = binMax;\n\n while (binMin < binMid) {\n const score = computeScore$1(pattern, {\n errors: i,\n currentLocation: expectedLocation + binMid,\n expectedLocation,\n distance,\n ignoreLocation\n });\n\n if (score <= currentThreshold) {\n binMin = binMid;\n } else {\n binMax = binMid;\n }\n\n binMid = Math.floor((binMax - binMin) / 2 + binMin);\n }\n\n // Use the result from this iteration as the maximum for the next.\n binMax = binMid;\n\n let start = Math.max(1, expectedLocation - binMid + 1);\n let finish = findAllMatches\n ? textLen\n : Math.min(expectedLocation + binMid, textLen) + patternLen;\n\n // Initialize the bit array\n let bitArr = Array(finish + 2);\n\n bitArr[finish + 1] = (1 << i) - 1;\n\n for (let j = finish; j >= start; j -= 1) {\n let currentLocation = j - 1;\n let charMatch = patternAlphabet[text.charAt(currentLocation)];\n\n if (computeMatches) {\n // Speed up: quick bool to int conversion (i.e, `charMatch ? 1 : 0`)\n matchMask[currentLocation] = +!!charMatch;\n }\n\n // First pass: exact match\n bitArr[j] = ((bitArr[j + 1] << 1) | 1) & charMatch;\n\n // Subsequent passes: fuzzy match\n if (i) {\n bitArr[j] |=\n ((lastBitArr[j + 1] | lastBitArr[j]) << 1) | 1 | lastBitArr[j + 1];\n }\n\n if (bitArr[j] & mask) {\n finalScore = computeScore$1(pattern, {\n errors: i,\n currentLocation,\n expectedLocation,\n distance,\n ignoreLocation\n });\n\n // This match will almost certainly be better than any existing match.\n // But check anyway.\n if (finalScore <= currentThreshold) {\n // Indeed it is\n currentThreshold = finalScore;\n bestLocation = currentLocation;\n\n // Already passed `loc`, downhill from here on in.\n if (bestLocation <= expectedLocation) {\n break\n }\n\n // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`.\n start = Math.max(1, 2 * expectedLocation - bestLocation);\n }\n }\n }\n\n // No hope for a (better) match at greater error levels.\n const score = computeScore$1(pattern, {\n errors: i + 1,\n currentLocation: expectedLocation,\n expectedLocation,\n distance,\n ignoreLocation\n });\n\n if (score > currentThreshold) {\n break\n }\n\n lastBitArr = bitArr;\n }\n\n const result = {\n isMatch: bestLocation >= 0,\n // Count exact matches (those with a score of 0) to be \"almost\" exact\n score: Math.max(0.001, finalScore)\n };\n\n if (computeMatches) {\n const indices = convertMaskToIndices(matchMask, minMatchCharLength);\n if (!indices.length) {\n result.isMatch = false;\n } else if (includeMatches) {\n result.indices = indices;\n }\n }\n\n return result\n}\n\nfunction createPatternAlphabet(pattern) {\n let mask = {};\n\n for (let i = 0, len = pattern.length; i < len; i += 1) {\n const char = pattern.charAt(i);\n mask[char] = (mask[char] || 0) | (1 << (len - i - 1));\n }\n\n return mask\n}\n\nclass BitapSearch {\n constructor(\n pattern,\n {\n location = Config.location,\n threshold = Config.threshold,\n distance = Config.distance,\n includeMatches = Config.includeMatches,\n findAllMatches = Config.findAllMatches,\n minMatchCharLength = Config.minMatchCharLength,\n isCaseSensitive = Config.isCaseSensitive,\n ignoreLocation = Config.ignoreLocation\n } = {}\n ) {\n this.options = {\n location,\n threshold,\n distance,\n includeMatches,\n findAllMatches,\n minMatchCharLength,\n isCaseSensitive,\n ignoreLocation\n };\n\n this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();\n\n this.chunks = [];\n\n if (!this.pattern.length) {\n return\n }\n\n const addChunk = (pattern, startIndex) => {\n this.chunks.push({\n pattern,\n alphabet: createPatternAlphabet(pattern),\n startIndex\n });\n };\n\n const len = this.pattern.length;\n\n if (len > MAX_BITS) {\n let i = 0;\n const remainder = len % MAX_BITS;\n const end = len - remainder;\n\n while (i < end) {\n addChunk(this.pattern.substr(i, MAX_BITS), i);\n i += MAX_BITS;\n }\n\n if (remainder) {\n const startIndex = len - MAX_BITS;\n addChunk(this.pattern.substr(startIndex), startIndex);\n }\n } else {\n addChunk(this.pattern, 0);\n }\n }\n\n searchIn(text) {\n const { isCaseSensitive, includeMatches } = this.options;\n\n if (!isCaseSensitive) {\n text = text.toLowerCase();\n }\n\n // Exact match\n if (this.pattern === text) {\n let result = {\n isMatch: true,\n score: 0\n };\n\n if (includeMatches) {\n result.indices = [[0, text.length - 1]];\n }\n\n return result\n }\n\n // Otherwise, use Bitap algorithm\n const {\n location,\n distance,\n threshold,\n findAllMatches,\n minMatchCharLength,\n ignoreLocation\n } = this.options;\n\n let allIndices = [];\n let totalScore = 0;\n let hasMatches = false;\n\n this.chunks.forEach(({ pattern, alphabet, startIndex }) => {\n const { isMatch, score, indices } = search(text, pattern, alphabet, {\n location: location + startIndex,\n distance,\n threshold,\n findAllMatches,\n minMatchCharLength,\n includeMatches,\n ignoreLocation\n });\n\n if (isMatch) {\n hasMatches = true;\n }\n\n totalScore += score;\n\n if (isMatch && indices) {\n allIndices = [...allIndices, ...indices];\n }\n });\n\n let result = {\n isMatch: hasMatches,\n score: hasMatches ? totalScore / this.chunks.length : 1\n };\n\n if (hasMatches && includeMatches) {\n result.indices = allIndices;\n }\n\n return result\n }\n}\n\nclass BaseMatch {\n constructor(pattern) {\n this.pattern = pattern;\n }\n static isMultiMatch(pattern) {\n return getMatch(pattern, this.multiRegex)\n }\n static isSingleMatch(pattern) {\n return getMatch(pattern, this.singleRegex)\n }\n search(/*text*/) {}\n}\n\nfunction getMatch(pattern, exp) {\n const matches = pattern.match(exp);\n return matches ? matches[1] : null\n}\n\n// Token: 'file\n\nclass ExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'exact'\n }\n static get multiRegex() {\n return /^=\"(.*)\"$/\n }\n static get singleRegex() {\n return /^=(.*)$/\n }\n search(text) {\n const isMatch = text === this.pattern;\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [0, this.pattern.length - 1]\n }\n }\n}\n\n// Token: !fire\n\nclass InverseExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'inverse-exact'\n }\n static get multiRegex() {\n return /^!\"(.*)\"$/\n }\n static get singleRegex() {\n return /^!(.*)$/\n }\n search(text) {\n const index = text.indexOf(this.pattern);\n const isMatch = index === -1;\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [0, text.length - 1]\n }\n }\n}\n\n// Token: ^file\n\nclass PrefixExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'prefix-exact'\n }\n static get multiRegex() {\n return /^\\^\"(.*)\"$/\n }\n static get singleRegex() {\n return /^\\^(.*)$/\n }\n search(text) {\n const isMatch = text.startsWith(this.pattern);\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [0, this.pattern.length - 1]\n }\n }\n}\n\n// Token: !^fire\n\nclass InversePrefixExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'inverse-prefix-exact'\n }\n static get multiRegex() {\n return /^!\\^\"(.*)\"$/\n }\n static get singleRegex() {\n return /^!\\^(.*)$/\n }\n search(text) {\n const isMatch = !text.startsWith(this.pattern);\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [0, text.length - 1]\n }\n }\n}\n\n// Token: .file$\n\nclass SuffixExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'suffix-exact'\n }\n static get multiRegex() {\n return /^\"(.*)\"\\$$/\n }\n static get singleRegex() {\n return /^(.*)\\$$/\n }\n search(text) {\n const isMatch = text.endsWith(this.pattern);\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [text.length - this.pattern.length, text.length - 1]\n }\n }\n}\n\n// Token: !.file$\n\nclass InverseSuffixExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'inverse-suffix-exact'\n }\n static get multiRegex() {\n return /^!\"(.*)\"\\$$/\n }\n static get singleRegex() {\n return /^!(.*)\\$$/\n }\n search(text) {\n const isMatch = !text.endsWith(this.pattern);\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [0, text.length - 1]\n }\n }\n}\n\nclass FuzzyMatch extends BaseMatch {\n constructor(\n pattern,\n {\n location = Config.location,\n threshold = Config.threshold,\n distance = Config.distance,\n includeMatches = Config.includeMatches,\n findAllMatches = Config.findAllMatches,\n minMatchCharLength = Config.minMatchCharLength,\n isCaseSensitive = Config.isCaseSensitive,\n ignoreLocation = Config.ignoreLocation\n } = {}\n ) {\n super(pattern);\n this._bitapSearch = new BitapSearch(pattern, {\n location,\n threshold,\n distance,\n includeMatches,\n findAllMatches,\n minMatchCharLength,\n isCaseSensitive,\n ignoreLocation\n });\n }\n static get type() {\n return 'fuzzy'\n }\n static get multiRegex() {\n return /^\"(.*)\"$/\n }\n static get singleRegex() {\n return /^(.*)$/\n }\n search(text) {\n return this._bitapSearch.searchIn(text)\n }\n}\n\n// Token: 'file\n\nclass IncludeMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'include'\n }\n static get multiRegex() {\n return /^'\"(.*)\"$/\n }\n static get singleRegex() {\n return /^'(.*)$/\n }\n search(text) {\n let location = 0;\n let index;\n\n const indices = [];\n const patternLen = this.pattern.length;\n\n // Get all exact matches\n while ((index = text.indexOf(this.pattern, location)) > -1) {\n location = index + patternLen;\n indices.push([index, location - 1]);\n }\n\n const isMatch = !!indices.length;\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices\n }\n }\n}\n\n// ❗Order is important. DO NOT CHANGE.\nconst searchers = [\n ExactMatch,\n IncludeMatch,\n PrefixExactMatch,\n InversePrefixExactMatch,\n InverseSuffixExactMatch,\n SuffixExactMatch,\n InverseExactMatch,\n FuzzyMatch\n];\n\nconst searchersLen = searchers.length;\n\n// Regex to split by spaces, but keep anything in quotes together\nconst SPACE_RE = / +(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)/;\nconst OR_TOKEN = '|';\n\n// Return a 2D array representation of the query, for simpler parsing.\n// Example:\n// \"^core go$ | rb$ | py$ xy$\" => [[\"^core\", \"go$\"], [\"rb$\"], [\"py$\", \"xy$\"]]\nfunction parseQuery(pattern, options = {}) {\n return pattern.split(OR_TOKEN).map((item) => {\n let query = item\n .trim()\n .split(SPACE_RE)\n .filter((item) => item && !!item.trim());\n\n let results = [];\n for (let i = 0, len = query.length; i < len; i += 1) {\n const queryItem = query[i];\n\n // 1. Handle multiple query match (i.e, once that are quoted, like `\"hello world\"`)\n let found = false;\n let idx = -1;\n while (!found && ++idx < searchersLen) {\n const searcher = searchers[idx];\n let token = searcher.isMultiMatch(queryItem);\n if (token) {\n results.push(new searcher(token, options));\n found = true;\n }\n }\n\n if (found) {\n continue\n }\n\n // 2. Handle single query matches (i.e, once that are *not* quoted)\n idx = -1;\n while (++idx < searchersLen) {\n const searcher = searchers[idx];\n let token = searcher.isSingleMatch(queryItem);\n if (token) {\n results.push(new searcher(token, options));\n break\n }\n }\n }\n\n return results\n })\n}\n\n// These extended matchers can return an array of matches, as opposed\n// to a singl match\nconst MultiMatchSet = new Set([FuzzyMatch.type, IncludeMatch.type]);\n\n/**\n * Command-like searching\n * ======================\n *\n * Given multiple search terms delimited by spaces.e.g. `^jscript .python$ ruby !java`,\n * search in a given text.\n *\n * Search syntax:\n *\n * | Token | Match type | Description |\n * | ----------- | -------------------------- | -------------------------------------- |\n * | `jscript` | fuzzy-match | Items that fuzzy match `jscript` |\n * | `=scheme` | exact-match | Items that are `scheme` |\n * | `'python` | include-match | Items that include `python` |\n * | `!ruby` | inverse-exact-match | Items that do not include `ruby` |\n * | `^java` | prefix-exact-match | Items that start with `java` |\n * | `!^earlang` | inverse-prefix-exact-match | Items that do not start with `earlang` |\n * | `.js$` | suffix-exact-match | Items that end with `.js` |\n * | `!.go$` | inverse-suffix-exact-match | Items that do not end with `.go` |\n *\n * A single pipe character acts as an OR operator. For example, the following\n * query matches entries that start with `core` and end with either`go`, `rb`,\n * or`py`.\n *\n * ```\n * ^core go$ | rb$ | py$\n * ```\n */\nclass ExtendedSearch {\n constructor(\n pattern,\n {\n isCaseSensitive = Config.isCaseSensitive,\n includeMatches = Config.includeMatches,\n minMatchCharLength = Config.minMatchCharLength,\n ignoreLocation = Config.ignoreLocation,\n findAllMatches = Config.findAllMatches,\n location = Config.location,\n threshold = Config.threshold,\n distance = Config.distance\n } = {}\n ) {\n this.query = null;\n this.options = {\n isCaseSensitive,\n includeMatches,\n minMatchCharLength,\n findAllMatches,\n ignoreLocation,\n location,\n threshold,\n distance\n };\n\n this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();\n this.query = parseQuery(this.pattern, this.options);\n }\n\n static condition(_, options) {\n return options.useExtendedSearch\n }\n\n searchIn(text) {\n const query = this.query;\n\n if (!query) {\n return {\n isMatch: false,\n score: 1\n }\n }\n\n const { includeMatches, isCaseSensitive } = this.options;\n\n text = isCaseSensitive ? text : text.toLowerCase();\n\n let numMatches = 0;\n let allIndices = [];\n let totalScore = 0;\n\n // ORs\n for (let i = 0, qLen = query.length; i < qLen; i += 1) {\n const searchers = query[i];\n\n // Reset indices\n allIndices.length = 0;\n numMatches = 0;\n\n // ANDs\n for (let j = 0, pLen = searchers.length; j < pLen; j += 1) {\n const searcher = searchers[j];\n const { isMatch, indices, score } = searcher.search(text);\n\n if (isMatch) {\n numMatches += 1;\n totalScore += score;\n if (includeMatches) {\n const type = searcher.constructor.type;\n if (MultiMatchSet.has(type)) {\n allIndices = [...allIndices, ...indices];\n } else {\n allIndices.push(indices);\n }\n }\n } else {\n totalScore = 0;\n numMatches = 0;\n allIndices.length = 0;\n break\n }\n }\n\n // OR condition, so if TRUE, return\n if (numMatches) {\n let result = {\n isMatch: true,\n score: totalScore / numMatches\n };\n\n if (includeMatches) {\n result.indices = allIndices;\n }\n\n return result\n }\n }\n\n // Nothing was matched\n return {\n isMatch: false,\n score: 1\n }\n }\n}\n\nconst registeredSearchers = [];\n\nfunction register(...args) {\n registeredSearchers.push(...args);\n}\n\nfunction createSearcher(pattern, options) {\n for (let i = 0, len = registeredSearchers.length; i < len; i += 1) {\n let searcherClass = registeredSearchers[i];\n if (searcherClass.condition(pattern, options)) {\n return new searcherClass(pattern, options)\n }\n }\n\n return new BitapSearch(pattern, options)\n}\n\nconst LogicalOperator = {\n AND: '$and',\n OR: '$or'\n};\n\nconst KeyType = {\n PATH: '$path',\n PATTERN: '$val'\n};\n\nconst isExpression = (query) =>\n !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);\n\nconst isPath = (query) => !!query[KeyType.PATH];\n\nconst isLeaf = (query) =>\n !isArray(query) && isObject(query) && !isExpression(query);\n\nconst convertToExplicit = (query) => ({\n [LogicalOperator.AND]: Object.keys(query).map((key) => ({\n [key]: query[key]\n }))\n});\n\n// When `auto` is `true`, the parse function will infer and initialize and add\n// the appropriate `Searcher` instance\nfunction parse(query, options, { auto = true } = {}) {\n const next = (query) => {\n let keys = Object.keys(query);\n\n const isQueryPath = isPath(query);\n\n if (!isQueryPath && keys.length > 1 && !isExpression(query)) {\n return next(convertToExplicit(query))\n }\n\n if (isLeaf(query)) {\n const key = isQueryPath ? query[KeyType.PATH] : keys[0];\n\n const pattern = isQueryPath ? query[KeyType.PATTERN] : query[key];\n\n if (!isString(pattern)) {\n throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key))\n }\n\n const obj = {\n keyId: createKeyId(key),\n pattern\n };\n\n if (auto) {\n obj.searcher = createSearcher(pattern, options);\n }\n\n return obj\n }\n\n let node = {\n children: [],\n operator: keys[0]\n };\n\n keys.forEach((key) => {\n const value = query[key];\n\n if (isArray(value)) {\n value.forEach((item) => {\n node.children.push(next(item));\n });\n }\n });\n\n return node\n };\n\n if (!isExpression(query)) {\n query = convertToExplicit(query);\n }\n\n return next(query)\n}\n\n// Practical scoring function\nfunction computeScore(\n results,\n { ignoreFieldNorm = Config.ignoreFieldNorm }\n) {\n results.forEach((result) => {\n let totalScore = 1;\n\n result.matches.forEach(({ key, norm, score }) => {\n const weight = key ? key.weight : null;\n\n totalScore *= Math.pow(\n score === 0 && weight ? Number.EPSILON : score,\n (weight || 1) * (ignoreFieldNorm ? 1 : norm)\n );\n });\n\n result.score = totalScore;\n });\n}\n\nfunction transformMatches(result, data) {\n const matches = result.matches;\n data.matches = [];\n\n if (!isDefined(matches)) {\n return\n }\n\n matches.forEach((match) => {\n if (!isDefined(match.indices) || !match.indices.length) {\n return\n }\n\n const { indices, value } = match;\n\n let obj = {\n indices,\n value\n };\n\n if (match.key) {\n obj.key = match.key.src;\n }\n\n if (match.idx > -1) {\n obj.refIndex = match.idx;\n }\n\n data.matches.push(obj);\n });\n}\n\nfunction transformScore(result, data) {\n data.score = result.score;\n}\n\nfunction format(\n results,\n docs,\n {\n includeMatches = Config.includeMatches,\n includeScore = Config.includeScore\n } = {}\n) {\n const transformers = [];\n\n if (includeMatches) transformers.push(transformMatches);\n if (includeScore) transformers.push(transformScore);\n\n return results.map((result) => {\n const { idx } = result;\n\n const data = {\n item: docs[idx],\n refIndex: idx\n };\n\n if (transformers.length) {\n transformers.forEach((transformer) => {\n transformer(result, data);\n });\n }\n\n return data\n })\n}\n\nclass Fuse {\n constructor(docs, options = {}, index) {\n this.options = { ...Config, ...options };\n\n if (\n this.options.useExtendedSearch &&\n !true\n ) {}\n\n this._keyStore = new KeyStore(this.options.keys);\n\n this.setCollection(docs, index);\n }\n\n setCollection(docs, index) {\n this._docs = docs;\n\n if (index && !(index instanceof FuseIndex)) {\n throw new Error(INCORRECT_INDEX_TYPE)\n }\n\n this._myIndex =\n index ||\n createIndex(this.options.keys, this._docs, {\n getFn: this.options.getFn,\n fieldNormWeight: this.options.fieldNormWeight\n });\n }\n\n add(doc) {\n if (!isDefined(doc)) {\n return\n }\n\n this._docs.push(doc);\n this._myIndex.add(doc);\n }\n\n remove(predicate = (/* doc, idx */) => false) {\n const results = [];\n\n for (let i = 0, len = this._docs.length; i < len; i += 1) {\n const doc = this._docs[i];\n if (predicate(doc, i)) {\n this.removeAt(i);\n i -= 1;\n len -= 1;\n\n results.push(doc);\n }\n }\n\n return results\n }\n\n removeAt(idx) {\n this._docs.splice(idx, 1);\n this._myIndex.removeAt(idx);\n }\n\n getIndex() {\n return this._myIndex\n }\n\n search(query, { limit = -1 } = {}) {\n const {\n includeMatches,\n includeScore,\n shouldSort,\n sortFn,\n ignoreFieldNorm\n } = this.options;\n\n let results = isString(query)\n ? isString(this._docs[0])\n ? this._searchStringList(query)\n : this._searchObjectList(query)\n : this._searchLogical(query);\n\n computeScore(results, { ignoreFieldNorm });\n\n if (shouldSort) {\n results.sort(sortFn);\n }\n\n if (isNumber(limit) && limit > -1) {\n results = results.slice(0, limit);\n }\n\n return format(results, this._docs, {\n includeMatches,\n includeScore\n })\n }\n\n _searchStringList(query) {\n const searcher = createSearcher(query, this.options);\n const { records } = this._myIndex;\n const results = [];\n\n // Iterate over every string in the index\n records.forEach(({ v: text, i: idx, n: norm }) => {\n if (!isDefined(text)) {\n return\n }\n\n const { isMatch, score, indices } = searcher.searchIn(text);\n\n if (isMatch) {\n results.push({\n item: text,\n idx,\n matches: [{ score, value: text, norm, indices }]\n });\n }\n });\n\n return results\n }\n\n _searchLogical(query) {\n\n const expression = parse(query, this.options);\n\n const evaluate = (node, item, idx) => {\n if (!node.children) {\n const { keyId, searcher } = node;\n\n const matches = this._findMatches({\n key: this._keyStore.get(keyId),\n value: this._myIndex.getValueForItemAtKeyId(item, keyId),\n searcher\n });\n\n if (matches && matches.length) {\n return [\n {\n idx,\n item,\n matches\n }\n ]\n }\n\n return []\n }\n\n const res = [];\n for (let i = 0, len = node.children.length; i < len; i += 1) {\n const child = node.children[i];\n const result = evaluate(child, item, idx);\n if (result.length) {\n res.push(...result);\n } else if (node.operator === LogicalOperator.AND) {\n return []\n }\n }\n return res\n };\n\n const records = this._myIndex.records;\n const resultMap = {};\n const results = [];\n\n records.forEach(({ $: item, i: idx }) => {\n if (isDefined(item)) {\n let expResults = evaluate(expression, item, idx);\n\n if (expResults.length) {\n // Dedupe when adding\n if (!resultMap[idx]) {\n resultMap[idx] = { idx, item, matches: [] };\n results.push(resultMap[idx]);\n }\n expResults.forEach(({ matches }) => {\n resultMap[idx].matches.push(...matches);\n });\n }\n }\n });\n\n return results\n }\n\n _searchObjectList(query) {\n const searcher = createSearcher(query, this.options);\n const { keys, records } = this._myIndex;\n const results = [];\n\n // List is Array\n records.forEach(({ $: item, i: idx }) => {\n if (!isDefined(item)) {\n return\n }\n\n let matches = [];\n\n // Iterate over every key (i.e, path), and fetch the value at that key\n keys.forEach((key, keyIndex) => {\n matches.push(\n ...this._findMatches({\n key,\n value: item[keyIndex],\n searcher\n })\n );\n });\n\n if (matches.length) {\n results.push({\n idx,\n item,\n matches\n });\n }\n });\n\n return results\n }\n _findMatches({ key, value, searcher }) {\n if (!isDefined(value)) {\n return []\n }\n\n let matches = [];\n\n if (isArray(value)) {\n value.forEach(({ v: text, i: idx, n: norm }) => {\n if (!isDefined(text)) {\n return\n }\n\n const { isMatch, score, indices } = searcher.searchIn(text);\n\n if (isMatch) {\n matches.push({\n score,\n key,\n value: text,\n idx,\n norm,\n indices\n });\n }\n });\n } else {\n const { v: text, n: norm } = value;\n\n const { isMatch, score, indices } = searcher.searchIn(text);\n\n if (isMatch) {\n matches.push({ score, key, value: text, norm, indices });\n }\n }\n\n return matches\n }\n}\n\nFuse.version = '6.6.2';\nFuse.createIndex = createIndex;\nFuse.parseIndex = parseIndex;\nFuse.config = Config;\n\n{\n Fuse.parseQuery = parse;\n}\n\n{\n register(ExtendedSearch);\n}\n\n\n\n\n/***/ }),\n\n/***/ 791:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, {\n \"__DO_NOT_USE__ActionTypes\": function() { return /* binding */ ActionTypes; },\n \"applyMiddleware\": function() { return /* binding */ applyMiddleware; },\n \"bindActionCreators\": function() { return /* binding */ bindActionCreators; },\n \"combineReducers\": function() { return /* binding */ combineReducers; },\n \"compose\": function() { return /* binding */ compose; },\n \"createStore\": function() { return /* binding */ createStore; },\n \"legacy_createStore\": function() { return /* binding */ legacy_createStore; }\n});\n\n;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}\n;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js\n\nfunction _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}\n;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js\n\n\nfunction _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}\n;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js\n\nfunction _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\n;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n return keys;\n}\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n return target;\n}\n;// CONCATENATED MODULE: ./node_modules/redux/es/redux.js\n\n\n/**\n * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js\n *\n * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes\n * during build.\n * @param {number} code\n */\nfunction formatProdErrorMessage(code) {\n return \"Minified Redux error #\" + code + \"; visit https://redux.js.org/Errors?code=\" + code + \" for the full message or \" + 'use the non-minified dev environment for full errors. ';\n}\n\n// Inlined version of the `symbol-observable` polyfill\nvar $$observable = (function () {\n return typeof Symbol === 'function' && Symbol.observable || '@@observable';\n})();\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nvar randomString = function randomString() {\n return Math.random().toString(36).substring(7).split('').join('.');\n};\n\nvar ActionTypes = {\n INIT: \"@@redux/INIT\" + randomString(),\n REPLACE: \"@@redux/REPLACE\" + randomString(),\n PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {\n return \"@@redux/PROBE_UNKNOWN_ACTION\" + randomString();\n }\n};\n\n/**\n * @param {any} obj The object to inspect.\n * @returns {boolean} True if the argument appears to be a plain object.\n */\nfunction isPlainObject(obj) {\n if (typeof obj !== 'object' || obj === null) return false;\n var proto = obj;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(obj) === proto;\n}\n\n// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of\nfunction miniKindOf(val) {\n if (val === void 0) return 'undefined';\n if (val === null) return 'null';\n var type = typeof val;\n\n switch (type) {\n case 'boolean':\n case 'string':\n case 'number':\n case 'symbol':\n case 'function':\n {\n return type;\n }\n }\n\n if (Array.isArray(val)) return 'array';\n if (isDate(val)) return 'date';\n if (isError(val)) return 'error';\n var constructorName = ctorName(val);\n\n switch (constructorName) {\n case 'Symbol':\n case 'Promise':\n case 'WeakMap':\n case 'WeakSet':\n case 'Map':\n case 'Set':\n return constructorName;\n } // other\n\n\n return type.slice(8, -1).toLowerCase().replace(/\\s/g, '');\n}\n\nfunction ctorName(val) {\n return typeof val.constructor === 'function' ? val.constructor.name : null;\n}\n\nfunction isError(val) {\n return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';\n}\n\nfunction isDate(val) {\n if (val instanceof Date) return true;\n return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';\n}\n\nfunction kindOf(val) {\n var typeOfVal = typeof val;\n\n if (false) {}\n\n return typeOfVal;\n}\n\n/**\n * @deprecated\n *\n * **We recommend using the `configureStore` method\n * of the `@reduxjs/toolkit` package**, which replaces `createStore`.\n *\n * Redux Toolkit is our recommended approach for writing Redux logic today,\n * including store setup, reducers, data fetching, and more.\n *\n * **For more details, please read this Redux docs page:**\n * **https://redux.js.org/introduction/why-rtk-is-redux-today**\n *\n * `configureStore` from Redux Toolkit is an improved version of `createStore` that\n * simplifies setup and helps avoid common bugs.\n *\n * You should not be using the `redux` core package by itself today, except for learning purposes.\n * The `createStore` method from the core `redux` package will not be removed, but we encourage\n * all users to migrate to using Redux Toolkit for all Redux code.\n *\n * If you want to use `createStore` without this visual deprecation warning, use\n * the `legacy_createStore` import instead:\n *\n * `import { legacy_createStore as createStore} from 'redux'`\n *\n */\n\nfunction createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n throw new Error( true ? formatProdErrorMessage(0) : 0);\n }\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error( true ? formatProdErrorMessage(1) : 0);\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error( true ? formatProdErrorMessage(2) : 0);\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n /**\n * This makes a shallow copy of currentListeners so we can use\n * nextListeners as a temporary list while dispatching.\n *\n * This prevents any bugs around consumers calling\n * subscribe/unsubscribe in the middle of a dispatch.\n */\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n\n\n function getState() {\n if (isDispatching) {\n throw new Error( true ? formatProdErrorMessage(3) : 0);\n }\n\n return currentState;\n }\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n\n\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error( true ? formatProdErrorMessage(4) : 0);\n }\n\n if (isDispatching) {\n throw new Error( true ? formatProdErrorMessage(5) : 0);\n }\n\n var isSubscribed = true;\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n if (isDispatching) {\n throw new Error( true ? formatProdErrorMessage(6) : 0);\n }\n\n isSubscribed = false;\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n currentListeners = null;\n };\n }\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing “what changed”. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n\n\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error( true ? formatProdErrorMessage(7) : 0);\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error( true ? formatProdErrorMessage(8) : 0);\n }\n\n if (isDispatching) {\n throw new Error( true ? formatProdErrorMessage(9) : 0);\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n\n\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error( true ? formatProdErrorMessage(10) : 0);\n }\n\n currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.\n // Any reducers that existed in both the new and old rootReducer\n // will receive the previous state. This effectively populates\n // the new state tree with any relevant data from the old one.\n\n dispatch({\n type: ActionTypes.REPLACE\n });\n }\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n\n\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n throw new Error( true ? formatProdErrorMessage(11) : 0);\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return {\n unsubscribe: unsubscribe\n };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n } // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n\n\n dispatch({\n type: ActionTypes.INIT\n });\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n/**\n * Creates a Redux store that holds the state tree.\n *\n * **We recommend using `configureStore` from the\n * `@reduxjs/toolkit` package**, which replaces `createStore`:\n * **https://redux.js.org/introduction/why-rtk-is-redux-today**\n *\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n\nvar legacy_createStore = createStore;\n\n/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nfunction warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n\n\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n } catch (e) {} // eslint-disable-line no-empty\n\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n return \"The \" + argumentName + \" has unexpected type of \\\"\" + kindOf(inputState) + \"\\\". Expected argument to be an object with the following \" + (\"keys: \\\"\" + reducerKeys.join('\", \"') + \"\\\"\");\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n if (action && action.type === ActionTypes.REPLACE) return;\n\n if (unexpectedKeys.length > 0) {\n return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, {\n type: ActionTypes.INIT\n });\n\n if (typeof initialState === 'undefined') {\n throw new Error( true ? formatProdErrorMessage(12) : 0);\n }\n\n if (typeof reducer(undefined, {\n type: ActionTypes.PROBE_UNKNOWN_ACTION()\n }) === 'undefined') {\n throw new Error( true ? formatProdErrorMessage(13) : 0);\n }\n });\n}\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\n\n\nfunction combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (false) {}\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n\n var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n // keys multiple times.\n\n var unexpectedKeyCache;\n\n if (false) {}\n\n var shapeAssertionError;\n\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination(state, action) {\n if (state === void 0) {\n state = {};\n }\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (false) { var warningMessage; }\n\n var hasChanged = false;\n var nextState = {};\n\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n\n if (typeof nextStateForKey === 'undefined') {\n var actionType = action && action.type;\n throw new Error( true ? formatProdErrorMessage(14) : 0);\n }\n\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n\n hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;\n return hasChanged ? nextState : state;\n };\n}\n\nfunction bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(this, arguments));\n };\n}\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass an action creator as the first argument,\n * and get a dispatch wrapped function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\n\n\nfunction bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error( true ? formatProdErrorMessage(16) : 0);\n }\n\n var boundActionCreators = {};\n\n for (var key in actionCreators) {\n var actionCreator = actionCreators[key];\n\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n\n return boundActionCreators;\n}\n\n/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\nfunction compose() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(void 0, arguments));\n };\n });\n}\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\n\nfunction applyMiddleware() {\n for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function () {\n var store = createStore.apply(void 0, arguments);\n\n var _dispatch = function dispatch() {\n throw new Error( true ? formatProdErrorMessage(15) : 0);\n };\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch() {\n return _dispatch.apply(void 0, arguments);\n }\n };\n var chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(void 0, chain)(store.dispatch);\n return _objectSpread2(_objectSpread2({}, store), {}, {\n dispatch: _dispatch\n });\n };\n };\n}\n\n/*\n * This is a dummy function to check if the function name has been altered by minification.\n * If the function has been minified and NODE_ENV !== 'production', warn the user.\n */\n\nfunction isCrushed() {}\n\nif (false) {}\n\n\n\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/compat get default export */\n/******/ \t!function() {\n/******/ \t\t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t\t__webpack_require__.n = function(module) {\n/******/ \t\t\tvar getter = module && module.__esModule ?\n/******/ \t\t\t\tfunction() { return module['default']; } :\n/******/ \t\t\t\tfunction() { return module; };\n/******/ \t\t\t__webpack_require__.d(getter, { a: getter });\n/******/ \t\t\treturn getter;\n/******/ \t\t};\n/******/ \t}();\n/******/ \t\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t!function() {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = function(exports, definition) {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t}();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t!function() {\n/******/ \t\t__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }\n/******/ \t}();\n/******/ \t\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t!function() {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = function(exports) {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t}();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.\n!function() {\n/* harmony import */ var _scripts_choices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(373);\n/* harmony import */ var _scripts_choices__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_scripts_choices__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _scripts_interfaces__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(187);\n/* harmony import */ var _scripts_interfaces__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_scripts_interfaces__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _scripts_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(883);\n/* harmony import */ var _scripts_defaults__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(789);\n/* harmony import */ var _scripts_templates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(686);\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ((_scripts_choices__WEBPACK_IMPORTED_MODULE_0___default()));\n\n}();\n__webpack_exports__ = __webpack_exports__[\"default\"];\n/******/ \treturn __webpack_exports__;\n/******/ })()\n;\n});","import { Controller } from '@hotwired/stimulus';\nimport Choices from 'choices.js';\n\nexport default class extends Controller {\n static values = {\n searchEnabled: Boolean,\n remoteSearchUrl: String,\n noChoicesText: String,\n noResultsText: String,\n hideRemoveItemButton: Boolean,\n renderChoiceLimit: Number,\n autoClose: Boolean\n };\n\n connect() {\n if (this.element.dataset.choice !== 'active') {\n const choices = new Choices(this.element, {\n allowHTML: true,\n silent: true,\n searchEnabled: this.searchEnabledValue,\n searchChoices: !this.remoteSearchUrlValue,\n noResultsText: this.noResultsTextValue || 'No results found',\n noChoicesText: this.noChoicesTextValue || 'No choices to choose from',\n searchFloor: 1,\n searchResultLimit: 10,\n shouldSort: false,\n maxItemCount: -1,\n renderChoiceLimit: this.renderChoiceLimitValue || -1,\n removeItems: true,\n delimiter: ',',\n removeItemButton: !this.hideRemoveItemButtonValue,\n duplicateItemsAllowed: false,\n addItems: true,\n fuseOptions: { threshold: 0.2 }\n });\n\n if(this.autoCloseValue) {\n choices.passedElement.element.addEventListener(\n 'addItem',\n function() {\n choices.hideDropdown();\n },\n false\n );\n }\n\n if (this.remoteSearchUrlValue) {\n const lookupDelay = 300;\n let lookupTimeout = null;\n\n this.element.addEventListener('search', (event) => {\n clearTimeout(lookupTimeout);\n\n lookupTimeout = setTimeout(() => {\n choices.clearChoices();\n choices.setChoices(async () => {\n const response = await fetch(\n this.remoteSearchUrlValue + event.detail.value\n );\n const data = await response.json();\n return data;\n }).then(() => {\n event.target.parentNode.querySelector('input').focus();\n });\n }, lookupDelay);\n });\n }\n }\n }\n}\n","import { Controller as i } from \"@hotwired/stimulus\";\nclass t extends i {\n connect() {\n this.hasButtonTarget && (this.originalContent = this.buttonTarget.innerHTML);\n }\n copy(e) {\n e.preventDefault();\n const s = this.sourceTarget.innerHTML || this.sourceTarget.value;\n navigator.clipboard.writeText(s).then(() => this.copied());\n }\n copied() {\n this.hasButtonTarget && (this.timeout && clearTimeout(this.timeout), this.buttonTarget.innerHTML = this.successContentValue, this.timeout = setTimeout(() => {\n this.buttonTarget.innerHTML = this.originalContent;\n }, this.successDurationValue));\n }\n}\nt.targets = [\"button\", \"source\"];\nt.values = {\n successContent: String,\n successDuration: {\n type: Number,\n default: 2e3\n }\n};\nexport {\n t as default\n};\n","import Clipboard from 'stimulus-clipboard';\n\nexport default class extends Clipboard {\n static targets = ['button', 'source'];\n static values = {\n successContent: String,\n successClass: String,\n defaultClass: String,\n successDuration: {\n type: Number,\n default: 2000\n }\n };\n\n connect(e) {\n super.connect(e);\n if (this.hasButtonTarget && this.hasDefaultClassValue) {\n this.buttonTarget.classList.add(this.defaultClassValue);\n }\n }\n\n copy(e) {\n super.copy(e);\n }\n\n copied(e) {\n super.copied(e);\n if (this.hasButtonTarget && this.hasSuccessClassValue && this.hasDefaultClassValue) {\n this.buttonTarget.classList.remove(this.defaultClassValue);\n this.buttonTarget.classList.add(this.successClassValue);\n this.timeoutId = setTimeout(() => {\n this.buttonTarget.classList.remove(this.successClassValue);\n this.buttonTarget.classList.add(this.defaultClassValue);\n }, this.successDurationValue);\n }\n }\n\n disconnect(e) {\n super.disconnect(e);\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n }\n }\n}\n","import { Controller } from '@hotwired/stimulus';\n\nexport default class extends Controller {\n static values = { delay: { type: Number, default: 100 } };\n static targets = ['target', 'template', 'lines', 'number'];\n\n connect() {\n this.setOrdinalNumbers();\n }\n\n disconnect() {\n if (this.removeRuleTid) {\n clearTimeout(this.removeRuleTid);\n }\n }\n\n add(e) {\n e.preventDefault();\n this.targetTarget.insertAdjacentHTML('beforeend', this.templateTarget.innerHTML);\n this.setOrdinalNumbers();\n }\n\n remove(el) {\n el.parentNode.remove();\n this.setOrdinalNumbers();\n }\n\n checkRule(e) {\n const target = e.target;\n\n if (this.linesTargets.length > 1 && target.value == '') {\n this.removeRuleTid = setTimeout(() => {\n this.remove(target);\n delete this.removeRuleTid;\n }, this.delayValue);\n }\n }\n\n setOrdinalNumbers() {\n this.numberTargets.forEach((numberItem, index) => {\n numberItem.innerHTML = `${index + 1}.`;\n });\n }\n}\n","import { Controller } from '@hotwired/stimulus';\n\nexport default class extends Controller {\n static targets = ['parent', 'children'];\n\n connect() {\n this.enableChildren();\n }\n\n enableChildren() {\n this.childrenTargets.forEach((child) => {\n child.disabled = !this.parentTarget.checked;\n if(!this.parentTarget.checked) {\n child.checked = false;\n }\n });\n }\n}\n","import{Controller as t}from\"@hotwired/stimulus\";class s extends t{initialize(){this.hide()}connect(){setTimeout(()=>{this.show()},this.showDelayValue),this.hasDismissAfterValue&&setTimeout(()=>{this.close()},this.dismissAfterValue)}close(){this.hide(),setTimeout(()=>{this.element.remove()},this.removeDelayValue)}show(){this.element.classList.add(...this.showClasses),this.element.classList.remove(...this.hideClasses)}hide(){this.element.classList.add(...this.hideClasses),this.element.classList.remove(...this.showClasses)}}s.values={dismissAfter:Number,showDelay:{type:Number,default:200},removeDelay:{type:Number,default:1100}},s.classes=[\"show\",\"hide\"];class e extends t{connect(){this.timeout=null,this.duration=this.data.get(\"duration\")||1e3}save(){clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.statusTarget.textContent=\"Saving...\",Rails.fire(this.formTarget,\"submit\")},this.duration)}success(){this.setStatus(\"Saved!\")}error(){this.setStatus(\"Unable to save!\")}setStatus(t){this.statusTarget.textContent=t,this.timeout=setTimeout(()=>{this.statusTarget.textContent=\"\"},2e3)}}e.targets=[\"form\",\"status\"];class i extends t{constructor(...t){super(...t),this._onMenuButtonKeydown=t=>{switch(t.keyCode){case 13:case 32:t.preventDefault(),this.toggle()}}}connect(){this.toggleClass=this.data.get(\"class\")||\"hidden\",this.visibleClass=this.data.get(\"visibleClass\")||null,this.invisibleClass=this.data.get(\"invisibleClass\")||null,this.activeClass=this.data.get(\"activeClass\")||null,this.enteringClass=this.data.get(\"enteringClass\")||null,this.leavingClass=this.data.get(\"leavingClass\")||null,this.hasButtonTarget&&this.buttonTarget.addEventListener(\"keydown\",this._onMenuButtonKeydown),this.element.setAttribute(\"aria-haspopup\",\"true\")}disconnect(){this.hasButtonTarget&&this.buttonTarget.removeEventListener(\"keydown\",this._onMenuButtonKeydown)}toggle(){this.openValue=!this.openValue}openValueChanged(){this.openValue?this._show():this._hide()}_show(t){setTimeout((()=>{this.menuTarget.classList.remove(this.toggleClass),this.element.setAttribute(\"aria-expanded\",\"true\"),this._enteringClassList[0].forEach((t=>{this.menuTarget.classList.add(t)}).bind(this)),this._activeClassList[0].forEach(t=>{this.activeTarget.classList.add(t)}),this._invisibleClassList[0].forEach(t=>this.menuTarget.classList.remove(t)),this._visibleClassList[0].forEach(t=>{this.menuTarget.classList.add(t)}),setTimeout((()=>{this._enteringClassList[0].forEach(t=>this.menuTarget.classList.remove(t))}).bind(this),this.enterTimeout[0]),\"function\"==typeof t&&t()}).bind(this))}_hide(t){setTimeout((()=>{this.element.setAttribute(\"aria-expanded\",\"false\"),this._invisibleClassList[0].forEach(t=>this.menuTarget.classList.add(t)),this._visibleClassList[0].forEach(t=>this.menuTarget.classList.remove(t)),this._activeClassList[0].forEach(t=>this.activeTarget.classList.remove(t)),this._leavingClassList[0].forEach(t=>this.menuTarget.classList.add(t)),setTimeout((()=>{this._leavingClassList[0].forEach(t=>this.menuTarget.classList.remove(t)),\"function\"==typeof t&&t(),this.menuTarget.classList.add(this.toggleClass)}).bind(this),this.leaveTimeout[0])}).bind(this))}show(){this.openValue=!0}hide(t){!1===this.element.contains(t.target)&&this.openValue&&(this.openValue=!1)}get activeTarget(){return this.data.has(\"activeTarget\")?document.querySelector(this.data.get(\"activeTarget\")):this.element}get _activeClassList(){return this.activeClass?this.activeClass.split(\",\").map(t=>t.split(\" \")):[[],[]]}get _visibleClassList(){return this.visibleClass?this.visibleClass.split(\",\").map(t=>t.split(\" \")):[[],[]]}get _invisibleClassList(){return this.invisibleClass?this.invisibleClass.split(\",\").map(t=>t.split(\" \")):[[],[]]}get _enteringClassList(){return this.enteringClass?this.enteringClass.split(\",\").map(t=>t.split(\" \")):[[],[]]}get _leavingClassList(){return this.leavingClass?this.leavingClass.split(\",\").map(t=>t.split(\" \")):[[],[]]}get enterTimeout(){return(this.data.get(\"enterTimeout\")||\"0,0\").split(\",\").map(t=>parseInt(t))}get leaveTimeout(){return(this.data.get(\"leaveTimeout\")||\"0,0\").split(\",\").map(t=>parseInt(t))}}i.targets=[\"menu\",\"button\"],i.values={open:Boolean};class a extends t{connect(){this.toggleClass=this.data.get(\"class\")||\"hidden\",this.backgroundId=this.data.get(\"backgroundId\")||\"modal-background\",this.backgroundHtml=this.data.get(\"backgroundHtml\")||this._backgroundHTML(),this.allowBackgroundClose=\"true\"===(this.data.get(\"allowBackgroundClose\")||\"true\"),this.preventDefaultActionOpening=\"true\"===(this.data.get(\"preventDefaultActionOpening\")||\"true\"),this.preventDefaultActionClosing=\"true\"===(this.data.get(\"preventDefaultActionClosing\")||\"true\")}disconnect(){this.close()}open(t){this.preventDefaultActionOpening&&t.preventDefault(),t.target.blur&&t.target.blur(),this.lockScroll(),this.containerTarget.classList.remove(this.toggleClass),this.data.get(\"disable-backdrop\")||(document.body.insertAdjacentHTML(\"beforeend\",this.backgroundHtml),this.background=document.querySelector(`#${this.backgroundId}`))}close(t){t&&this.preventDefaultActionClosing&&t.preventDefault(),this.unlockScroll(),this.containerTarget.classList.add(this.toggleClass),this.background&&this.background.remove()}closeBackground(t){this.allowBackgroundClose&&t.target===this.containerTarget&&this.close(t)}closeWithKeyboard(t){27!==t.keyCode||this.containerTarget.classList.contains(this.toggleClass)||this.close(t)}_backgroundHTML(){return`
`}lockScroll(){const t=window.innerWidth-document.documentElement.clientWidth;document.body.style.paddingRight=`${t}px`,this.saveScrollPosition(),document.body.classList.add(\"fixed\",\"inset-x-0\",\"overflow-hidden\"),document.body.style.top=`-${this.scrollPosition}px`}unlockScroll(){document.body.style.paddingRight=null,document.body.classList.remove(\"fixed\",\"inset-x-0\",\"overflow-hidden\"),this.restoreScrollValue&&this.restoreScrollPosition(),document.body.style.top=null}saveScrollPosition(){this.scrollPosition=window.pageYOffset||document.body.scrollTop}restoreScrollPosition(){void 0!==this.scrollPosition&&(document.documentElement.scrollTop=this.scrollPosition)}}a.targets=[\"container\"],a.values={backdropColor:{type:String,default:\"rgba(0, 0, 0, 0.8)\"},restoreScroll:{type:Boolean,default:!0}};class l extends t{connect(){this.activeTabClasses=(this.data.get(\"activeTab\")||\"active\").split(\" \"),this.inactiveTabClasses=(this.data.get(\"inactiveTab\")||\"inactive\").split(\" \"),this.anchor&&(this.index=this.tabTargets.findIndex(t=>t.id===this.anchor)),this.showTab()}change(t){t.preventDefault(),this.index=t.currentTarget.dataset.index?t.currentTarget.dataset.index:t.currentTarget.dataset.id?this.tabTargets.findIndex(s=>s.id==t.currentTarget.dataset.id):this.tabTargets.indexOf(t.currentTarget),window.dispatchEvent(new CustomEvent(\"tsc:tab-change\"))}showTab(){this.tabTargets.forEach((t,s)=>{const e=this.panelTargets[s];s===this.index?(e.classList.remove(\"hidden\"),t.classList.remove(...this.inactiveTabClasses),t.classList.add(...this.activeTabClasses),t.id&&(location.hash=t.id)):(e.classList.add(\"hidden\"),t.classList.remove(...this.activeTabClasses),t.classList.add(...this.inactiveTabClasses))})}get index(){return parseInt(this.data.get(\"index\")||0)}set index(t){this.data.set(\"index\",t>=0?t:0),this.showTab()}get anchor(){return document.URL.split(\"#\").length>1?document.URL.split(\"#\")[1]:null}}l.targets=[\"tab\",\"panel\"];class o extends t{connect(){this.toggleClass=this.data.get(\"class\")||\"hidden\"}toggle(t){t.preventDefault(),this.openValue=!this.openValue}hide(t){t.preventDefault(),this.openValue=!1}show(t){t.preventDefault(),this.openValue=!0}openValueChanged(){this.toggleClass&&this.toggleableTargets.forEach(t=>{t.classList.toggle(this.toggleClass)})}}o.targets=[\"toggleable\"],o.values={open:Boolean};class n extends t{initialize(){this.contentTarget.setAttribute(\"style\",`transform:translate(${this.data.get(\"translateX\")}, ${this.data.get(\"translateY\")});`)}mouseOver(){this.contentTarget.classList.remove(\"hidden\")}mouseOut(){this.contentTarget.classList.add(\"hidden\")}toggle(){this.contentTarget.classList.contains(\"hidden\")?this.contentTarget.classList.remove(\"hidden\"):this.contentTarget.classList.add(\"hidden\")}}n.targets=[\"content\"];class r extends i{_show(){this.overlayTarget.classList.remove(this.toggleClass),super._show((()=>{this._activeClassList[1].forEach(t=>this.overlayTarget.classList.add(t)),this._invisibleClassList[1].forEach(t=>this.overlayTarget.classList.remove(t)),this._visibleClassList[1].forEach(t=>this.overlayTarget.classList.add(t)),setTimeout((()=>{this._enteringClassList[1].forEach(t=>this.overlayTarget.classList.remove(t))}).bind(this),this.enterTimeout[1])}).bind(this))}_hide(){this._leavingClassList[1].forEach(t=>this.overlayTarget.classList.add(t)),super._hide((()=>{setTimeout((()=>{this._visibleClassList[1].forEach(t=>this.overlayTarget.classList.remove(t)),this._invisibleClassList[1].forEach(t=>this.overlayTarget.classList.add(t)),this._activeClassList[1].forEach(t=>this.overlayTarget.classList.remove(t)),this._leavingClassList[1].forEach(t=>this.overlayTarget.classList.remove(t)),this.overlayTarget.classList.add(this.toggleClass)}).bind(this),this.leaveTimeout[1])}).bind(this))}}r.targets=[\"menu\",\"overlay\"];class h extends t{connect(){this.styleProperty=this.data.get(\"style\")||\"backgroundColor\"}update(){this.preview=this.color}set preview(t){this.previewTarget.style[this.styleProperty]=t;const s=this._getContrastYIQ(t);\"color\"===this.styleProperty?this.previewTarget.style.backgroundColor=s:this.previewTarget.style.color=s}get color(){return this.colorTarget.value}_getContrastYIQ(t){return t=t.replace(\"#\",\"\"),(299*parseInt(t.substr(0,2),16)+587*parseInt(t.substr(2,2),16)+114*parseInt(t.substr(4,2),16))/1e3>=128?\"#000\":\"#fff\"}}h.targets=[\"preview\",\"color\"];export{s as Alert,e as Autosave,h as ColorPreview,i as Dropdown,a as Modal,n as Popover,r as Slideover,l as Tabs,o as Toggle};\n//# sourceMappingURL=tailwindcss-stimulus-components.modern.js.map\n","import { Modal } from 'tailwindcss-stimulus-components';\n\nexport default class extends Modal {\n static targets = ['turboFrame', 'autofocus'];\n\n close() {\n super.close();\n\n if (this.hasTurboFrameTarget) {\n this.turboFrameTarget.src = null;\n this.turboFrameTarget.innerHTML = '';\n }\n }\n\n open(e) {\n super.open(e);\n\n if (this.hasAutofocusTarget) {\n const len = this.autofocusTarget.value.length;\n this.autofocusTarget.focus();\n this.autofocusTarget.setSelectionRange(len, len);\n }\n }\n\n escClose(event) {\n if (event.key === 'Escape') this.close();\n }\n}\n","/**! \n * hotkeys-js v3.12.0 \n * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. \n * \n * Copyright (c) 2023 kenny wong \n * https://jaywcjlove.github.io/hotkeys-js \n * Licensed under the MIT license \n */\n\nvar isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false;\n\n// 绑定事件\nfunction addEvent(object, event, method, useCapture) {\n if (object.addEventListener) {\n object.addEventListener(event, method, useCapture);\n } else if (object.attachEvent) {\n object.attachEvent(\"on\".concat(event), function () {\n method(window.event);\n });\n }\n}\n\n// 修饰键转换成对应的键码\nfunction getMods(modifier, key) {\n var mods = key.slice(0, key.length - 1);\n for (var i = 0; i < mods.length; i++) mods[i] = modifier[mods[i].toLowerCase()];\n return mods;\n}\n\n// 处理传的key字符串转换成数组\nfunction getKeys(key) {\n if (typeof key !== 'string') key = '';\n key = key.replace(/\\s/g, ''); // 匹配任何空白字符,包括空格、制表符、换页符等等\n var keys = key.split(','); // 同时设置多个快捷键,以','分割\n var index = keys.lastIndexOf('');\n\n // 快捷键可能包含',',需特殊处理\n for (; index >= 0;) {\n keys[index - 1] += ',';\n keys.splice(index, 1);\n index = keys.lastIndexOf('');\n }\n return keys;\n}\n\n// 比较修饰键的数组\nfunction compareArray(a1, a2) {\n var arr1 = a1.length >= a2.length ? a1 : a2;\n var arr2 = a1.length >= a2.length ? a2 : a1;\n var isIndex = true;\n for (var i = 0; i < arr1.length; i++) {\n if (arr2.indexOf(arr1[i]) === -1) isIndex = false;\n }\n return isIndex;\n}\n\n// Special Keys\nvar _keyMap = {\n backspace: 8,\n '⌫': 8,\n tab: 9,\n clear: 12,\n enter: 13,\n '↩': 13,\n return: 13,\n esc: 27,\n escape: 27,\n space: 32,\n left: 37,\n up: 38,\n right: 39,\n down: 40,\n del: 46,\n delete: 46,\n ins: 45,\n insert: 45,\n home: 36,\n end: 35,\n pageup: 33,\n pagedown: 34,\n capslock: 20,\n num_0: 96,\n num_1: 97,\n num_2: 98,\n num_3: 99,\n num_4: 100,\n num_5: 101,\n num_6: 102,\n num_7: 103,\n num_8: 104,\n num_9: 105,\n num_multiply: 106,\n num_add: 107,\n num_enter: 108,\n num_subtract: 109,\n num_decimal: 110,\n num_divide: 111,\n '⇪': 20,\n ',': 188,\n '.': 190,\n '/': 191,\n '`': 192,\n '-': isff ? 173 : 189,\n '=': isff ? 61 : 187,\n ';': isff ? 59 : 186,\n '\\'': 222,\n '[': 219,\n ']': 221,\n '\\\\': 220\n};\n\n// Modifier Keys\nvar _modifier = {\n // shiftKey\n '⇧': 16,\n shift: 16,\n // altKey\n '⌥': 18,\n alt: 18,\n option: 18,\n // ctrlKey\n '⌃': 17,\n ctrl: 17,\n control: 17,\n // metaKey\n '⌘': 91,\n cmd: 91,\n command: 91\n};\nvar modifierMap = {\n 16: 'shiftKey',\n 18: 'altKey',\n 17: 'ctrlKey',\n 91: 'metaKey',\n shiftKey: 16,\n ctrlKey: 17,\n altKey: 18,\n metaKey: 91\n};\nvar _mods = {\n 16: false,\n 18: false,\n 17: false,\n 91: false\n};\nvar _handlers = {};\n\n// F1~F12 special key\nfor (var k = 1; k < 20; k++) {\n _keyMap[\"f\".concat(k)] = 111 + k;\n}\n\nvar _downKeys = []; // 记录摁下的绑定键\nvar winListendFocus = false; // window是否已经监听了focus事件\nvar _scope = 'all'; // 默认热键范围\nvar elementHasBindEvent = []; // 已绑定事件的节点记录\n\n// 返回键码\nvar code = function code(x) {\n return _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);\n};\nvar getKey = function getKey(x) {\n return Object.keys(_keyMap).find(function (k) {\n return _keyMap[k] === x;\n });\n};\nvar getModifier = function getModifier(x) {\n return Object.keys(_modifier).find(function (k) {\n return _modifier[k] === x;\n });\n};\n\n// 设置获取当前范围(默认为'所有')\nfunction setScope(scope) {\n _scope = scope || 'all';\n}\n// 获取当前范围\nfunction getScope() {\n return _scope || 'all';\n}\n// 获取摁下绑定键的键值\nfunction getPressedKeyCodes() {\n return _downKeys.slice(0);\n}\nfunction getPressedKeyString() {\n return _downKeys.map(function (c) {\n return getKey(c) || getModifier(c) || String.fromCharCode(c);\n });\n}\nfunction getAllKeyCodes() {\n var result = [];\n Object.keys(_handlers).forEach(function (k) {\n _handlers[k].forEach(function (_ref) {\n var key = _ref.key,\n scope = _ref.scope,\n mods = _ref.mods,\n shortcut = _ref.shortcut;\n result.push({\n scope: scope,\n shortcut: shortcut,\n mods: mods,\n keys: key.split('+').map(function (v) {\n return code(v);\n })\n });\n });\n });\n return result;\n}\n\n// 表单控件控件判断 返回 Boolean\n// hotkey is effective only when filter return true\nfunction filter(event) {\n var target = event.target || event.srcElement;\n var tagName = target.tagName;\n var flag = true;\n // ignore: isContentEditable === 'true', and