{ "version": 3, "sources": ["../../../node_modules/.pnpm/@rails+actioncable@7.2.201/node_modules/@rails/actioncable/src/adapters.js", "../../../node_modules/.pnpm/@rails+actioncable@7.2.201/node_modules/@rails/actioncable/src/logger.js", "../../../node_modules/.pnpm/@rails+actioncable@7.2.201/node_modules/@rails/actioncable/src/connection_monitor.js", "../../../node_modules/.pnpm/@rails+actioncable@7.2.201/node_modules/@rails/actioncable/src/internal.js", "../../../node_modules/.pnpm/@rails+actioncable@7.2.201/node_modules/@rails/actioncable/src/connection.js", "../../../node_modules/.pnpm/@rails+actioncable@7.2.201/node_modules/@rails/actioncable/src/subscription.js", "../../../node_modules/.pnpm/@rails+actioncable@7.2.201/node_modules/@rails/actioncable/src/subscription_guarantor.js", "../../../node_modules/.pnpm/@rails+actioncable@7.2.201/node_modules/@rails/actioncable/src/subscriptions.js", "../../../node_modules/.pnpm/@rails+actioncable@7.2.201/node_modules/@rails/actioncable/src/consumer.js", "../../../node_modules/.pnpm/@rails+actioncable@7.2.201/node_modules/@rails/actioncable/src/index.js", "../../../node_modules/.pnpm/sweetalert2@11.4.8/node_modules/sweetalert2/dist/sweetalert2.js", "../../../node_modules/.pnpm/bs-custom-file-input@1.3.4/node_modules/bs-custom-file-input/src/selector.js", "../../../node_modules/.pnpm/bs-custom-file-input@1.3.4/node_modules/bs-custom-file-input/src/util.js", "../../../node_modules/.pnpm/bs-custom-file-input@1.3.4/node_modules/bs-custom-file-input/src/eventHandlers.js", "../../../node_modules/.pnpm/bs-custom-file-input@1.3.4/node_modules/bs-custom-file-input/src/index.js", "../../../node_modules/.pnpm/choices.js@11.0.3/node_modules/choices.js/public/assets/scripts/choices.mjs", "../../../node_modules/.pnpm/lodash.debounce@4.0.8/node_modules/lodash.debounce/index.js", "../../../node_modules/.pnpm/humps@2.0.1/node_modules/humps/humps.js", "../../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js", "../../../node_modules/.pnpm/pdfobject@2.3.0/node_modules/pdfobject/pdfobject.js", "../../../node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.js", "../../../node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js", "../../../node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.js", "../../../node_modules/.pnpm/@hotwired+turbo@8.0.12/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js", "../../../node_modules/.pnpm/@hotwired+turbo-rails@8.0.12/node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js", "../../../node_modules/.pnpm/@hotwired+turbo-rails@8.0.12/node_modules/@hotwired/turbo-rails/app/javascript/turbo/snakeize.js", "../../../node_modules/.pnpm/@hotwired+turbo-rails@8.0.12/node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js", "../../../node_modules/.pnpm/@hotwired+turbo-rails@8.0.12/node_modules/@hotwired/turbo-rails/app/javascript/turbo/fetch_requests.js", "../../../node_modules/.pnpm/@hotwired+turbo-rails@8.0.12/node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js", "../../../node_modules/.pnpm/@hotwired+stimulus@3.2.2/node_modules/@hotwired/stimulus/dist/stimulus.js", "../../../node_modules/.pnpm/@rails+activestorage@7.2.201/node_modules/@rails/activestorage/app/assets/javascripts/activestorage.esm.js", "../../../node_modules/.pnpm/@rails+actiontext@8.0.200_trix@2.1.12/node_modules/@rails/actiontext/app/assets/javascripts/actiontext.esm.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/index.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/enums.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getWindow.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/applyStyles.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getBasePlacement.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/math.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/userAgent.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/contains.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/within.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/expandToHashMap.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/arrow.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getVariation.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/computeStyles.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/eventListeners.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/rectToClientRect.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/computeOffsets.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/detectOverflow.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/flip.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/hide.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/offset.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/getAltAxis.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/orderModifiers.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/debounce.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/utils/mergeByName.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/createPopper.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/popper-lite.js", "../../../node_modules/.pnpm/@popperjs+core@2.11.8/node_modules/@popperjs/core/lib/popper.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/dom/data.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/util/index.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/dom/event-handler.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/dom/manipulator.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/util/config.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/base-component.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/dom/selector-engine.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/util/component-functions.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/alert.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/button.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/util/swipe.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/carousel.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/collapse.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/dropdown.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/util/backdrop.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/util/focustrap.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/util/scrollbar.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/modal.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/offcanvas.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/util/sanitizer.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/util/template-factory.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/tooltip.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/popover.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/scrollspy.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/tab.js", "../../../node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/js/src/toast.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/attachments.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/block_attributes.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/browser.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/dompurify.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/lang.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/file_size_formatting.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/constants.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/extend.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/dom.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/input.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/key_names.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/parser.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/text_attributes.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/toolbar.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/undo.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/config/css.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/basic_object.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/utilities/utf16_string.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/object.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/arrays.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/bidi.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/config.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/custom_elements.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/events.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/functions.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/objects.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/ranges.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/observers/selection_change_observer.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/helpers/strings.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/collections/hash.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/collections/object_group.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/collections/object_map.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/collections/element_store.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/utilities/operation.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/views/object_view.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/html_sanitizer.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/views/attachment_view.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/views/previewable_attachment_view.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/views/piece_view.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/views/text_view.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/views/block_view.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/views/document_view.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/piece.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/operations/image_preload_operation.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/attachment.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/attachment_piece.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/string_piece.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/splittable_list.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/text.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/block.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/document.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/html_parser.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/core/serialization.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/managed_attachment.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/attachment_manager.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/line_break_insertion.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/composition.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/undo_manager.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/filters/filter.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/filters/attachment_gallery_filter.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/editor.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/location_mapper.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/point_mapper.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/selection_manager.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/controllers/attachment_editor_controller.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/controllers/composition_controller.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/controllers/controller.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/observers/mutation_observer.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/operations/file_verification_operation.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/models/flaky_android_keyboard_detector.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/controllers/input_controller.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/controllers/level_0_input_controller.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/controllers/level_2_input_controller.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/controllers/toolbar_controller.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/controllers/editor_controller.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/elements/trix_toolbar_element.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/elements/trix_editor_element.js", "../../../node_modules/.pnpm/trix@2.1.12/node_modules/trix/src/trix/trix.js", "../../../node_modules/.pnpm/ahoy.js@0.4.4/node_modules/ahoy.js/dist/ahoy.esm.js", "../../javascript/controllers/application.js", "../../javascript/controllers/carousel_controller.js", "../../../node_modules/.pnpm/@kurkle+color@0.3.4/node_modules/@kurkle/color/dist/color.esm.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.core.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.math.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.collection.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.extras.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.easing.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.color.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.animations.defaults.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.layouts.defaults.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.intl.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.ticks.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.scale.defaults.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.defaults.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.canvas.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.options.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.config.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.curve.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.dom.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.interpolation.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.rtl.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/helpers/helpers.segment.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.animator.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.animation.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.animations.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.datasetController.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/controllers/controller.bar.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/controllers/controller.bubble.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/controllers/controller.doughnut.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/controllers/controller.line.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/controllers/controller.polarArea.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/controllers/controller.pie.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/controllers/controller.radar.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/controllers/controller.scatter.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.adapters.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.interaction.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.layouts.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/platform/platform.base.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/platform/platform.basic.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/platform/platform.dom.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/platform/index.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.element.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.scale.autoskip.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.scale.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.typedRegistry.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.registry.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.plugins.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.config.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/core/core.controller.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/elements/element.arc.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/elements/element.line.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/elements/element.point.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/elements/element.bar.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.colors.ts", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.decimation.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.filler/filler.segment.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.filler/filler.helper.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.filler/filler.options.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.filler/filler.target.stack.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.filler/simpleArc.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.filler/filler.target.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.filler/filler.drawing.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.filler/index.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.legend.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.title.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.subtitle.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/plugins/plugin.tooltip.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/scales/scale.category.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/scales/scale.linearbase.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/scales/scale.linear.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/scales/scale.logarithmic.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/scales/scale.radialLinear.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/scales/scale.time.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/scales/scale.timeseries.js", "../../../node_modules/.pnpm/chart.js@4.4.7/node_modules/chart.js/src/index.ts", "../../javascript/controllers/charts_controller.js", "../../javascript/controllers/check_all_controller.js", "../../../node_modules/.pnpm/@stimulus-components+clipboard@5.0.0_@hotwired+stimulus@3.2.2/node_modules/@stimulus-components/clipboard/dist/stimulus-clipboard.mjs", "../../javascript/controllers/clipboard_controller.js", "../../javascript/controllers/confirm_controller.js", "../../javascript/controllers/content_block_controller.js", "../../../node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs", "../../javascript/controllers/cookie_notice_controller.js", "../../javascript/controllers/custom_file_controller.js", "../../javascript/controllers/disable_controller.js", "../../javascript/controllers/disable_on_check_controller.js", "../../javascript/controllers/dropdown_ajax_controller.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/bind.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/utils.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/core/AxiosError.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/null.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/toFormData.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/AxiosURLSearchParams.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/buildURL.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/core/InterceptorManager.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/defaults/transitional.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/platform/browser/classes/FormData.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/platform/browser/classes/Blob.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/platform/browser/index.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/platform/common/utils.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/platform/index.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/toURLEncodedForm.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/formDataToJSON.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/defaults/index.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/parseHeaders.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/core/AxiosHeaders.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/core/transformData.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/cancel/isCancel.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/cancel/CanceledError.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/core/settle.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/parseProtocol.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/speedometer.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/throttle.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/progressEventReducer.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/isURLSameOrigin.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/cookies.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/isAbsoluteURL.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/combineURLs.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/core/buildFullPath.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/core/mergeConfig.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/resolveConfig.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/adapters/xhr.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/composeSignals.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/trackStream.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/adapters/fetch.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/adapters/adapters.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/core/dispatchRequest.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/env/data.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/validator.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/core/Axios.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/cancel/CancelToken.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/spread.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/isAxiosError.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/helpers/HttpStatusCode.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/lib/axios.js", "../../../node_modules/.pnpm/axios@1.8.2/node_modules/axios/index.js", "../../javascript/api/axios.js", "../../javascript/utils/meta.js", "../../javascript/utils/toQueryString.js", "../../../node_modules/.pnpm/@rails+request.js@0.0.11/node_modules/@rails/request.js/src/fetch_response.js", "../../../node_modules/.pnpm/@rails+request.js@0.0.11/node_modules/@rails/request.js/src/request_interceptor.js", "../../../node_modules/.pnpm/@rails+request.js@0.0.11/node_modules/@rails/request.js/src/lib/utils.js", "../../../node_modules/.pnpm/@rails+request.js@0.0.11/node_modules/@rails/request.js/src/fetch_request.js", "../../../node_modules/.pnpm/@rails+request.js@0.0.11/node_modules/@rails/request.js/src/verbs.js", "../../../node_modules/.pnpm/@vimeo+player@2.25.1/node_modules/@vimeo/player/dist/player.es.js", "../../javascript/controllers/embed_iframe_controller.js", "../../javascript/controllers/embedded_contact_select_controller.js", "../../javascript/controllers/fill_in_company_controller.js", "../../javascript/controllers/fixed_footer_controller.js", "../../javascript/controllers/focus_controller.js", "../../javascript/controllers/form_controller.js", "../../javascript/controllers/group_contact_controller.js", "../../javascript/controllers/group_duration_controller.js", "../../javascript/controllers/group_form_controller.js", "../../javascript/controllers/group_package_controller.js", "../../javascript/controllers/infinite_scroll_controller.js", "../../javascript/controllers/inplace_editing_controller.js", "../../javascript/api/invoices.js", "../../javascript/controllers/invoices_controller.js", "../../javascript/controllers/lazy_modal_controller.js", "../../javascript/controllers/max_members_count_to_package_controller.js", "../../javascript/controllers/max_members_to_group_package_controller.js", "../../javascript/controllers/modal_controller.js", "../../javascript/controllers/multi_select_controller.js", "../../../node_modules/.pnpm/@github+combobox-nav@3.0.1/node_modules/@github/combobox-nav/dist/index.js", "../../javascript/controllers/navsearch_controller.js", "../../javascript/controllers/nested_form_controller.js", "../../javascript/controllers/onboarding_company_controller.js", "../../javascript/controllers/order_controller.js", "../../../node_modules/.pnpm/@stimulus-components+password-visibility@3.0.0_@hotwired+stimulus@3.2.2/node_modules/@stimulus-components/password-visibility/dist/stimulus-password-visibility.mjs", "../../javascript/controllers/password_visibility_controller.js", "../../javascript/controllers/pdf_object_controller.js", "../../javascript/controllers/piechart_controller.js", "../../javascript/api/regions.js", "../../javascript/controllers/places_controller.js", "../../javascript/controllers/popover_controller.js", "../../javascript/controllers/region_controller.js", "../../javascript/controllers/reload_controller.js", "../../javascript/controllers/remote_search_controller.js", "../../javascript/controllers/remote_search_material_controller.js", "../../javascript/controllers/reset_form_controller.js", "../../javascript/controllers/search_controller.js", "../../../node_modules/.pnpm/sortablejs@1.15.6/node_modules/sortablejs/modular/sortable.esm.js", "../../javascript/controllers/sortable_controller.js", "../../javascript/controllers/submit_button_label_controller.js", "../../javascript/controllers/submit_on_change_controller.js", "../../javascript/controllers/subnav_controller.js", "../../javascript/controllers/subscriptions_controller.js", "../../javascript/controllers/teaser_controller.js", "../../javascript/controllers/toggle_controller.js", "../../javascript/controllers/toggle_on_check_controller.js", "../../javascript/controllers/tooltip_controller.js", "../../javascript/controllers/update_license_price_controller.js", "../../javascript/controllers/video_controller.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/error.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/logger.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/noopUrlStorage.js", "../../../node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.mjs", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/upload.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/uuid.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/isReactNative.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/uriToBlob.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/sources/isCordova.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/sources/readAsByteArray.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/sources/FileSource.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/sources/StreamSource.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/fileReader.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/fileSignature.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/httpStack.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/urlStorage.js", "../../../node_modules/.pnpm/tus-js-client@4.3.1/node_modules/tus-js-client/lib.esm/browser/index.js", "../../javascript/api/video.js", "../../javascript/controllers/vimeo_controller.js", "../../javascript/controllers/word_count_controller.js", "../../javascript/controllers/index.js", "../../javascript/behaviors/LessonSidebar.js", "../../javascript/behaviors/index.js", "../../javascript/utils/confirmDialog.js", "../../javascript/application.js"], "sourcesContent": ["export default {\n logger: typeof console !== \"undefined\" ? console : undefined,\n WebSocket: typeof WebSocket !== \"undefined\" ? WebSocket : undefined,\n}\n", "import adapters from \"./adapters\"\n\n// The logger is disabled by default. You can enable it with:\n//\n// ActionCable.logger.enabled = true\n//\n// Example:\n//\n// import * as ActionCable from '@rails/actioncable'\n//\n// ActionCable.logger.enabled = true\n// ActionCable.logger.log('Connection Established.')\n//\n\nexport default {\n log(...messages) {\n if (this.enabled) {\n messages.push(Date.now())\n adapters.logger.log(\"[ActionCable]\", ...messages)\n }\n },\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring the cable connection is in good health by validating the heartbeat pings sent from the server, and attempting\n// revival reconnections if things go astray. Internal class, not intended for direct user manipulation.\n\nconst now = () => new Date().getTime()\n\nconst secondsSince = time => (now() - time) / 1000\n\nclass ConnectionMonitor {\n constructor(connection) {\n this.visibilityDidChange = this.visibilityDidChange.bind(this)\n this.connection = connection\n this.reconnectAttempts = 0\n }\n\n start() {\n if (!this.isRunning()) {\n this.startedAt = now()\n delete this.stoppedAt\n this.startPolling()\n addEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`)\n }\n }\n\n stop() {\n if (this.isRunning()) {\n this.stoppedAt = now()\n this.stopPolling()\n removeEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(\"ConnectionMonitor stopped\")\n }\n }\n\n isRunning() {\n return this.startedAt && !this.stoppedAt\n }\n\n recordMessage() {\n this.pingedAt = now()\n }\n\n recordConnect() {\n this.reconnectAttempts = 0\n delete this.disconnectedAt\n logger.log(\"ConnectionMonitor recorded connect\")\n }\n\n recordDisconnect() {\n this.disconnectedAt = now()\n logger.log(\"ConnectionMonitor recorded disconnect\")\n }\n\n // Private\n\n startPolling() {\n this.stopPolling()\n this.poll()\n }\n\n stopPolling() {\n clearTimeout(this.pollTimeout)\n }\n\n poll() {\n this.pollTimeout = setTimeout(() => {\n this.reconnectIfStale()\n this.poll()\n }\n , this.getPollInterval())\n }\n\n getPollInterval() {\n const { staleThreshold, reconnectionBackoffRate } = this.constructor\n const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10))\n const jitterMax = this.reconnectAttempts === 0 ? 1.0 : reconnectionBackoffRate\n const jitter = jitterMax * Math.random()\n return staleThreshold * 1000 * backoff * (1 + jitter)\n }\n\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`)\n this.reconnectAttempts++\n if (this.disconnectedRecently()) {\n logger.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`)\n } else {\n logger.log(\"ConnectionMonitor reopening\")\n this.connection.reopen()\n }\n }\n }\n\n get refreshedAt() {\n return this.pingedAt ? this.pingedAt : this.startedAt\n }\n\n connectionIsStale() {\n return secondsSince(this.refreshedAt) > this.constructor.staleThreshold\n }\n\n disconnectedRecently() {\n return this.disconnectedAt && (secondsSince(this.disconnectedAt) < this.constructor.staleThreshold)\n }\n\n visibilityDidChange() {\n if (document.visibilityState === \"visible\") {\n setTimeout(() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`)\n this.connection.reopen()\n }\n }\n , 200)\n }\n }\n\n}\n\nConnectionMonitor.staleThreshold = 6 // Server::Connections::BEAT_INTERVAL * 2 (missed two pings)\nConnectionMonitor.reconnectionBackoffRate = 0.15\n\nexport default ConnectionMonitor\n", "export default {\n \"message_types\": {\n \"welcome\": \"welcome\",\n \"disconnect\": \"disconnect\",\n \"ping\": \"ping\",\n \"confirmation\": \"confirm_subscription\",\n \"rejection\": \"reject_subscription\"\n },\n \"disconnect_reasons\": {\n \"unauthorized\": \"unauthorized\",\n \"invalid_request\": \"invalid_request\",\n \"server_restart\": \"server_restart\",\n \"remote\": \"remote\"\n },\n \"default_mount_path\": \"/cable\",\n \"protocols\": [\n \"actioncable-v1-json\",\n \"actioncable-unsupported\"\n ]\n}\n", "import adapters from \"./adapters\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport INTERNAL from \"./internal\"\nimport logger from \"./logger\"\n\n// Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.\n\nconst {message_types, protocols} = INTERNAL\nconst supportedProtocols = protocols.slice(0, protocols.length - 1)\n\nconst indexOf = [].indexOf\n\nclass Connection {\n constructor(consumer) {\n this.open = this.open.bind(this)\n this.consumer = consumer\n this.subscriptions = this.consumer.subscriptions\n this.monitor = new ConnectionMonitor(this)\n this.disconnected = true\n }\n\n send(data) {\n if (this.isOpen()) {\n this.webSocket.send(JSON.stringify(data))\n return true\n } else {\n return false\n }\n }\n\n open() {\n if (this.isActive()) {\n logger.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`)\n return false\n } else {\n const socketProtocols = [...protocols, ...this.consumer.subprotocols || []]\n logger.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${socketProtocols}`)\n if (this.webSocket) { this.uninstallEventHandlers() }\n this.webSocket = new adapters.WebSocket(this.consumer.url, socketProtocols)\n this.installEventHandlers()\n this.monitor.start()\n return true\n }\n }\n\n close({allowReconnect} = {allowReconnect: true}) {\n if (!allowReconnect) { this.monitor.stop() }\n // Avoid closing websockets in a \"connecting\" state due to Safari 15.1+ bug. See: https://github.com/rails/rails/issues/43835#issuecomment-1002288478\n if (this.isOpen()) {\n return this.webSocket.close()\n }\n }\n\n reopen() {\n logger.log(`Reopening WebSocket, current state is ${this.getState()}`)\n if (this.isActive()) {\n try {\n return this.close()\n } catch (error) {\n logger.log(\"Failed to reopen WebSocket\", error)\n }\n finally {\n logger.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`)\n setTimeout(this.open, this.constructor.reopenDelay)\n }\n } else {\n return this.open()\n }\n }\n\n getProtocol() {\n if (this.webSocket) {\n return this.webSocket.protocol\n }\n }\n\n isOpen() {\n return this.isState(\"open\")\n }\n\n isActive() {\n return this.isState(\"open\", \"connecting\")\n }\n\n triedToReconnect() {\n return this.monitor.reconnectAttempts > 0\n }\n\n // Private\n\n isProtocolSupported() {\n return indexOf.call(supportedProtocols, this.getProtocol()) >= 0\n }\n\n isState(...states) {\n return indexOf.call(states, this.getState()) >= 0\n }\n\n getState() {\n if (this.webSocket) {\n for (let state in adapters.WebSocket) {\n if (adapters.WebSocket[state] === this.webSocket.readyState) {\n return state.toLowerCase()\n }\n }\n }\n return null\n }\n\n installEventHandlers() {\n for (let eventName in this.events) {\n const handler = this.events[eventName].bind(this)\n this.webSocket[`on${eventName}`] = handler\n }\n }\n\n uninstallEventHandlers() {\n for (let eventName in this.events) {\n this.webSocket[`on${eventName}`] = function() {}\n }\n }\n\n}\n\nConnection.reopenDelay = 500\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) { return }\n const {identifier, message, reason, reconnect, type} = JSON.parse(event.data)\n this.monitor.recordMessage()\n switch (type) {\n case message_types.welcome:\n if (this.triedToReconnect()) {\n this.reconnectAttempted = true\n }\n this.monitor.recordConnect()\n return this.subscriptions.reload()\n case message_types.disconnect:\n logger.log(`Disconnecting. Reason: ${reason}`)\n return this.close({allowReconnect: reconnect})\n case message_types.ping:\n return null\n case message_types.confirmation:\n this.subscriptions.confirmSubscription(identifier)\n if (this.reconnectAttempted) {\n this.reconnectAttempted = false\n return this.subscriptions.notify(identifier, \"connected\", {reconnected: true})\n } else {\n return this.subscriptions.notify(identifier, \"connected\", {reconnected: false})\n }\n case message_types.rejection:\n return this.subscriptions.reject(identifier)\n default:\n return this.subscriptions.notify(identifier, \"received\", message)\n }\n },\n\n open() {\n logger.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`)\n this.disconnected = false\n if (!this.isProtocolSupported()) {\n logger.log(\"Protocol is unsupported. Stopping monitor and disconnecting.\")\n return this.close({allowReconnect: false})\n }\n },\n\n close(event) {\n logger.log(\"WebSocket onclose event\")\n if (this.disconnected) { return }\n this.disconnected = true\n this.monitor.recordDisconnect()\n return this.subscriptions.notifyAll(\"disconnected\", {willAttemptReconnect: this.monitor.isRunning()})\n },\n\n error() {\n logger.log(\"WebSocket onerror event\")\n }\n}\n\nexport default Connection\n", "// A new subscription is created through the ActionCable.Subscriptions instance available on the consumer.\n// It provides a number of callbacks and a method for calling remote procedure calls on the corresponding\n// Channel instance on the server side.\n//\n// An example demonstrates the basic functionality:\n//\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\", {\n// connected() {\n// // Called once the subscription has been successfully completed\n// },\n//\n// disconnected({ willAttemptReconnect: boolean }) {\n// // Called when the client has disconnected with the server.\n// // The object will have an `willAttemptReconnect` property which\n// // says whether the client has the intention of attempting\n// // to reconnect.\n// },\n//\n// appear() {\n// this.perform('appear', {appearing_on: this.appearingOn()})\n// },\n//\n// away() {\n// this.perform('away')\n// },\n//\n// appearingOn() {\n// $('main').data('appearing-on')\n// }\n// })\n//\n// The methods #appear and #away forward their intent to the remote AppearanceChannel instance on the server\n// by calling the `perform` method with the first parameter being the action (which maps to AppearanceChannel#appear/away).\n// The second parameter is a hash that'll get JSON encoded and made available on the server in the data parameter.\n//\n// This is how the server component would look:\n//\n// class AppearanceChannel < ApplicationActionCable::Channel\n// def subscribed\n// current_user.appear\n// end\n//\n// def unsubscribed\n// current_user.disappear\n// end\n//\n// def appear(data)\n// current_user.appear on: data['appearing_on']\n// end\n//\n// def away\n// current_user.away\n// end\n// end\n//\n// The \"AppearanceChannel\" name is automatically mapped between the client-side subscription creation and the server-side Ruby class name.\n// The AppearanceChannel#appear/away public methods are exposed automatically to client-side invocation through the perform method.\n\nconst extend = function(object, properties) {\n if (properties != null) {\n for (let key in properties) {\n const value = properties[key]\n object[key] = value\n }\n }\n return object\n}\n\nexport default class Subscription {\n constructor(consumer, params = {}, mixin) {\n this.consumer = consumer\n this.identifier = JSON.stringify(params)\n extend(this, mixin)\n }\n\n // Perform a channel action with the optional data passed as an attribute\n perform(action, data = {}) {\n data.action = action\n return this.send(data)\n }\n\n send(data) {\n return this.consumer.send({command: \"message\", identifier: this.identifier, data: JSON.stringify(data)})\n }\n\n unsubscribe() {\n return this.consumer.subscriptions.remove(this)\n }\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring channel subscribe command is confirmed, retrying until confirmation is received.\n// Internal class, not intended for direct user manipulation.\n\nclass SubscriptionGuarantor {\n constructor(subscriptions) {\n this.subscriptions = subscriptions\n this.pendingSubscriptions = []\n }\n\n guarantee(subscription) {\n if(this.pendingSubscriptions.indexOf(subscription) == -1){ \n logger.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`)\n this.pendingSubscriptions.push(subscription) \n }\n else {\n logger.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`)\n }\n this.startGuaranteeing()\n }\n\n forget(subscription) {\n logger.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`)\n this.pendingSubscriptions = (this.pendingSubscriptions.filter((s) => s !== subscription))\n }\n\n startGuaranteeing() {\n this.stopGuaranteeing()\n this.retrySubscribing()\n }\n \n stopGuaranteeing() {\n clearTimeout(this.retryTimeout)\n }\n\n retrySubscribing() {\n this.retryTimeout = setTimeout(() => {\n if (this.subscriptions && typeof(this.subscriptions.subscribe) === \"function\") {\n this.pendingSubscriptions.map((subscription) => {\n logger.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`)\n this.subscriptions.subscribe(subscription)\n })\n }\n }\n , 500)\n }\n}\n\nexport default SubscriptionGuarantor", "import Subscription from \"./subscription\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport logger from \"./logger\"\n\n// Collection class for creating (and internally managing) channel subscriptions.\n// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,\n// and it should be called through the consumer like so:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n\nexport default class Subscriptions {\n constructor(consumer) {\n this.consumer = consumer\n this.guarantor = new SubscriptionGuarantor(this)\n this.subscriptions = []\n }\n\n create(channelName, mixin) {\n const channel = channelName\n const params = typeof channel === \"object\" ? channel : {channel}\n const subscription = new Subscription(this.consumer, params, mixin)\n return this.add(subscription)\n }\n\n // Private\n\n add(subscription) {\n this.subscriptions.push(subscription)\n this.consumer.ensureActiveConnection()\n this.notify(subscription, \"initialized\")\n this.subscribe(subscription)\n return subscription\n }\n\n remove(subscription) {\n this.forget(subscription)\n if (!this.findAll(subscription.identifier).length) {\n this.sendCommand(subscription, \"unsubscribe\")\n }\n return subscription\n }\n\n reject(identifier) {\n return this.findAll(identifier).map((subscription) => {\n this.forget(subscription)\n this.notify(subscription, \"rejected\")\n return subscription\n })\n }\n\n forget(subscription) {\n this.guarantor.forget(subscription)\n this.subscriptions = (this.subscriptions.filter((s) => s !== subscription))\n return subscription\n }\n\n findAll(identifier) {\n return this.subscriptions.filter((s) => s.identifier === identifier)\n }\n\n reload() {\n return this.subscriptions.map((subscription) =>\n this.subscribe(subscription))\n }\n\n notifyAll(callbackName, ...args) {\n return this.subscriptions.map((subscription) =>\n this.notify(subscription, callbackName, ...args))\n }\n\n notify(subscription, callbackName, ...args) {\n let subscriptions\n if (typeof subscription === \"string\") {\n subscriptions = this.findAll(subscription)\n } else {\n subscriptions = [subscription]\n }\n\n return subscriptions.map((subscription) =>\n (typeof subscription[callbackName] === \"function\" ? subscription[callbackName](...args) : undefined))\n }\n\n subscribe(subscription) {\n if (this.sendCommand(subscription, \"subscribe\")) {\n this.guarantor.guarantee(subscription)\n }\n }\n\n confirmSubscription(identifier) {\n logger.log(`Subscription confirmed ${identifier}`)\n this.findAll(identifier).map((subscription) =>\n this.guarantor.forget(subscription))\n }\n\n sendCommand(subscription, command) {\n const {identifier} = subscription\n return this.consumer.send({command, identifier})\n }\n}\n", "import Connection from \"./connection\"\nimport Subscriptions from \"./subscriptions\"\n\n// The ActionCable.Consumer establishes the connection to a server-side Ruby Connection object. Once established,\n// the ActionCable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates.\n// The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription\n// method.\n//\n// The following example shows how this can be set up:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n//\n// When a consumer is created, it automatically connects with the server.\n//\n// To disconnect from the server, call\n//\n// App.cable.disconnect()\n//\n// and to restart the connection:\n//\n// App.cable.connect()\n//\n// Any channel subscriptions which existed prior to disconnecting will\n// automatically resubscribe.\n\nexport default class Consumer {\n constructor(url) {\n this._url = url\n this.subscriptions = new Subscriptions(this)\n this.connection = new Connection(this)\n this.subprotocols = []\n }\n\n get url() {\n return createWebSocketURL(this._url)\n }\n\n send(data) {\n return this.connection.send(data)\n }\n\n connect() {\n return this.connection.open()\n }\n\n disconnect() {\n return this.connection.close({allowReconnect: false})\n }\n\n ensureActiveConnection() {\n if (!this.connection.isActive()) {\n return this.connection.open()\n }\n }\n\n addSubProtocol(subprotocol) {\n this.subprotocols = [...this.subprotocols, subprotocol]\n }\n}\n\nexport function createWebSocketURL(url) {\n if (typeof url === \"function\") {\n url = url()\n }\n\n if (url && !/^wss?:/i.test(url)) {\n const a = document.createElement(\"a\")\n a.href = url\n // Fix populating Location properties in IE. Otherwise, protocol will be blank.\n a.href = a.href\n a.protocol = a.protocol.replace(\"http\", \"ws\")\n return a.href\n } else {\n return url\n }\n}\n", "import Connection from \"./connection\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport Consumer, { createWebSocketURL } from \"./consumer\"\nimport INTERNAL from \"./internal\"\nimport Subscription from \"./subscription\"\nimport Subscriptions from \"./subscriptions\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport adapters from \"./adapters\"\nimport logger from \"./logger\"\n\nexport {\n Connection,\n ConnectionMonitor,\n Consumer,\n INTERNAL,\n Subscription,\n Subscriptions,\n SubscriptionGuarantor,\n adapters,\n createWebSocketURL,\n logger,\n}\n\nexport function createConsumer(url = getConfig(\"url\") || INTERNAL.default_mount_path) {\n return new Consumer(url)\n}\n\nexport function getConfig(name) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`)\n if (element) {\n return element.getAttribute(\"content\")\n }\n}\n", "/*!\n* sweetalert2 v11.4.8\n* Released under the MIT License.\n*/\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.Sweetalert2 = factory());\n}(this, function () { 'use strict';\n\n const consolePrefix = 'SweetAlert2:';\n /**\n * Filter the unique values into a new array\n * @param arr\n */\n\n const uniqueArray = arr => {\n const result = [];\n\n for (let i = 0; i < arr.length; i++) {\n if (result.indexOf(arr[i]) === -1) {\n result.push(arr[i]);\n }\n }\n\n return result;\n };\n /**\n * Capitalize the first letter of a string\n * @param {string} str\n * @returns {string}\n */\n\n const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1);\n /**\n * @param {NodeList | HTMLCollection | NamedNodeMap} nodeList\n * @returns {array}\n */\n\n const toArray = nodeList => Array.prototype.slice.call(nodeList);\n /**\n * Standardize console warnings\n * @param {string | array} message\n */\n\n const warn = message => {\n console.warn(\"\".concat(consolePrefix, \" \").concat(typeof message === 'object' ? message.join(' ') : message));\n };\n /**\n * Standardize console errors\n * @param {string} message\n */\n\n const error = message => {\n console.error(\"\".concat(consolePrefix, \" \").concat(message));\n };\n /**\n * Private global state for `warnOnce`\n * @type {Array}\n * @private\n */\n\n const previousWarnOnceMessages = [];\n /**\n * Show a console warning, but only if it hasn't already been shown\n * @param {string} message\n */\n\n const warnOnce = message => {\n if (!previousWarnOnceMessages.includes(message)) {\n previousWarnOnceMessages.push(message);\n warn(message);\n }\n };\n /**\n * Show a one-time console warning about deprecated params/methods\n */\n\n const warnAboutDeprecation = (deprecatedParam, useInstead) => {\n warnOnce(\"\\\"\".concat(deprecatedParam, \"\\\" is deprecated and will be removed in the next major release. Please use \\\"\").concat(useInstead, \"\\\" instead.\"));\n };\n /**\n * If `arg` is a function, call it (with no arguments or context) and return the result.\n * Otherwise, just pass the value through\n * @param arg\n */\n\n const callIfFunction = arg => typeof arg === 'function' ? arg() : arg;\n const hasToPromiseFn = arg => arg && typeof arg.toPromise === 'function';\n const asPromise = arg => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg);\n const isPromise = arg => arg && Promise.resolve(arg) === arg;\n\n const defaultParams = {\n title: '',\n titleText: '',\n text: '',\n html: '',\n footer: '',\n icon: undefined,\n iconColor: undefined,\n iconHtml: undefined,\n template: undefined,\n toast: false,\n showClass: {\n popup: 'swal2-show',\n backdrop: 'swal2-backdrop-show',\n icon: 'swal2-icon-show'\n },\n hideClass: {\n popup: 'swal2-hide',\n backdrop: 'swal2-backdrop-hide',\n icon: 'swal2-icon-hide'\n },\n customClass: {},\n target: 'body',\n color: undefined,\n backdrop: true,\n heightAuto: true,\n allowOutsideClick: true,\n allowEscapeKey: true,\n allowEnterKey: true,\n stopKeydownPropagation: true,\n keydownListenerCapture: false,\n showConfirmButton: true,\n showDenyButton: false,\n showCancelButton: false,\n preConfirm: undefined,\n preDeny: undefined,\n confirmButtonText: 'OK',\n confirmButtonAriaLabel: '',\n confirmButtonColor: undefined,\n denyButtonText: 'No',\n denyButtonAriaLabel: '',\n denyButtonColor: undefined,\n cancelButtonText: 'Cancel',\n cancelButtonAriaLabel: '',\n cancelButtonColor: undefined,\n buttonsStyling: true,\n reverseButtons: false,\n focusConfirm: true,\n focusDeny: false,\n focusCancel: false,\n returnFocus: true,\n showCloseButton: false,\n closeButtonHtml: '×',\n closeButtonAriaLabel: 'Close this dialog',\n loaderHtml: '',\n showLoaderOnConfirm: false,\n showLoaderOnDeny: false,\n imageUrl: undefined,\n imageWidth: undefined,\n imageHeight: undefined,\n imageAlt: '',\n timer: undefined,\n timerProgressBar: false,\n width: undefined,\n padding: undefined,\n background: undefined,\n input: undefined,\n inputPlaceholder: '',\n inputLabel: '',\n inputValue: '',\n inputOptions: {},\n inputAutoTrim: true,\n inputAttributes: {},\n inputValidator: undefined,\n returnInputValueOnDeny: false,\n validationMessage: undefined,\n grow: false,\n position: 'center',\n progressSteps: [],\n currentProgressStep: undefined,\n progressStepsDistance: undefined,\n willOpen: undefined,\n didOpen: undefined,\n didRender: undefined,\n willClose: undefined,\n didClose: undefined,\n didDestroy: undefined,\n scrollbarPadding: true\n };\n const updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'willClose'];\n const deprecatedParams = {};\n const toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture'];\n /**\n * Is valid parameter\n * @param {string} paramName\n */\n\n const isValidParameter = paramName => {\n return Object.prototype.hasOwnProperty.call(defaultParams, paramName);\n };\n /**\n * Is valid parameter for Swal.update() method\n * @param {string} paramName\n */\n\n const isUpdatableParameter = paramName => {\n return updatableParams.indexOf(paramName) !== -1;\n };\n /**\n * Is deprecated parameter\n * @param {string} paramName\n */\n\n const isDeprecatedParameter = paramName => {\n return deprecatedParams[paramName];\n };\n\n const checkIfParamIsValid = param => {\n if (!isValidParameter(param)) {\n warn(\"Unknown parameter \\\"\".concat(param, \"\\\"\"));\n }\n };\n\n const checkIfToastParamIsValid = param => {\n if (toastIncompatibleParams.includes(param)) {\n warn(\"The parameter \\\"\".concat(param, \"\\\" is incompatible with toasts\"));\n }\n };\n\n const checkIfParamIsDeprecated = param => {\n if (isDeprecatedParameter(param)) {\n warnAboutDeprecation(param, isDeprecatedParameter(param));\n }\n };\n /**\n * Show relevant warnings for given params\n *\n * @param params\n */\n\n\n const showWarningsForParams = params => {\n if (!params.backdrop && params.allowOutsideClick) {\n warn('\"allowOutsideClick\" parameter requires `backdrop` parameter to be set to `true`');\n }\n\n for (const param in params) {\n checkIfParamIsValid(param);\n\n if (params.toast) {\n checkIfToastParamIsValid(param);\n }\n\n checkIfParamIsDeprecated(param);\n }\n };\n\n const swalPrefix = 'swal2-';\n const prefix = items => {\n const result = {};\n\n for (const i in items) {\n result[items[i]] = swalPrefix + items[i];\n }\n\n return result;\n };\n const swalClasses = prefix(['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'show', 'hide', 'close', 'title', 'html-container', 'actions', 'confirm', 'deny', 'cancel', 'default-outline', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'input-label', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loader', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl', 'timer-progress-bar', 'timer-progress-bar-container', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error']);\n const iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']);\n\n /**\n * Gets the popup container which contains the backdrop and the popup itself.\n *\n * @returns {HTMLElement | null}\n */\n\n const getContainer = () => document.body.querySelector(\".\".concat(swalClasses.container));\n const elementBySelector = selectorString => {\n const container = getContainer();\n return container ? container.querySelector(selectorString) : null;\n };\n\n const elementByClass = className => {\n return elementBySelector(\".\".concat(className));\n };\n\n const getPopup = () => elementByClass(swalClasses.popup);\n const getIcon = () => elementByClass(swalClasses.icon);\n const getTitle = () => elementByClass(swalClasses.title);\n const getHtmlContainer = () => elementByClass(swalClasses['html-container']);\n const getImage = () => elementByClass(swalClasses.image);\n const getProgressSteps = () => elementByClass(swalClasses['progress-steps']);\n const getValidationMessage = () => elementByClass(swalClasses['validation-message']);\n const getConfirmButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.confirm));\n const getDenyButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.deny));\n const getInputLabel = () => elementByClass(swalClasses['input-label']);\n const getLoader = () => elementBySelector(\".\".concat(swalClasses.loader));\n const getCancelButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.cancel));\n const getActions = () => elementByClass(swalClasses.actions);\n const getFooter = () => elementByClass(swalClasses.footer);\n const getTimerProgressBar = () => elementByClass(swalClasses['timer-progress-bar']);\n const getCloseButton = () => elementByClass(swalClasses.close); // https://github.com/jkup/focusable/blob/master/index.js\n\n const focusable = \"\\n a[href],\\n area[href],\\n input:not([disabled]),\\n select:not([disabled]),\\n textarea:not([disabled]),\\n button:not([disabled]),\\n iframe,\\n object,\\n embed,\\n [tabindex=\\\"0\\\"],\\n [contenteditable],\\n audio[controls],\\n video[controls],\\n summary\\n\";\n const getFocusableElements = () => {\n const focusableElementsWithTabindex = toArray(getPopup().querySelectorAll('[tabindex]:not([tabindex=\"-1\"]):not([tabindex=\"0\"])')) // sort according to tabindex\n .sort((a, b) => {\n const tabindexA = parseInt(a.getAttribute('tabindex'));\n const tabindexB = parseInt(b.getAttribute('tabindex'));\n\n if (tabindexA > tabindexB) {\n return 1;\n } else if (tabindexA < tabindexB) {\n return -1;\n }\n\n return 0;\n });\n const otherFocusableElements = toArray(getPopup().querySelectorAll(focusable)).filter(el => el.getAttribute('tabindex') !== '-1');\n return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)).filter(el => isVisible(el));\n };\n const isModal = () => {\n return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']);\n };\n const isToast = () => {\n return getPopup() && hasClass(getPopup(), swalClasses.toast);\n };\n const isLoading = () => {\n return getPopup().hasAttribute('data-loading');\n };\n\n const states = {\n previousBodyPadding: null\n };\n /**\n * Securely set innerHTML of an element\n * https://github.com/sweetalert2/sweetalert2/issues/1926\n *\n * @param {HTMLElement} elem\n * @param {string} html\n */\n\n const setInnerHtml = (elem, html) => {\n elem.textContent = '';\n\n if (html) {\n const parser = new DOMParser();\n const parsed = parser.parseFromString(html, \"text/html\");\n toArray(parsed.querySelector('head').childNodes).forEach(child => {\n elem.appendChild(child);\n });\n toArray(parsed.querySelector('body').childNodes).forEach(child => {\n elem.appendChild(child);\n });\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} className\n * @returns {boolean}\n */\n\n const hasClass = (elem, className) => {\n if (!className) {\n return false;\n }\n\n const classList = className.split(/\\s+/);\n\n for (let i = 0; i < classList.length; i++) {\n if (!elem.classList.contains(classList[i])) {\n return false;\n }\n }\n\n return true;\n };\n\n const removeCustomClasses = (elem, params) => {\n toArray(elem.classList).forEach(className => {\n if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass).includes(className)) {\n elem.classList.remove(className);\n }\n });\n };\n\n const applyCustomClass = (elem, params, className) => {\n removeCustomClasses(elem, params);\n\n if (params.customClass && params.customClass[className]) {\n if (typeof params.customClass[className] !== 'string' && !params.customClass[className].forEach) {\n return warn(\"Invalid type of customClass.\".concat(className, \"! Expected string or iterable object, got \\\"\").concat(typeof params.customClass[className], \"\\\"\"));\n }\n\n addClass(elem, params.customClass[className]);\n }\n };\n /**\n * @param {HTMLElement} popup\n * @param {string} inputType\n * @returns {HTMLInputElement | null}\n */\n\n const getInput = (popup, inputType) => {\n if (!inputType) {\n return null;\n }\n\n switch (inputType) {\n case 'select':\n case 'textarea':\n case 'file':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses[inputType]));\n\n case 'checkbox':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.checkbox, \" input\"));\n\n case 'radio':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.radio, \" input:checked\")) || popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.radio, \" input:first-child\"));\n\n case 'range':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.range, \" input\"));\n\n default:\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.input));\n }\n };\n /**\n * @param {HTMLInputElement} input\n */\n\n const focusInput = input => {\n input.focus(); // place cursor at end of text in text input\n\n if (input.type !== 'file') {\n // http://stackoverflow.com/a/2345915\n const val = input.value;\n input.value = '';\n input.value = val;\n }\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[]} classList\n * @param {boolean} condition\n */\n\n const toggleClass = (target, classList, condition) => {\n if (!target || !classList) {\n return;\n }\n\n if (typeof classList === 'string') {\n classList = classList.split(/\\s+/).filter(Boolean);\n }\n\n classList.forEach(className => {\n if (Array.isArray(target)) {\n target.forEach(elem => {\n condition ? elem.classList.add(className) : elem.classList.remove(className);\n });\n } else {\n condition ? target.classList.add(className) : target.classList.remove(className);\n }\n });\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[]} classList\n */\n\n const addClass = (target, classList) => {\n toggleClass(target, classList, true);\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[]} classList\n */\n\n const removeClass = (target, classList) => {\n toggleClass(target, classList, false);\n };\n /**\n * Get direct child of an element by class name\n *\n * @param {HTMLElement} elem\n * @param {string} className\n * @returns {HTMLElement | null}\n */\n\n const getDirectChildByClass = (elem, className) => {\n const childNodes = toArray(elem.childNodes);\n\n for (let i = 0; i < childNodes.length; i++) {\n if (hasClass(childNodes[i], className)) {\n return childNodes[i];\n }\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} property\n * @param {*} value\n */\n\n const applyNumericalStyle = (elem, property, value) => {\n if (value === \"\".concat(parseInt(value))) {\n value = parseInt(value);\n }\n\n if (value || parseInt(value) === 0) {\n elem.style[property] = typeof value === 'number' ? \"\".concat(value, \"px\") : value;\n } else {\n elem.style.removeProperty(property);\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} display\n */\n\n const show = function (elem) {\n let display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex';\n elem.style.display = display;\n };\n /**\n * @param {HTMLElement} elem\n */\n\n const hide = elem => {\n elem.style.display = 'none';\n };\n const setStyle = (parent, selector, property, value) => {\n const el = parent.querySelector(selector);\n\n if (el) {\n el.style[property] = value;\n }\n };\n const toggle = (elem, condition, display) => {\n condition ? show(elem, display) : hide(elem);\n }; // borrowed from jquery $(elem).is(':visible') implementation\n\n const isVisible = elem => !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));\n const allButtonsAreHidden = () => !isVisible(getConfirmButton()) && !isVisible(getDenyButton()) && !isVisible(getCancelButton());\n const isScrollable = elem => !!(elem.scrollHeight > elem.clientHeight); // borrowed from https://stackoverflow.com/a/46352119\n\n const hasCssAnimation = elem => {\n const style = window.getComputedStyle(elem);\n const animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');\n const transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');\n return animDuration > 0 || transDuration > 0;\n };\n const animateTimerProgressBar = function (timer) {\n let reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n const timerProgressBar = getTimerProgressBar();\n\n if (isVisible(timerProgressBar)) {\n if (reset) {\n timerProgressBar.style.transition = 'none';\n timerProgressBar.style.width = '100%';\n }\n\n setTimeout(() => {\n timerProgressBar.style.transition = \"width \".concat(timer / 1000, \"s linear\");\n timerProgressBar.style.width = '0%';\n }, 10);\n }\n };\n const stopTimerProgressBar = () => {\n const timerProgressBar = getTimerProgressBar();\n const timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width);\n timerProgressBar.style.removeProperty('transition');\n timerProgressBar.style.width = '100%';\n const timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width);\n const timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100;\n timerProgressBar.style.removeProperty('transition');\n timerProgressBar.style.width = \"\".concat(timerProgressBarPercent, \"%\");\n };\n\n /**\n * Detect Node env\n *\n * @returns {boolean}\n */\n const isNodeEnv = () => typeof window === 'undefined' || typeof document === 'undefined';\n\n const RESTORE_FOCUS_TIMEOUT = 100;\n\n const globalState = {};\n\n const focusPreviousActiveElement = () => {\n if (globalState.previousActiveElement && globalState.previousActiveElement.focus) {\n globalState.previousActiveElement.focus();\n globalState.previousActiveElement = null;\n } else if (document.body) {\n document.body.focus();\n }\n }; // Restore previous active (focused) element\n\n\n const restoreActiveElement = returnFocus => {\n return new Promise(resolve => {\n if (!returnFocus) {\n return resolve();\n }\n\n const x = window.scrollX;\n const y = window.scrollY;\n globalState.restoreFocusTimeout = setTimeout(() => {\n focusPreviousActiveElement();\n resolve();\n }, RESTORE_FOCUS_TIMEOUT); // issues/900\n\n window.scrollTo(x, y);\n });\n };\n\n const sweetHTML = \"\\n
\\n \\n \\n
\\n \\n

\\n
\\n \\n \\n
\\n \\n \\n
\\n \\n
\\n \\n \\n
\\n
\\n
\\n \\n \\n \\n
\\n
\\n
\\n
\\n
\\n
\\n\").replace(/(^|\\n)\\s*/g, '');\n\n const resetOldContainer = () => {\n const oldContainer = getContainer();\n\n if (!oldContainer) {\n return false;\n }\n\n oldContainer.remove();\n removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]);\n return true;\n };\n\n const resetValidationMessage = () => {\n globalState.currentInstance.resetValidationMessage();\n };\n\n const addInputChangeListeners = () => {\n const popup = getPopup();\n const input = getDirectChildByClass(popup, swalClasses.input);\n const file = getDirectChildByClass(popup, swalClasses.file);\n const range = popup.querySelector(\".\".concat(swalClasses.range, \" input\"));\n const rangeOutput = popup.querySelector(\".\".concat(swalClasses.range, \" output\"));\n const select = getDirectChildByClass(popup, swalClasses.select);\n const checkbox = popup.querySelector(\".\".concat(swalClasses.checkbox, \" input\"));\n const textarea = getDirectChildByClass(popup, swalClasses.textarea);\n input.oninput = resetValidationMessage;\n file.onchange = resetValidationMessage;\n select.onchange = resetValidationMessage;\n checkbox.onchange = resetValidationMessage;\n textarea.oninput = resetValidationMessage;\n\n range.oninput = () => {\n resetValidationMessage();\n rangeOutput.value = range.value;\n };\n\n range.onchange = () => {\n resetValidationMessage();\n range.nextSibling.value = range.value;\n };\n };\n\n const getTarget = target => typeof target === 'string' ? document.querySelector(target) : target;\n\n const setupAccessibility = params => {\n const popup = getPopup();\n popup.setAttribute('role', params.toast ? 'alert' : 'dialog');\n popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');\n\n if (!params.toast) {\n popup.setAttribute('aria-modal', 'true');\n }\n };\n\n const setupRTL = targetElement => {\n if (window.getComputedStyle(targetElement).direction === 'rtl') {\n addClass(getContainer(), swalClasses.rtl);\n }\n };\n /*\n * Add modal + backdrop to DOM\n */\n\n\n const init = params => {\n // Clean up the old popup container if it exists\n const oldContainerExisted = resetOldContainer();\n /* istanbul ignore if */\n\n if (isNodeEnv()) {\n error('SweetAlert2 requires document to initialize');\n return;\n }\n\n const container = document.createElement('div');\n container.className = swalClasses.container;\n\n if (oldContainerExisted) {\n addClass(container, swalClasses['no-transition']);\n }\n\n setInnerHtml(container, sweetHTML);\n const targetElement = getTarget(params.target);\n targetElement.appendChild(container);\n setupAccessibility(params);\n setupRTL(targetElement);\n addInputChangeListeners();\n };\n\n /**\n * @param {HTMLElement | object | string} param\n * @param {HTMLElement} target\n */\n\n const parseHtmlToContainer = (param, target) => {\n // DOM element\n if (param instanceof HTMLElement) {\n target.appendChild(param);\n } // Object\n else if (typeof param === 'object') {\n handleObject(param, target);\n } // Plain string\n else if (param) {\n setInnerHtml(target, param);\n }\n };\n /**\n * @param {object} param\n * @param {HTMLElement} target\n */\n\n const handleObject = (param, target) => {\n // JQuery element(s)\n if (param.jquery) {\n handleJqueryElem(target, param);\n } // For other objects use their string representation\n else {\n setInnerHtml(target, param.toString());\n }\n };\n\n const handleJqueryElem = (target, elem) => {\n target.textContent = '';\n\n if (0 in elem) {\n for (let i = 0; (i in elem); i++) {\n target.appendChild(elem[i].cloneNode(true));\n }\n } else {\n target.appendChild(elem.cloneNode(true));\n }\n };\n\n const animationEndEvent = (() => {\n // Prevent run in Node env\n\n /* istanbul ignore if */\n if (isNodeEnv()) {\n return false;\n }\n\n const testEl = document.createElement('div');\n const transEndEventNames = {\n WebkitAnimation: 'webkitAnimationEnd',\n // Chrome, Safari and Opera\n animation: 'animationend' // Standard syntax\n\n };\n\n for (const i in transEndEventNames) {\n if (Object.prototype.hasOwnProperty.call(transEndEventNames, i) && typeof testEl.style[i] !== 'undefined') {\n return transEndEventNames[i];\n }\n }\n\n return false;\n })();\n\n // https://github.com/twbs/bootstrap/blob/master/js/src/modal.js\n\n const measureScrollbar = () => {\n const scrollDiv = document.createElement('div');\n scrollDiv.className = swalClasses['scrollbar-measure'];\n document.body.appendChild(scrollDiv);\n const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarWidth;\n };\n\n const renderActions = (instance, params) => {\n const actions = getActions();\n const loader = getLoader(); // Actions (buttons) wrapper\n\n if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) {\n hide(actions);\n } else {\n show(actions);\n } // Custom class\n\n\n applyCustomClass(actions, params, 'actions'); // Render all the buttons\n\n renderButtons(actions, loader, params); // Loader\n\n setInnerHtml(loader, params.loaderHtml);\n applyCustomClass(loader, params, 'loader');\n };\n\n function renderButtons(actions, loader, params) {\n const confirmButton = getConfirmButton();\n const denyButton = getDenyButton();\n const cancelButton = getCancelButton(); // Render buttons\n\n renderButton(confirmButton, 'confirm', params);\n renderButton(denyButton, 'deny', params);\n renderButton(cancelButton, 'cancel', params);\n handleButtonsStyling(confirmButton, denyButton, cancelButton, params);\n\n if (params.reverseButtons) {\n if (params.toast) {\n actions.insertBefore(cancelButton, confirmButton);\n actions.insertBefore(denyButton, confirmButton);\n } else {\n actions.insertBefore(cancelButton, loader);\n actions.insertBefore(denyButton, loader);\n actions.insertBefore(confirmButton, loader);\n }\n }\n }\n\n function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) {\n if (!params.buttonsStyling) {\n return removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled);\n }\n\n addClass([confirmButton, denyButton, cancelButton], swalClasses.styled); // Buttons background colors\n\n if (params.confirmButtonColor) {\n confirmButton.style.backgroundColor = params.confirmButtonColor;\n addClass(confirmButton, swalClasses['default-outline']);\n }\n\n if (params.denyButtonColor) {\n denyButton.style.backgroundColor = params.denyButtonColor;\n addClass(denyButton, swalClasses['default-outline']);\n }\n\n if (params.cancelButtonColor) {\n cancelButton.style.backgroundColor = params.cancelButtonColor;\n addClass(cancelButton, swalClasses['default-outline']);\n }\n }\n\n function renderButton(button, buttonType, params) {\n toggle(button, params[\"show\".concat(capitalizeFirstLetter(buttonType), \"Button\")], 'inline-block');\n setInnerHtml(button, params[\"\".concat(buttonType, \"ButtonText\")]); // Set caption text\n\n button.setAttribute('aria-label', params[\"\".concat(buttonType, \"ButtonAriaLabel\")]); // ARIA label\n // Add buttons custom classes\n\n button.className = swalClasses[buttonType];\n applyCustomClass(button, params, \"\".concat(buttonType, \"Button\"));\n addClass(button, params[\"\".concat(buttonType, \"ButtonClass\")]);\n }\n\n function handleBackdropParam(container, backdrop) {\n if (typeof backdrop === 'string') {\n container.style.background = backdrop;\n } else if (!backdrop) {\n addClass([document.documentElement, document.body], swalClasses['no-backdrop']);\n }\n }\n\n function handlePositionParam(container, position) {\n if (position in swalClasses) {\n addClass(container, swalClasses[position]);\n } else {\n warn('The \"position\" parameter is not valid, defaulting to \"center\"');\n addClass(container, swalClasses.center);\n }\n }\n\n function handleGrowParam(container, grow) {\n if (grow && typeof grow === 'string') {\n const growClass = \"grow-\".concat(grow);\n\n if (growClass in swalClasses) {\n addClass(container, swalClasses[growClass]);\n }\n }\n }\n\n const renderContainer = (instance, params) => {\n const container = getContainer();\n\n if (!container) {\n return;\n }\n\n handleBackdropParam(container, params.backdrop);\n handlePositionParam(container, params.position);\n handleGrowParam(container, params.grow); // Custom class\n\n applyCustomClass(container, params, 'container');\n };\n\n /**\n * This module contains `WeakMap`s for each effectively-\"private property\" that a `Swal` has.\n * For example, to set the private property \"foo\" of `this` to \"bar\", you can `privateProps.foo.set(this, 'bar')`\n * This is the approach that Babel will probably take to implement private methods/fields\n * https://github.com/tc39/proposal-private-methods\n * https://github.com/babel/babel/pull/7555\n * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*\n * then we can use that language feature.\n */\n var privateProps = {\n awaitingPromise: new WeakMap(),\n promise: new WeakMap(),\n innerParams: new WeakMap(),\n domCache: new WeakMap()\n };\n\n const inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];\n const renderInput = (instance, params) => {\n const popup = getPopup();\n const innerParams = privateProps.innerParams.get(instance);\n const rerender = !innerParams || params.input !== innerParams.input;\n inputTypes.forEach(inputType => {\n const inputClass = swalClasses[inputType];\n const inputContainer = getDirectChildByClass(popup, inputClass); // set attributes\n\n setAttributes(inputType, params.inputAttributes); // set class\n\n inputContainer.className = inputClass;\n\n if (rerender) {\n hide(inputContainer);\n }\n });\n\n if (params.input) {\n if (rerender) {\n showInput(params);\n } // set custom class\n\n\n setCustomClass(params);\n }\n };\n\n const showInput = params => {\n if (!renderInputType[params.input]) {\n return error(\"Unexpected type of input! Expected \\\"text\\\", \\\"email\\\", \\\"password\\\", \\\"number\\\", \\\"tel\\\", \\\"select\\\", \\\"radio\\\", \\\"checkbox\\\", \\\"textarea\\\", \\\"file\\\" or \\\"url\\\", got \\\"\".concat(params.input, \"\\\"\"));\n }\n\n const inputContainer = getInputContainer(params.input);\n const input = renderInputType[params.input](inputContainer, params);\n show(input); // input autofocus\n\n setTimeout(() => {\n focusInput(input);\n });\n };\n\n const removeAttributes = input => {\n for (let i = 0; i < input.attributes.length; i++) {\n const attrName = input.attributes[i].name;\n\n if (!['type', 'value', 'style'].includes(attrName)) {\n input.removeAttribute(attrName);\n }\n }\n };\n\n const setAttributes = (inputType, inputAttributes) => {\n const input = getInput(getPopup(), inputType);\n\n if (!input) {\n return;\n }\n\n removeAttributes(input);\n\n for (const attr in inputAttributes) {\n input.setAttribute(attr, inputAttributes[attr]);\n }\n };\n\n const setCustomClass = params => {\n const inputContainer = getInputContainer(params.input);\n\n if (params.customClass) {\n addClass(inputContainer, params.customClass.input);\n }\n };\n\n const setInputPlaceholder = (input, params) => {\n if (!input.placeholder || params.inputPlaceholder) {\n input.placeholder = params.inputPlaceholder;\n }\n };\n\n const setInputLabel = (input, prependTo, params) => {\n if (params.inputLabel) {\n input.id = swalClasses.input;\n const label = document.createElement('label');\n const labelClass = swalClasses['input-label'];\n label.setAttribute('for', input.id);\n label.className = labelClass;\n addClass(label, params.customClass.inputLabel);\n label.innerText = params.inputLabel;\n prependTo.insertAdjacentElement('beforebegin', label);\n }\n };\n\n const getInputContainer = inputType => {\n const inputClass = swalClasses[inputType] ? swalClasses[inputType] : swalClasses.input;\n return getDirectChildByClass(getPopup(), inputClass);\n };\n\n const renderInputType = {};\n\n renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = (input, params) => {\n if (typeof params.inputValue === 'string' || typeof params.inputValue === 'number') {\n input.value = params.inputValue;\n } else if (!isPromise(params.inputValue)) {\n warn(\"Unexpected type of inputValue! Expected \\\"string\\\", \\\"number\\\" or \\\"Promise\\\", got \\\"\".concat(typeof params.inputValue, \"\\\"\"));\n }\n\n setInputLabel(input, input, params);\n setInputPlaceholder(input, params);\n input.type = params.input;\n return input;\n };\n\n renderInputType.file = (input, params) => {\n setInputLabel(input, input, params);\n setInputPlaceholder(input, params);\n return input;\n };\n\n renderInputType.range = (range, params) => {\n const rangeInput = range.querySelector('input');\n const rangeOutput = range.querySelector('output');\n rangeInput.value = params.inputValue;\n rangeInput.type = params.input;\n rangeOutput.value = params.inputValue;\n setInputLabel(rangeInput, range, params);\n return range;\n };\n\n renderInputType.select = (select, params) => {\n select.textContent = '';\n\n if (params.inputPlaceholder) {\n const placeholder = document.createElement('option');\n setInnerHtml(placeholder, params.inputPlaceholder);\n placeholder.value = '';\n placeholder.disabled = true;\n placeholder.selected = true;\n select.appendChild(placeholder);\n }\n\n setInputLabel(select, select, params);\n return select;\n };\n\n renderInputType.radio = radio => {\n radio.textContent = '';\n return radio;\n };\n\n renderInputType.checkbox = (checkboxContainer, params) => {\n /** @type {HTMLInputElement} */\n const checkbox = getInput(getPopup(), 'checkbox');\n checkbox.value = '1';\n checkbox.id = swalClasses.checkbox;\n checkbox.checked = Boolean(params.inputValue);\n const label = checkboxContainer.querySelector('span');\n setInnerHtml(label, params.inputPlaceholder);\n return checkboxContainer;\n };\n\n renderInputType.textarea = (textarea, params) => {\n textarea.value = params.inputValue;\n setInputPlaceholder(textarea, params);\n setInputLabel(textarea, textarea, params);\n\n const getMargin = el => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight); // https://github.com/sweetalert2/sweetalert2/issues/2291\n\n\n setTimeout(() => {\n // https://github.com/sweetalert2/sweetalert2/issues/1699\n if ('MutationObserver' in window) {\n const initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width);\n\n const textareaResizeHandler = () => {\n const textareaWidth = textarea.offsetWidth + getMargin(textarea);\n\n if (textareaWidth > initialPopupWidth) {\n getPopup().style.width = \"\".concat(textareaWidth, \"px\");\n } else {\n getPopup().style.width = null;\n }\n };\n\n new MutationObserver(textareaResizeHandler).observe(textarea, {\n attributes: true,\n attributeFilter: ['style']\n });\n }\n });\n return textarea;\n };\n\n const renderContent = (instance, params) => {\n const htmlContainer = getHtmlContainer();\n applyCustomClass(htmlContainer, params, 'htmlContainer'); // Content as HTML\n\n if (params.html) {\n parseHtmlToContainer(params.html, htmlContainer);\n show(htmlContainer, 'block');\n } // Content as plain text\n else if (params.text) {\n htmlContainer.textContent = params.text;\n show(htmlContainer, 'block');\n } // No content\n else {\n hide(htmlContainer);\n }\n\n renderInput(instance, params);\n };\n\n const renderFooter = (instance, params) => {\n const footer = getFooter();\n toggle(footer, params.footer);\n\n if (params.footer) {\n parseHtmlToContainer(params.footer, footer);\n } // Custom class\n\n\n applyCustomClass(footer, params, 'footer');\n };\n\n const renderCloseButton = (instance, params) => {\n const closeButton = getCloseButton();\n setInnerHtml(closeButton, params.closeButtonHtml); // Custom class\n\n applyCustomClass(closeButton, params, 'closeButton');\n toggle(closeButton, params.showCloseButton);\n closeButton.setAttribute('aria-label', params.closeButtonAriaLabel);\n };\n\n const renderIcon = (instance, params) => {\n const innerParams = privateProps.innerParams.get(instance);\n const icon = getIcon(); // if the given icon already rendered, apply the styling without re-rendering the icon\n\n if (innerParams && params.icon === innerParams.icon) {\n // Custom or default content\n setContent(icon, params);\n applyStyles(icon, params);\n return;\n }\n\n if (!params.icon && !params.iconHtml) {\n return hide(icon);\n }\n\n if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) {\n error(\"Unknown icon! Expected \\\"success\\\", \\\"error\\\", \\\"warning\\\", \\\"info\\\" or \\\"question\\\", got \\\"\".concat(params.icon, \"\\\"\"));\n return hide(icon);\n }\n\n show(icon); // Custom or default content\n\n setContent(icon, params);\n applyStyles(icon, params); // Animate icon\n\n addClass(icon, params.showClass.icon);\n };\n\n const applyStyles = (icon, params) => {\n for (const iconType in iconTypes) {\n if (params.icon !== iconType) {\n removeClass(icon, iconTypes[iconType]);\n }\n }\n\n addClass(icon, iconTypes[params.icon]); // Icon color\n\n setColor(icon, params); // Success icon background color\n\n adjustSuccessIconBackgroundColor(); // Custom class\n\n applyCustomClass(icon, params, 'icon');\n }; // Adjust success icon background color to match the popup background color\n\n\n const adjustSuccessIconBackgroundColor = () => {\n const popup = getPopup();\n const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');\n const successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');\n\n for (let i = 0; i < successIconParts.length; i++) {\n successIconParts[i].style.backgroundColor = popupBackgroundColor;\n }\n };\n\n const successIconHtml = \"\\n
\\n \\n
\\n
\\n\";\n const errorIconHtml = \"\\n \\n \\n \\n \\n\";\n\n const setContent = (icon, params) => {\n icon.textContent = '';\n\n if (params.iconHtml) {\n setInnerHtml(icon, iconContent(params.iconHtml));\n } else if (params.icon === 'success') {\n setInnerHtml(icon, successIconHtml);\n } else if (params.icon === 'error') {\n setInnerHtml(icon, errorIconHtml);\n } else {\n const defaultIconHtml = {\n question: '?',\n warning: '!',\n info: 'i'\n };\n setInnerHtml(icon, iconContent(defaultIconHtml[params.icon]));\n }\n };\n\n const setColor = (icon, params) => {\n if (!params.iconColor) {\n return;\n }\n\n icon.style.color = params.iconColor;\n icon.style.borderColor = params.iconColor;\n\n for (const sel of ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']) {\n setStyle(icon, sel, 'backgroundColor', params.iconColor);\n }\n\n setStyle(icon, '.swal2-success-ring', 'borderColor', params.iconColor);\n };\n\n const iconContent = content => \"
\").concat(content, \"
\");\n\n const renderImage = (instance, params) => {\n const image = getImage();\n\n if (!params.imageUrl) {\n return hide(image);\n }\n\n show(image, ''); // Src, alt\n\n image.setAttribute('src', params.imageUrl);\n image.setAttribute('alt', params.imageAlt); // Width, height\n\n applyNumericalStyle(image, 'width', params.imageWidth);\n applyNumericalStyle(image, 'height', params.imageHeight); // Class\n\n image.className = swalClasses.image;\n applyCustomClass(image, params, 'image');\n };\n\n const createStepElement = step => {\n const stepEl = document.createElement('li');\n addClass(stepEl, swalClasses['progress-step']);\n setInnerHtml(stepEl, step);\n return stepEl;\n };\n\n const createLineElement = params => {\n const lineEl = document.createElement('li');\n addClass(lineEl, swalClasses['progress-step-line']);\n\n if (params.progressStepsDistance) {\n lineEl.style.width = params.progressStepsDistance;\n }\n\n return lineEl;\n };\n\n const renderProgressSteps = (instance, params) => {\n const progressStepsContainer = getProgressSteps();\n\n if (!params.progressSteps || params.progressSteps.length === 0) {\n return hide(progressStepsContainer);\n }\n\n show(progressStepsContainer);\n progressStepsContainer.textContent = '';\n\n if (params.currentProgressStep >= params.progressSteps.length) {\n warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');\n }\n\n params.progressSteps.forEach((step, index) => {\n const stepEl = createStepElement(step);\n progressStepsContainer.appendChild(stepEl);\n\n if (index === params.currentProgressStep) {\n addClass(stepEl, swalClasses['active-progress-step']);\n }\n\n if (index !== params.progressSteps.length - 1) {\n const lineEl = createLineElement(params);\n progressStepsContainer.appendChild(lineEl);\n }\n });\n };\n\n const renderTitle = (instance, params) => {\n const title = getTitle();\n toggle(title, params.title || params.titleText, 'block');\n\n if (params.title) {\n parseHtmlToContainer(params.title, title);\n }\n\n if (params.titleText) {\n title.innerText = params.titleText;\n } // Custom class\n\n\n applyCustomClass(title, params, 'title');\n };\n\n const renderPopup = (instance, params) => {\n const container = getContainer();\n const popup = getPopup(); // Width\n // https://github.com/sweetalert2/sweetalert2/issues/2170\n\n if (params.toast) {\n applyNumericalStyle(container, 'width', params.width);\n popup.style.width = '100%';\n popup.insertBefore(getLoader(), getIcon());\n } else {\n applyNumericalStyle(popup, 'width', params.width);\n } // Padding\n\n\n applyNumericalStyle(popup, 'padding', params.padding); // Color\n\n if (params.color) {\n popup.style.color = params.color;\n } // Background\n\n\n if (params.background) {\n popup.style.background = params.background;\n }\n\n hide(getValidationMessage()); // Classes\n\n addClasses(popup, params);\n };\n\n const addClasses = (popup, params) => {\n // Default Class + showClass when updating Swal.update({})\n popup.className = \"\".concat(swalClasses.popup, \" \").concat(isVisible(popup) ? params.showClass.popup : '');\n\n if (params.toast) {\n addClass([document.documentElement, document.body], swalClasses['toast-shown']);\n addClass(popup, swalClasses.toast);\n } else {\n addClass(popup, swalClasses.modal);\n } // Custom class\n\n\n applyCustomClass(popup, params, 'popup');\n\n if (typeof params.customClass === 'string') {\n addClass(popup, params.customClass);\n } // Icon class (#1842)\n\n\n if (params.icon) {\n addClass(popup, swalClasses[\"icon-\".concat(params.icon)]);\n }\n };\n\n const render = (instance, params) => {\n renderPopup(instance, params);\n renderContainer(instance, params);\n renderProgressSteps(instance, params);\n renderIcon(instance, params);\n renderImage(instance, params);\n renderTitle(instance, params);\n renderCloseButton(instance, params);\n renderContent(instance, params);\n renderActions(instance, params);\n renderFooter(instance, params);\n\n if (typeof params.didRender === 'function') {\n params.didRender(getPopup());\n }\n };\n\n const DismissReason = Object.freeze({\n cancel: 'cancel',\n backdrop: 'backdrop',\n close: 'close',\n esc: 'esc',\n timer: 'timer'\n });\n\n // Adding aria-hidden=\"true\" to elements outside of the active modal dialog ensures that\n // elements not within the active modal dialog will not be surfaced if a user opens a screen\n // reader\u2019s list of elements (headings, form controls, landmarks, etc.) in the document.\n\n const setAriaHidden = () => {\n const bodyChildren = toArray(document.body.children);\n bodyChildren.forEach(el => {\n if (el === getContainer() || el.contains(getContainer())) {\n return;\n }\n\n if (el.hasAttribute('aria-hidden')) {\n el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden'));\n }\n\n el.setAttribute('aria-hidden', 'true');\n });\n };\n const unsetAriaHidden = () => {\n const bodyChildren = toArray(document.body.children);\n bodyChildren.forEach(el => {\n if (el.hasAttribute('data-previous-aria-hidden')) {\n el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden'));\n el.removeAttribute('data-previous-aria-hidden');\n } else {\n el.removeAttribute('aria-hidden');\n }\n });\n };\n\n const swalStringParams = ['swal-title', 'swal-html', 'swal-footer'];\n const getTemplateParams = params => {\n const template = typeof params.template === 'string' ? document.querySelector(params.template) : params.template;\n\n if (!template) {\n return {};\n }\n /** @type {DocumentFragment} */\n\n\n const templateContent = template.content;\n showWarningsForElements(templateContent);\n const result = Object.assign(getSwalParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams));\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n const getSwalParams = templateContent => {\n const result = {};\n toArray(templateContent.querySelectorAll('swal-param')).forEach(param => {\n showWarningsForAttributes(param, ['name', 'value']);\n const paramName = param.getAttribute('name');\n const value = param.getAttribute('value');\n\n if (typeof defaultParams[paramName] === 'boolean' && value === 'false') {\n result[paramName] = false;\n }\n\n if (typeof defaultParams[paramName] === 'object') {\n result[paramName] = JSON.parse(value);\n }\n });\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalButtons = templateContent => {\n const result = {};\n toArray(templateContent.querySelectorAll('swal-button')).forEach(button => {\n showWarningsForAttributes(button, ['type', 'color', 'aria-label']);\n const type = button.getAttribute('type');\n result[\"\".concat(type, \"ButtonText\")] = button.innerHTML;\n result[\"show\".concat(capitalizeFirstLetter(type), \"Button\")] = true;\n\n if (button.hasAttribute('color')) {\n result[\"\".concat(type, \"ButtonColor\")] = button.getAttribute('color');\n }\n\n if (button.hasAttribute('aria-label')) {\n result[\"\".concat(type, \"ButtonAriaLabel\")] = button.getAttribute('aria-label');\n }\n });\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalImage = templateContent => {\n const result = {};\n /** @type {HTMLElement} */\n\n const image = templateContent.querySelector('swal-image');\n\n if (image) {\n showWarningsForAttributes(image, ['src', 'width', 'height', 'alt']);\n\n if (image.hasAttribute('src')) {\n result.imageUrl = image.getAttribute('src');\n }\n\n if (image.hasAttribute('width')) {\n result.imageWidth = image.getAttribute('width');\n }\n\n if (image.hasAttribute('height')) {\n result.imageHeight = image.getAttribute('height');\n }\n\n if (image.hasAttribute('alt')) {\n result.imageAlt = image.getAttribute('alt');\n }\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalIcon = templateContent => {\n const result = {};\n /** @type {HTMLElement} */\n\n const icon = templateContent.querySelector('swal-icon');\n\n if (icon) {\n showWarningsForAttributes(icon, ['type', 'color']);\n\n if (icon.hasAttribute('type')) {\n result.icon = icon.getAttribute('type');\n }\n\n if (icon.hasAttribute('color')) {\n result.iconColor = icon.getAttribute('color');\n }\n\n result.iconHtml = icon.innerHTML;\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalInput = templateContent => {\n const result = {};\n /** @type {HTMLElement} */\n\n const input = templateContent.querySelector('swal-input');\n\n if (input) {\n showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']);\n result.input = input.getAttribute('type') || 'text';\n\n if (input.hasAttribute('label')) {\n result.inputLabel = input.getAttribute('label');\n }\n\n if (input.hasAttribute('placeholder')) {\n result.inputPlaceholder = input.getAttribute('placeholder');\n }\n\n if (input.hasAttribute('value')) {\n result.inputValue = input.getAttribute('value');\n }\n }\n\n const inputOptions = templateContent.querySelectorAll('swal-input-option');\n\n if (inputOptions.length) {\n result.inputOptions = {};\n toArray(inputOptions).forEach(option => {\n showWarningsForAttributes(option, ['value']);\n const optionValue = option.getAttribute('value');\n const optionName = option.innerHTML;\n result.inputOptions[optionValue] = optionName;\n });\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n * @param {string[]} paramNames\n */\n\n\n const getSwalStringParams = (templateContent, paramNames) => {\n const result = {};\n\n for (const i in paramNames) {\n const paramName = paramNames[i];\n /** @type {HTMLElement} */\n\n const tag = templateContent.querySelector(paramName);\n\n if (tag) {\n showWarningsForAttributes(tag, []);\n result[paramName.replace(/^swal-/, '')] = tag.innerHTML.trim();\n }\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const showWarningsForElements = templateContent => {\n const allowedElements = swalStringParams.concat(['swal-param', 'swal-button', 'swal-image', 'swal-icon', 'swal-input', 'swal-input-option']);\n toArray(templateContent.children).forEach(el => {\n const tagName = el.tagName.toLowerCase();\n\n if (allowedElements.indexOf(tagName) === -1) {\n warn(\"Unrecognized element <\".concat(tagName, \">\"));\n }\n });\n };\n /**\n * @param {HTMLElement} el\n * @param {string[]} allowedAttributes\n */\n\n\n const showWarningsForAttributes = (el, allowedAttributes) => {\n toArray(el.attributes).forEach(attribute => {\n if (allowedAttributes.indexOf(attribute.name) === -1) {\n warn([\"Unrecognized attribute \\\"\".concat(attribute.name, \"\\\" on <\").concat(el.tagName.toLowerCase(), \">.\"), \"\".concat(allowedAttributes.length ? \"Allowed attributes are: \".concat(allowedAttributes.join(', ')) : 'To set the value, use HTML within the element.')]);\n }\n });\n };\n\n var defaultInputValidators = {\n email: (string, validationMessage) => {\n return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,24}$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address');\n },\n url: (string, validationMessage) => {\n // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 and #2013\n return /^https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-z]{2,63}\\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL');\n }\n };\n\n function setDefaultInputValidators(params) {\n // Use default `inputValidator` for supported input types if not provided\n if (!params.inputValidator) {\n Object.keys(defaultInputValidators).forEach(key => {\n if (params.input === key) {\n params.inputValidator = defaultInputValidators[key];\n }\n });\n }\n }\n\n function validateCustomTargetElement(params) {\n // Determine if the custom target element is valid\n if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) {\n warn('Target parameter is not valid, defaulting to \"body\"');\n params.target = 'body';\n }\n }\n /**\n * Set type, text and actions on popup\n *\n * @param params\n */\n\n\n function setParameters(params) {\n setDefaultInputValidators(params); // showLoaderOnConfirm && preConfirm\n\n if (params.showLoaderOnConfirm && !params.preConfirm) {\n warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\\n' + 'https://sweetalert2.github.io/#ajax-request');\n }\n\n validateCustomTargetElement(params); // Replace newlines with
in title\n\n if (typeof params.title === 'string') {\n params.title = params.title.split('\\n').join('
');\n }\n\n init(params);\n }\n\n class Timer {\n constructor(callback, delay) {\n this.callback = callback;\n this.remaining = delay;\n this.running = false;\n this.start();\n }\n\n start() {\n if (!this.running) {\n this.running = true;\n this.started = new Date();\n this.id = setTimeout(this.callback, this.remaining);\n }\n\n return this.remaining;\n }\n\n stop() {\n if (this.running) {\n this.running = false;\n clearTimeout(this.id);\n this.remaining -= new Date().getTime() - this.started.getTime();\n }\n\n return this.remaining;\n }\n\n increase(n) {\n const running = this.running;\n\n if (running) {\n this.stop();\n }\n\n this.remaining += n;\n\n if (running) {\n this.start();\n }\n\n return this.remaining;\n }\n\n getTimerLeft() {\n if (this.running) {\n this.stop();\n this.start();\n }\n\n return this.remaining;\n }\n\n isRunning() {\n return this.running;\n }\n\n }\n\n const fixScrollbar = () => {\n // for queues, do not do this more than once\n if (states.previousBodyPadding !== null) {\n return;\n } // if the body has overflow\n\n\n if (document.body.scrollHeight > window.innerHeight) {\n // add padding so the content doesn't shift after removal of scrollbar\n states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'));\n document.body.style.paddingRight = \"\".concat(states.previousBodyPadding + measureScrollbar(), \"px\");\n }\n };\n const undoScrollbar = () => {\n if (states.previousBodyPadding !== null) {\n document.body.style.paddingRight = \"\".concat(states.previousBodyPadding, \"px\");\n states.previousBodyPadding = null;\n }\n };\n\n /* istanbul ignore file */\n\n const iOSfix = () => {\n const iOS = // @ts-ignore\n /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;\n\n if (iOS && !hasClass(document.body, swalClasses.iosfix)) {\n const offset = document.body.scrollTop;\n document.body.style.top = \"\".concat(offset * -1, \"px\");\n addClass(document.body, swalClasses.iosfix);\n lockBodyScroll();\n addBottomPaddingForTallPopups();\n }\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1948\n */\n\n const addBottomPaddingForTallPopups = () => {\n const ua = navigator.userAgent;\n const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i);\n const webkit = !!ua.match(/WebKit/i);\n const iOSSafari = iOS && webkit && !ua.match(/CriOS/i);\n\n if (iOSSafari) {\n const bottomPanelHeight = 44;\n\n if (getPopup().scrollHeight > window.innerHeight - bottomPanelHeight) {\n getContainer().style.paddingBottom = \"\".concat(bottomPanelHeight, \"px\");\n }\n }\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1246\n */\n\n\n const lockBodyScroll = () => {\n const container = getContainer();\n let preventTouchMove;\n\n container.ontouchstart = e => {\n preventTouchMove = shouldPreventTouchMove(e);\n };\n\n container.ontouchmove = e => {\n if (preventTouchMove) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n };\n\n const shouldPreventTouchMove = event => {\n const target = event.target;\n const container = getContainer();\n\n if (isStylus(event) || isZoom(event)) {\n return false;\n }\n\n if (target === container) {\n return true;\n }\n\n if (!isScrollable(container) && target.tagName !== 'INPUT' && // #1603\n target.tagName !== 'TEXTAREA' && // #2266\n !(isScrollable(getHtmlContainer()) && // #1944\n getHtmlContainer().contains(target))) {\n return true;\n }\n\n return false;\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1786\n *\n * @param {*} event\n * @returns {boolean}\n */\n\n\n const isStylus = event => {\n return event.touches && event.touches.length && event.touches[0].touchType === 'stylus';\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1891\n *\n * @param {TouchEvent} event\n * @returns {boolean}\n */\n\n\n const isZoom = event => {\n return event.touches && event.touches.length > 1;\n };\n\n const undoIOSfix = () => {\n if (hasClass(document.body, swalClasses.iosfix)) {\n const offset = parseInt(document.body.style.top, 10);\n removeClass(document.body, swalClasses.iosfix);\n document.body.style.top = '';\n document.body.scrollTop = offset * -1;\n }\n };\n\n const SHOW_CLASS_TIMEOUT = 10;\n /**\n * Open popup, add necessary classes and styles, fix scrollbar\n *\n * @param params\n */\n\n const openPopup = params => {\n const container = getContainer();\n const popup = getPopup();\n\n if (typeof params.willOpen === 'function') {\n params.willOpen(popup);\n }\n\n const bodyStyles = window.getComputedStyle(document.body);\n const initialBodyOverflow = bodyStyles.overflowY;\n addClasses$1(container, popup, params); // scrolling is 'hidden' until animation is done, after that 'auto'\n\n setTimeout(() => {\n setScrollingVisibility(container, popup);\n }, SHOW_CLASS_TIMEOUT);\n\n if (isModal()) {\n fixScrollContainer(container, params.scrollbarPadding, initialBodyOverflow);\n setAriaHidden();\n }\n\n if (!isToast() && !globalState.previousActiveElement) {\n globalState.previousActiveElement = document.activeElement;\n }\n\n if (typeof params.didOpen === 'function') {\n setTimeout(() => params.didOpen(popup));\n }\n\n removeClass(container, swalClasses['no-transition']);\n };\n\n const swalOpenAnimationFinished = event => {\n const popup = getPopup();\n\n if (event.target !== popup) {\n return;\n }\n\n const container = getContainer();\n popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished);\n container.style.overflowY = 'auto';\n };\n\n const setScrollingVisibility = (container, popup) => {\n if (animationEndEvent && hasCssAnimation(popup)) {\n container.style.overflowY = 'hidden';\n popup.addEventListener(animationEndEvent, swalOpenAnimationFinished);\n } else {\n container.style.overflowY = 'auto';\n }\n };\n\n const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) => {\n iOSfix();\n\n if (scrollbarPadding && initialBodyOverflow !== 'hidden') {\n fixScrollbar();\n } // sweetalert2/issues/1247\n\n\n setTimeout(() => {\n container.scrollTop = 0;\n });\n };\n\n const addClasses$1 = (container, popup, params) => {\n addClass(container, params.showClass.backdrop); // this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059\n\n popup.style.setProperty('opacity', '0', 'important');\n show(popup, 'grid');\n setTimeout(() => {\n // Animate popup right after showing it\n addClass(popup, params.showClass.popup); // and remove the opacity workaround\n\n popup.style.removeProperty('opacity');\n }, SHOW_CLASS_TIMEOUT); // 10ms in order to fix #2062\n\n addClass([document.documentElement, document.body], swalClasses.shown);\n\n if (params.heightAuto && params.backdrop && !params.toast) {\n addClass([document.documentElement, document.body], swalClasses['height-auto']);\n }\n };\n\n /**\n * Shows loader (spinner), this is useful with AJAX requests.\n * By default the loader be shown instead of the \"Confirm\" button.\n */\n\n const showLoading = buttonToReplace => {\n let popup = getPopup();\n\n if (!popup) {\n new Swal(); // eslint-disable-line no-new\n }\n\n popup = getPopup();\n const loader = getLoader();\n\n if (isToast()) {\n hide(getIcon());\n } else {\n replaceButton(popup, buttonToReplace);\n }\n\n show(loader);\n popup.setAttribute('data-loading', true);\n popup.setAttribute('aria-busy', true);\n popup.focus();\n };\n\n const replaceButton = (popup, buttonToReplace) => {\n const actions = getActions();\n const loader = getLoader();\n\n if (!buttonToReplace && isVisible(getConfirmButton())) {\n buttonToReplace = getConfirmButton();\n }\n\n show(actions);\n\n if (buttonToReplace) {\n hide(buttonToReplace);\n loader.setAttribute('data-button-to-replace', buttonToReplace.className);\n }\n\n loader.parentNode.insertBefore(loader, buttonToReplace);\n addClass([popup, actions], swalClasses.loading);\n };\n\n const handleInputOptionsAndValue = (instance, params) => {\n if (params.input === 'select' || params.input === 'radio') {\n handleInputOptions(instance, params);\n } else if (['text', 'email', 'number', 'tel', 'textarea'].includes(params.input) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) {\n showLoading(getConfirmButton());\n handleInputValue(instance, params);\n }\n };\n const getInputValue = (instance, innerParams) => {\n const input = instance.getInput();\n\n if (!input) {\n return null;\n }\n\n switch (innerParams.input) {\n case 'checkbox':\n return getCheckboxValue(input);\n\n case 'radio':\n return getRadioValue(input);\n\n case 'file':\n return getFileValue(input);\n\n default:\n return innerParams.inputAutoTrim ? input.value.trim() : input.value;\n }\n };\n\n const getCheckboxValue = input => input.checked ? 1 : 0;\n\n const getRadioValue = input => input.checked ? input.value : null;\n\n const getFileValue = input => input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null;\n\n const handleInputOptions = (instance, params) => {\n const popup = getPopup();\n\n const processInputOptions = inputOptions => populateInputOptions[params.input](popup, formatInputOptions(inputOptions), params);\n\n if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) {\n showLoading(getConfirmButton());\n asPromise(params.inputOptions).then(inputOptions => {\n instance.hideLoading();\n processInputOptions(inputOptions);\n });\n } else if (typeof params.inputOptions === 'object') {\n processInputOptions(params.inputOptions);\n } else {\n error(\"Unexpected type of inputOptions! Expected object, Map or Promise, got \".concat(typeof params.inputOptions));\n }\n };\n\n const handleInputValue = (instance, params) => {\n const input = instance.getInput();\n hide(input);\n asPromise(params.inputValue).then(inputValue => {\n input.value = params.input === 'number' ? parseFloat(inputValue) || 0 : \"\".concat(inputValue);\n show(input);\n input.focus();\n instance.hideLoading();\n }).catch(err => {\n error(\"Error in inputValue promise: \".concat(err));\n input.value = '';\n show(input);\n input.focus();\n instance.hideLoading();\n });\n };\n\n const populateInputOptions = {\n select: (popup, inputOptions, params) => {\n const select = getDirectChildByClass(popup, swalClasses.select);\n\n const renderOption = (parent, optionLabel, optionValue) => {\n const option = document.createElement('option');\n option.value = optionValue;\n setInnerHtml(option, optionLabel);\n option.selected = isSelected(optionValue, params.inputValue);\n parent.appendChild(option);\n };\n\n inputOptions.forEach(inputOption => {\n const optionValue = inputOption[0];\n const optionLabel = inputOption[1]; // spec:\n // https://www.w3.org/TR/html401/interact/forms.html#h-17.6\n // \"...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)...\"\n // check whether this is a \n\n if (Array.isArray(optionLabel)) {\n // if it is an array, then it is an \n const optgroup = document.createElement('optgroup');\n optgroup.label = optionValue;\n optgroup.disabled = false; // not configurable for now\n\n select.appendChild(optgroup);\n optionLabel.forEach(o => renderOption(optgroup, o[1], o[0]));\n } else {\n // case of \n valueFormatted = formatInputOptions(valueFormatted);\n }\n\n result.push([key, valueFormatted]);\n });\n } else {\n Object.keys(inputOptions).forEach(key => {\n let valueFormatted = inputOptions[key];\n\n if (typeof valueFormatted === 'object') {\n // case of \n valueFormatted = formatInputOptions(valueFormatted);\n }\n\n result.push([key, valueFormatted]);\n });\n }\n\n return result;\n };\n\n const isSelected = (optionValue, inputValue) => {\n return inputValue && inputValue.toString() === optionValue.toString();\n };\n\n /**\n * Hides loader and shows back the button which was hidden by .showLoading()\n */\n\n function hideLoading() {\n // do nothing if popup is closed\n const innerParams = privateProps.innerParams.get(this);\n\n if (!innerParams) {\n return;\n }\n\n const domCache = privateProps.domCache.get(this);\n hide(domCache.loader);\n\n if (isToast()) {\n if (innerParams.icon) {\n show(getIcon());\n }\n } else {\n showRelatedButton(domCache);\n }\n\n removeClass([domCache.popup, domCache.actions], swalClasses.loading);\n domCache.popup.removeAttribute('aria-busy');\n domCache.popup.removeAttribute('data-loading');\n domCache.confirmButton.disabled = false;\n domCache.denyButton.disabled = false;\n domCache.cancelButton.disabled = false;\n }\n\n const showRelatedButton = domCache => {\n const buttonToReplace = domCache.popup.getElementsByClassName(domCache.loader.getAttribute('data-button-to-replace'));\n\n if (buttonToReplace.length) {\n show(buttonToReplace[0], 'inline-block');\n } else if (allButtonsAreHidden()) {\n hide(domCache.actions);\n }\n };\n\n /**\n * Gets the input DOM node, this method works with input parameter.\n * @returns {HTMLElement | null}\n */\n\n function getInput$1(instance) {\n const innerParams = privateProps.innerParams.get(instance || this);\n const domCache = privateProps.domCache.get(instance || this);\n\n if (!domCache) {\n return null;\n }\n\n return getInput(domCache.popup, innerParams.input);\n }\n\n /**\n * This module contains `WeakMap`s for each effectively-\"private property\" that a `Swal` has.\n * For example, to set the private property \"foo\" of `this` to \"bar\", you can `privateProps.foo.set(this, 'bar')`\n * This is the approach that Babel will probably take to implement private methods/fields\n * https://github.com/tc39/proposal-private-methods\n * https://github.com/babel/babel/pull/7555\n * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*\n * then we can use that language feature.\n */\n var privateMethods = {\n swalPromiseResolve: new WeakMap(),\n swalPromiseReject: new WeakMap()\n };\n\n /*\n * Global function to determine if SweetAlert2 popup is shown\n */\n\n const isVisible$1 = () => {\n return isVisible(getPopup());\n };\n /*\n * Global function to click 'Confirm' button\n */\n\n const clickConfirm = () => getConfirmButton() && getConfirmButton().click();\n /*\n * Global function to click 'Deny' button\n */\n\n const clickDeny = () => getDenyButton() && getDenyButton().click();\n /*\n * Global function to click 'Cancel' button\n */\n\n const clickCancel = () => getCancelButton() && getCancelButton().click();\n\n const removeKeydownHandler = globalState => {\n if (globalState.keydownTarget && globalState.keydownHandlerAdded) {\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n };\n const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {\n removeKeydownHandler(globalState);\n\n if (!innerParams.toast) {\n globalState.keydownHandler = e => keydownHandler(instance, e, dismissWith);\n\n globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup();\n globalState.keydownListenerCapture = innerParams.keydownListenerCapture;\n globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = true;\n }\n }; // Focus handling\n\n const setFocus = (innerParams, index, increment) => {\n const focusableElements = getFocusableElements(); // search for visible elements and select the next possible match\n\n if (focusableElements.length) {\n index = index + increment; // rollover to first item\n\n if (index === focusableElements.length) {\n index = 0; // go to last item\n } else if (index === -1) {\n index = focusableElements.length - 1;\n }\n\n return focusableElements[index].focus();\n } // no visible focusable elements, focus the popup\n\n\n getPopup().focus();\n };\n const arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];\n const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];\n\n const keydownHandler = (instance, e, dismissWith) => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams) {\n return; // This instance has already been destroyed\n } // Ignore keydown during IME composition\n // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition\n // https://github.com/sweetalert2/sweetalert2/issues/720\n // https://github.com/sweetalert2/sweetalert2/issues/2406\n\n\n if (e.isComposing || e.keyCode === 229) {\n return;\n }\n\n if (innerParams.stopKeydownPropagation) {\n e.stopPropagation();\n } // ENTER\n\n\n if (e.key === 'Enter') {\n handleEnter(instance, e, innerParams);\n } // TAB\n else if (e.key === 'Tab') {\n handleTab(e, innerParams);\n } // ARROWS - switch focus between buttons\n else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(e.key)) {\n handleArrows(e.key);\n } // ESC\n else if (e.key === 'Escape') {\n handleEsc(e, innerParams, dismissWith);\n }\n };\n\n const handleEnter = (instance, e, innerParams) => {\n // https://github.com/sweetalert2/sweetalert2/issues/2386\n if (!callIfFunction(innerParams.allowEnterKey)) {\n return;\n }\n\n if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) {\n if (['textarea', 'file'].includes(innerParams.input)) {\n return; // do not submit\n }\n\n clickConfirm();\n e.preventDefault();\n }\n };\n\n const handleTab = (e, innerParams) => {\n const targetElement = e.target;\n const focusableElements = getFocusableElements();\n let btnIndex = -1;\n\n for (let i = 0; i < focusableElements.length; i++) {\n if (targetElement === focusableElements[i]) {\n btnIndex = i;\n break;\n }\n } // Cycle to the next button\n\n\n if (!e.shiftKey) {\n setFocus(innerParams, btnIndex, 1);\n } // Cycle to the prev button\n else {\n setFocus(innerParams, btnIndex, -1);\n }\n\n e.stopPropagation();\n e.preventDefault();\n };\n\n const handleArrows = key => {\n const confirmButton = getConfirmButton();\n const denyButton = getDenyButton();\n const cancelButton = getCancelButton();\n\n if (![confirmButton, denyButton, cancelButton].includes(document.activeElement)) {\n return;\n }\n\n const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';\n let buttonToFocus = document.activeElement;\n\n for (let i = 0; i < getActions().children.length; i++) {\n buttonToFocus = buttonToFocus[sibling];\n\n if (!buttonToFocus) {\n return;\n }\n\n if (isVisible(buttonToFocus) && buttonToFocus instanceof HTMLButtonElement) {\n break;\n }\n }\n\n if (buttonToFocus instanceof HTMLButtonElement) {\n buttonToFocus.focus();\n }\n };\n\n const handleEsc = (e, innerParams, dismissWith) => {\n if (callIfFunction(innerParams.allowEscapeKey)) {\n e.preventDefault();\n dismissWith(DismissReason.esc);\n }\n };\n\n /*\n * Instance method to close sweetAlert\n */\n\n function removePopupAndResetState(instance, container, returnFocus, didClose) {\n if (isToast()) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose));\n removeKeydownHandler(globalState);\n }\n\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // workaround for #2088\n // for some reason removing the container in Safari will scroll the document to bottom\n\n if (isSafari) {\n container.setAttribute('style', 'display:none !important');\n container.removeAttribute('class');\n container.innerHTML = '';\n } else {\n container.remove();\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }\n\n function removeBodyClasses() {\n removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]);\n }\n\n function close(resolveValue) {\n resolveValue = prepareResolveValue(resolveValue);\n const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);\n const didClose = triggerClosePopup(this);\n\n if (this.isAwaitingPromise()) {\n // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335\n if (!resolveValue.isDismissed) {\n handleAwaitingPromise(this);\n swalPromiseResolve(resolveValue);\n }\n } else if (didClose) {\n // Resolve Swal promise\n swalPromiseResolve(resolveValue);\n }\n }\n function isAwaitingPromise() {\n return !!privateProps.awaitingPromise.get(this);\n }\n\n const triggerClosePopup = instance => {\n const popup = getPopup();\n\n if (!popup) {\n return false;\n }\n\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) {\n return false;\n }\n\n removeClass(popup, innerParams.showClass.popup);\n addClass(popup, innerParams.hideClass.popup);\n const backdrop = getContainer();\n removeClass(backdrop, innerParams.showClass.backdrop);\n addClass(backdrop, innerParams.hideClass.backdrop);\n handlePopupAnimation(instance, popup, innerParams);\n return true;\n };\n\n function rejectPromise(error) {\n const rejectPromise = privateMethods.swalPromiseReject.get(this);\n handleAwaitingPromise(this);\n\n if (rejectPromise) {\n // Reject Swal promise\n rejectPromise(error);\n }\n }\n const handleAwaitingPromise = instance => {\n if (instance.isAwaitingPromise()) {\n privateProps.awaitingPromise.delete(instance); // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335\n\n if (!privateProps.innerParams.get(instance)) {\n instance._destroy();\n }\n }\n };\n\n const prepareResolveValue = resolveValue => {\n // When user calls Swal.close()\n if (typeof resolveValue === 'undefined') {\n return {\n isConfirmed: false,\n isDenied: false,\n isDismissed: true\n };\n }\n\n return Object.assign({\n isConfirmed: false,\n isDenied: false,\n isDismissed: false\n }, resolveValue);\n };\n\n const handlePopupAnimation = (instance, popup, innerParams) => {\n const container = getContainer(); // If animation is supported, animate\n\n const animationIsSupported = animationEndEvent && hasCssAnimation(popup);\n\n if (typeof innerParams.willClose === 'function') {\n innerParams.willClose(popup);\n }\n\n if (animationIsSupported) {\n animatePopup(instance, popup, container, innerParams.returnFocus, innerParams.didClose);\n } else {\n // Otherwise, remove immediately\n removePopupAndResetState(instance, container, innerParams.returnFocus, innerParams.didClose);\n }\n };\n\n const animatePopup = (instance, popup, container, returnFocus, didClose) => {\n globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose);\n popup.addEventListener(animationEndEvent, function (e) {\n if (e.target === popup) {\n globalState.swalCloseEventFinishedCallback();\n delete globalState.swalCloseEventFinishedCallback;\n }\n });\n };\n\n const triggerDidCloseAndDispose = (instance, didClose) => {\n setTimeout(() => {\n if (typeof didClose === 'function') {\n didClose.bind(instance.params)();\n }\n\n instance._destroy();\n });\n };\n\n function setButtonsDisabled(instance, buttons, disabled) {\n const domCache = privateProps.domCache.get(instance);\n buttons.forEach(button => {\n domCache[button].disabled = disabled;\n });\n }\n\n function setInputDisabled(input, disabled) {\n if (!input) {\n return false;\n }\n\n if (input.type === 'radio') {\n const radiosContainer = input.parentNode.parentNode;\n const radios = radiosContainer.querySelectorAll('input');\n\n for (let i = 0; i < radios.length; i++) {\n radios[i].disabled = disabled;\n }\n } else {\n input.disabled = disabled;\n }\n }\n\n function enableButtons() {\n setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false);\n }\n function disableButtons() {\n setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true);\n }\n function enableInput() {\n return setInputDisabled(this.getInput(), false);\n }\n function disableInput() {\n return setInputDisabled(this.getInput(), true);\n }\n\n function showValidationMessage(error) {\n const domCache = privateProps.domCache.get(this);\n const params = privateProps.innerParams.get(this);\n setInnerHtml(domCache.validationMessage, error);\n domCache.validationMessage.className = swalClasses['validation-message'];\n\n if (params.customClass && params.customClass.validationMessage) {\n addClass(domCache.validationMessage, params.customClass.validationMessage);\n }\n\n show(domCache.validationMessage);\n const input = this.getInput();\n\n if (input) {\n input.setAttribute('aria-invalid', true);\n input.setAttribute('aria-describedby', swalClasses['validation-message']);\n focusInput(input);\n addClass(input, swalClasses.inputerror);\n }\n } // Hide block with validation message\n\n function resetValidationMessage$1() {\n const domCache = privateProps.domCache.get(this);\n\n if (domCache.validationMessage) {\n hide(domCache.validationMessage);\n }\n\n const input = this.getInput();\n\n if (input) {\n input.removeAttribute('aria-invalid');\n input.removeAttribute('aria-describedby');\n removeClass(input, swalClasses.inputerror);\n }\n }\n\n function getProgressSteps$1() {\n const domCache = privateProps.domCache.get(this);\n return domCache.progressSteps;\n }\n\n /**\n * Updates popup parameters.\n */\n\n function update(params) {\n const popup = getPopup();\n const innerParams = privateProps.innerParams.get(this);\n\n if (!popup || hasClass(popup, innerParams.hideClass.popup)) {\n return warn(\"You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.\");\n }\n\n const validUpdatableParams = filterValidParams(params);\n const updatedParams = Object.assign({}, innerParams, validUpdatableParams);\n render(this, updatedParams);\n privateProps.innerParams.set(this, updatedParams);\n Object.defineProperties(this, {\n params: {\n value: Object.assign({}, this.params, params),\n writable: false,\n enumerable: true\n }\n });\n }\n\n const filterValidParams = params => {\n const validUpdatableParams = {};\n Object.keys(params).forEach(param => {\n if (isUpdatableParameter(param)) {\n validUpdatableParams[param] = params[param];\n } else {\n warn(\"Invalid parameter to update: \\\"\".concat(param, \"\\\". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js\\n\\nIf you think this parameter should be updatable, request it here: https://github.com/sweetalert2/sweetalert2/issues/new?template=02_feature_request.md\"));\n }\n });\n return validUpdatableParams;\n };\n\n function _destroy() {\n const domCache = privateProps.domCache.get(this);\n const innerParams = privateProps.innerParams.get(this);\n\n if (!innerParams) {\n disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335\n\n return; // This instance has already been destroyed\n } // Check if there is another Swal closing\n\n\n if (domCache.popup && globalState.swalCloseEventFinishedCallback) {\n globalState.swalCloseEventFinishedCallback();\n delete globalState.swalCloseEventFinishedCallback;\n } // Check if there is a swal disposal defer timer\n\n\n if (globalState.deferDisposalTimer) {\n clearTimeout(globalState.deferDisposalTimer);\n delete globalState.deferDisposalTimer;\n }\n\n if (typeof innerParams.didDestroy === 'function') {\n innerParams.didDestroy();\n }\n\n disposeSwal(this);\n }\n\n const disposeSwal = instance => {\n disposeWeakMaps(instance); // Unset this.params so GC will dispose it (#1569)\n\n delete instance.params; // Unset globalState props so GC will dispose globalState (#1569)\n\n delete globalState.keydownHandler;\n delete globalState.keydownTarget; // Unset currentInstance\n\n delete globalState.currentInstance;\n };\n\n const disposeWeakMaps = instance => {\n // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335\n if (instance.isAwaitingPromise()) {\n unsetWeakMaps(privateProps, instance);\n privateProps.awaitingPromise.set(instance, true);\n } else {\n unsetWeakMaps(privateMethods, instance);\n unsetWeakMaps(privateProps, instance);\n }\n };\n\n const unsetWeakMaps = (obj, instance) => {\n for (const i in obj) {\n obj[i].delete(instance);\n }\n };\n\n\n\n var instanceMethods = /*#__PURE__*/Object.freeze({\n hideLoading: hideLoading,\n disableLoading: hideLoading,\n getInput: getInput$1,\n close: close,\n isAwaitingPromise: isAwaitingPromise,\n rejectPromise: rejectPromise,\n handleAwaitingPromise: handleAwaitingPromise,\n closePopup: close,\n closeModal: close,\n closeToast: close,\n enableButtons: enableButtons,\n disableButtons: disableButtons,\n enableInput: enableInput,\n disableInput: disableInput,\n showValidationMessage: showValidationMessage,\n resetValidationMessage: resetValidationMessage$1,\n getProgressSteps: getProgressSteps$1,\n update: update,\n _destroy: _destroy\n });\n\n const handleConfirmButtonClick = instance => {\n const innerParams = privateProps.innerParams.get(instance);\n instance.disableButtons();\n\n if (innerParams.input) {\n handleConfirmOrDenyWithInput(instance, 'confirm');\n } else {\n confirm(instance, true);\n }\n };\n const handleDenyButtonClick = instance => {\n const innerParams = privateProps.innerParams.get(instance);\n instance.disableButtons();\n\n if (innerParams.returnInputValueOnDeny) {\n handleConfirmOrDenyWithInput(instance, 'deny');\n } else {\n deny(instance, false);\n }\n };\n const handleCancelButtonClick = (instance, dismissWith) => {\n instance.disableButtons();\n dismissWith(DismissReason.cancel);\n };\n\n const handleConfirmOrDenyWithInput = (instance, type\n /* 'confirm' | 'deny' */\n ) => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams.input) {\n return error(\"The \\\"input\\\" parameter is needed to be set when using returnInputValueOn\".concat(capitalizeFirstLetter(type)));\n }\n\n const inputValue = getInputValue(instance, innerParams);\n\n if (innerParams.inputValidator) {\n handleInputValidator(instance, inputValue, type);\n } else if (!instance.getInput().checkValidity()) {\n instance.enableButtons();\n instance.showValidationMessage(innerParams.validationMessage);\n } else if (type === 'deny') {\n deny(instance, inputValue);\n } else {\n confirm(instance, inputValue);\n }\n };\n\n const handleInputValidator = (instance, inputValue, type\n /* 'confirm' | 'deny' */\n ) => {\n const innerParams = privateProps.innerParams.get(instance);\n instance.disableInput();\n const validationPromise = Promise.resolve().then(() => asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage)));\n validationPromise.then(validationMessage => {\n instance.enableButtons();\n instance.enableInput();\n\n if (validationMessage) {\n instance.showValidationMessage(validationMessage);\n } else if (type === 'deny') {\n deny(instance, inputValue);\n } else {\n confirm(instance, inputValue);\n }\n });\n };\n\n const deny = (instance, value) => {\n const innerParams = privateProps.innerParams.get(instance || undefined);\n\n if (innerParams.showLoaderOnDeny) {\n showLoading(getDenyButton());\n }\n\n if (innerParams.preDeny) {\n privateProps.awaitingPromise.set(instance || undefined, true); // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received\n\n const preDenyPromise = Promise.resolve().then(() => asPromise(innerParams.preDeny(value, innerParams.validationMessage)));\n preDenyPromise.then(preDenyValue => {\n if (preDenyValue === false) {\n instance.hideLoading();\n handleAwaitingPromise(instance);\n } else {\n instance.closePopup({\n isDenied: true,\n value: typeof preDenyValue === 'undefined' ? value : preDenyValue\n });\n }\n }).catch(error$$1 => rejectWith(instance || undefined, error$$1));\n } else {\n instance.closePopup({\n isDenied: true,\n value\n });\n }\n };\n\n const succeedWith = (instance, value) => {\n instance.closePopup({\n isConfirmed: true,\n value\n });\n };\n\n const rejectWith = (instance, error$$1) => {\n instance.rejectPromise(error$$1);\n };\n\n const confirm = (instance, value) => {\n const innerParams = privateProps.innerParams.get(instance || undefined);\n\n if (innerParams.showLoaderOnConfirm) {\n showLoading();\n }\n\n if (innerParams.preConfirm) {\n instance.resetValidationMessage();\n privateProps.awaitingPromise.set(instance || undefined, true); // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received\n\n const preConfirmPromise = Promise.resolve().then(() => asPromise(innerParams.preConfirm(value, innerParams.validationMessage)));\n preConfirmPromise.then(preConfirmValue => {\n if (isVisible(getValidationMessage()) || preConfirmValue === false) {\n instance.hideLoading();\n handleAwaitingPromise(instance);\n } else {\n succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue);\n }\n }).catch(error$$1 => rejectWith(instance || undefined, error$$1));\n } else {\n succeedWith(instance, value);\n }\n };\n\n const handlePopupClick = (instance, domCache, dismissWith) => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (innerParams.toast) {\n handleToastClick(instance, domCache, dismissWith);\n } else {\n // Ignore click events that had mousedown on the popup but mouseup on the container\n // This can happen when the user drags a slider\n handleModalMousedown(domCache); // Ignore click events that had mousedown on the container but mouseup on the popup\n\n handleContainerMousedown(domCache);\n handleModalClick(instance, domCache, dismissWith);\n }\n };\n\n const handleToastClick = (instance, domCache, dismissWith) => {\n // Closing toast by internal click\n domCache.popup.onclick = () => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) {\n return;\n }\n\n dismissWith(DismissReason.close);\n };\n };\n /**\n * @param {*} innerParams\n * @returns {boolean}\n */\n\n\n const isAnyButtonShown = innerParams => {\n return innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton;\n };\n\n let ignoreOutsideClick = false;\n\n const handleModalMousedown = domCache => {\n domCache.popup.onmousedown = () => {\n domCache.container.onmouseup = function (e) {\n domCache.container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't\n // have any other direct children aside of the popup\n\n if (e.target === domCache.container) {\n ignoreOutsideClick = true;\n }\n };\n };\n };\n\n const handleContainerMousedown = domCache => {\n domCache.container.onmousedown = () => {\n domCache.popup.onmouseup = function (e) {\n domCache.popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup\n\n if (e.target === domCache.popup || domCache.popup.contains(e.target)) {\n ignoreOutsideClick = true;\n }\n };\n };\n };\n\n const handleModalClick = (instance, domCache, dismissWith) => {\n domCache.container.onclick = e => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (ignoreOutsideClick) {\n ignoreOutsideClick = false;\n return;\n }\n\n if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) {\n dismissWith(DismissReason.backdrop);\n }\n };\n };\n\n const isJqueryElement = elem => typeof elem === 'object' && elem.jquery;\n\n const isElement = elem => elem instanceof Element || isJqueryElement(elem);\n\n const argsToParams = args => {\n const params = {};\n\n if (typeof args[0] === 'object' && !isElement(args[0])) {\n Object.assign(params, args[0]);\n } else {\n ['title', 'html', 'icon'].forEach((name, index) => {\n const arg = args[index];\n\n if (typeof arg === 'string' || isElement(arg)) {\n params[name] = arg;\n } else if (arg !== undefined) {\n error(\"Unexpected type of \".concat(name, \"! Expected \\\"string\\\" or \\\"Element\\\", got \").concat(typeof arg));\n }\n });\n }\n\n return params;\n };\n\n function fire() {\n const Swal = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return new Swal(...args);\n }\n\n /**\n * Returns an extended version of `Swal` containing `params` as defaults.\n * Useful for reusing Swal configuration.\n *\n * For example:\n *\n * Before:\n * const textPromptOptions = { input: 'text', showCancelButton: true }\n * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' })\n * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' })\n *\n * After:\n * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true })\n * const {value: firstName} = await TextPrompt('What is your first name?')\n * const {value: lastName} = await TextPrompt('What is your last name?')\n *\n * @param mixinParams\n */\n function mixin(mixinParams) {\n class MixinSwal extends this {\n _main(params, priorityMixinParams) {\n return super._main(params, Object.assign({}, mixinParams, priorityMixinParams));\n }\n\n }\n\n return MixinSwal;\n }\n\n /**\n * If `timer` parameter is set, returns number of milliseconds of timer remained.\n * Otherwise, returns undefined.\n */\n\n const getTimerLeft = () => {\n return globalState.timeout && globalState.timeout.getTimerLeft();\n };\n /**\n * Stop timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const stopTimer = () => {\n if (globalState.timeout) {\n stopTimerProgressBar();\n return globalState.timeout.stop();\n }\n };\n /**\n * Resume timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const resumeTimer = () => {\n if (globalState.timeout) {\n const remaining = globalState.timeout.start();\n animateTimerProgressBar(remaining);\n return remaining;\n }\n };\n /**\n * Resume timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const toggleTimer = () => {\n const timer = globalState.timeout;\n return timer && (timer.running ? stopTimer() : resumeTimer());\n };\n /**\n * Increase timer. Returns number of milliseconds of an updated timer.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const increaseTimer = n => {\n if (globalState.timeout) {\n const remaining = globalState.timeout.increase(n);\n animateTimerProgressBar(remaining, true);\n return remaining;\n }\n };\n /**\n * Check if timer is running. Returns true if timer is running\n * or false if timer is paused or stopped.\n * If `timer` parameter isn't set, returns undefined\n */\n\n const isTimerRunning = () => {\n return globalState.timeout && globalState.timeout.isRunning();\n };\n\n let bodyClickListenerAdded = false;\n const clickHandlers = {};\n function bindClickHandler() {\n let attr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'data-swal-template';\n clickHandlers[attr] = this;\n\n if (!bodyClickListenerAdded) {\n document.body.addEventListener('click', bodyClickListener);\n bodyClickListenerAdded = true;\n }\n }\n\n const bodyClickListener = event => {\n for (let el = event.target; el && el !== document; el = el.parentNode) {\n for (const attr in clickHandlers) {\n const template = el.getAttribute(attr);\n\n if (template) {\n clickHandlers[attr].fire({\n template\n });\n return;\n }\n }\n }\n };\n\n\n\n var staticMethods = /*#__PURE__*/Object.freeze({\n isValidParameter: isValidParameter,\n isUpdatableParameter: isUpdatableParameter,\n isDeprecatedParameter: isDeprecatedParameter,\n argsToParams: argsToParams,\n isVisible: isVisible$1,\n clickConfirm: clickConfirm,\n clickDeny: clickDeny,\n clickCancel: clickCancel,\n getContainer: getContainer,\n getPopup: getPopup,\n getTitle: getTitle,\n getHtmlContainer: getHtmlContainer,\n getImage: getImage,\n getIcon: getIcon,\n getInputLabel: getInputLabel,\n getCloseButton: getCloseButton,\n getActions: getActions,\n getConfirmButton: getConfirmButton,\n getDenyButton: getDenyButton,\n getCancelButton: getCancelButton,\n getLoader: getLoader,\n getFooter: getFooter,\n getTimerProgressBar: getTimerProgressBar,\n getFocusableElements: getFocusableElements,\n getValidationMessage: getValidationMessage,\n isLoading: isLoading,\n fire: fire,\n mixin: mixin,\n showLoading: showLoading,\n enableLoading: showLoading,\n getTimerLeft: getTimerLeft,\n stopTimer: stopTimer,\n resumeTimer: resumeTimer,\n toggleTimer: toggleTimer,\n increaseTimer: increaseTimer,\n isTimerRunning: isTimerRunning,\n bindClickHandler: bindClickHandler\n });\n\n let currentInstance;\n\n class SweetAlert {\n constructor() {\n // Prevent run in Node env\n if (typeof window === 'undefined') {\n return;\n }\n\n currentInstance = this; // @ts-ignore\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n const outerParams = Object.freeze(this.constructor.argsToParams(args));\n Object.defineProperties(this, {\n params: {\n value: outerParams,\n writable: false,\n enumerable: true,\n configurable: true\n }\n }); // @ts-ignore\n\n const promise = this._main(this.params);\n\n privateProps.promise.set(this, promise);\n }\n\n _main(userParams) {\n let mixinParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n showWarningsForParams(Object.assign({}, mixinParams, userParams));\n\n if (globalState.currentInstance) {\n globalState.currentInstance._destroy();\n\n if (isModal()) {\n unsetAriaHidden();\n }\n }\n\n globalState.currentInstance = this;\n const innerParams = prepareParams(userParams, mixinParams);\n setParameters(innerParams);\n Object.freeze(innerParams); // clear the previous timer\n\n if (globalState.timeout) {\n globalState.timeout.stop();\n delete globalState.timeout;\n } // clear the restore focus timeout\n\n\n clearTimeout(globalState.restoreFocusTimeout);\n const domCache = populateDomCache(this);\n render(this, innerParams);\n privateProps.innerParams.set(this, innerParams);\n return swalPromise(this, domCache, innerParams);\n } // `catch` cannot be the name of a module export, so we define our thenable methods here instead\n\n\n then(onFulfilled) {\n const promise = privateProps.promise.get(this);\n return promise.then(onFulfilled);\n }\n\n finally(onFinally) {\n const promise = privateProps.promise.get(this);\n return promise.finally(onFinally);\n }\n\n }\n\n const swalPromise = (instance, domCache, innerParams) => {\n return new Promise((resolve, reject) => {\n // functions to handle all closings/dismissals\n const dismissWith = dismiss => {\n instance.closePopup({\n isDismissed: true,\n dismiss\n });\n };\n\n privateMethods.swalPromiseResolve.set(instance, resolve);\n privateMethods.swalPromiseReject.set(instance, reject);\n\n domCache.confirmButton.onclick = () => handleConfirmButtonClick(instance);\n\n domCache.denyButton.onclick = () => handleDenyButtonClick(instance);\n\n domCache.cancelButton.onclick = () => handleCancelButtonClick(instance, dismissWith);\n\n domCache.closeButton.onclick = () => dismissWith(DismissReason.close);\n\n handlePopupClick(instance, domCache, dismissWith);\n addKeydownHandler(instance, globalState, innerParams, dismissWith);\n handleInputOptionsAndValue(instance, innerParams);\n openPopup(innerParams);\n setupTimer(globalState, innerParams, dismissWith);\n initFocus(domCache, innerParams); // Scroll container to top on open (#1247, #1946)\n\n setTimeout(() => {\n domCache.container.scrollTop = 0;\n });\n });\n };\n\n const prepareParams = (userParams, mixinParams) => {\n const templateParams = getTemplateParams(userParams);\n const params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); // precedence is described in #2131\n\n params.showClass = Object.assign({}, defaultParams.showClass, params.showClass);\n params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass);\n return params;\n };\n\n const populateDomCache = instance => {\n const domCache = {\n popup: getPopup(),\n container: getContainer(),\n actions: getActions(),\n confirmButton: getConfirmButton(),\n denyButton: getDenyButton(),\n cancelButton: getCancelButton(),\n loader: getLoader(),\n closeButton: getCloseButton(),\n validationMessage: getValidationMessage(),\n progressSteps: getProgressSteps()\n };\n privateProps.domCache.set(instance, domCache);\n return domCache;\n };\n\n const setupTimer = (globalState$$1, innerParams, dismissWith) => {\n const timerProgressBar = getTimerProgressBar();\n hide(timerProgressBar);\n\n if (innerParams.timer) {\n globalState$$1.timeout = new Timer(() => {\n dismissWith('timer');\n delete globalState$$1.timeout;\n }, innerParams.timer);\n\n if (innerParams.timerProgressBar) {\n show(timerProgressBar);\n applyCustomClass(timerProgressBar, innerParams, 'timerProgressBar');\n setTimeout(() => {\n if (globalState$$1.timeout && globalState$$1.timeout.running) {\n // timer can be already stopped or unset at this point\n animateTimerProgressBar(innerParams.timer);\n }\n });\n }\n }\n };\n\n const initFocus = (domCache, innerParams) => {\n if (innerParams.toast) {\n return;\n }\n\n if (!callIfFunction(innerParams.allowEnterKey)) {\n return blurActiveElement();\n }\n\n if (!focusButton(domCache, innerParams)) {\n setFocus(innerParams, -1, 1);\n }\n };\n\n const focusButton = (domCache, innerParams) => {\n if (innerParams.focusDeny && isVisible(domCache.denyButton)) {\n domCache.denyButton.focus();\n return true;\n }\n\n if (innerParams.focusCancel && isVisible(domCache.cancelButton)) {\n domCache.cancelButton.focus();\n return true;\n }\n\n if (innerParams.focusConfirm && isVisible(domCache.confirmButton)) {\n domCache.confirmButton.focus();\n return true;\n }\n\n return false;\n };\n\n const blurActiveElement = () => {\n if (document.activeElement instanceof HTMLElement && typeof document.activeElement.blur === 'function') {\n document.activeElement.blur();\n }\n }; // Assign instance methods from src/instanceMethods/*.js to prototype\n\n\n Object.assign(SweetAlert.prototype, instanceMethods); // Assign static methods from src/staticMethods/*.js to constructor\n\n Object.assign(SweetAlert, staticMethods); // Proxy to instance methods to constructor, for now, for backwards compatibility\n\n Object.keys(instanceMethods).forEach(key => {\n SweetAlert[key] = function () {\n if (currentInstance) {\n return currentInstance[key](...arguments);\n }\n };\n });\n SweetAlert.DismissReason = DismissReason;\n SweetAlert.version = '11.4.8';\n\n const Swal = SweetAlert; // @ts-ignore\n\n Swal.default = Swal;\n\n return Swal;\n\n}));\nif (typeof this !== 'undefined' && this.Sweetalert2){ this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2}\n", "const Selector = {\n CUSTOMFILE: '.custom-file input[type=\"file\"]',\n CUSTOMFILELABEL: '.custom-file-label',\n FORM: 'form',\n INPUT: 'input',\n}\n\nexport default Selector\n", "import Selector from './selector'\n\nconst textNodeType = 3\nconst getDefaultText = (input) => {\n let defaultText = ''\n\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n defaultText = label.textContent\n }\n\n return defaultText\n}\n\nconst findFirstChildNode = (element) => {\n if (element.childNodes.length > 0) {\n const childNodes = [].slice.call(element.childNodes)\n\n for (let i = 0; i < childNodes.length; i++) {\n const node = childNodes[i]\n if (node.nodeType !== textNodeType) {\n return node\n }\n }\n }\n\n return element\n}\n\nconst restoreDefaultText = (input) => {\n const defaultText = input.bsCustomFileInput.defaultText\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n const element = findFirstChildNode(label)\n\n element.textContent = defaultText\n }\n}\n\nexport {\n getDefaultText,\n findFirstChildNode,\n restoreDefaultText,\n}\n", "import { findFirstChildNode, restoreDefaultText } from './util'\nimport Selector from './selector'\n\nconst fileApi = !!window.File\nconst FAKE_PATH = 'fakepath'\nconst FAKE_PATH_SEPARATOR = '\\\\'\n\nconst getSelectedFiles = (input) => {\n if (input.hasAttribute('multiple') && fileApi) {\n return [].slice.call(input.files)\n .map((file) => file.name)\n .join(', ')\n }\n\n if (input.value.indexOf(FAKE_PATH) !== -1) {\n const splittedValue = input.value.split(FAKE_PATH_SEPARATOR)\n\n return splittedValue[splittedValue.length - 1]\n }\n\n return input.value\n}\n\nfunction handleInputChange() {\n const label = this.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n const element = findFirstChildNode(label)\n const inputValue = getSelectedFiles(this)\n\n if (inputValue.length) {\n element.textContent = inputValue\n } else {\n restoreDefaultText(this)\n }\n }\n}\n\nfunction handleFormReset() {\n const customFileList = [].slice.call(this.querySelectorAll(Selector.INPUT))\n .filter((input) => !!input.bsCustomFileInput)\n\n for (let i = 0, len = customFileList.length; i < len; i++) {\n restoreDefaultText(customFileList[i])\n }\n}\n\nexport {\n handleInputChange,\n handleFormReset,\n}\n", "import { getDefaultText, restoreDefaultText } from './util'\nimport { handleFormReset, handleInputChange } from './eventHandlers'\nimport Selector from './selector'\n\nconst customProperty = 'bsCustomFileInput'\nconst Event = {\n FORMRESET : 'reset',\n INPUTCHANGE : 'change',\n}\n\nconst bsCustomFileInput = {\n init(inputSelector = Selector.CUSTOMFILE, formSelector = Selector.FORM) {\n const customFileInputList = [].slice.call(document.querySelectorAll(inputSelector))\n const formList = [].slice.call(document.querySelectorAll(formSelector))\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n Object.defineProperty(input, customProperty, {\n value: {\n defaultText: getDefaultText(input),\n },\n writable: true,\n })\n\n handleInputChange.call(input)\n input.addEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].addEventListener(Event.FORMRESET, handleFormReset)\n Object.defineProperty(formList[i], customProperty, {\n value: true,\n writable: true,\n })\n }\n },\n\n destroy() {\n const formList = [].slice.call(document.querySelectorAll(Selector.FORM))\n .filter((form) => !!form.bsCustomFileInput)\n const customFileInputList = [].slice.call(document.querySelectorAll(Selector.INPUT))\n .filter((input) => !!input.bsCustomFileInput)\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n restoreDefaultText(input)\n input[customProperty] = undefined\n\n input.removeEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].removeEventListener(Event.FORMRESET, handleFormReset)\n formList[i][customProperty] = undefined\n }\n },\n}\n\nexport default bsCustomFileInput\n", "/*! choices.js v11.0.3 | \u00A9 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar 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};\nfunction __extends(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}\nvar __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nfunction __spreadArray(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}\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nvar ActionType = {\n ADD_CHOICE: 'ADD_CHOICE',\n REMOVE_CHOICE: 'REMOVE_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};\n\nvar EventType = {\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};\n\nvar KeyCodeMap = {\n TAB_KEY: 9,\n SHIFT_KEY: 16,\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};\n\nvar ObjectsInConfig = ['fuseOptions', 'classNames'];\n\nvar PassedElementTypes = {\n Text: 'text',\n SelectOne: 'select-one',\n SelectMultiple: 'select-multiple',\n};\n\nvar addChoice = function (choice) { return ({\n type: ActionType.ADD_CHOICE,\n choice: choice,\n}); };\nvar removeChoice = function (choice) { return ({\n type: ActionType.REMOVE_CHOICE,\n choice: choice,\n}); };\nvar filterChoices = function (results) { return ({\n type: ActionType.FILTER_CHOICES,\n results: results,\n}); };\nvar activateChoices = function (active) {\n return ({\n type: ActionType.ACTIVATE_CHOICES,\n active: active,\n });\n};\n\nvar addGroup = function (group) { return ({\n type: ActionType.ADD_GROUP,\n group: group,\n}); };\n\nvar addItem = function (item) { return ({\n type: ActionType.ADD_ITEM,\n item: item,\n}); };\nvar removeItem$1 = function (item) { return ({\n type: ActionType.REMOVE_ITEM,\n item: item,\n}); };\nvar highlightItem = function (item, highlighted) { return ({\n type: ActionType.HIGHLIGHT_ITEM,\n item: item,\n highlighted: highlighted,\n}); };\n\nvar getRandomNumber = function (min, max) { return Math.floor(Math.random() * (max - min) + min); };\nvar generateChars = function (length) {\n return Array.from({ length: length }, function () { return getRandomNumber(0, 36).toString(36); }).join('');\n};\nvar generateId = function (element, prefix) {\n var id = element.id || (element.name && \"\".concat(element.name, \"-\").concat(generateChars(2))) || generateChars(4);\n id = id.replace(/(:|\\.|\\[|\\]|,)/g, '');\n id = \"\".concat(prefix, \"-\").concat(id);\n return id;\n};\nvar getAdjacentEl = function (startEl, selector, direction) {\n if (direction === void 0) { direction = 1; }\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 null;\n};\nvar isScrolledIntoView = function (element, parent, direction) {\n if (direction === void 0) { direction = 1; }\n var isVisible;\n if (direction > 0) {\n // In view from bottom\n isVisible = parent.scrollTop + parent.offsetHeight >= element.offsetTop + element.offsetHeight;\n }\n else {\n // In view from top\n isVisible = element.offsetTop >= parent.scrollTop;\n }\n return isVisible;\n};\nvar sanitise = function (value) {\n if (typeof value !== 'string') {\n if (value === null || value === undefined) {\n return '';\n }\n if (typeof value === 'object') {\n if ('raw' in value) {\n return sanitise(value.raw);\n }\n if ('trusted' in value) {\n return value.trusted;\n }\n }\n return value;\n }\n return value\n .replace(/&/g, '&')\n .replace(/>/g, '>')\n .replace(/= 0 &&\n !window.matchMedia(\"(min-height: \".concat(dropdownPos + 1, \"px)\")).matches;\n }\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, dropdownHeight) {\n addClassesToElement(this.element, this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'true');\n this.isOpen = true;\n if (this.shouldFlip(dropdownPos, dropdownHeight)) {\n addClassesToElement(this.element, this.classNames.flippedState);\n this.isFlipped = true;\n }\n };\n Container.prototype.close = function () {\n removeClassesFromElement(this.element, 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 removeClassesFromElement(this.element, this.classNames.flippedState);\n this.isFlipped = false;\n }\n };\n Container.prototype.addFocusState = function () {\n addClassesToElement(this.element, this.classNames.focusState);\n };\n Container.prototype.removeFocusState = function () {\n removeClassesFromElement(this.element, this.classNames.focusState);\n };\n Container.prototype.enable = function () {\n removeClassesFromElement(this.element, this.classNames.disabledState);\n this.element.removeAttribute('aria-disabled');\n if (this.type === PassedElementTypes.SelectOne) {\n this.element.setAttribute('tabindex', '0');\n }\n this.isDisabled = false;\n };\n Container.prototype.disable = function () {\n addClassesToElement(this.element, this.classNames.disabledState);\n this.element.setAttribute('aria-disabled', 'true');\n if (this.type === PassedElementTypes.SelectOne) {\n this.element.setAttribute('tabindex', '-1');\n }\n this.isDisabled = true;\n };\n Container.prototype.wrap = function (element) {\n var el = this.element;\n var parentNode = element.parentNode;\n if (parentNode) {\n if (element.nextSibling) {\n parentNode.insertBefore(el, element.nextSibling);\n }\n else {\n parentNode.appendChild(el);\n }\n }\n el.appendChild(element);\n };\n Container.prototype.unwrap = function (element) {\n var el = this.element;\n var parentNode = el.parentNode;\n if (parentNode) {\n // Move passed element outside this element\n parentNode.insertBefore(element, el);\n // Remove this element\n parentNode.removeChild(el);\n }\n };\n Container.prototype.addLoadingState = function () {\n addClassesToElement(this.element, this.classNames.loadingState);\n this.element.setAttribute('aria-busy', 'true');\n this.isLoading = true;\n };\n Container.prototype.removeLoadingState = function () {\n removeClassesFromElement(this.element, this.classNames.loadingState);\n this.element.removeAttribute('aria-busy');\n this.isLoading = false;\n };\n return Container;\n}());\n\nvar Input = /** @class */ (function () {\n function Input(_a) {\n var element = _a.element, type = _a.type, classNames = _a.classNames, 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 this.element.value;\n },\n set: function (value) {\n this.element.value = value;\n },\n enumerable: false,\n configurable: true\n });\n Input.prototype.addEventListeners = function () {\n var el = this.element;\n el.addEventListener('paste', this._onPaste);\n el.addEventListener('input', this._onInput, {\n passive: true,\n });\n el.addEventListener('focus', this._onFocus, {\n passive: true,\n });\n el.addEventListener('blur', this._onBlur, {\n passive: true,\n });\n };\n Input.prototype.removeEventListeners = function () {\n var el = this.element;\n el.removeEventListener('input', this._onInput);\n el.removeEventListener('paste', this._onPaste);\n el.removeEventListener('focus', this._onFocus);\n el.removeEventListener('blur', this._onBlur);\n };\n Input.prototype.enable = function () {\n var el = this.element;\n el.removeAttribute('disabled');\n this.isDisabled = false;\n };\n Input.prototype.disable = function () {\n var el = this.element;\n el.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) { setWidth = true; }\n this.element.value = '';\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 element = this.element;\n element.style.minWidth = \"\".concat(element.placeholder.length + 1, \"ch\");\n element.style.width = \"\".concat(element.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 !== PassedElementTypes.SelectOne) {\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}());\n\nvar SCROLLING_SPEED = 4;\n\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.prepend = function (node) {\n var child = this.element.firstElementChild;\n if (child) {\n this.element.insertBefore(node, child);\n }\n else {\n this.element.append(node);\n }\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 = 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 }\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}());\n\nvar WrappedElement = /** @class */ (function () {\n function WrappedElement(_a) {\n var element = _a.element, classNames = _a.classNames;\n this.element = element;\n this.classNames = classNames;\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 this.element.setAttribute('value', value);\n this.element.value = value;\n },\n enumerable: false,\n configurable: true\n });\n WrappedElement.prototype.conceal = function () {\n var el = this.element;\n // Hide passed input\n addClassesToElement(el, this.classNames.input);\n el.hidden = true;\n // Remove element from tab index\n el.tabIndex = -1;\n // Backup original styles if any\n var origStyle = el.getAttribute('style');\n if (origStyle) {\n el.setAttribute('data-choice-orig-style', origStyle);\n }\n el.setAttribute('data-choice', 'active');\n };\n WrappedElement.prototype.reveal = function () {\n var el = this.element;\n // Reinstate passed element\n removeClassesFromElement(el, this.classNames.input);\n el.hidden = false;\n el.removeAttribute('tabindex');\n // Recover original styles if any\n var origStyle = el.getAttribute('data-choice-orig-style');\n if (origStyle) {\n el.removeAttribute('data-choice-orig-style');\n el.setAttribute('style', origStyle);\n }\n else {\n el.removeAttribute('style');\n }\n el.removeAttribute('data-choice');\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 dispatchEvent(this.element, eventType, data || {});\n };\n return WrappedElement;\n}());\n\nvar WrappedInput = /** @class */ (function (_super) {\n __extends(WrappedInput, _super);\n function WrappedInput() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return WrappedInput;\n}(WrappedElement));\n\nvar coerceBool = function (arg, defaultValue) {\n if (defaultValue === void 0) { defaultValue = true; }\n return typeof arg === 'undefined' ? defaultValue : !!arg;\n};\nvar stringToHtmlClass = function (input) {\n if (typeof input === 'string') {\n // eslint-disable-next-line no-param-reassign\n input = input.split(' ').filter(function (s) { return s.length; });\n }\n if (Array.isArray(input) && input.length) {\n return input;\n }\n return undefined;\n};\nvar mapInputToChoice = function (value, allowGroup, allowRawString) {\n if (allowRawString === void 0) { allowRawString = true; }\n if (typeof value === 'string') {\n var sanitisedValue = sanitise(value);\n var userValue = allowRawString || sanitisedValue === value ? value : { escaped: sanitisedValue, raw: value };\n var result_1 = mapInputToChoice({\n value: value,\n label: userValue,\n selected: true,\n }, false);\n return result_1;\n }\n var groupOrChoice = value;\n if ('choices' in groupOrChoice) {\n if (!allowGroup) {\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup\n throw new TypeError(\"optGroup is not allowed\");\n }\n var group = groupOrChoice;\n var choices = group.choices.map(function (e) { return mapInputToChoice(e, false); });\n var result_2 = {\n id: 0, // actual ID will be assigned during _addGroup\n label: unwrapStringForRaw(group.label) || group.value,\n active: !!choices.length,\n disabled: !!group.disabled,\n choices: choices,\n };\n return result_2;\n }\n var choice = groupOrChoice;\n var result = {\n id: 0, // actual ID will be assigned during _addChoice\n group: null, // actual group will be assigned during _addGroup but before _addChoice\n score: 0, // used in search\n rank: 0, // used in search, stable sort order\n value: choice.value,\n label: choice.label || choice.value,\n active: coerceBool(choice.active),\n selected: coerceBool(choice.selected, false),\n disabled: coerceBool(choice.disabled, false),\n placeholder: coerceBool(choice.placeholder, false),\n highlighted: false,\n labelClass: stringToHtmlClass(choice.labelClass),\n labelDescription: choice.labelDescription,\n customProperties: choice.customProperties,\n };\n return result;\n};\n\nvar isHtmlInputElement = function (e) { return e.tagName === 'INPUT'; };\nvar isHtmlSelectElement = function (e) { return e.tagName === 'SELECT'; };\nvar isHtmlOption = function (e) { return e.tagName === 'OPTION'; };\nvar isHtmlOptgroup = function (e) { return e.tagName === 'OPTGROUP'; };\n\nvar WrappedSelect = /** @class */ (function (_super) {\n __extends(WrappedSelect, _super);\n function WrappedSelect(_a) {\n var element = _a.element, classNames = _a.classNames, template = _a.template, extractPlaceholder = _a.extractPlaceholder;\n var _this = _super.call(this, { element: element, classNames: classNames }) || this;\n _this.template = template;\n _this.extractPlaceholder = extractPlaceholder;\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 WrappedSelect.prototype.addOptions = function (choices) {\n var _this = this;\n var fragment = document.createDocumentFragment();\n choices.forEach(function (obj) {\n var choice = obj;\n if (choice.element) {\n return;\n }\n var option = _this.template(choice);\n fragment.appendChild(option);\n choice.element = option;\n });\n this.element.appendChild(fragment);\n };\n WrappedSelect.prototype.optionsAsChoices = function () {\n var _this = this;\n var choices = [];\n this.element.querySelectorAll(':scope > option, :scope > optgroup').forEach(function (e) {\n if (isHtmlOption(e)) {\n choices.push(_this._optionToChoice(e));\n }\n else if (isHtmlOptgroup(e)) {\n choices.push(_this._optgroupToChoice(e));\n }\n // todo: hr as empty optgroup, requires displaying empty opt-groups to be useful\n });\n return choices;\n };\n // eslint-disable-next-line class-methods-use-this\n WrappedSelect.prototype._optionToChoice = function (option) {\n // option.value returns the label if there is no value attribute, which can break legacy placeholder attribute support\n if (!option.hasAttribute('value') && option.hasAttribute('placeholder')) {\n option.setAttribute('value', '');\n option.value = '';\n }\n return {\n id: 0,\n group: null,\n score: 0,\n rank: 0,\n value: option.value,\n label: option.innerText, // HTML options do not support most html tags, but innerHtml will extract html comments...\n element: option,\n active: true,\n // this returns true if nothing is selected on initial load, which will break placeholder support\n selected: this.extractPlaceholder ? option.selected : option.hasAttribute('selected'),\n disabled: option.disabled,\n highlighted: false,\n placeholder: this.extractPlaceholder && (!option.value || option.hasAttribute('placeholder')),\n labelClass: typeof option.dataset.labelClass !== 'undefined' ? stringToHtmlClass(option.dataset.labelClass) : undefined,\n labelDescription: typeof option.dataset.labelDescription !== 'undefined' ? option.dataset.labelDescription : undefined,\n customProperties: parseCustomProperties(option.dataset.customProperties),\n };\n };\n WrappedSelect.prototype._optgroupToChoice = function (optgroup) {\n var _this = this;\n var options = optgroup.querySelectorAll('option');\n var choices = Array.from(options).map(function (option) { return _this._optionToChoice(option); });\n return {\n id: 0,\n label: optgroup.label || '',\n element: optgroup,\n active: !!choices.length,\n disabled: optgroup.disabled,\n choices: choices,\n };\n };\n return WrappedSelect;\n}(WrappedElement));\n\nvar 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 description: ['choices__description'],\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 notice: ['choices__notice'],\n addChoice: ['choices__item--selectable', 'add-choice'],\n noResults: ['has-no-results'],\n noChoices: ['has-no-choices'],\n};\nvar DEFAULT_CONFIG = {\n items: [],\n choices: [],\n silent: false,\n renderChoiceLimit: -1,\n maxItemCount: -1,\n closeDropdownOnSelect: 'auto',\n singleModeForMultiSelect: false,\n addChoices: false,\n addItems: true,\n addItemFilter: function (value) { return !!value && value !== ''; },\n removeItems: true,\n removeItemButton: false,\n removeItemButtonAlignLeft: false,\n editItems: false,\n allowHTML: false,\n allowHtmlUserInput: false,\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: sortByAlpha,\n shadowRoot: null,\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) { return \"Press Enter to add \\\"\".concat(value, \"\\\"\"); },\n removeItemIconText: function () { return \"Remove item\"; },\n removeItemLabelText: function (value) { return \"Remove item: \".concat(value); },\n maxItemText: function (maxItemCount) { return \"Only \".concat(maxItemCount, \" values can be added\"); },\n valueComparer: function (value1, value2) { return value1 === value2; },\n fuseOptions: {\n includeScore: true,\n },\n labelId: '',\n callbackOnInit: null,\n callbackOnCreateTemplates: null,\n classNames: DEFAULT_CLASSNAMES,\n appendGroupInSearch: false,\n};\n\nvar removeItem = function (item) {\n var itemEl = item.itemEl;\n if (itemEl) {\n itemEl.remove();\n item.itemEl = undefined;\n }\n};\nfunction items(s, action, context) {\n var state = s;\n var update = true;\n switch (action.type) {\n case ActionType.ADD_ITEM: {\n action.item.selected = true;\n var el = action.item.element;\n if (el) {\n el.selected = true;\n el.setAttribute('selected', '');\n }\n state.push(action.item);\n break;\n }\n case ActionType.REMOVE_ITEM: {\n action.item.selected = false;\n var el = action.item.element;\n if (el) {\n el.selected = false;\n el.removeAttribute('selected');\n // For a select-one, if all options are deselected, the first item is selected. To set a black value, select.value needs to be set\n var select = el.parentElement;\n if (select && isHtmlSelectElement(select) && select.type === PassedElementTypes.SelectOne) {\n select.value = '';\n }\n }\n // this is mixing concerns, but this is *so much faster*\n removeItem(action.item);\n state = state.filter(function (choice) { return choice.id !== action.item.id; });\n break;\n }\n case ActionType.REMOVE_CHOICE: {\n removeItem(action.choice);\n state = state.filter(function (item) { return item.id !== action.choice.id; });\n break;\n }\n case ActionType.HIGHLIGHT_ITEM: {\n var highlighted = action.highlighted;\n var item = state.find(function (obj) { return obj.id === action.item.id; });\n if (item && item.highlighted !== highlighted) {\n item.highlighted = highlighted;\n if (context) {\n updateClassList(item, highlighted ? context.classNames.highlightedState : context.classNames.selectedState, highlighted ? context.classNames.selectedState : context.classNames.highlightedState);\n }\n }\n break;\n }\n default: {\n update = false;\n break;\n }\n }\n return { state: state, update: update };\n}\n\nfunction groups(s, action) {\n var state = s;\n var update = true;\n switch (action.type) {\n case ActionType.ADD_GROUP: {\n state.push(action.group);\n break;\n }\n case ActionType.CLEAR_CHOICES: {\n state = [];\n break;\n }\n default: {\n update = false;\n break;\n }\n }\n return { state: state, update: update };\n}\n\n/* eslint-disable */\nfunction choices(s, action, context) {\n var state = s;\n var update = true;\n switch (action.type) {\n case ActionType.ADD_CHOICE: {\n state.push(action.choice);\n break;\n }\n case ActionType.REMOVE_CHOICE: {\n action.choice.choiceEl = undefined;\n if (action.choice.group) {\n action.choice.group.choices = action.choice.group.choices.filter(function (obj) { return obj.id !== action.choice.id; });\n }\n state = state.filter(function (obj) { return obj.id !== action.choice.id; });\n break;\n }\n case ActionType.ADD_ITEM:\n case ActionType.REMOVE_ITEM: {\n action.item.choiceEl = undefined;\n break;\n }\n case ActionType.FILTER_CHOICES: {\n // avoid O(n^2) algorithm complexity when searching/filtering choices\n var scoreLookup_1 = [];\n action.results.forEach(function (result) {\n scoreLookup_1[result.item.id] = result;\n });\n state.forEach(function (choice) {\n var result = scoreLookup_1[choice.id];\n if (result !== undefined) {\n choice.score = result.score;\n choice.rank = result.rank;\n choice.active = true;\n }\n else {\n choice.score = 0;\n choice.rank = 0;\n choice.active = false;\n }\n if (context && context.appendGroupInSearch) {\n choice.choiceEl = undefined;\n }\n });\n break;\n }\n case ActionType.ACTIVATE_CHOICES: {\n state.forEach(function (choice) {\n choice.active = action.active;\n if (context && context.appendGroupInSearch) {\n choice.choiceEl = undefined;\n }\n });\n break;\n }\n case ActionType.CLEAR_CHOICES: {\n state = [];\n break;\n }\n default: {\n update = false;\n break;\n }\n }\n return { state: state, update: update };\n}\n\nvar reducers = {\n groups: groups,\n items: items,\n choices: choices,\n};\nvar Store = /** @class */ (function () {\n function Store(context) {\n this._state = this.defaultState;\n this._listeners = [];\n this._txn = 0;\n this._context = context;\n }\n Object.defineProperty(Store.prototype, \"defaultState\", {\n // eslint-disable-next-line class-methods-use-this\n get: function () {\n return {\n groups: [],\n items: [],\n choices: [],\n };\n },\n enumerable: false,\n configurable: true\n });\n // eslint-disable-next-line class-methods-use-this\n Store.prototype.changeSet = function (init) {\n return {\n groups: init,\n items: init,\n choices: init,\n };\n };\n Store.prototype.reset = function () {\n this._state = this.defaultState;\n var changes = this.changeSet(true);\n if (this._txn) {\n this._changeSet = changes;\n }\n else {\n this._listeners.forEach(function (l) { return l(changes); });\n }\n };\n Store.prototype.subscribe = function (onChange) {\n this._listeners.push(onChange);\n return this;\n };\n Store.prototype.dispatch = function (action) {\n var _this = this;\n var state = this._state;\n var hasChanges = false;\n var changes = this._changeSet || this.changeSet(false);\n Object.keys(reducers).forEach(function (key) {\n var stateUpdate = reducers[key](state[key], action, _this._context);\n if (stateUpdate.update) {\n hasChanges = true;\n changes[key] = true;\n state[key] = stateUpdate.state;\n }\n });\n if (hasChanges) {\n if (this._txn) {\n this._changeSet = changes;\n }\n else {\n this._listeners.forEach(function (l) { return l(changes); });\n }\n }\n };\n Store.prototype.withTxn = function (func) {\n this._txn++;\n try {\n func();\n }\n finally {\n this._txn = Math.max(0, this._txn - 1);\n if (!this._txn) {\n var changeSet_1 = this._changeSet;\n if (changeSet_1) {\n this._changeSet = undefined;\n this._listeners.forEach(function (l) { return l(changeSet_1); });\n }\n }\n }\n };\n Object.defineProperty(Store.prototype, \"state\", {\n /**\n * Get store object\n */\n get: function () {\n return this._state;\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, \"highlightedActiveItems\", {\n /**\n * Get highlighted items from store\n */\n get: function () {\n return this.items.filter(function (item) { return !item.disabled && item.active && item.highlighted; });\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) { return choice.active; });\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.choices.filter(function (choice) { return !choice.disabled && !choice.placeholder; });\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 _this = this;\n return this.state.groups.filter(function (group) {\n var isActive = group.active && !group.disabled;\n var hasActiveOptions = _this.state.choices.some(function (choice) { return choice.active && !choice.disabled; });\n return isActive && hasActiveOptions;\n }, []);\n },\n enumerable: false,\n configurable: true\n });\n Store.prototype.inTxn = function () {\n return this._txn > 0;\n };\n /**\n * Get single choice by it's ID\n */\n Store.prototype.getChoiceById = function (id) {\n return this.activeChoices.find(function (choice) { return choice.id === id; });\n };\n /**\n * Get group by group id\n */\n Store.prototype.getGroupById = function (id) {\n return this.groups.find(function (group) { return group.id === id; });\n };\n return Store;\n}());\n\nvar NoticeTypes = {\n noChoices: 'no-choices',\n noResults: 'no-results',\n addChoice: 'add-choice',\n generic: '',\n};\n\nfunction _defineProperty(e, r, t) {\n return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\n\n/**\n * Fuse.js v7.0.0 - Lightweight fuzzy-search (http://fusejs.io)\n *\n * Copyright (c) 2023 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 ? getTag(value) === '[object Array]' : 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}\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\nfunction isString(value) {\n return typeof value === 'string';\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 value === true || value === false || isObjectLike(value) && getTag(value) == '[object Boolean]';\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}\nfunction isDefined(value) {\n return value !== undefined && value !== null;\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 ? value === undefined ? '[object Undefined]' : '[object Null]' : Object.prototype.toString.call(value);\n}\nconst EXTENDED_SEARCH_UNAVAILABLE = 'Extended search is not available';\nconst INCORRECT_INDEX_TYPE = \"Incorrect 'index' type\";\nconst LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = key => `Invalid value for key ${key}`;\nconst PATTERN_LENGTH_TOO_LARGE = max => `Pattern length exceeds max of ${max}.`;\nconst MISSING_KEY_PROPERTY = name => `Missing ${name} property in key`;\nconst INVALID_KEY_WEIGHT_VALUE = key => `Property 'weight' in key '${key}' must be a positive integer`;\nconst hasOwn = Object.prototype.hasOwnProperty;\nclass KeyStore {\n constructor(keys) {\n this._keys = [];\n this._keyMap = {};\n let totalWeight = 0;\n keys.forEach(key => {\n let obj = createKey(key);\n this._keys.push(obj);\n this._keyMap[obj.id] = obj;\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}\nfunction createKey(key) {\n let path = null;\n let id = null;\n let src = null;\n let weight = 1;\n let getFn = null;\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 const name = key.name;\n src = name;\n if (hasOwn.call(key, 'weight')) {\n weight = key.weight;\n if (weight <= 0) {\n throw new Error(INVALID_KEY_WEIGHT_VALUE(name));\n }\n }\n path = createKeyPath(name);\n id = createKeyId(name);\n getFn = key.getFn;\n }\n return {\n path,\n id,\n weight,\n src,\n getFn\n };\n}\nfunction createKeyPath(key) {\n return isArray(key) ? key : key.split('.');\n}\nfunction createKeyId(key) {\n return isArray(key) ? key.join('.') : key;\n}\nfunction get(obj, path) {\n let list = [];\n let arr = false;\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 const value = obj[key];\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 (index === path.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) {\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 return arr ? list : list[0];\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};\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) => a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1\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};\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};\nvar Config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, BasicOptions), MatchOptions), FuzzyOptions), AdvancedOptions);\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 return {\n get(value) {\n const numTokens = value.match(SPACE).length;\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 cache.set(numTokens, n);\n return n;\n },\n clear() {\n cache.clear();\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 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 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 this.norm.clear();\n }\n // Adds a doc to the end of the index\n add(doc) {\n const idx = this.size();\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 let record = {\n v: doc,\n i: docIndex,\n n: this.norm.get(doc)\n };\n this.records.push(record);\n }\n _addObject(doc, docIndex) {\n let record = {\n i: docIndex,\n $: {}\n };\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 if (!isDefined(value)) {\n return;\n }\n if (isArray(value)) {\n let subRecords = [];\n const stack = [{\n nestedArrIndex: -1,\n value\n }];\n while (stack.length) {\n const {\n nestedArrIndex,\n value\n } = stack.pop();\n if (!isDefined(value)) {\n continue;\n }\n if (isString(value) && !isBlank(value)) {\n let subRecord = {\n v: value,\n i: nestedArrIndex,\n n: this.norm.get(value)\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 record.$[keyIndex] = subRecord;\n }\n });\n this.records.push(record);\n }\n toJSON() {\n return {\n keys: this.keys,\n records: this.records\n };\n }\n}\nfunction createIndex(keys, docs, {\n getFn = Config.getFn,\n fieldNormWeight = Config.fieldNormWeight\n} = {}) {\n const myIndex = new FuseIndex({\n getFn,\n fieldNormWeight\n });\n myIndex.setKeys(keys.map(createKey));\n myIndex.setSources(docs);\n myIndex.create();\n return myIndex;\n}\nfunction parseIndex(data, {\n getFn = Config.getFn,\n fieldNormWeight = Config.fieldNormWeight\n} = {}) {\n const {\n keys,\n records\n } = data;\n const myIndex = new FuseIndex({\n getFn,\n fieldNormWeight\n });\n myIndex.setKeys(keys);\n myIndex.setIndexRecords(records);\n return myIndex;\n}\nfunction computeScore$1(pattern, {\n errors = 0,\n currentLocation = 0,\n expectedLocation = 0,\n distance = Config.distance,\n ignoreLocation = Config.ignoreLocation\n} = {}) {\n const accuracy = errors / pattern.length;\n if (ignoreLocation) {\n return accuracy;\n }\n const proximity = Math.abs(expectedLocation - currentLocation);\n if (!distance) {\n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy;\n }\n return accuracy + proximity / distance;\n}\nfunction convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMatchCharLength) {\n let indices = [];\n let start = -1;\n let end = -1;\n let i = 0;\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 return indices;\n}\n\n// Machine word size\nconst MAX_BITS = 32;\nfunction search(text, pattern, patternAlphabet, {\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 if (pattern.length > MAX_BITS) {\n throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS));\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 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 currentThreshold = Math.min(score, currentThreshold);\n bestLocation = index + patternLen;\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 let lastBitArr = [];\n let finalScore = 1;\n let binMax = patternLen + textLen;\n const mask = 1 << patternLen - 1;\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 while (binMin < binMid) {\n const score = computeScore$1(pattern, {\n errors: i,\n currentLocation: expectedLocation + binMid,\n expectedLocation,\n distance,\n ignoreLocation\n });\n if (score <= currentThreshold) {\n binMin = binMid;\n } else {\n binMax = binMid;\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 let start = Math.max(1, expectedLocation - binMid + 1);\n let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;\n\n // Initialize the bit array\n let bitArr = Array(finish + 2);\n bitArr[finish + 1] = (1 << i) - 1;\n for (let j = finish; j >= start; j -= 1) {\n let currentLocation = j - 1;\n let charMatch = patternAlphabet[text.charAt(currentLocation)];\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] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];\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 if (score > currentThreshold) {\n break;\n }\n lastBitArr = bitArr;\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 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 return result;\n}\nfunction createPatternAlphabet(pattern) {\n let mask = {};\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 return mask;\n}\nclass BitapSearch {\n constructor(pattern, {\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 this.options = {\n location,\n threshold,\n distance,\n includeMatches,\n findAllMatches,\n minMatchCharLength,\n isCaseSensitive,\n ignoreLocation\n };\n this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();\n this.chunks = [];\n if (!this.pattern.length) {\n return;\n }\n const addChunk = (pattern, startIndex) => {\n this.chunks.push({\n pattern,\n alphabet: createPatternAlphabet(pattern),\n startIndex\n });\n };\n const len = this.pattern.length;\n if (len > MAX_BITS) {\n let i = 0;\n const remainder = len % MAX_BITS;\n const end = len - remainder;\n while (i < end) {\n addChunk(this.pattern.substr(i, MAX_BITS), i);\n i += MAX_BITS;\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 searchIn(text) {\n const {\n isCaseSensitive,\n includeMatches\n } = this.options;\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 if (includeMatches) {\n result.indices = [[0, text.length - 1]];\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 let allIndices = [];\n let totalScore = 0;\n let hasMatches = false;\n this.chunks.forEach(({\n pattern,\n alphabet,\n startIndex\n }) => {\n const {\n isMatch,\n score,\n indices\n } = search(text, pattern, alphabet, {\n location: location + startIndex,\n distance,\n threshold,\n findAllMatches,\n minMatchCharLength,\n includeMatches,\n ignoreLocation\n });\n if (isMatch) {\n hasMatches = true;\n }\n totalScore += score;\n if (isMatch && indices) {\n allIndices = [...allIndices, ...indices];\n }\n });\n let result = {\n isMatch: hasMatches,\n score: hasMatches ? totalScore / this.chunks.length : 1\n };\n if (hasMatches && includeMatches) {\n result.indices = allIndices;\n }\n return result;\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}\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 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 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 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 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 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}\nclass FuzzyMatch extends BaseMatch {\n constructor(pattern, {\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 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 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 const isMatch = !!indices.length;\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices\n };\n }\n}\n\n// \u2757Order is important. DO NOT CHANGE.\nconst searchers = [ExactMatch, IncludeMatch, PrefixExactMatch, InversePrefixExactMatch, InverseSuffixExactMatch, SuffixExactMatch, InverseExactMatch, FuzzyMatch];\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.trim().split(SPACE_RE).filter(item => item && !!item.trim());\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 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 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(pattern, {\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 this.query = null;\n this.options = {\n isCaseSensitive,\n includeMatches,\n minMatchCharLength,\n findAllMatches,\n ignoreLocation,\n location,\n threshold,\n distance\n };\n this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();\n this.query = parseQuery(this.pattern, this.options);\n }\n static condition(_, options) {\n return options.useExtendedSearch;\n }\n searchIn(text) {\n const query = this.query;\n if (!query) {\n return {\n isMatch: false,\n score: 1\n };\n }\n const {\n includeMatches,\n isCaseSensitive\n } = this.options;\n text = isCaseSensitive ? text : text.toLowerCase();\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 {\n isMatch,\n indices,\n score\n } = searcher.search(text);\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 if (includeMatches) {\n result.indices = allIndices;\n }\n return result;\n }\n }\n\n // Nothing was matched\n return {\n isMatch: false,\n score: 1\n };\n }\n}\nconst registeredSearchers = [];\nfunction register(...args) {\n registeredSearchers.push(...args);\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 return new BitapSearch(pattern, options);\n}\nconst LogicalOperator = {\n AND: '$and',\n OR: '$or'\n};\nconst KeyType = {\n PATH: '$path',\n PATTERN: '$val'\n};\nconst isExpression = query => !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);\nconst isPath = query => !!query[KeyType.PATH];\nconst isLeaf = query => !isArray(query) && isObject(query) && !isExpression(query);\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, {\n auto = true\n} = {}) {\n const next = query => {\n let keys = Object.keys(query);\n const isQueryPath = isPath(query);\n if (!isQueryPath && keys.length > 1 && !isExpression(query)) {\n return next(convertToExplicit(query));\n }\n if (isLeaf(query)) {\n const key = isQueryPath ? query[KeyType.PATH] : keys[0];\n const pattern = isQueryPath ? query[KeyType.PATTERN] : query[key];\n if (!isString(pattern)) {\n throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));\n }\n const obj = {\n keyId: createKeyId(key),\n pattern\n };\n if (auto) {\n obj.searcher = createSearcher(pattern, options);\n }\n return obj;\n }\n let node = {\n children: [],\n operator: keys[0]\n };\n keys.forEach(key => {\n const value = query[key];\n if (isArray(value)) {\n value.forEach(item => {\n node.children.push(next(item));\n });\n }\n });\n return node;\n };\n if (!isExpression(query)) {\n query = convertToExplicit(query);\n }\n return next(query);\n}\n\n// Practical scoring function\nfunction computeScore(results, {\n ignoreFieldNorm = Config.ignoreFieldNorm\n}) {\n results.forEach(result => {\n let totalScore = 1;\n result.matches.forEach(({\n key,\n norm,\n score\n }) => {\n const weight = key ? key.weight : null;\n totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm));\n });\n result.score = totalScore;\n });\n}\nfunction transformMatches(result, data) {\n const matches = result.matches;\n data.matches = [];\n if (!isDefined(matches)) {\n return;\n }\n matches.forEach(match => {\n if (!isDefined(match.indices) || !match.indices.length) {\n return;\n }\n const {\n indices,\n value\n } = match;\n let obj = {\n indices,\n value\n };\n if (match.key) {\n obj.key = match.key.src;\n }\n if (match.idx > -1) {\n obj.refIndex = match.idx;\n }\n data.matches.push(obj);\n });\n}\nfunction transformScore(result, data) {\n data.score = result.score;\n}\nfunction format(results, docs, {\n includeMatches = Config.includeMatches,\n includeScore = Config.includeScore\n} = {}) {\n const transformers = [];\n if (includeMatches) transformers.push(transformMatches);\n if (includeScore) transformers.push(transformScore);\n return results.map(result => {\n const {\n idx\n } = result;\n const data = {\n item: docs[idx],\n refIndex: idx\n };\n if (transformers.length) {\n transformers.forEach(transformer => {\n transformer(result, data);\n });\n }\n return data;\n });\n}\nclass Fuse {\n constructor(docs, options = {}, index) {\n this.options = _objectSpread2(_objectSpread2({}, Config), options);\n if (this.options.useExtendedSearch && !true) {\n throw new Error(EXTENDED_SEARCH_UNAVAILABLE);\n }\n this._keyStore = new KeyStore(this.options.keys);\n this.setCollection(docs, index);\n }\n setCollection(docs, index) {\n this._docs = docs;\n if (index && !(index instanceof FuseIndex)) {\n throw new Error(INCORRECT_INDEX_TYPE);\n }\n this._myIndex = index || createIndex(this.options.keys, this._docs, {\n getFn: this.options.getFn,\n fieldNormWeight: this.options.fieldNormWeight\n });\n }\n add(doc) {\n if (!isDefined(doc)) {\n return;\n }\n this._docs.push(doc);\n this._myIndex.add(doc);\n }\n remove(predicate = ( /* doc, idx */) => false) {\n const results = [];\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 results.push(doc);\n }\n }\n return results;\n }\n removeAt(idx) {\n this._docs.splice(idx, 1);\n this._myIndex.removeAt(idx);\n }\n getIndex() {\n return this._myIndex;\n }\n search(query, {\n limit = -1\n } = {}) {\n const {\n includeMatches,\n includeScore,\n shouldSort,\n sortFn,\n ignoreFieldNorm\n } = this.options;\n let results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query);\n computeScore(results, {\n ignoreFieldNorm\n });\n if (shouldSort) {\n results.sort(sortFn);\n }\n if (isNumber(limit) && limit > -1) {\n results = results.slice(0, limit);\n }\n return format(results, this._docs, {\n includeMatches,\n includeScore\n });\n }\n _searchStringList(query) {\n const searcher = createSearcher(query, this.options);\n const {\n records\n } = this._myIndex;\n const results = [];\n\n // Iterate over every string in the index\n records.forEach(({\n v: text,\n i: idx,\n n: norm\n }) => {\n if (!isDefined(text)) {\n return;\n }\n const {\n isMatch,\n score,\n indices\n } = searcher.searchIn(text);\n if (isMatch) {\n results.push({\n item: text,\n idx,\n matches: [{\n score,\n value: text,\n norm,\n indices\n }]\n });\n }\n });\n return results;\n }\n _searchLogical(query) {\n const expression = parse(query, this.options);\n const evaluate = (node, item, idx) => {\n if (!node.children) {\n const {\n keyId,\n searcher\n } = node;\n const matches = this._findMatches({\n key: this._keyStore.get(keyId),\n value: this._myIndex.getValueForItemAtKeyId(item, keyId),\n searcher\n });\n if (matches && matches.length) {\n return [{\n idx,\n item,\n matches\n }];\n }\n return [];\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 const records = this._myIndex.records;\n const resultMap = {};\n const results = [];\n records.forEach(({\n $: item,\n i: idx\n }) => {\n if (isDefined(item)) {\n let expResults = evaluate(expression, item, idx);\n if (expResults.length) {\n // Dedupe when adding\n if (!resultMap[idx]) {\n resultMap[idx] = {\n idx,\n item,\n matches: []\n };\n results.push(resultMap[idx]);\n }\n expResults.forEach(({\n matches\n }) => {\n resultMap[idx].matches.push(...matches);\n });\n }\n }\n });\n return results;\n }\n _searchObjectList(query) {\n const searcher = createSearcher(query, this.options);\n const {\n keys,\n records\n } = this._myIndex;\n const results = [];\n\n // List is Array\n records.forEach(({\n $: item,\n i: idx\n }) => {\n if (!isDefined(item)) {\n return;\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(...this._findMatches({\n key,\n value: item[keyIndex],\n searcher\n }));\n });\n if (matches.length) {\n results.push({\n idx,\n item,\n matches\n });\n }\n });\n return results;\n }\n _findMatches({\n key,\n value,\n searcher\n }) {\n if (!isDefined(value)) {\n return [];\n }\n let matches = [];\n if (isArray(value)) {\n value.forEach(({\n v: text,\n i: idx,\n n: norm\n }) => {\n if (!isDefined(text)) {\n return;\n }\n const {\n isMatch,\n score,\n indices\n } = searcher.searchIn(text);\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 {\n v: text,\n n: norm\n } = value;\n const {\n isMatch,\n score,\n indices\n } = searcher.searchIn(text);\n if (isMatch) {\n matches.push({\n score,\n key,\n value: text,\n norm,\n indices\n });\n }\n }\n return matches;\n }\n}\nFuse.version = '7.0.0';\nFuse.createIndex = createIndex;\nFuse.parseIndex = parseIndex;\nFuse.config = Config;\n{\n Fuse.parseQuery = parse;\n}\n{\n register(ExtendedSearch);\n}\n\nvar SearchByFuse = /** @class */ (function () {\n function SearchByFuse(config) {\n this._haystack = [];\n this._fuseOptions = __assign(__assign({}, config.fuseOptions), { keys: __spreadArray([], config.searchFields, true), includeMatches: true });\n }\n SearchByFuse.prototype.index = function (data) {\n this._haystack = data;\n if (this._fuse) {\n this._fuse.setCollection(data);\n }\n };\n SearchByFuse.prototype.reset = function () {\n this._haystack = [];\n this._fuse = undefined;\n };\n SearchByFuse.prototype.isEmptyIndex = function () {\n return !this._haystack.length;\n };\n SearchByFuse.prototype.search = function (needle) {\n if (!this._fuse) {\n {\n this._fuse = new Fuse(this._haystack, this._fuseOptions);\n }\n }\n var results = this._fuse.search(needle);\n return results.map(function (value, i) {\n return {\n item: value.item,\n score: value.score || 0,\n rank: i + 1, // If value.score is used for sorting, this can create non-stable sorts!\n };\n });\n };\n return SearchByFuse;\n}());\n\nfunction getSearcher(config) {\n {\n return new SearchByFuse(config);\n }\n}\n\n/**\n * Helpers to create HTML elements used by Choices\n * Can be overridden by providing `callbackOnCreateTemplates` option.\n * `Choices.defaults.templates` allows access to the default template methods from `callbackOnCreateTemplates`\n */\nvar isEmptyObject = function (obj) {\n // eslint-disable-next-line no-restricted-syntax\n for (var prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n return false;\n }\n }\n return true;\n};\nvar assignCustomProperties = function (el, choice, withCustomProperties) {\n var dataset = el.dataset;\n var customProperties = choice.customProperties, labelClass = choice.labelClass, labelDescription = choice.labelDescription;\n if (labelClass) {\n dataset.labelClass = getClassNames(labelClass).join(' ');\n }\n if (labelDescription) {\n dataset.labelDescription = labelDescription;\n }\n if (withCustomProperties && customProperties) {\n if (typeof customProperties === 'string') {\n dataset.customProperties = customProperties;\n }\n else if (typeof customProperties === 'object' && !isEmptyObject(customProperties)) {\n dataset.customProperties = JSON.stringify(customProperties);\n }\n }\n};\nvar addAriaLabel = function (docRoot, id, element) {\n var label = id && docRoot.querySelector(\"label[for='\".concat(id, \"']\"));\n var text = label && label.innerText;\n if (text) {\n element.setAttribute('aria-label', text);\n }\n};\nvar templates = {\n containerOuter: function (_a, dir, isSelectElement, isSelectOneElement, searchEnabled, passedElementType, labelId) {\n var containerOuter = _a.classNames.containerOuter;\n var div = document.createElement('div');\n addClassesToElement(div, containerOuter);\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 else if (!labelId) {\n addAriaLabel(this._docRoot, this.passedElement.element.id, div);\n }\n div.setAttribute('aria-haspopup', 'true');\n div.setAttribute('aria-expanded', 'false');\n }\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 var div = document.createElement('div');\n addClassesToElement(div, containerInner);\n return div;\n },\n itemList: function (_a, isSelectOneElement) {\n var searchEnabled = _a.searchEnabled, _b = _a.classNames, list = _b.list, listSingle = _b.listSingle, listItems = _b.listItems;\n var div = document.createElement('div');\n addClassesToElement(div, list);\n addClassesToElement(div, isSelectOneElement ? listSingle : listItems);\n if (this._isSelectElement && searchEnabled) {\n div.setAttribute('role', 'listbox');\n }\n return div;\n },\n placeholder: function (_a, value) {\n var allowHTML = _a.allowHTML, placeholder = _a.classNames.placeholder;\n var div = document.createElement('div');\n addClassesToElement(div, placeholder);\n setElementHtml(div, allowHTML, value);\n return div;\n },\n item: function (_a, choice, removeItemButton) {\n var allowHTML = _a.allowHTML, removeItemButtonAlignLeft = _a.removeItemButtonAlignLeft, removeItemIconText = _a.removeItemIconText, removeItemLabelText = _a.removeItemLabelText, _b = _a.classNames, item = _b.item, button = _b.button, highlightedState = _b.highlightedState, itemSelectable = _b.itemSelectable, placeholder = _b.placeholder;\n var rawValue = unwrapStringForRaw(choice.value);\n var div = document.createElement('div');\n addClassesToElement(div, item);\n if (choice.labelClass) {\n var spanLabel = document.createElement('span');\n setElementHtml(spanLabel, allowHTML, choice.label);\n addClassesToElement(spanLabel, choice.labelClass);\n div.appendChild(spanLabel);\n }\n else {\n setElementHtml(div, allowHTML, choice.label);\n }\n div.dataset.item = '';\n div.dataset.id = choice.id;\n div.dataset.value = rawValue;\n assignCustomProperties(div, choice, true);\n if (choice.disabled || this.containerOuter.isDisabled) {\n div.setAttribute('aria-disabled', 'true');\n }\n if (this._isSelectElement) {\n div.setAttribute('aria-selected', 'true');\n div.setAttribute('role', 'option');\n }\n if (choice.placeholder) {\n addClassesToElement(div, placeholder);\n div.dataset.placeholder = '';\n }\n addClassesToElement(div, choice.highlighted ? highlightedState : itemSelectable);\n if (removeItemButton) {\n if (choice.disabled) {\n removeClassesFromElement(div, itemSelectable);\n }\n div.dataset.deletable = '';\n var removeButton = document.createElement('button');\n removeButton.type = 'button';\n addClassesToElement(removeButton, button);\n setElementHtml(removeButton, true, resolveNoticeFunction(removeItemIconText, choice.value));\n var REMOVE_ITEM_LABEL = resolveNoticeFunction(removeItemLabelText, choice.value);\n if (REMOVE_ITEM_LABEL) {\n removeButton.setAttribute('aria-label', REMOVE_ITEM_LABEL);\n }\n removeButton.dataset.button = '';\n if (removeItemButtonAlignLeft) {\n div.insertAdjacentElement('afterbegin', removeButton);\n }\n else {\n div.appendChild(removeButton);\n }\n }\n return div;\n },\n choiceList: function (_a, isSelectOneElement) {\n var list = _a.classNames.list;\n var div = document.createElement('div');\n addClassesToElement(div, list);\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 allowHTML = _a.allowHTML, _c = _a.classNames, group = _c.group, groupHeading = _c.groupHeading, itemDisabled = _c.itemDisabled;\n var id = _b.id, label = _b.label, disabled = _b.disabled;\n var rawLabel = unwrapStringForRaw(label);\n var div = document.createElement('div');\n addClassesToElement(div, group);\n if (disabled) {\n addClassesToElement(div, itemDisabled);\n }\n div.setAttribute('role', 'group');\n div.dataset.group = '';\n div.dataset.id = id;\n div.dataset.value = rawLabel;\n if (disabled) {\n div.setAttribute('aria-disabled', 'true');\n }\n var heading = document.createElement('div');\n addClassesToElement(heading, groupHeading);\n setElementHtml(heading, allowHTML, label || '');\n div.appendChild(heading);\n return div;\n },\n choice: function (_a, choice, selectText, groupName) {\n var allowHTML = _a.allowHTML, _b = _a.classNames, item = _b.item, itemChoice = _b.itemChoice, itemSelectable = _b.itemSelectable, selectedState = _b.selectedState, itemDisabled = _b.itemDisabled, description = _b.description, placeholder = _b.placeholder;\n // eslint-disable-next-line prefer-destructuring\n var label = choice.label;\n var rawValue = unwrapStringForRaw(choice.value);\n var div = document.createElement('div');\n div.id = choice.elementId;\n addClassesToElement(div, item);\n addClassesToElement(div, itemChoice);\n if (groupName && typeof label === 'string') {\n label = escapeForTemplate(allowHTML, label);\n label += \" (\".concat(groupName, \")\");\n label = { trusted: label };\n }\n var describedBy = div;\n if (choice.labelClass) {\n var spanLabel = document.createElement('span');\n setElementHtml(spanLabel, allowHTML, label);\n addClassesToElement(spanLabel, choice.labelClass);\n describedBy = spanLabel;\n div.appendChild(spanLabel);\n }\n else {\n setElementHtml(div, allowHTML, label);\n }\n if (choice.labelDescription) {\n var descId = \"\".concat(choice.elementId, \"-description\");\n describedBy.setAttribute('aria-describedby', descId);\n var spanDesc = document.createElement('span');\n setElementHtml(spanDesc, allowHTML, choice.labelDescription);\n spanDesc.id = descId;\n addClassesToElement(spanDesc, description);\n div.appendChild(spanDesc);\n }\n if (choice.selected) {\n addClassesToElement(div, selectedState);\n }\n if (choice.placeholder) {\n addClassesToElement(div, placeholder);\n }\n div.setAttribute('role', choice.group ? 'treeitem' : 'option');\n div.dataset.choice = '';\n div.dataset.id = choice.id;\n div.dataset.value = rawValue;\n if (selectText) {\n div.dataset.selectText = selectText;\n }\n if (choice.group) {\n div.dataset.groupId = \"\".concat(choice.group.id);\n }\n assignCustomProperties(div, choice, false);\n if (choice.disabled) {\n addClassesToElement(div, itemDisabled);\n div.dataset.choiceDisabled = '';\n div.setAttribute('aria-disabled', 'true');\n }\n else {\n addClassesToElement(div, itemSelectable);\n div.dataset.choiceSelectable = '';\n }\n return div;\n },\n input: function (_a, placeholderValue) {\n var _b = _a.classNames, input = _b.input, inputCloned = _b.inputCloned, labelId = _a.labelId;\n var inp = document.createElement('input');\n inp.type = 'search';\n addClassesToElement(inp, input);\n addClassesToElement(inp, inputCloned);\n inp.autocomplete = 'off';\n inp.autocapitalize = 'off';\n inp.spellcheck = false;\n inp.setAttribute('role', 'textbox');\n inp.setAttribute('aria-autocomplete', 'list');\n if (placeholderValue) {\n inp.setAttribute('aria-label', placeholderValue);\n }\n else if (!labelId) {\n addAriaLabel(this._docRoot, this.passedElement.element.id, inp);\n }\n return inp;\n },\n dropdown: function (_a) {\n var _b = _a.classNames, list = _b.list, listDropdown = _b.listDropdown;\n var div = document.createElement('div');\n addClassesToElement(div, list);\n addClassesToElement(div, listDropdown);\n div.setAttribute('aria-expanded', 'false');\n return div;\n },\n notice: function (_a, innerHTML, type) {\n var _b = _a.classNames, item = _b.item, itemChoice = _b.itemChoice, addChoice = _b.addChoice, noResults = _b.noResults, noChoices = _b.noChoices, noticeItem = _b.notice;\n if (type === void 0) { type = NoticeTypes.generic; }\n var notice = document.createElement('div');\n setElementHtml(notice, true, innerHTML);\n addClassesToElement(notice, item);\n addClassesToElement(notice, itemChoice);\n addClassesToElement(notice, noticeItem);\n // eslint-disable-next-line default-case\n switch (type) {\n case NoticeTypes.addChoice:\n addClassesToElement(notice, addChoice);\n break;\n case NoticeTypes.noResults:\n addClassesToElement(notice, noResults);\n break;\n case NoticeTypes.noChoices:\n addClassesToElement(notice, noChoices);\n break;\n }\n if (type === NoticeTypes.addChoice) {\n notice.dataset.choiceSelectable = '';\n notice.dataset.choice = '';\n }\n return notice;\n },\n option: function (choice) {\n // HtmlOptionElement's label value does not support HTML, so the avoid double escaping unwrap the untrusted string.\n var labelValue = unwrapStringForRaw(choice.label);\n var opt = new Option(labelValue, choice.value, false, choice.selected);\n assignCustomProperties(opt, choice, true);\n opt.disabled = choice.disabled;\n if (choice.selected) {\n opt.setAttribute('selected', '');\n }\n return opt;\n },\n};\n\n/** @see {@link http://browserhacks.com/#hack-acea075d0ac6954f275a70023906050c} */\nvar IS_IE11 = '-ms-scroll-limit' in document.documentElement.style &&\n '-ms-ime-align' in document.documentElement.style;\nvar USER_DEFAULTS = {};\nvar parseDataSetId = function (element) {\n if (!element) {\n return undefined;\n }\n return element.dataset.id ? parseInt(element.dataset.id, 10) : undefined;\n};\nvar selectableChoiceIdentifier = '[data-choice-selectable]';\n/**\n * Choices\n * @author Josh Johnson\n */\nvar Choices = /** @class */ (function () {\n function Choices(element, userConfig) {\n if (element === void 0) { element = '[data-choice]'; }\n if (userConfig === void 0) { userConfig = {}; }\n var _this = this;\n this.initialisedOK = undefined;\n this._hasNonChoicePlaceholder = false;\n this._lastAddedChoiceId = 0;\n this._lastAddedGroupId = 0;\n var defaults = Choices.defaults;\n this.config = __assign(__assign(__assign({}, defaults.allOptions), defaults.options), userConfig);\n ObjectsInConfig.forEach(function (key) {\n _this.config[key] = __assign(__assign(__assign({}, defaults.allOptions[key]), defaults.options[key]), userConfig[key]);\n });\n var config = this.config;\n if (!config.silent) {\n this._validateConfig();\n }\n var docRoot = config.shadowRoot || document.documentElement;\n this._docRoot = docRoot;\n var passedElement = typeof element === 'string' ? docRoot.querySelector(element) : element;\n if (!passedElement ||\n typeof passedElement !== 'object' ||\n !(isHtmlInputElement(passedElement) || isHtmlSelectElement(passedElement))) {\n if (!passedElement && typeof element === 'string') {\n throw TypeError(\"Selector \".concat(element, \" failed to find an element\"));\n }\n throw TypeError(\"Expected one of the following types text|select-one|select-multiple\");\n }\n var elementType = passedElement.type;\n var isText = elementType === PassedElementTypes.Text;\n if (isText || config.maxItemCount !== 1) {\n config.singleModeForMultiSelect = false;\n }\n if (config.singleModeForMultiSelect) {\n elementType = PassedElementTypes.SelectMultiple;\n }\n var isSelectOne = elementType === PassedElementTypes.SelectOne;\n var isSelectMultiple = elementType === PassedElementTypes.SelectMultiple;\n var isSelect = isSelectOne || isSelectMultiple;\n this._elementType = elementType;\n this._isTextElement = isText;\n this._isSelectOneElement = isSelectOne;\n this._isSelectMultipleElement = isSelectMultiple;\n this._isSelectElement = isSelectOne || isSelectMultiple;\n this._canAddUserChoices = (isText && config.addItems) || (isSelect && config.addChoices);\n if (typeof config.renderSelectedChoices !== 'boolean') {\n config.renderSelectedChoices = config.renderSelectedChoices === 'always' || isSelectOne;\n }\n if (config.closeDropdownOnSelect === 'auto') {\n config.closeDropdownOnSelect = isText || isSelectOne || config.singleModeForMultiSelect;\n }\n else {\n config.closeDropdownOnSelect = coerceBool(config.closeDropdownOnSelect);\n }\n if (config.placeholder) {\n if (config.placeholderValue) {\n this._hasNonChoicePlaceholder = true;\n }\n else if (passedElement.dataset.placeholder) {\n this._hasNonChoicePlaceholder = true;\n config.placeholderValue = passedElement.dataset.placeholder;\n }\n }\n if (userConfig.addItemFilter && typeof userConfig.addItemFilter !== 'function') {\n var re = userConfig.addItemFilter instanceof RegExp ? userConfig.addItemFilter : new RegExp(userConfig.addItemFilter);\n config.addItemFilter = re.test.bind(re);\n }\n if (this._isTextElement) {\n this.passedElement = new WrappedInput({\n element: passedElement,\n classNames: config.classNames,\n });\n }\n else {\n var selectEl = passedElement;\n this.passedElement = new WrappedSelect({\n element: selectEl,\n classNames: config.classNames,\n template: function (data) { return _this._templates.option(data); },\n extractPlaceholder: config.placeholder && !this._hasNonChoicePlaceholder,\n });\n }\n this.initialised = false;\n this._store = new Store(config);\n this._currentValue = '';\n config.searchEnabled = (!isText && config.searchEnabled) || isSelectMultiple;\n this._canSearch = config.searchEnabled;\n this._isScrollingOnIe = false;\n this._highlightPosition = 0;\n this._wasTap = true;\n this._placeholderValue = this._generatePlaceholderValue();\n this._baseId = generateId(passedElement, '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 = passedElement.dir;\n if (!this._direction) {\n var elementDirection = window.getComputedStyle(passedElement).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 this._templates = defaults.templates;\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._onInput = this._onInput.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 (!config.silent) {\n console.warn('Trying to initialise Choices on element already initialised', { element: element });\n }\n this.initialised = true;\n this.initialisedOK = false;\n return;\n }\n // Let's go\n this.init();\n // preserve the selected item list after setup for form reset\n this._initialItems = this._store.items.map(function (choice) { return choice.value; });\n }\n Object.defineProperty(Choices, \"defaults\", {\n get: function () {\n return Object.preventExtensions({\n get options() {\n return USER_DEFAULTS;\n },\n get allOptions() {\n return DEFAULT_CONFIG;\n },\n get templates() {\n return templates;\n },\n });\n },\n enumerable: false,\n configurable: true\n });\n Choices.prototype.init = function () {\n if (this.initialised || this.initialisedOK !== undefined) {\n return;\n }\n this._searcher = getSearcher(this.config);\n this._loadChoices();\n this._createTemplates();\n this._createElements();\n this._createStructure();\n if ((this._isTextElement && !this.config.addItems) ||\n this.passedElement.element.hasAttribute('disabled') ||\n !!this.passedElement.element.closest('fieldset:disabled')) {\n this.disable();\n }\n else {\n this.enable();\n this._addEventListeners();\n }\n // should be triggered **after** disabled state to avoid additional re-draws\n this._initStore();\n this.initialised = true;\n this.initialisedOK = true;\n var callbackOnInit = this.config.callbackOnInit;\n // Run callback if it is a function\n if (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._store._listeners = []; // prevents select/input value being wiped\n this.clearStore(false);\n this._stopSearch();\n this._templates = Choices.defaults.templates;\n this.initialised = false;\n this.initialisedOK = undefined;\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) { runEvent = true; }\n if (!item || !item.id) {\n return this;\n }\n var choice = this._store.items.find(function (c) { return c.id === item.id; });\n if (!choice || choice.highlighted) {\n return this;\n }\n this._store.dispatch(highlightItem(choice, true));\n if (runEvent) {\n this.passedElement.triggerEvent(EventType.highlightItem, this._getChoiceForOutput(choice));\n }\n return this;\n };\n Choices.prototype.unhighlightItem = function (item, runEvent) {\n if (runEvent === void 0) { runEvent = true; }\n if (!item || !item.id) {\n return this;\n }\n var choice = this._store.items.find(function (c) { return c.id === item.id; });\n if (!choice || !choice.highlighted) {\n return this;\n }\n this._store.dispatch(highlightItem(choice, false));\n if (runEvent) {\n this.passedElement.triggerEvent(EventType.unhighlightItem, this._getChoiceForOutput(choice));\n }\n return this;\n };\n Choices.prototype.highlightAll = function () {\n var _this = this;\n this._store.withTxn(function () {\n _this._store.items.forEach(function (item) {\n if (!item.highlighted) {\n _this._store.dispatch(highlightItem(item, true));\n _this.passedElement.triggerEvent(EventType.highlightItem, _this._getChoiceForOutput(item));\n }\n });\n });\n return this;\n };\n Choices.prototype.unhighlightAll = function () {\n var _this = this;\n this._store.withTxn(function () {\n _this._store.items.forEach(function (item) {\n if (item.highlighted) {\n _this._store.dispatch(highlightItem(item, false));\n _this.passedElement.triggerEvent(EventType.highlightItem, _this._getChoiceForOutput(item));\n }\n });\n });\n return this;\n };\n Choices.prototype.removeActiveItemsByValue = function (value) {\n var _this = this;\n this._store.withTxn(function () {\n _this._store.items.filter(function (item) { return item.value === value; }).forEach(function (item) { return _this._removeItem(item); });\n });\n return this;\n };\n Choices.prototype.removeActiveItems = function (excludedId) {\n var _this = this;\n this._store.withTxn(function () {\n _this._store.items.filter(function (_a) {\n var id = _a.id;\n return id !== excludedId;\n }).forEach(function (item) { return _this._removeItem(item); });\n });\n return this;\n };\n Choices.prototype.removeHighlightedItems = function (runEvent) {\n var _this = this;\n if (runEvent === void 0) { runEvent = false; }\n this._store.withTxn(function () {\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 });\n return this;\n };\n Choices.prototype.showDropdown = function (preventInputFocus) {\n var _this = this;\n if (this.dropdown.isActive) {\n return this;\n }\n if (preventInputFocus === undefined) {\n // eslint-disable-next-line no-param-reassign\n preventInputFocus = !this._canSearch;\n }\n requestAnimationFrame(function () {\n _this.dropdown.show();\n var rect = _this.dropdown.element.getBoundingClientRect();\n _this.containerOuter.open(rect.bottom, rect.height);\n if (!preventInputFocus) {\n _this.input.focus();\n }\n _this.passedElement.triggerEvent(EventType.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(EventType.hideDropdown);\n });\n return this;\n };\n Choices.prototype.getValue = function (valueOnly) {\n var _this = this;\n var values = this._store.items.map(function (item) {\n return (valueOnly ? item.value : _this._getChoiceForOutput(item));\n });\n return this._isSelectOneElement || this.config.singleModeForMultiSelect ? values[0] : values;\n };\n Choices.prototype.setValue = function (items) {\n var _this = this;\n if (!this.initialisedOK) {\n this._warnChoicesInitFailed('setValue');\n return this;\n }\n this._store.withTxn(function () {\n items.forEach(function (value) {\n if (value) {\n _this._addChoice(mapInputToChoice(value, false));\n }\n });\n });\n // @todo integrate with Store\n this._searcher.reset();\n return this;\n };\n Choices.prototype.setChoiceByValue = function (value) {\n var _this = this;\n if (!this.initialisedOK) {\n this._warnChoicesInitFailed('setChoiceByValue');\n return this;\n }\n if (this._isTextElement) {\n return this;\n }\n this._store.withTxn(function () {\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) { return _this._findAndSelectChoiceByValue(val); });\n _this.unhighlightAll();\n });\n // @todo integrate with Store\n this._searcher.reset();\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, clearSearchFlag) {\n var _this = this;\n if (choicesArrayOrFetcher === void 0) { choicesArrayOrFetcher = []; }\n if (value === void 0) { value = 'value'; }\n if (label === void 0) { label = 'label'; }\n if (replaceChoices === void 0) { replaceChoices = false; }\n if (clearSearchFlag === void 0) { clearSearchFlag = true; }\n if (!this.initialisedOK) {\n this._warnChoicesInitFailed('setChoices');\n return this;\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) { return requestAnimationFrame(resolve); })\n .then(function () { return _this._handleLoadingState(true); })\n .then(function () { return fetcher_1; })\n .then(function (data) { return _this.setChoices(data, value, label, replaceChoices); })\n .catch(function (err) {\n if (!_this.config.silent) {\n console.error(err);\n }\n })\n .then(function () { return _this._handleLoadingState(false); })\n .then(function () { return _this; });\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._store.withTxn(function () {\n if (clearSearchFlag) {\n _this._isSearching = false;\n }\n var isDefaultValue = value === 'value';\n var isDefaultLabel = label === 'label';\n choicesArrayOrFetcher.forEach(function (groupOrChoice) {\n if ('choices' in groupOrChoice) {\n var group = groupOrChoice;\n if (!isDefaultLabel) {\n group = __assign(__assign({}, group), { label: group[label] });\n }\n _this._addGroup(mapInputToChoice(group, true));\n }\n else {\n var choice = groupOrChoice;\n if (!isDefaultLabel || !isDefaultValue) {\n choice = __assign(__assign({}, choice), { value: choice[value], label: choice[label] });\n }\n _this._addChoice(mapInputToChoice(choice, false));\n }\n });\n _this.unhighlightAll();\n });\n // @todo integrate with Store\n this._searcher.reset();\n return this;\n };\n Choices.prototype.refresh = function (withEvents, selectFirstOption, deselectAll) {\n var _this = this;\n if (withEvents === void 0) { withEvents = false; }\n if (selectFirstOption === void 0) { selectFirstOption = false; }\n if (deselectAll === void 0) { deselectAll = false; }\n if (!this._isSelectElement) {\n if (!this.config.silent) {\n console.warn('refresh method can only be used on choices backed by a