{"version":3,"file":"js/themes/odistad-f52bfdb1781a744b8c7f.js","sources":["webpack:///webpack/bootstrap","webpack:///./app/javascript/controllers/application.js","webpack:///./app/javascript/controllers/counter_controller.js","webpack:///./app/javascript/controllers/dropzone_controller.js","webpack:///./app/javascript/controllers/index.js","webpack:///./app/javascript/controllers/metadata_controller.js","webpack:///./app/javascript/controllers/modals_controller.js","webpack:///./app/javascript/controllers/sagri_bidding_custom_controller.js","webpack:///./app/javascript/controllers/sortable_controller.js","webpack:///./app/javascript/controllers/tab_controller.js","webpack:///./app/javascript/controllers/visual_editor_controller.js","webpack:///./app/javascript/css/admin.css","webpack:///./app/javascript/css/themes/odistad.css","webpack:///./app/javascript/grapesjs-techtown-block/src/blocks/index.js","webpack:///./app/javascript/grapesjs-techtown-block/src/blocks/techtown.js","webpack:///./app/javascript/grapesjs-techtown-block/src/components.js","webpack:///./app/javascript/grapesjs-techtown-block/src/index.js","webpack:///./app/javascript/helpers/index.js","webpack:///./app/javascript/images sync ^\\.\\/.*$","webpack:///./app/javascript/images/envelopes.png","webpack:///./app/javascript/images/frame-592.png","webpack:///./app/javascript/images/index.js","webpack:///./app/javascript/images/linkedin.png","webpack:///./app/javascript/images/monster.png","webpack:///./app/javascript/images/odistad_doctor.png","webpack:///./app/javascript/images/odistad_favicon.png","webpack:///./app/javascript/images/odistad_hotline.png","webpack:///./app/javascript/images/odistad_messager.png","webpack:///./app/javascript/images/phone-call.png","webpack:///./app/javascript/images/sagri-favicon-16x16.png","webpack:///./app/javascript/images/sagri-map.png","webpack:///./app/javascript/images/signs-direction.png","webpack:///./app/javascript/images/vector.png","webpack:///./app/javascript/packs/components/particles.js","webpack:///./app/javascript/packs/themes/odistad.js","webpack:///./app/javascript/packs/web.js","webpack:///./node_modules/@hotwired/stimulus/dist/stimulus.js","webpack:///./node_modules/@hotwired/stimulus/dist/stimulus.umd.js","webpack:///./node_modules/@popperjs/core/lib/createPopper.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/contains.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getWindow.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","webpack:///./node_modules/@popperjs/core/lib/enums.js","webpack:///./node_modules/@popperjs/core/lib/index.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/applyStyles.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/arrow.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/computeStyles.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/eventListeners.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/flip.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/hide.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/index.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/offset.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","webpack:///./node_modules/@popperjs/core/lib/popper-lite.js","webpack:///./node_modules/@popperjs/core/lib/popper.js","webpack:///./node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","webpack:///./node_modules/@popperjs/core/lib/utils/computeOffsets.js","webpack:///./node_modules/@popperjs/core/lib/utils/debounce.js","webpack:///./node_modules/@popperjs/core/lib/utils/detectOverflow.js","webpack:///./node_modules/@popperjs/core/lib/utils/expandToHashMap.js","webpack:///./node_modules/@popperjs/core/lib/utils/getAltAxis.js","webpack:///./node_modules/@popperjs/core/lib/utils/getBasePlacement.js","webpack:///./node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","webpack:///./node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","webpack:///./node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","webpack:///./node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","webpack:///./node_modules/@popperjs/core/lib/utils/getVariation.js","webpack:///./node_modules/@popperjs/core/lib/utils/math.js","webpack:///./node_modules/@popperjs/core/lib/utils/mergeByName.js","webpack:///./node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","webpack:///./node_modules/@popperjs/core/lib/utils/orderModifiers.js","webpack:///./node_modules/@popperjs/core/lib/utils/rectToClientRect.js","webpack:///./node_modules/@popperjs/core/lib/utils/userAgent.js","webpack:///./node_modules/@popperjs/core/lib/utils/within.js","webpack:///./node_modules/@rails/activestorage/app/assets/javascripts/activestorage.esm.js","webpack:///./node_modules/@rails/request.js/src/fetch_request.js","webpack:///./node_modules/@rails/request.js/src/fetch_response.js","webpack:///./node_modules/@rails/request.js/src/index.js","webpack:///./node_modules/@rails/request.js/src/lib/utils.js","webpack:///./node_modules/@rails/request.js/src/request_interceptor.js","webpack:///./node_modules/@rails/request.js/src/verbs.js","webpack:///./node_modules/dropzone/dist/dropzone.mjs","webpack:///./node_modules/flowbite/lib/esm/components/accordion/index.js","webpack:///./node_modules/flowbite/lib/esm/components/accordion/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/accordion/types.js","webpack:///./node_modules/flowbite/lib/esm/components/carousel/index.js","webpack:///./node_modules/flowbite/lib/esm/components/carousel/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/carousel/types.js","webpack:///./node_modules/flowbite/lib/esm/components/collapse/index.js","webpack:///./node_modules/flowbite/lib/esm/components/collapse/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/collapse/types.js","webpack:///./node_modules/flowbite/lib/esm/components/dial/index.js","webpack:///./node_modules/flowbite/lib/esm/components/dial/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/dial/types.js","webpack:///./node_modules/flowbite/lib/esm/components/dismiss/index.js","webpack:///./node_modules/flowbite/lib/esm/components/dismiss/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/dismiss/types.js","webpack:///./node_modules/flowbite/lib/esm/components/drawer/index.js","webpack:///./node_modules/flowbite/lib/esm/components/drawer/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/drawer/types.js","webpack:///./node_modules/flowbite/lib/esm/components/dropdown/index.js","webpack:///./node_modules/flowbite/lib/esm/components/dropdown/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/dropdown/types.js","webpack:///./node_modules/flowbite/lib/esm/components/index.js","webpack:///./node_modules/flowbite/lib/esm/components/modal/index.js","webpack:///./node_modules/flowbite/lib/esm/components/modal/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/modal/types.js","webpack:///./node_modules/flowbite/lib/esm/components/popover/index.js","webpack:///./node_modules/flowbite/lib/esm/components/popover/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/popover/types.js","webpack:///./node_modules/flowbite/lib/esm/components/tabs/index.js","webpack:///./node_modules/flowbite/lib/esm/components/tabs/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/tabs/types.js","webpack:///./node_modules/flowbite/lib/esm/components/tooltip/index.js","webpack:///./node_modules/flowbite/lib/esm/components/tooltip/interface.js","webpack:///./node_modules/flowbite/lib/esm/components/tooltip/types.js","webpack:///./node_modules/flowbite/lib/esm/dom/events.js","webpack:///./node_modules/flowbite/lib/esm/dom/instances.js","webpack:///./node_modules/flowbite/lib/esm/index.js","webpack:///./node_modules/hotkeys-js/dist/hotkeys.esm.js","webpack:///./node_modules/jquery/dist/jquery.js","webpack:///./node_modules/just-extend/index.js","webpack:///./node_modules/sortablejs/modular/sortable.esm.js","webpack:///./node_modules/stimulus-notification/dist/stimulus-notification.mjs","webpack:///./node_modules/stimulus-use/dist/index.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/packs/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./app/javascript/packs/themes/odistad.js\");\n","// import \"@hotwired/turbo-rails\"\nimport { Application } from \"@hotwired/stimulus\"\nimport Notification from 'stimulus-notification'\n\nconst application = Application.start()\n\n// Configure Stimulus development experience\napplication.debug = false\nwindow.Stimulus = application\n\napplication.register('notification', Notification)\n\nimport TabController from \"./tab_controller\"\napplication.register(\"tab\", TabController)\n\nexport { application }\n","import { Controller } from \"@hotwired/stimulus\"\n\n// Connects to data-controller=\"counter\"\nexport default class extends Controller {\n \n static targets = [\"output\"]\n \n connect() {\n this.count = 0\n }\n\n increment(){\n this.count += 1;\n this.outputTarget.textContent = this.count\n }\n}\n","import Dropzone from \"dropzone\";\nimport { Controller } from \"@hotwired/stimulus\"\nimport { DirectUpload } from \"@rails/activestorage\";\nimport {\n getMetaValue,\n toArray,\n findElement,\n removeElement,\n insertAfter\n} from \"helpers\";\n\nexport default class extends Controller {\n static targets = [\"input\"];\n\n connect() {\n this.dropZone = createDropZone(this);\n this.hideFileInput();\n this.bindEvents();\n this.createThumbnailFromUrl();\n Dropzone.autoDiscover = false;\n }\n\n // Private\n hideFileInput() {\n this.inputTarget.disabled = true;\n this.inputTarget.style.display = \"none\";\n }\n\n createThumbnailFromUrl() {\n const url = this.currentUrl;\n\n // show in preview\n if (url) {\n const mockFile = { name: url, size: 12345 };\n this.dropZone.emit(\"addedfile\", mockFile);\n this.dropZone.emit(\"thumbnail\", mockFile, url);\n this.dropZone.emit(\"complete\", mockFile);\n this.dropZone.files.push(mockFile);\n }\n }\n\n bindEvents() {\n\n this.dropZone.on(\"addedfile\", file => {\n\n // Upload single file\n if ( this.maxFiles == 1 && this.dropZone.files.length > 1 ) {\n this.dropZone.removeFile(this.dropZone.files[0]);\n }\n\n setTimeout(() => {\n file.accepted && createDirectUploadController(this, file).start();\n }, 500);\n });\n\n this.dropZone.on(\"removedfile\", file => {\n file.controller && removeElement(file.controller.hiddenInput);\n });\n\n this.dropZone.on(\"canceled\", file => {\n file.controller && file.controller.xhr.abort();\n });\n\n this.dropZone.on(\"maxfilesexceeded\", file => {\n console.log('maxfilesexceeded: ', file )\n // this.dropZone.removeAllFiles();\n });\n\n this.dropZone.on(\"maxfilesreached\", file => {\n console.log('maxfilesreached: ', file )\n });\n\n }\n\n get headers() {\n return { \"X-CSRF-Token\": getMetaValue(\"csrf-token\") };\n }\n\n get url() {\n return this.inputTarget.getAttribute(\"data-direct-upload-url\");\n }\n\n get currentUrl() {\n return this.data.get(\"url\");\n }\n\n get maxFiles() {\n return this.data.get(\"maxFiles\") || 1;\n }\n\n get maxFileSize() {\n return this.data.get(\"maxFileSize\") || 256;\n }\n\n get acceptedFiles() {\n return this.data.get(\"acceptedFiles\");\n }\n\n get addRemoveLinks() {\n return this.data.get(\"addRemoveLinks\") || true;\n }\n}\n\nclass DirectUploadController {\n constructor(source, file) {\n this.directUpload = createDirectUpload(file, source.url, this);\n this.source = source;\n this.file = file;\n }\n\n start() {\n this.file.controller = this;\n this.hiddenInput = this.createHiddenInput();\n this.directUpload.create((error, attributes) => {\n if (error) {\n removeElement(this.hiddenInput);\n this.emitDropzoneError(error);\n } else {\n this.hiddenInput.value = attributes.signed_id;\n this.emitDropzoneSuccess();\n }\n });\n }\n\n createHiddenInput() {\n const input = document.createElement(\"input\");\n input.type = \"hidden\";\n input.name = this.source.inputTarget.name;\n insertAfter(input, this.source.inputTarget);\n return input;\n }\n\n directUploadWillStoreFileWithXHR(xhr) {\n this.bindProgressEvent(xhr);\n this.emitDropzoneUploading();\n }\n\n bindProgressEvent(xhr) {\n this.xhr = xhr;\n this.xhr.upload.addEventListener(\"progress\", event =>\n this.uploadRequestDidProgress(event)\n );\n }\n\n uploadRequestDidProgress(event) {\n const element = this.source.element;\n const progress = (event.loaded / event.total) * 100;\n findElement(\n this.file.previewTemplate,\n \".dz-upload\"\n ).style.width = `${progress}%`;\n }\n\n emitDropzoneUploading() {\n this.file.status = Dropzone.UPLOADING;\n this.source.dropZone.emit(\"processing\", this.file);\n }\n\n emitDropzoneError(error) {\n this.file.status = Dropzone.ERROR;\n this.source.dropZone.emit(\"error\", this.file, error);\n this.source.dropZone.emit(\"complete\", this.file);\n }\n\n emitDropzoneSuccess() {\n this.file.status = Dropzone.SUCCESS;\n this.source.dropZone.emit(\"success\", this.file);\n this.source.dropZone.emit(\"complete\", this.file);\n }\n}\n\nfunction createDirectUploadController(source, file) {\n return new DirectUploadController(source, file);\n}\n\nfunction createDirectUpload(file, url, controller) {\n return new DirectUpload(file, url, controller);\n}\n\n\n\nfunction createDropZone(controller) {\n return new Dropzone(controller.element, {\n url: controller.url,\n headers: controller.headers,\n maxFiles: controller.maxFiles,\n maxFilesize: controller.maxFileSize,\n acceptedFiles: controller.acceptedFiles,\n addRemoveLinks: controller.addRemoveLinks,\n autoQueue: false,\n thumbnailWidth: controller.maxFiles == 1 ? 512 : 120,\n thumbnailHeight: controller.maxFiles == 1 ? 200 : 120,\n\n });\n}","// This file is auto-generated by ./bin/rails stimulus:manifest:update\n// Run that command whenever you add a new controller or create them with\n// ./bin/rails generate stimulus controllerName\n\nimport { application } from \"./application\"\n\nimport CounterController from \"./counter_controller\"\napplication.register(\"counter\", CounterController)\n\nimport DropzoneController from \"./dropzone_controller\"\napplication.register(\"dropzone\", DropzoneController)\n\n// import EditorController from \"./editor_controller\"\n// application.register(\"editor\", EditorController)\n\nimport MetadataController from \"./metadata_controller\"\napplication.register(\"metadata\", MetadataController)\n\nimport ModalsController from \"./modals_controller\"\napplication.register(\"modals\", ModalsController)\n\nimport SortableController from \"./sortable_controller\"\napplication.register(\"sortable\", SortableController)\n\nimport TabController from \"./tab_controller\"\napplication.register(\"tab\", TabController)\n\nimport SagriBiddingCustomController from \"./sagri_bidding_custom_controller\"\napplication.register(\"dauthau\", SagriBiddingCustomController)\n\nimport VisualEditorController from \"./visual_editor_controller\"\napplication.register(\"visual-editor\", VisualEditorController)\n","import { Controller } from \"@hotwired/stimulus\"\nimport $ from 'jquery'\n\n// Connects to data-controller=\"metadata\"\nexport default class extends Controller {\n static targets = [\n 'seoTitle','seoLink', 'seoDesc', 'seoPreviewTitle', 'seoPreviewLink', 'seoPreviewDesc', 'seoTitleCounter', 'seoDescCounter',//SEO METADATA\n 'fbTitle','fbLink', 'fbDesc', 'fbPreviewTitle', 'fbPreviewLink', 'fbPreviewDesc', 'fbTitleCounter', 'fbDescCounter',//Facebook CARD\n 'xTitle','xLink', 'xDesc', 'xPreviewTitle', 'xPreviewLink', 'xPreviewDesc', 'xTitleCounter', 'xDescCounter', //X CARD\n 'desc', 'descCounter'\n\n ]\n connect() {\n this.updateMetadata(this.descTarget, null, this.descCounterTarget)\n this.updateMetadata(this.seoTitleTarget, this.seoPreviewTitleTarget, this.seoTitleCounterTarget)\n this.updateMetadata(this.seoLinkTarget, this.seoPreviewLinkTarget)\n this.updateMetadata(this.seoDescTarget, this.seoPreviewDescTarget, this.seoDescCounterTarget)\n\n this.updateMetadata(this.fbTitleTarget, this.fbPreviewTitleTarget,this.fbTitleCounterTarget)\n this.updateMetadata(this.fbDescTarget, this.fbPreviewDescTarget,this.fbDescCounterTarget)\n\n this.updateMetadata(this.xTitleTarget, this.xPreviewTitleTarget, this.xTitleCounterTarget)\n this.updateMetadata(this.xDescTarget, this.xPreviewDescTarget,this.xDescCounterTarget)\n this.multipleSelect()\n }\n\n updateMetadata(target, targetPreview, counter){\n if(targetPreview)\n targetPreview.innerHTML = target.value\n if(counter)\n counter.innerHTML = target.value.length + ''\n target.addEventListener('keyup', () => {\n if(targetPreview)\n targetPreview.innerHTML = target.value\n if(counter)\n counter.innerHTML = target.value.length + ''\n })\n }\n\n multipleSelect(){\n console.log('multiple')\n\n $('select#page_category_ids').select2()\n $('.select2-container--default .select2-selection--multiple ').css({\n 'border-color': 'rgb(209, 213, 219)',\n })\n $('.select2-search--inline .select2-search__field').css({\n 'box-shadow': 'unset',\n })\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { Drawer, Popover } from 'flowbite';\nimport $ from 'jquery'\nimport { get } from \"@rails/request.js\";\n// Connects to data-controller=\"modals\"\n// options with default values\nconst options = {\n placement: 'right',\n backdrop: true,\n bodyScrolling: false,\n edge: true,\n edgeOffset: '',\n backdropClasses: 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-30',\n onHide: () => {\n },\n onShow: () => {\n },\n onToggle: () => {\n }\n};\n\nconst optionsPopover = {\n placement: 'bottom',\n triggerType: 'click',\n offset: 10,\n onHide: () => {\n },\n onShow: () => {\n },\n onToggle: () => {\n }\n};\n\nlet menuItemLabels = {\n 'Categories': { label: 'categories', params: {per_page: '100'}, label_id: 'category' },\n 'Posts': { label: 'posts', params: { post_type: 'post', per_page: '100' }, label_id: 'page' },\n 'Pages': { label: 'pages', params: {per_page: '100'}, label_id: 'page' },\n 'Tags': { label: 'tags', params: {}, label_id: 'tag' },\n 'Job categories': { label: 'job_categories', params: {}, label_id: 'job_category' },\n 'Galleries': { label: 'posts', params: { post_type: 'gallery', per_page: '100' }, label_id: 'page' }\n}\nexport default class extends Controller {\n static targets = ['url', 'inputUrl', 'form', 'popoverContent', 'childVal']\n\n connect() {\n this.modal = new Drawer(document.getElementById('modal').children[0], options)\n this.modal.show()\n this.selectField = $('#menu_item_menu_item_type')\n this.selectField.select2()\n // set the popover content element\n const $targetEl = document.getElementById('popover-click');\n // set the element that trigger the popover using hover or click\n const $triggerEl = document.getElementById('test');\n console.log('inside childVal')\n // options with default values\n this.popover = new Popover($targetEl, $triggerEl, optionsPopover);\n this.selectField.on('select2:select', (e) => {\n let data = e.params.data\n const classes = ['hidden']\n\n if (this.childValTarget.classList.contains('hidden')){\n this.childValTarget.classList.remove(...classes)\n }\n let label = $('label#child-val-label')\n var childVal = $('#childVal')\n\n label.empty();\n if (data.text != 'Homepage'){\n label.append(data.text);\n }\n let dataLabel = data.text.toLocaleLowerCase().replace(/ /g,'-')\n switch (dataLabel){\n case 'redirect-url':\n this.removeExist()\n childVal.append(`\n \n `)\n break\n case 'homepage':\n break\n default:\n this.removeExist()\n let menuItemLabel = menuItemLabels[`${data.text}`]\n\n let label_id = menuItemLabel.label_id\n childVal.append(`'\n options.append(optionsString)\n }\n\n getData(title, params='') {\n var client = $('.hidden-client-id').val()\n let url = `${window.location.origin}/api/v1/`\n if (title != 'job_categories'){\n url += 'content'\n }\n url += `/${title}?${new URLSearchParams(params)}`\n const req = fetch(url ,{\n method: 'GET',\n headers: {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/json\",\n \"CLIENT_ID\": client,\n }\n })\n req.then(res => {\n return res.json()\n }).then(data => {\n this.createSelectOption(data.data.items)\n })\n }\n\n submit(e) {\n e.preventDefault()\n this.formTarget.submit()\n\n }\n close(e) {\n e.preventDefault()\n this.modal.close()\n }\n}\n\n","import { Controller } from \"@hotwired/stimulus\"\nimport $ from 'jquery'\n\nexport default class extends Controller {\n static values = {\n resource: {type: String, default: 'bid_invitations'},\n input: String,\n perPage: {type: Number, default: 3}\n }\n\n async connect() {\n console.log('stimulus connected')\n var data = await this.fetchData()\n // console.log('this.dataValue', this.dataValue)\n\n this.buildHtml(data.items)\n $('.searchForm #dropdown .select-option').click(\n function(event) {\n const value = $(this).text().trim();\n this.resourceValue = event.target.value\n $('.searchForm #dropdown-button').text(value)\n }\n )\n \n $('.load-more').addClass('flex px-28')\n console.log('s', $('.load-more'))\n $('.load-more > div:first-child').after(\n '

Xem Thêm

')\n\n document.addEventListener('click', () => {\n var element = $('.searchForm #dropdown')\n var button = $('.searchForm #dropdown-button')\n \n if ( !button.is(event.target) && button.has(event.target).length === 0) {\n element.hide()\n }\n } );\n\n }\n\n\n fetchData(per=this.perPageValue){\n var resource = this.resourceValue\n var inputValue = this.inputValue\n var url = `https://nhathaumgt.sagri.com.vn/v1/${resource}?page=1&per_page=3&order_attribute=published_at&q[code_or_bid_package_name_cont]=${inputValue}`\n return fetch(url ,{\n method: 'GET',\n headers: {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/json\",\n }\n }).then(async res => {\n const data = await res.json()\n return data.data\n })\n }\n\n buildHtml(data){\n var dropdownSearch = this.buildSearchDropdownElement()\n var table = this.buildTable(data)\n var html = dropdownSearch + table\n $('.dauthau-content').html(html)\n }\n\n buildTableContent(data){\n var stopReceiveDate = this.dateTimeConvert(data.stop_receive_at)\n var updatedAtDate = this.dateTimeConvert(data.updated_at)\n return `\n \n \n
${data.code}
\n
${data.bid_package.name}
\n
${data.bid_package.investor_name}
\n \n \n
${stopReceiveDate.day}/${stopReceiveDate.month}/${stopReceiveDate.year}
\n
${stopReceiveDate.hours}:${stopReceiveDate.minutes}
\n \n ${data.status}\n ${data.bid_package.investor_name}\n \n
${updatedAtDate.day}/${updatedAtDate.month}/${updatedAtDate.year}
\n
${updatedAtDate.hours}:${updatedAtDate.minutes}
\n \n \n `\n }\n\n buildTable(data){\n var header = `\n \n Tin mở thầu\n Thời điểm đóng thầu\n Trạng thái\n Chủ đầu tư\n Lần cuối chỉnh sửa\n \n `\n var content = ``\n data.forEach((item) => {\n content += this.buildTableContent(item)\n })\n\n content += ``\n \n return `
` + header + content + `
`\n }\n\n dateTimeConvert(dateString){\n var date = new Date(dateString)\n const day = String(date.getDate()).padStart(2, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-indexed in JS\n const year = date.getFullYear();\n const hours = String(date.getHours()).padStart(2, '0');\n const minutes = String(date.getMinutes()).padStart(2, '0');\n \n return {\n day: day,\n month: month,\n year: year,\n hours: hours,\n minutes: minutes\n } \n }\n\n\n // Build search\n\n buildSearchDropdownElement(){\n\n return `
\n
\n
\n \n \n\n \n
\n
\n dauthau#searchContent\" class=\"search-input w-[751px] block w-full h-full rounded-none pl-4 z-20 text-sm text-gray-900 bg-gray-50 placeholder=\"...\" required />\n \n
\n
\n
\n \n
\n\n
`\n }\n\n setInput(event){\n console.log('event', event.target.value)\n }\n\n dropdown(){\n var element = $('.searchForm #dropdown')\n if (element.is(\":hidden\")){\n element.show()\n } else {\n element.hide()\n }\n // $('.searchForm #dropdown').show()\n\n }\n\n\n\n\n async searchContent(event){\n console.log(' event.target.value', event.target.value)\n // var data = await this.fetchData()\n\n // var table = this.buildTable(data.items)\n // $('.dauthau-content table.table').html(table)\n }\n\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport Sortable from \"sortablejs\"\nimport { put } from \"@rails/request.js\"\n// Connects to data-controller=\"sortable\"\nexport default class extends Controller {\n static values = {url: String}\n\n connect() {\n \n this.sortable = Sortable.create(this.element, {\n onEnd: this.onEnd.bind(this),\n handle: \"[data-sortable-handle]\",\n group: \"nested\",\n })\n }\n \n disconnect() {\n this.sortable.destroy()\n }\n\n onEnd(e) {\n const { newIndex, item} = e \n const id = item.dataset[\"sortableId\"]\n const url = this.urlValue.replace(\":id\", id)\n put(`${url}`, {\n body: JSON.stringify({position: newIndex})\n })\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport $ from 'jquery'\n\n// window.onload = function() {\n// var reloading = sessionStorage.getItem(\"reloading\");\n// if (reloading) {\n// sessionStorage.removeItem(\"reloading\");\n// myFunction();\n// }\n// }\n\n// function reloadP() {\n// sessionStorage.setItem(\"reloading\", \"true\");\n// document.location.reload();\n// }\n\n\nexport default class extends Controller {\n static values = {\n currentPage: {type: Number, default: 1},\n currentSlug: String,\n totalPage: Number,\n perPage: {type: Number, default: 6}\n }\n\n connect() {\n console.log('stimulus connected')\n this.initial()\n }\n\n async initial(){\n this.currentSlugValue = $('.post-categories-content .category-tab button')[0].value\n var data = await this.fetchData(this.currentSlugValue, this.currentPageValue)\n if ( data?.items.length == 0){\n this.showNotFoundMessage()\n return\n } else {\n this.appendArticleElements(data.items)\n this.totalPageValue = data.total_pages\n this.createPagination(this.totalPageValue, 1)\n }\n }\n\n // update with slug\n async updateWithSlug(event){\n this.currentSlugValue = event.target.value\n this.currentPageValue = 1\n if (event.target.classList.contains('active')){\n return\n }\n\n this.activeTab(event.target)\n var data = await this.fetchData(this.currentSlugValue, this.currentPageValue)\n this.totalPageValue = data.total_pages\n\n if ( data?.items.length == 0){\n $('.post-categories-content .post-categories .contents').empty()\n $('.post-categories-content .pagination nav').hide()\n this.showNotFoundMessage()\n return\n }\n\n $('.post-categories-content .pagination nav').show()\n this.createPagination(this.totalPageValue, 1)\n this.hideNotFoundMessage()\n this.appendArticleElements(data.items)\n }\n\n\n // update with page\n async updateWithPage(event){\n this.currentPageValue = event.target.text\n if (event.target.classList.contains('pagi-active')){\n return\n }\n this.activePage(event.target)\n\n // $('.post-categories-content .pagination .pagi-active').text\n var data = await this.fetchData(this.currentSlugValue, this.currentPageValue)\n if ( data?.items.length == 0){\n $('.post-categories-content .post-categories .contents').empty()\n $('.post-categories-content .pagination nav').hide()\n this.showNotFoundMessage()\n return\n }\n this.createPagination(this.totalPageValue, this.currentPageValue)\n this.hideNotFoundMessage()\n this.appendArticleElements(data.items)\n }\n\n activeTab(element){\n $('.post-categories-content .category-tabs button.active').removeClass('active')\n $(element).addClass('active')\n }\n\n fetchData(slug, page, per=this.perPageValue){\n if (slug) {\n var url = `api/v1/content/categories/${slug}/posts?page=${page}&per_page=${per}`\n return fetch(url ,{\n method: 'GET',\n headers: {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/json\",\n \"CLIENT_ID\": 'SAGRI',\n }\n }).then(async res => {\n const data = await res.json()\n return data.data\n })\n }\n }\n\n buildArticleElement(data) {\n return `\n
\n \n

${data.updated_at}

\n

${data.title}

\n

${data.expert}

\n
\n `\n }\n\n appendArticleElements(items){\n var articlesElements = ``\n items.forEach((item) => {\n articlesElements += this.buildArticleElement(item)\n })\n\n $('.post-categories-content .post-categories .contents').html(articlesElements)\n }\n\n // Function to show the message\n showNotFoundMessage() {\n var notFoundElement = $('.post-categories-content .not-found-message')\n if (notFoundElement.hasClass('hidden')){\n notFoundElement.removeClass('hidden')\n }\n }\n \n // Function to hide the message\n hideNotFoundMessage() {\n var notFoundElement = $('.post-categories-content .not-found-message')\n if (notFoundElement.hasClass('hidden')){\n return\n }\n notFoundElement.addClass('hidden')\n }\n\n // Paginate----------------------------------------\n createPagination(totalPage, currentPage){\n $('.post-categories-content .pagination nav').empty()\n if (this.hasTotalPageValue) {\n var html = ``\n if (totalPage === 0){\n $('.post-categories-content .pagination nav').html(html)\n } else {\n if (totalPage === 1){\n html = this.buildPaginationElement(1)\n } else if (totalPage > 1 && totalPage <= 5) {\n for (var i = 1; i <= totalPage; i ++ ){\n html += this.buildPaginationElement(i)\n }\n html = this.previousElement() + html + this.nextElement() \n } else {\n if (currentPage <= 3){\n html += this.previousElement()\n for (var i = 1; i <= 5; i ++ ){\n html += this.buildPaginationElement(i)\n }\n if (totalPage === 6){\n html += this.buildPaginationElement(6)\n\n } else {\n html += this.threeDot()\n html += this.buildPaginationElement(totalPage)\n html += this.nextElement()\n }\n } else {\n if (totalPage > currentPage + 2 ) {\n for (var i = currentPage -2 ; i <= currentPage + 2; i ++ ){\n html += this.buildPaginationElement(i)\n }\n html += this.threeDot()\n } else {\n for (var i = currentPage -2 ; i <= totalPage; i ++ ){\n html += this.buildPaginationElement(i)\n }\n }\n html = this.previousElement() + this.threeDot() + html + this.nextElement() \n } \n }\n $('.post-categories-content .pagination nav').append(html)\n }\n }\n }\n\n threeDot(){\n return `\n ...\n `\n }\n\n previousElement(){\n return `\n tab#goPreviousPage\" class=\"previous relative inline-flex items-center rounded-l-md px-2 py-2 text-gray-400 hover:bg-gray-50 \">\n < \n \n \n \n \n `\n }\n\n async goPreviousPage(){\n if (this.currentPageValue === 1) return\n this.currentPageValue -= 1\n this.createPagination(this.totalPageValue, this.currentPageValue)\n var data = await this.fetchData(this.currentSlugValue, this.currentPageValue)\n if ( data?.items.length == 0){\n $('.post-categories-content .post-categories .contents').empty()\n this.showNotFoundMessage()\n return\n }\n this.createPagination(this.totalPageValue, this.currentPageValue)\n this.hideNotFoundMessage()\n this.appendArticleElements(data.items)\n }\n\n async goNextPage(){\n if (this.currentPageValue === this.totalPageValue) return\n this.currentPageValue += 1\n this.createPagination(this.totalPageValue, this.currentPageValue)\n var data = await this.fetchData(this.currentSlugValue, this.currentPageValue)\n if ( data?.items.length == 0){\n $('.post-categories-content .post-categories .contents').empty()\n this.showNotFoundMessage()\n return\n }\n this.createPagination(this.totalPageValue, this.currentPageValue)\n this.hideNotFoundMessage()\n this.appendArticleElements(data.items)\n }\n\n nextElement(){\n return `\n tab#goNextPage\" class=\"relative next inline-flex items-center rounded-r-md px-2 py-2 text-gray-400\">\n > \n \n \n \n \n `\n }\n\n\n buildPaginationElement(pageNumber){\n return `\n tab#updateWithPage\" value='${pageNumber}' class=\"page-${pageNumber} ${pageNumber === this.currentPageValue ? 'pagi-active' : ''} relative hidden items-center px-4 py-2 text-sm text-gray-900 rounded-full md:inline-flex\">${pageNumber}\n `\n }\n\n activePage(element){\n $('.post-categories-content .pagination a.pagi-active').removeClass('pagi-active')\n $(element).addClass('pagi-active')\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\n// import grapesjs from \"grapesjs\"\n// Connects to data-controller=\"visual-editor\"\nimport techtown from \"../grapesjs-techtown-block/src/\";\nexport default class extends Controller {\n static values = {pageslug: String, accesstoken: String}\n csrfToken() {\n const metaTag = document.querySelector(\"meta[name='csrf-token']\");\n return metaTag ? metaTag.content : \"\";\n }\n async connect() {\n console.log('Connected Visual Editor')\n\n const escapeName = (name) => `${name}`.trim().replace(/([^a-z0-9\\w-:/]+)/gi, '-');\n \n this.visualEditor = grapesjs.init({\n container: '#gjs',\n plugins: [\"grapesjs-ga\", \"grapesjs-plugin-forms\",\n techtown, \"grapesjs-tailwind\"],\n pluginsOpts: {\n 'grapesjs-tailwind': { \n cover: ''\n }\n },\n fromElement: true, \n width: 'auto',\n height: '100vh',\n selectorManager: { escapeName, componentFirst: true },\n storageManager: {\n type: 'remote',\n autosave: true,\n autoload: true,\n stepsBeforeSave: 1,\n options: {\n remote: {\n headers: {\n 'X-CSRF-Token': this.csrfToken()\n },\n urlStore: `/admin/en/pages/${this.pageslugValue}/update_editor`,\n urlLoad: `/admin/en/pages/${this.pageslugValue}/html`,\n fetchOptions: opts => (opts.method === 'POST' ? { method: 'PATCH' } : {}),\n onLoad: result => result.data\n }\n }\n },\n assetManager:{\n headers: {\n 'X-CSRF-Token': this.csrfToken(),\n },\n upload: '/admin/pages/upload_image',\n uploadName: 'image'\n }\n })\n\n const assetManager = this.visualEditor.AssetManager;\n const assets = await fetch(`/admin/en/asset_images.json?slug=${this.pageslugValue}`, {\n method: 'GET',\n headers: {\n 'X-CSRF-Token': this.csrfToken()\n }\n }).then(response => response.json())\n .then(response => {\n return response\n })\n assetManager.add(assets)\n assetManager.render()\n // Callback--------\n\n this.visualEditor.on('asset:open', () => { \n assetManager.add(assets)\n });\n\n\n this.visualEditor.on('asset:upload:end', (result) => {\n\n result = JSON.parse(result)\n assetManager.add({\n type: 'image',\n src: result.file.url,\n height: 350,\n width: 250,\n name: result.file.name\n })\n });\n\n this.visualEditor.on('asset:upload:error', (error) => { console.log('error', error)});\n\n this.visualEditor.on('asset:upload:start', () => { \n // console.log('on start')\n assetManager.add(assets)\n });\n\n\n const panelManager = this.visualEditor.Panels\n panelManager.addButton(\"options\", {\n id: \"update-theme\",\n className: \"fa fa-adjust\",\n command: \"open-update-theme\",\n attributes: {\n title: \"Update Theme\",\n \"data-tooltip-pos\": \"bottom\"\n }\n });\n // console.log(panelManager.getPanel())\n panelManager.addButton('options', {\n id: 'show-json',\n className: 'fa fa-heart',\n command(editor) {\n console.log({css: editor.getHtml()})\n // editor.Modal.setTitle('Components JSON')\n // .setContent(``).open();\n },\n context: 'show-json',\n attributes: { title: 'Some title'},\n active: false,\n })\n }\n}\n\n","// extracted by mini-css-extract-plugin","// extracted by mini-css-extract-plugin","import loadTechtownBlocks from './techtown'\n\nexport default (editor, opts = {}, openBlock) => {\n loadTechtownBlocks(editor, opts, openBlock);\n}","\n\n\nconst getSvgHtml = (svg) => {\n if (typeof window === 'undefined') return ''\n svg.setAttribute('width', '100%')\n svg.setAttribute('height', '100%')\n return svg.outerHTML\n}\n\n\nexport default (editor, options = {}) => {\n const bm = editor.Blocks\n const { category, blocks, stylePrefix, flexGrid, rowHeight, addBasicStyle } = options;\n const clsRow = `gjs-row `;\n const clsCell = `gjs-cell`;\n\n const step = 0.2;\n const minDim = 1;\n const currentUnit = 1;\n const resizerBtm = {\n tl: 0,\n tc: 0,\n tr: 0,\n cl: 0,\n cr: 0,\n bl: 0,\n br: 0,\n minDim\n };\n const resizerRight = {\n ...resizerBtm,\n cr: 1,\n bc: 0,\n currentUnit,\n minDim,\n step\n };\n const rowAttr = {\n 'data-gjs-droppable': `.${clsCell}`,\n 'data-gjs-resizable': resizerBtm,\n 'data-gjs-name': 'Row'\n };\n const colAttr = {\n 'data-gjs-draggable': `.${clsRow}`,\n 'data-gjs-resizable': resizerRight,\n 'data-gjs-name': 'Cell'\n };\n\n const attrsToString = (attrs) => {\n const result = [];\n\n for (let key in attrs) {\n let value = attrs[key];\n const toParse = value instanceof Array || value instanceof Object;\n value = toParse ? JSON.stringify(value) : value;\n result.push(`${key}=${toParse ? `'${value}'` : `'${value}'`}`);\n }\n\n return result.length ? ` ${result.join(' ')}` : '';\n };\n const attrsRow = attrsToString(rowAttr);\n const attrsCell = attrsToString(colAttr);\n\n \n const sources = [\n {\n id: 'text-element-h1',\n class: '',\n label: 'Heading 1',\n content: { type: 'HEADING'},\n category: 'Element',\n order: 1\n },\n {\n id: 'section',\n class: '',\n label: 'Section',\n content: { type: 'SECTION'},\n category: 'Element',\n order: 1\n },{\n id: 'column',\n class: '',\n label: 'Column',\n content: { type: 'COLUMN'},\n category: 'Element',\n order: 1\n },\n {\n id: 'category',\n class: '',\n label: 'Category',\n content: { type: 'CATEGORY'},\n category: 'Element',\n order: 1\n },\n {\n id: 'faq',\n class: '',\n label: 'FAQ',\n content: { type: 'FAQ'},\n category: 'Element',\n order: 1\n },\n {\n id: 'bullet_list',\n class: '',\n label: 'BulletList',\n content: { type: 'BULLET_LIST'},\n category: 'Element',\n order: 1\n },\n {\n id: 'subscriber',\n class: '',\n label: 'Subscriber',\n content: { type: 'SUBSCRIBER'},\n category: 'Element',\n order: 1\n },\n {\n id: 'carousel',\n class: '',\n label: 'Carousel',\n content: { type: 'CAROUSEL'},\n category: 'Element',\n order: 1\n },\n {\n id: 'tabs',\n class: '',\n label: 'Tabs',\n content: { type: 'TABS'},\n category: 'Element',\n order: 1\n },\n {\n id: 'search',\n class: '',\n label: 'Search',\n content: { type: 'SEARCH'},\n category: 'Element',\n order: 1\n }\n ]\n \n sources.forEach((s) => {\n \n bm.add(s.id, {\n label: s.label,\n attributes: { class: `${s.class}` },\n content: s.content,\n category: { label: s.category, open: s.category === options.openCategory },\n })\n })\n}\n","export default (editor, opts = {}) => {\n const domc = editor.DomComponents;\n const col_html = `
\n
\n

CATEGORY

\n

Raclette Blueberry Nextious Level

\n

Photo booth fam kinfolk cold-pressed sriracha leggings jianbing microdosing tousled waistcoat.

\n Learn More \n \n \n \n \n \n
\n
`\n\nconst subcriber_form = `\n
\n
\n
\n
\n \n
\n \"Nhan\n
\n
\n

Đăng ký nhận cẩm nang

\n

Đồng hành trên hành trình chăm sóc sức khỏe

\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 const heading_style = {\n 'h1': 'mb-4 text-5xl font-extrabold',\n 'h2': 'mb-4 text-4xl font-bold',\n 'h3': 'mb-4 text-3xl font-bold',\n 'h4': 'mb-4 text-2xl font-bold',\n 'h5': 'mb-4 text-xl font-bold',\n 'h6': 'mb-4 text-lg font-bold'\n }\n domc.addType('HEADING', {\n model: {\n defaults: {\n tagName: 'h1',\n components: 'Insert your text here',\n traits: [\n {\n type: \"select\",\n name: \"heading\",\n label: \"Heading\",\n changeProp: 1,\n options: [\n { id: 'h1', name: 'H1'},\n { id: 'h2', name: 'H2'},\n { id: 'h3', name: 'H3'},\n { id: 'h4', name: 'H4'},\n { id: 'h5', name: 'H5'},\n { id: 'h6', name: 'H6'},\n ]\n }\n ]\n },\n init() {\n this.on(\"change:heading\", this.handleHeadingTagChange);\n this.updateHeadingStyles(); // Initial update\n },\n handleHeadingTagChange() {\n this.attributes.tagName = this.attributes.heading\n this.updateHeadingStyles();\n this.view.render();\n },\n updateHeadingStyles() {\n const identifier_class = (Math.random() + 1).toString(36).substring(2);\n this.setClass(heading_style[this.attributes.tagName] + ' techtown_' + identifier_class);\n }\n },\n view: {\n \n },\n });\n\n domc.addType('PARTICLES', {\n model: {\n defaults: {\n tagName: 'div',\n components: ''\n },\n },\n view: {\n \n },\n });\n\n domc.addType('COLUMN', {\n model: {\n defaults: {\n tagName: 'div',\n components: col_html\n },\n },\n view: {\n \n },\n });\n\n\n domc.addType('BULLET_LIST', {\n model: {\n defaults: {\n tagName: 'div',\n components: `\n `\n },\n },\n view: {\n \n },\n });\n\n\n domc.addType('SECTION', {\n model: {\n defaults: {\n tagName: 'section',\n components: `
\n

INSERT YOUR BLOCK HERE

\n
`\n },\n init() {\n // this.on(\"change:heading\", this.handleHeadingTagChange);\n this.updateSectionStyles(); // Initial update\n \n },\n handleSectionChange() {\n // const numberOfColumn = this.get('number_of_columns');\n // if (selectedCategory) {}}\n\n },\n updateSectionStyles() {\n // const identifier_class = (Math.random() + 1).toString(36).substring(2);\n // this.setClass(heading_style[this.attributes.tagName] + ' techtown_' + identifier_class);\n }\n },\n view: {\n \n },\n });\n\n domc.addType('SUBSCRIBER', {\n model: {\n defaults: {\n tagName: 'section',\n components: subcriber_form\n },\n init() {\n // this.on(\"change:heading\", this.handleHeadingTagChange);\n this.updateSectionStyles(); // Initial update\n \n },\n handleSectionChange() {\n // const numberOfColumn = this.get('number_of_columns');\n // if (selectedCategory) {}}\n\n },\n updateSectionStyles() {\n // const identifier_class = (Math.random() + 1).toString(36).substring(2);\n // this.setClass(heading_style[this.attributes.tagName] + ' techtown_' + identifier_class);\n }\n },\n view: {\n \n },\n });\n\n domc.addType('CAROUSEL', {\n model: {\n defaults: {\n tagName: 'div',\n components: `
\n

INSERT YOUR BLOCK HERE

\n
`\n },\n init() {\n // this.on(\"change:heading\", this.handleHeadingTagChange);\n this.updateSectionStyles(); // Initial update\n \n },\n handleSectionChange() {\n // const numberOfColumn = this.get('number_of_columns');\n // if (selectedCategory) {}}\n\n },\n updateSectionStyles() {\n // const identifier_class = (Math.random() + 1).toString(36).substring(2);\n // this.setClass(heading_style[this.attributes.tagName] + ' techtown_' + identifier_class);\n }\n },\n view: {\n \n },\n });\n\n domc.addType('SEARCH', {\n model: {\n defaults: {\n tagName: 'section',\n components: `
\n \n
\n
\n \n \n \n
\n \n
\n
`\n },\n init() {\n // this.on(\"change:heading\", this.handleHeadingTagChange);\n this.updateSectionStyles(); // Initial update\n \n },\n handleSectionChange() {\n // const numberOfColumn = this.get('number_of_columns');\n // if (selectedCategory) {}}\n\n },\n updateSectionStyles() {\n // const identifier_class = (Math.random() + 1).toString(36).substring(2);\n // this.setClass(heading_style[this.attributes.tagName] + ' techtown_' + identifier_class);\n }\n },\n view: {\n \n },\n });\n\n domc.addType('TABS', {\n model: {\n defaults: {\n tagName: 'section',\n components: `
\n\n \n \n \n \n \n \n
\n First tab pane\n
\n
\n Second tab pane\n
\n \n
`\n },\n init() {\n // this.on(\"change:heading\", this.handleHeadingTagChange);\n this.updateSectionStyles(); // Initial update\n \n },\n handleSectionChange() {\n // const numberOfColumn = this.get('number_of_columns');\n // if (selectedCategory) {}}\n\n },\n updateSectionStyles() {\n // const identifier_class = (Math.random() + 1).toString(36).substring(2);\n // this.setClass(heading_style[this.attributes.tagName] + ' techtown_' + identifier_class);\n }\n },\n view: {\n \n },\n });\n\n domc.addType('CATEGORY', {\n model: {\n defaults: {\n tagName: 'section',\n components: `

Master Cleanse Reliac Heirloom

Whatever cardigan tote bag tumblr hexagon brooklyn asymmetrical gentrify, subway tile poke farm-to-table. Franzen you probably haven't heard of them man bun deep jianbing selfies heirloom prism food truck ugh squid celiac humblebrag.

Shooting Stars

Fingerstache flexitarian street art 8-bit waistcoat. Distillery hexagon disrupt edison bulbche.

Learn More

The Catalyzer

Fingerstache flexitarian street art 8-bit waistcoat. Distillery hexagon disrupt edison bulbche.

Learn More

Neptune

Fingerstache flexitarian street art 8-bit waistcoat. Distillery hexagon disrupt edison bulbche.

Learn More

Melanchole

Fingerstache flexitarian street art 8-bit waistcoat. Distillery hexagon disrupt edison bulbche.

Learn More
`,\n traits: [\n {\n type: \"select\",\n name: \"category\",\n label: \"Category\",\n changeProp: 1,\n options: [\n ]\n },\n {\n type: \"number\",\n name: \"number_of_posts\",\n label: \"Number Of Posts\",\n changeProp: 1\n },\n {\n type: \"boolean\",\n name: \"is_display_pagination\",\n label: \"Pagination\",\n changeProp: 1\n },\n {\n type: \"boolean\",\n name: \"is_display_title\",\n label: \"Title\",\n changeProp: 1\n }\n ]\n },\n init() {\n fetch('/admin/categories.json')\n .then(response => response.json())\n .then(options => {\n const categoryTrait = this.getTrait('category');\n \n if(categoryTrait) {\n categoryTrait.set('options', options)\n }\n\n })\n this.on(\"change:category\", this.handleCategoryChange);\n this.handleCategoryChange();\n\n },\n handleCategoryChange() {\n const selectedCategory = this.get('category');\n const numberTrait = this.get('number_of_posts');\n const isDisplayTitle = this.get('is_display_title');\n if (selectedCategory) {\n // Fetch data from API based on selected category\n fetch(`/admin/categories/${selectedCategory}.json?limit=${numberTrait}`)\n .then(response => response.json())\n .then(data => {\n // Update the component's content with the fetched data\n console.log(isDisplayTitle)\n let components = isDisplayTitle === true ? `
\n
\n

${data.category.name}

\n

${data.category.desc}

\n
` : ``\n components += `
`\n for (let i=0;i\n
\n \"content\"\n
\n \n

${post.title}

\n

${post.expert}

\n
`\n }\n components += `
`\n this.set('components',components)\n this.view && this.view.render();\n })\n .catch(error => console.error('Error fetching data:', error));\n\n \n }\n },\n updateSectionStyles() {\n // const identifier_class = (Math.random() + 1).toString(36).substring(2);\n // this.setClass(heading_style[this.attributes.tagName] + ' techtown_' + identifier_class);\n }\n },\n view: {\n render() {\n // Implement your view rendering logic here\n console.log('View rendered');\n return this;\n },\n },\n });\n\n domc.addType('FAQ', {\n model: {\n defaults: {\n tagName: 'section',\n components: `

Master Cleanse Reliac Heirloom

Whatever cardigan tote bag tumblr hexagon brooklyn asymmetrical gentrify, subway tile poke farm-to-table. Franzen you probably haven't heard of them man bun deep jianbing selfies heirloom prism food truck ugh squid celiac humblebrag.

Shooting Stars

Fingerstache flexitarian street art 8-bit waistcoat. Distillery hexagon disrupt edison bulbche.

Learn More

The Catalyzer

Fingerstache flexitarian street art 8-bit waistcoat. Distillery hexagon disrupt edison bulbche.

Learn More

Neptune

Fingerstache flexitarian street art 8-bit waistcoat. Distillery hexagon disrupt edison bulbche.

Learn More

Melanchole

Fingerstache flexitarian street art 8-bit waistcoat. Distillery hexagon disrupt edison bulbche.

Learn More
`,\n traits: [\n {\n type: \"select\",\n name: \"category\",\n label: \"Category\",\n changeProp: 1,\n options: [\n ]\n },\n {\n type: \"number\",\n name: \"number_of_posts\",\n label: \"Number Of Posts\",\n changeProp: 1\n },\n ]\n },\n init() {\n fetch('/admin/categories.json?category_type=faq')\n .then(response => response.json())\n .then(options => {\n const categoryTrait = this.getTrait('category');\n \n if(categoryTrait) {\n categoryTrait.set('options', options)\n }\n\n })\n this.on(\"change:category\", this.handleCategoryChange);\n this.handleCategoryChange();\n\n },\n handleCategoryChange() {\n const selectedCategory = this.get('category');\n const numberTrait = this.get('number_of_posts');\n\n if (selectedCategory) {\n // Fetch data from API based on selected category\n fetch(`/admin/categories/${selectedCategory}.json?limit=${numberTrait}`)\n .then(response => response.json())\n .then(data => {\n // Update the component's content with the fetched data\n let components = ``\n for (let i=0;i\n
\n
${post.title}
\n
\n

${post.expert}

\n `\n }\n \n this.set('components',components)\n this.view && this.view.render();\n })\n .catch(error => console.error('Error fetching data:', error));\n\n \n }\n },\n updateSectionStyles() {\n // const identifier_class = (Math.random() + 1).toString(36).substring(2);\n // this.setClass(heading_style[this.attributes.tagName] + ' techtown_' + identifier_class);\n }\n },\n view: {\n render() {\n // Implement your view rendering logic here\n console.log('View rendered');\n return this;\n },\n },\n });\n\n};\n\n","import loadComponents from './components';\nimport loadBlocks from './blocks';\n\nexport default (editor, opts = {}) => {\n\n const options = {\n ...{\n i18n: {},\n // default options\n tailwindPlayCdn: 'https://cdn.tailwindcss.com',\n plugins: [],\n config: {},\n cover: `.object-cover { filter: sepia(1) hue-rotate(190deg) opacity(.46) grayscale(.7) !important; }`,\n changeThemeText: 'Change Theme',\n openCategory: 'Element',\n }, ...opts\n };\n \n // Add components\n loadComponents(editor, options);\n // Add blocks\n loadBlocks(editor, options);\n // Load i18n files\n // editor.I18n && editor.I18n.addMessages({\n // en,\n // ...options.i18n,\n // });\n\n // Load Template\n\n const appendTemplateCss = async(frame) => {\n const iframe = frame.view.getEl()\n if(!iframe) return \n\n const {tailwindPlayCdn, plugins, config, cover} = options\n\n const init = () => {\n iframe.contentWindow.tailwind.config = config;\n }\n\n const script = document.createElement('script');\n script.src = tailwindPlayCdn + (plugins.length ? `?plugins=${plugins.join()}` : '');\n script.onload = init;\n\n const cssStyle = document.createElement('style');\n cssStyle.innerHTML = cover;\n\n // checks iframe is ready before loading Tailwind CSS - issue with firefox\n const f = setInterval(() => {\n const doc = iframe.contentDocument;\n if (doc.readyState === 'complete') {\n doc.head.appendChild(script);\n doc.head.appendChild(cssStyle);\n clearInterval(f);\n }\n }, 100)\n }\n \n editor.Canvas.getModel()['on']('change:frames', (m, frames) => {\n frames.forEach(frame => frame.once('loaded', () => appendTemplateCss(frame)));\n });\n \n};","export function getMetaValue(name) {\n const element = findElement(document.head, `meta[name=\"${name}\"]`);\n if (element) {\n return element.getAttribute(\"content\");\n }\n}\n\nexport function findElement(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n return root.querySelector(selector);\n}\n\nexport function toArray(value) {\n if (Array.isArray(value)) {\n return value;\n } else if (Array.from) {\n return Array.from(value);\n } else {\n return [].slice.call(value);\n }\n}\n\nexport function removeElement(el) {\n if (el && el.parentNode) {\n el.parentNode.removeChild(el);\n }\n}\n\nexport function insertAfter(el, referenceNode) {\n return referenceNode.parentNode.insertBefore(el, referenceNode.nextSibling);\n}","var map = {\n\t\"./\": \"./app/javascript/images/index.js\",\n\t\"./envelopes\": \"./app/javascript/images/envelopes.png\",\n\t\"./envelopes.png\": \"./app/javascript/images/envelopes.png\",\n\t\"./frame-592\": \"./app/javascript/images/frame-592.png\",\n\t\"./frame-592.png\": \"./app/javascript/images/frame-592.png\",\n\t\"./index\": \"./app/javascript/images/index.js\",\n\t\"./index.js\": \"./app/javascript/images/index.js\",\n\t\"./linkedin\": \"./app/javascript/images/linkedin.png\",\n\t\"./linkedin.png\": \"./app/javascript/images/linkedin.png\",\n\t\"./monster\": \"./app/javascript/images/monster.png\",\n\t\"./monster.png\": \"./app/javascript/images/monster.png\",\n\t\"./odistad_doctor\": \"./app/javascript/images/odistad_doctor.png\",\n\t\"./odistad_doctor.png\": \"./app/javascript/images/odistad_doctor.png\",\n\t\"./odistad_favicon\": \"./app/javascript/images/odistad_favicon.png\",\n\t\"./odistad_favicon.png\": \"./app/javascript/images/odistad_favicon.png\",\n\t\"./odistad_hotline\": \"./app/javascript/images/odistad_hotline.png\",\n\t\"./odistad_hotline.png\": \"./app/javascript/images/odistad_hotline.png\",\n\t\"./odistad_messager\": \"./app/javascript/images/odistad_messager.png\",\n\t\"./odistad_messager.png\": \"./app/javascript/images/odistad_messager.png\",\n\t\"./phone-call\": \"./app/javascript/images/phone-call.png\",\n\t\"./phone-call.png\": \"./app/javascript/images/phone-call.png\",\n\t\"./sagri-favicon-16x16\": \"./app/javascript/images/sagri-favicon-16x16.png\",\n\t\"./sagri-favicon-16x16.png\": \"./app/javascript/images/sagri-favicon-16x16.png\",\n\t\"./sagri-map\": \"./app/javascript/images/sagri-map.png\",\n\t\"./sagri-map.png\": \"./app/javascript/images/sagri-map.png\",\n\t\"./signs-direction\": \"./app/javascript/images/signs-direction.png\",\n\t\"./signs-direction.png\": \"./app/javascript/images/signs-direction.png\",\n\t\"./vector\": \"./app/javascript/images/vector.png\",\n\t\"./vector.png\": \"./app/javascript/images/vector.png\"\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = \"./app/javascript/images sync recursive ^\\\\.\\\\/.*$\";","module.exports = __webpack_public_path__ + \"media/images/envelopes-e018ad5cfaadedf589c12d90ad571995.png\";","module.exports = __webpack_public_path__ + \"media/images/frame-592-3a0e4e55f489aac72a1d390c6a013681.png\";","import 'odistad_favicon.png'\nimport 'odistad_hotline.png'\nimport 'odistad_messager.png'\nimport 'odistad_doctor.png'\nimport 'sagri-favicon-16x16.png'\nimport 'sagri-map.png'\nimport 'phone-call.png'\nimport 'signs-direction.png'\nimport 'envelopes.png'\nimport 'frame-592.png'\nimport 'linkedin.png'\nimport 'vector.png'\n","module.exports = __webpack_public_path__ + \"media/images/linkedin-dd1d7b8fc022bffea0673153beb655c3.png\";","module.exports = __webpack_public_path__ + \"media/images/monster-4276143f4cc6c55481f34fe6520e3044.png\";","module.exports = __webpack_public_path__ + \"media/images/odistad_doctor-ec3e244c63607561ca790efa801018dd.png\";","module.exports = __webpack_public_path__ + \"media/images/odistad_favicon-c62131d168c41ef9c6a9290ea55412ae.png\";","module.exports = __webpack_public_path__ + \"media/images/odistad_hotline-c3ee8f5ee36c090fe1bcd6bc096b6a1d.png\";","module.exports = __webpack_public_path__ + \"media/images/odistad_messager-db69952144fe958eb62cfeecd1359ba6.png\";","module.exports = __webpack_public_path__ + \"media/images/phone-call-2295fd390adb087820dacb6e0c9f2ffd.png\";","module.exports = __webpack_public_path__ + \"media/images/sagri-favicon-16x16-bd7f644ef7b4ceb9b1af8b9c16f2f24b.png\";","module.exports = __webpack_public_path__ + \"media/images/sagri-map-2b934ffe7a6be563bd893933286e939f.png\";","module.exports = __webpack_public_path__ + \"media/images/signs-direction-f1ecbff044ed2837cd47665a845a2fc3.png\";","module.exports = __webpack_public_path__ + \"media/images/vector-5b1c5568ebea5e6e0f92e1c158ff6382.png\";","/* -----------------------------------------------\n/* Author : Vincent Garreau - vincentgarreau.com\n/* MIT license: http://opensource.org/licenses/MIT\n/* Demo / Generator : vincentgarreau.com/particles.js\n/* GitHub : github.com/VincentGarreau/particles.js\n/* How to use? : Check the GitHub README\n/* v2.0.0\n/* ----------------------------------------------- */\nfunction hexToRgb(e){var a=/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;e=e.replace(a,function(e,a,t,i){return a+a+t+t+i+i});var t=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function clamp(e,a,t){return Math.min(Math.max(e,a),t)}function isInArray(e,a){return a.indexOf(e)>-1}var pJS=function(e,a){var t=document.querySelector(\"#\"+e+\" > .particles-js-canvas-el\");this.pJS={canvas:{el:t,w:t.offsetWidth,h:t.offsetHeight},particles:{number:{value:400,density:{enable:!0,value_area:800}},color:{value:\"#fff\"},shape:{type:\"circle\",stroke:{width:0,color:\"#ff0000\"},polygon:{nb_sides:5},image:{src:\"\",width:100,height:100}},opacity:{value:1,random:!1,anim:{enable:!1,speed:2,opacity_min:0,sync:!1}},size:{value:20,random:!1,anim:{enable:!1,speed:20,size_min:0,sync:!1}},line_linked:{enable:!0,distance:100,color:\"#fff\",opacity:1,width:1},move:{enable:!0,speed:2,direction:\"none\",random:!1,straight:!1,out_mode:\"out\",bounce:!1,attract:{enable:!1,rotateX:3e3,rotateY:3e3}},array:[]},interactivity:{detect_on:\"canvas\",events:{onhover:{enable:!0,mode:\"grab\"},onclick:{enable:!0,mode:\"push\"},resize:!0},modes:{grab:{distance:100,line_linked:{opacity:1}},bubble:{distance:200,size:80,duration:.4},repulse:{distance:200,duration:.4},push:{particles_nb:4},remove:{particles_nb:2}},mouse:{}},retina_detect:!1,fn:{interact:{},modes:{},vendors:{}},tmp:{}};var i=this.pJS;a&&Object.deepExtend(i,a),i.tmp.obj={size_value:i.particles.size.value,size_anim_speed:i.particles.size.anim.speed,move_speed:i.particles.move.speed,line_linked_distance:i.particles.line_linked.distance,line_linked_width:i.particles.line_linked.width,mode_grab_distance:i.interactivity.modes.grab.distance,mode_bubble_distance:i.interactivity.modes.bubble.distance,mode_bubble_size:i.interactivity.modes.bubble.size,mode_repulse_distance:i.interactivity.modes.repulse.distance},i.fn.retinaInit=function(){i.retina_detect&&window.devicePixelRatio>1?(i.canvas.pxratio=window.devicePixelRatio,i.tmp.retina=!0):(i.canvas.pxratio=1,i.tmp.retina=!1),i.canvas.w=i.canvas.el.offsetWidth*i.canvas.pxratio,i.canvas.h=i.canvas.el.offsetHeight*i.canvas.pxratio,i.particles.size.value=i.tmp.obj.size_value*i.canvas.pxratio,i.particles.size.anim.speed=i.tmp.obj.size_anim_speed*i.canvas.pxratio,i.particles.move.speed=i.tmp.obj.move_speed*i.canvas.pxratio,i.particles.line_linked.distance=i.tmp.obj.line_linked_distance*i.canvas.pxratio,i.interactivity.modes.grab.distance=i.tmp.obj.mode_grab_distance*i.canvas.pxratio,i.interactivity.modes.bubble.distance=i.tmp.obj.mode_bubble_distance*i.canvas.pxratio,i.particles.line_linked.width=i.tmp.obj.line_linked_width*i.canvas.pxratio,i.interactivity.modes.bubble.size=i.tmp.obj.mode_bubble_size*i.canvas.pxratio,i.interactivity.modes.repulse.distance=i.tmp.obj.mode_repulse_distance*i.canvas.pxratio},i.fn.canvasInit=function(){i.canvas.ctx=i.canvas.el.getContext(\"2d\")},i.fn.canvasSize=function(){i.canvas.el.width=i.canvas.w,i.canvas.el.height=i.canvas.h,i&&i.interactivity.events.resize&&window.addEventListener(\"resize\",function(){i.canvas.w=i.canvas.el.offsetWidth,i.canvas.h=i.canvas.el.offsetHeight,i.tmp.retina&&(i.canvas.w*=i.canvas.pxratio,i.canvas.h*=i.canvas.pxratio),i.canvas.el.width=i.canvas.w,i.canvas.el.height=i.canvas.h,i.particles.move.enable||(i.fn.particlesEmpty(),i.fn.particlesCreate(),i.fn.particlesDraw(),i.fn.vendors.densityAutoParticles()),i.fn.vendors.densityAutoParticles()})},i.fn.canvasPaint=function(){i.canvas.ctx.fillRect(0,0,i.canvas.w,i.canvas.h)},i.fn.canvasClear=function(){i.canvas.ctx.clearRect(0,0,i.canvas.w,i.canvas.h)},i.fn.particle=function(e,a,t){if(this.radius=(i.particles.size.random?Math.random():1)*i.particles.size.value,i.particles.size.anim.enable&&(this.size_status=!1,this.vs=i.particles.size.anim.speed/100,i.particles.size.anim.sync||(this.vs=this.vs*Math.random())),this.x=t?t.x:Math.random()*i.canvas.w,this.y=t?t.y:Math.random()*i.canvas.h,this.x>i.canvas.w-2*this.radius?this.x=this.x-this.radius:this.x<2*this.radius&&(this.x=this.x+this.radius),this.y>i.canvas.h-2*this.radius?this.y=this.y-this.radius:this.y<2*this.radius&&(this.y=this.y+this.radius),i.particles.move.bounce&&i.fn.vendors.checkOverlap(this,t),this.color={},\"object\"==typeof e.value)if(e.value instanceof Array){var s=e.value[Math.floor(Math.random()*i.particles.color.value.length)];this.color.rgb=hexToRgb(s)}else void 0!=e.value.r&&void 0!=e.value.g&&void 0!=e.value.b&&(this.color.rgb={r:e.value.r,g:e.value.g,b:e.value.b}),void 0!=e.value.h&&void 0!=e.value.s&&void 0!=e.value.l&&(this.color.hsl={h:e.value.h,s:e.value.s,l:e.value.l});else\"random\"==e.value?this.color.rgb={r:Math.floor(256*Math.random())+0,g:Math.floor(256*Math.random())+0,b:Math.floor(256*Math.random())+0}:\"string\"==typeof e.value&&(this.color=e,this.color.rgb=hexToRgb(this.color.value));this.opacity=(i.particles.opacity.random?Math.random():1)*i.particles.opacity.value,i.particles.opacity.anim.enable&&(this.opacity_status=!1,this.vo=i.particles.opacity.anim.speed/100,i.particles.opacity.anim.sync||(this.vo=this.vo*Math.random()));var n={};switch(i.particles.move.direction){case\"top\":n={x:0,y:-1};break;case\"top-right\":n={x:.5,y:-.5};break;case\"right\":n={x:1,y:-0};break;case\"bottom-right\":n={x:.5,y:.5};break;case\"bottom\":n={x:0,y:1};break;case\"bottom-left\":n={x:-.5,y:1};break;case\"left\":n={x:-1,y:0};break;case\"top-left\":n={x:-.5,y:-.5};break;default:n={x:0,y:0}}i.particles.move.straight?(this.vx=n.x,this.vy=n.y,i.particles.move.random&&(this.vx=this.vx*Math.random(),this.vy=this.vy*Math.random())):(this.vx=n.x+Math.random()-.5,this.vy=n.y+Math.random()-.5),this.vx_i=this.vx,this.vy_i=this.vy;var r=i.particles.shape.type;if(\"object\"==typeof r){if(r instanceof Array){var c=r[Math.floor(Math.random()*r.length)];this.shape=c}}else this.shape=r;if(\"image\"==this.shape){var o=i.particles.shape;this.img={src:o.image.src,ratio:o.image.width/o.image.height},this.img.ratio||(this.img.ratio=1),\"svg\"==i.tmp.img_type&&void 0!=i.tmp.source_svg&&(i.fn.vendors.createSvgImg(this),i.tmp.pushing&&(this.img.loaded=!1))}},i.fn.particle.prototype.draw=function(){function e(){i.canvas.ctx.drawImage(r,a.x-t,a.y-t,2*t,2*t/a.img.ratio)}var a=this;if(void 0!=a.radius_bubble)var t=a.radius_bubble;else var t=a.radius;if(void 0!=a.opacity_bubble)var s=a.opacity_bubble;else var s=a.opacity;if(a.color.rgb)var n=\"rgba(\"+a.color.rgb.r+\",\"+a.color.rgb.g+\",\"+a.color.rgb.b+\",\"+s+\")\";else var n=\"hsla(\"+a.color.hsl.h+\",\"+a.color.hsl.s+\"%,\"+a.color.hsl.l+\"%,\"+s+\")\";switch(i.canvas.ctx.fillStyle=n,i.canvas.ctx.beginPath(),a.shape){case\"circle\":i.canvas.ctx.arc(a.x,a.y,t,0,2*Math.PI,!1);break;case\"edge\":i.canvas.ctx.rect(a.x-t,a.y-t,2*t,2*t);break;case\"triangle\":i.fn.vendors.drawShape(i.canvas.ctx,a.x-t,a.y+t/1.66,2*t,3,2);break;case\"polygon\":i.fn.vendors.drawShape(i.canvas.ctx,a.x-t/(i.particles.shape.polygon.nb_sides/3.5),a.y-t/.76,2.66*t/(i.particles.shape.polygon.nb_sides/3),i.particles.shape.polygon.nb_sides,1);break;case\"star\":i.fn.vendors.drawShape(i.canvas.ctx,a.x-2*t/(i.particles.shape.polygon.nb_sides/4),a.y-t/1.52,2*t*2.66/(i.particles.shape.polygon.nb_sides/3),i.particles.shape.polygon.nb_sides,2);break;case\"image\":if(\"svg\"==i.tmp.img_type)var r=a.img.obj;else var r=i.tmp.img_obj;r&&e()}i.canvas.ctx.closePath(),i.particles.shape.stroke.width>0&&(i.canvas.ctx.strokeStyle=i.particles.shape.stroke.color,i.canvas.ctx.lineWidth=i.particles.shape.stroke.width,i.canvas.ctx.stroke()),i.canvas.ctx.fill()},i.fn.particlesCreate=function(){for(var e=0;e=i.particles.opacity.value&&(a.opacity_status=!1),a.opacity+=a.vo):(a.opacity<=i.particles.opacity.anim.opacity_min&&(a.opacity_status=!0),a.opacity-=a.vo),a.opacity<0&&(a.opacity=0)),i.particles.size.anim.enable&&(1==a.size_status?(a.radius>=i.particles.size.value&&(a.size_status=!1),a.radius+=a.vs):(a.radius<=i.particles.size.anim.size_min&&(a.size_status=!0),a.radius-=a.vs),a.radius<0&&(a.radius=0)),\"bounce\"==i.particles.move.out_mode)var s={x_left:a.radius,x_right:i.canvas.w,y_top:a.radius,y_bottom:i.canvas.h};else var s={x_left:-a.radius,x_right:i.canvas.w+a.radius,y_top:-a.radius,y_bottom:i.canvas.h+a.radius};switch(a.x-a.radius>i.canvas.w?(a.x=s.x_left,a.y=Math.random()*i.canvas.h):a.x+a.radius<0&&(a.x=s.x_right,a.y=Math.random()*i.canvas.h),a.y-a.radius>i.canvas.h?(a.y=s.y_top,a.x=Math.random()*i.canvas.w):a.y+a.radius<0&&(a.y=s.y_bottom,a.x=Math.random()*i.canvas.w),i.particles.move.out_mode){case\"bounce\":a.x+a.radius>i.canvas.w?a.vx=-a.vx:a.x-a.radius<0&&(a.vx=-a.vx),a.y+a.radius>i.canvas.h?a.vy=-a.vy:a.y-a.radius<0&&(a.vy=-a.vy)}if(isInArray(\"grab\",i.interactivity.events.onhover.mode)&&i.fn.modes.grabParticle(a),(isInArray(\"bubble\",i.interactivity.events.onhover.mode)||isInArray(\"bubble\",i.interactivity.events.onclick.mode))&&i.fn.modes.bubbleParticle(a),(isInArray(\"repulse\",i.interactivity.events.onhover.mode)||isInArray(\"repulse\",i.interactivity.events.onclick.mode))&&i.fn.modes.repulseParticle(a),i.particles.line_linked.enable||i.particles.move.attract.enable)for(var n=e+1;n0){var c=i.particles.line_linked.color_rgb_line;i.canvas.ctx.strokeStyle=\"rgba(\"+c.r+\",\"+c.g+\",\"+c.b+\",\"+r+\")\",i.canvas.ctx.lineWidth=i.particles.line_linked.width,i.canvas.ctx.beginPath(),i.canvas.ctx.moveTo(e.x,e.y),i.canvas.ctx.lineTo(a.x,a.y),i.canvas.ctx.stroke(),i.canvas.ctx.closePath()}}},i.fn.interact.attractParticles=function(e,a){var t=e.x-a.x,s=e.y-a.y,n=Math.sqrt(t*t+s*s);if(n<=i.particles.line_linked.distance){var r=t/(1e3*i.particles.move.attract.rotateX),c=s/(1e3*i.particles.move.attract.rotateY);e.vx-=r,e.vy-=c,a.vx+=r,a.vy+=c}},i.fn.interact.bounceParticles=function(e,a){var t=e.x-a.x,i=e.y-a.y,s=Math.sqrt(t*t+i*i),n=e.radius+a.radius;n>=s&&(e.vx=-e.vx,e.vy=-e.vy,a.vx=-a.vx,a.vy=-a.vy)},i.fn.modes.pushParticles=function(e,a){i.tmp.pushing=!0;for(var t=0;e>t;t++)i.particles.array.push(new i.fn.particle(i.particles.color,i.particles.opacity.value,{x:a?a.pos_x:Math.random()*i.canvas.w,y:a?a.pos_y:Math.random()*i.canvas.h})),t==e-1&&(i.particles.move.enable||i.fn.particlesDraw(),i.tmp.pushing=!1)},i.fn.modes.removeParticles=function(e){i.particles.array.splice(0,e),i.particles.move.enable||i.fn.particlesDraw()},i.fn.modes.bubbleParticle=function(e){function a(){e.opacity_bubble=e.opacity,e.radius_bubble=e.radius}function t(a,t,s,n,c){if(a!=t)if(i.tmp.bubble_duration_end){if(void 0!=s){var o=n-p*(n-a)/i.interactivity.modes.bubble.duration,l=a-o;d=a+l,\"size\"==c&&(e.radius_bubble=d),\"opacity\"==c&&(e.opacity_bubble=d)}}else if(r<=i.interactivity.modes.bubble.distance){if(void 0!=s)var v=s;else var v=n;if(v!=a){var d=n-p*(n-a)/i.interactivity.modes.bubble.duration;\"size\"==c&&(e.radius_bubble=d),\"opacity\"==c&&(e.opacity_bubble=d)}}else\"size\"==c&&(e.radius_bubble=void 0),\"opacity\"==c&&(e.opacity_bubble=void 0)}if(i.interactivity.events.onhover.enable&&isInArray(\"bubble\",i.interactivity.events.onhover.mode)){var s=e.x-i.interactivity.mouse.pos_x,n=e.y-i.interactivity.mouse.pos_y,r=Math.sqrt(s*s+n*n),c=1-r/i.interactivity.modes.bubble.distance;if(r<=i.interactivity.modes.bubble.distance){if(c>=0&&\"mousemove\"==i.interactivity.status){if(i.interactivity.modes.bubble.size!=i.particles.size.value)if(i.interactivity.modes.bubble.size>i.particles.size.value){var o=e.radius+i.interactivity.modes.bubble.size*c;o>=0&&(e.radius_bubble=o)}else{var l=e.radius-i.interactivity.modes.bubble.size,o=e.radius-l*c;o>0?e.radius_bubble=o:e.radius_bubble=0}if(i.interactivity.modes.bubble.opacity!=i.particles.opacity.value)if(i.interactivity.modes.bubble.opacity>i.particles.opacity.value){var v=i.interactivity.modes.bubble.opacity*c;v>e.opacity&&v<=i.interactivity.modes.bubble.opacity&&(e.opacity_bubble=v)}else{var v=e.opacity-(i.particles.opacity.value-i.interactivity.modes.bubble.opacity)*c;v=i.interactivity.modes.bubble.opacity&&(e.opacity_bubble=v)}}}else a();\"mouseleave\"==i.interactivity.status&&a()}else if(i.interactivity.events.onclick.enable&&isInArray(\"bubble\",i.interactivity.events.onclick.mode)){if(i.tmp.bubble_clicking){var s=e.x-i.interactivity.mouse.click_pos_x,n=e.y-i.interactivity.mouse.click_pos_y,r=Math.sqrt(s*s+n*n),p=((new Date).getTime()-i.interactivity.mouse.click_time)/1e3;p>i.interactivity.modes.bubble.duration&&(i.tmp.bubble_duration_end=!0),p>2*i.interactivity.modes.bubble.duration&&(i.tmp.bubble_clicking=!1,i.tmp.bubble_duration_end=!1)}i.tmp.bubble_clicking&&(t(i.interactivity.modes.bubble.size,i.particles.size.value,e.radius_bubble,e.radius,\"size\"),t(i.interactivity.modes.bubble.opacity,i.particles.opacity.value,e.opacity_bubble,e.opacity,\"opacity\"))}},i.fn.modes.repulseParticle=function(e){function a(){var a=Math.atan2(d,p);if(e.vx=u*Math.cos(a),e.vy=u*Math.sin(a),\"bounce\"==i.particles.move.out_mode){var t={x:e.x+e.vx,y:e.y+e.vy};t.x+e.radius>i.canvas.w?e.vx=-e.vx:t.x-e.radius<0&&(e.vx=-e.vx),t.y+e.radius>i.canvas.h?e.vy=-e.vy:t.y-e.radius<0&&(e.vy=-e.vy)}}if(i.interactivity.events.onhover.enable&&isInArray(\"repulse\",i.interactivity.events.onhover.mode)&&\"mousemove\"==i.interactivity.status){var t=e.x-i.interactivity.mouse.pos_x,s=e.y-i.interactivity.mouse.pos_y,n=Math.sqrt(t*t+s*s),r={x:t/n,y:s/n},c=i.interactivity.modes.repulse.distance,o=100,l=clamp(1/c*(-1*Math.pow(n/c,2)+1)*c*o,0,50),v={x:e.x+r.x*l,y:e.y+r.y*l};\"bounce\"==i.particles.move.out_mode?(v.x-e.radius>0&&v.x+e.radius0&&v.y+e.radius=m&&a()}else 0==i.tmp.repulse_clicking&&(e.vx=e.vx_i,e.vy=e.vy_i)},i.fn.modes.grabParticle=function(e){if(i.interactivity.events.onhover.enable&&\"mousemove\"==i.interactivity.status){var a=e.x-i.interactivity.mouse.pos_x,t=e.y-i.interactivity.mouse.pos_y,s=Math.sqrt(a*a+t*t);if(s<=i.interactivity.modes.grab.distance){var n=i.interactivity.modes.grab.line_linked.opacity-s/(1/i.interactivity.modes.grab.line_linked.opacity)/i.interactivity.modes.grab.distance;if(n>0){var r=i.particles.line_linked.color_rgb_line;i.canvas.ctx.strokeStyle=\"rgba(\"+r.r+\",\"+r.g+\",\"+r.b+\",\"+n+\")\",i.canvas.ctx.lineWidth=i.particles.line_linked.width,i.canvas.ctx.beginPath(),i.canvas.ctx.moveTo(e.x,e.y),i.canvas.ctx.lineTo(i.interactivity.mouse.pos_x,i.interactivity.mouse.pos_y),i.canvas.ctx.stroke(),i.canvas.ctx.closePath()}}}},i.fn.vendors.eventsListeners=function(){\"window\"==i.interactivity.detect_on?i.interactivity.el=window:i.interactivity.el=i.canvas.el,(i.interactivity.events.onhover.enable||i.interactivity.events.onclick.enable)&&(i.interactivity.el.addEventListener(\"mousemove\",function(e){if(i.interactivity.el==window)var a=e.clientX,t=e.clientY;else var a=e.offsetX||e.clientX,t=e.offsetY||e.clientY;i.interactivity.mouse.pos_x=a,i.interactivity.mouse.pos_y=t,i.tmp.retina&&(i.interactivity.mouse.pos_x*=i.canvas.pxratio,i.interactivity.mouse.pos_y*=i.canvas.pxratio),i.interactivity.status=\"mousemove\"}),i.interactivity.el.addEventListener(\"mouseleave\",function(e){i.interactivity.mouse.pos_x=null,i.interactivity.mouse.pos_y=null,i.interactivity.status=\"mouseleave\"})),i.interactivity.events.onclick.enable&&i.interactivity.el.addEventListener(\"click\",function(){if(i.interactivity.mouse.click_pos_x=i.interactivity.mouse.pos_x,i.interactivity.mouse.click_pos_y=i.interactivity.mouse.pos_y,i.interactivity.mouse.click_time=(new Date).getTime(),i.interactivity.events.onclick.enable)switch(i.interactivity.events.onclick.mode){case\"push\":i.particles.move.enable?i.fn.modes.pushParticles(i.interactivity.modes.push.particles_nb,i.interactivity.mouse):1==i.interactivity.modes.push.particles_nb?i.fn.modes.pushParticles(i.interactivity.modes.push.particles_nb,i.interactivity.mouse):i.interactivity.modes.push.particles_nb>1&&i.fn.modes.pushParticles(i.interactivity.modes.push.particles_nb);break;case\"remove\":i.fn.modes.removeParticles(i.interactivity.modes.remove.particles_nb);break;case\"bubble\":i.tmp.bubble_clicking=!0;break;case\"repulse\":i.tmp.repulse_clicking=!0,i.tmp.repulse_count=0,i.tmp.repulse_finish=!1,setTimeout(function(){i.tmp.repulse_clicking=!1},1e3*i.interactivity.modes.repulse.duration)}})},i.fn.vendors.densityAutoParticles=function(){if(i.particles.number.density.enable){var e=i.canvas.el.width*i.canvas.el.height/1e3;i.tmp.retina&&(e/=2*i.canvas.pxratio);var a=e*i.particles.number.value/i.particles.number.density.value_area,t=i.particles.array.length-a;0>t?i.fn.modes.pushParticles(Math.abs(t)):i.fn.modes.removeParticles(t)}},i.fn.vendors.checkOverlap=function(e,a){for(var t=0;tv;v++)e.lineTo(i,0),e.translate(i,0),e.rotate(l);e.fill(),e.restore()},i.fn.vendors.exportImg=function(){window.open(i.canvas.el.toDataURL(\"image/png\"),\"_blank\")},i.fn.vendors.loadImg=function(e){if(i.tmp.img_error=void 0,\"\"!=i.particles.shape.image.src)if(\"svg\"==e){var a=new XMLHttpRequest;a.open(\"GET\",i.particles.shape.image.src),a.onreadystatechange=function(e){4==a.readyState&&(200==a.status?(i.tmp.source_svg=e.currentTarget.response,i.fn.vendors.checkBeforeDraw()):(console.log(\"Error pJS - Image not found\"),i.tmp.img_error=!0))},a.send()}else{var t=new Image;t.addEventListener(\"load\",function(){i.tmp.img_obj=t,i.fn.vendors.checkBeforeDraw()}),t.src=i.particles.shape.image.src}else console.log(\"Error pJS - No image.src\"),i.tmp.img_error=!0},i.fn.vendors.draw=function(){\"image\"==i.particles.shape.type?\"svg\"==i.tmp.img_type?i.tmp.count_svg>=i.particles.number.value?(i.fn.particlesDraw(),i.particles.move.enable?i.fn.drawAnimFrame=requestAnimFrame(i.fn.vendors.draw):cancelRequestAnimFrame(i.fn.drawAnimFrame)):i.tmp.img_error||(i.fn.drawAnimFrame=requestAnimFrame(i.fn.vendors.draw)):void 0!=i.tmp.img_obj?(i.fn.particlesDraw(),i.particles.move.enable?i.fn.drawAnimFrame=requestAnimFrame(i.fn.vendors.draw):cancelRequestAnimFrame(i.fn.drawAnimFrame)):i.tmp.img_error||(i.fn.drawAnimFrame=requestAnimFrame(i.fn.vendors.draw)):(i.fn.particlesDraw(),i.particles.move.enable?i.fn.drawAnimFrame=requestAnimFrame(i.fn.vendors.draw):cancelRequestAnimFrame(i.fn.drawAnimFrame))},i.fn.vendors.checkBeforeDraw=function(){\"image\"==i.particles.shape.type?\"svg\"==i.tmp.img_type&&void 0==i.tmp.source_svg?i.tmp.checkAnimFrame=requestAnimFrame(check):(cancelRequestAnimFrame(i.tmp.checkAnimFrame),i.tmp.img_error||(i.fn.vendors.init(),i.fn.vendors.draw())):(i.fn.vendors.init(),i.fn.vendors.draw())},i.fn.vendors.init=function(){i.fn.retinaInit(),i.fn.canvasInit(),i.fn.canvasSize(),i.fn.canvasPaint(),i.fn.particlesCreate(),i.fn.vendors.densityAutoParticles(),i.particles.line_linked.color_rgb_line=hexToRgb(i.particles.line_linked.color)},i.fn.vendors.start=function(){isInArray(\"image\",i.particles.shape.type)?(i.tmp.img_type=i.particles.shape.image.src.substr(i.particles.shape.image.src.length-3),i.fn.vendors.loadImg(i.tmp.img_type)):i.fn.vendors.checkBeforeDraw()},i.fn.vendors.eventsListeners(),i.fn.vendors.start()};Object.deepExtend=function(e,a){for(var t in a)a[t]&&a[t].constructor&&a[t].constructor===Object?(e[t]=e[t]||{},arguments.callee(e[t],a[t])):e[t]=a[t];return e},window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}(),window.cancelRequestAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout}(),window.pJSDom=[],window.particlesJS=function(e,a){\"string\"!=typeof e&&(a=e,e=\"particles-js\"),e||(e=\"particles-js\");var t=document.getElementById(e),i=\"particles-js-canvas-el\",s=t.getElementsByClassName(i);if(s.length)for(;s.length>0;)t.removeChild(s[0]);var n=document.createElement(\"canvas\");n.className=i,n.style.width=\"100%\",n.style.height=\"100%\";var r=document.getElementById(e).appendChild(n);null!=r&&pJSDom.push(new pJS(e,a))},window.particlesJS.load=function(e,a,t){var i=new XMLHttpRequest;i.open(\"GET\",a),i.onreadystatechange=function(a){if(4==i.readyState)if(200==i.status){var s=JSON.parse(a.currentTarget.response);window.particlesJS(e,s),t&&t()}else console.log(\"Error pJS - XMLHttpRequest status: \"+i.status),console.log(\"Error pJS - File config not found\")},i.send()};","// console.log(\"🚀 ~ file: odistad.js:1 ~ Loaded with Webpack!\")\nimport \"../web.js\";\n\n// themes\nimport \"../../css/themes/odistad.css\";","// styles\nimport \"../css/admin.css\";\n\nrequire.context('../images', true)\n\n// libs\nimport 'flowbite';\nimport \"./components/particles\";\nimport \"../controllers\"\n\nwindow.onload = () => {\n const nav = document.querySelector(\"nav\");\n const navHeight = 70;\n // the point the scroll starts from (in px)\n let lastScrollY = 0;\n // how far to scroll (in px) before triggering\n const delta = 10;\n \n // function to run on scrolling\n function scrolled() {\n let sy = window.scrollY;\n \n // only trigger if scrolled more than delta\n if (Math.abs(lastScrollY - sy) > delta) {\n // scroll down -> hide nav bar\n if (sy > lastScrollY && sy > navHeight) {\n nav.classList.add(\"hidden\");\n } \n // scroll up -> show nav bar\n else if (sy < lastScrollY) {\n nav.classList.remove(\"hidden\");\n }\n // update current scroll point\n lastScrollY = sy \n }\n }\n \n // Add event listener & debounce so not constantly checking for scroll\n let didScroll = false;\n window.addEventListener(\"scroll\", function(e){\n didScroll = true;\n });\n \n setInterval(function() {\n \n if (didScroll) {\n scrolled();\n didScroll = false;\n }\n }, 250)\n const particle = document.getElementById(\"particles-js\")\n if(particle) {\n particlesJS('particles-js',\n {\n \"particles\": {\n \"number\": {\n \"value\": 80,\n \"density\": {\n \"enable\": true,\n \"value_area\": 800\n }\n },\n \"color\": {\n \"value\": \"#ffffff\"\n },\n \"shape\": {\n \"type\": \"circle\",\n \"stroke\": {\n \"width\": 0,\n \"color\": \"#000000\"\n },\n \"polygon\": {\n \"nb_sides\": 5\n },\n \"image\": {\n \"src\": \"img/github.svg\",\n \"width\": 100,\n \"height\": 100\n }\n },\n \"opacity\": {\n \"value\": 0.5,\n \"random\": false,\n \"anim\": {\n \"enable\": false,\n \"speed\": 1,\n \"opacity_min\": 0.1,\n \"sync\": false\n }\n },\n \"size\": {\n \"value\": 5,\n \"random\": true,\n \"anim\": {\n \"enable\": false,\n \"speed\": 40,\n \"size_min\": 0.1,\n \"sync\": false\n }\n },\n \"line_linked\": {\n \"enable\": true,\n \"distance\": 150,\n \"color\": \"#ffffff\",\n \"opacity\": 0.4,\n \"width\": 1\n },\n \"move\": {\n \"enable\": true,\n \"speed\": 6,\n \"direction\": \"none\",\n \"random\": false,\n \"straight\": false,\n \"out_mode\": \"out\",\n \"attract\": {\n \"enable\": false,\n \"rotateX\": 600,\n \"rotateY\": 1200\n }\n }\n },\n \"interactivity\": {\n \"detect_on\": \"canvas\",\n \"events\": {\n \"onhover\": {\n \"enable\": true,\n \"mode\": \"repulse\"\n },\n \"onclick\": {\n \"enable\": true,\n \"mode\": \"push\"\n },\n \"resize\": true\n },\n \"modes\": {\n \"grab\": {\n \"distance\": 400,\n \"line_linked\": {\n \"opacity\": 1\n }\n },\n \"bubble\": {\n \"distance\": 400,\n \"size\": 40,\n \"duration\": 2,\n \"opacity\": 8,\n \"speed\": 3\n },\n \"repulse\": {\n \"distance\": 200\n },\n \"push\": {\n \"particles_nb\": 4\n },\n \"remove\": {\n \"particles_nb\": 2\n }\n }\n },\n \"retina_detect\": true,\n \"config_demo\": {\n \"hide_card\": false,\n \"background_color\": \"#b61924\",\n \"background_image\": \"\",\n \"background_position\": \"50% 50%\",\n \"background_repeat\": \"no-repeat\",\n \"background_size\": \"cover\"\n }\n }\n );\n }\n\n // set the modal menu element\n const $targetEl = document.getElementById('default-modal');\n // if($targetEl){\n // options with default values\n const options = {\n placement: 'bottom-right',\n backdrop: 'dynamic',\n backdropClasses:\n 'bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-40',\n closable: true,\n onHide: () => {\n console.log('modal is hidden');\n },\n onShow: () => {\n console.log('modal is shown');\n },\n onToggle: () => {\n console.log('modal has been toggled');\n },\n };\n \n // instance options object\n const instanceOptions = {\n id: 'default-modal',\n override: true\n };\n\n const modal = new Modal($targetEl, options, instanceOptions);\n const btnModal = document.getElementsByClassName('open-modal')\n const btnCloseModal = document.getElementsByClassName('close-modal')\n if(btnModal.length > 0){\n btnModal[0].addEventListener('click', (e) => {\n e.preventDefault()\n modal.show()\n })\n }\n\n if(btnCloseModal.length > 0){\n btnCloseModal[0].addEventListener('click', (e) => {\n e.preventDefault()\n modal.hide()\n })\n }\n\n document.getElementById('btn_cam_nang').addEventListener('click', (e) => {\n e.preventDefault()\n const payload = {\n email: document.getElementById('email').value,\n fullname: document.getElementById('fullname').value,\n phone_number: document.getElementById('phone').value\n };\n fetch('/api/v1/members',{\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Client-id': 'ODISTAD120'\n },\n body: JSON.stringify(payload)\n }).then(response => response.json())\n .then(data => {\n if(data.error){\n document.getElementById('result').innerHTML = '

Đã có lỗi trong quá trình đăng ký, vui lòng thử lại sau

'\n }else{\n document.getElementById('result').innerHTML = '

Đăng ký thành công

'\n }\n \n })\n .catch(error => {\n console.error('Error:', error);\n });\n return false;\n })\n\n var elementsCollection = document.getElementsByClassName('phone')\n for(const element of elementsCollection) {\n element.addEventListener('input', function(event) {\n let input = event.target;\n var value = input.value;\n input.value = value.replace(/\\D/g, '');\n if (input.value.length < 10 || input.value.length > 14){\n input.setCustomValidity('Số điện thoại phải từ 10 đến 14 kí tự')\n input.reportValidity()\n } else {\n document.getElementById('btn_new_employee').disabled = false; \n input.setCustomValidity('');\n }\n });\n }\n var newEmployeeButon = document.getElementById('btn_new_employee')\n if (newEmployeeButon) {\n newEmployeeButon.addEventListener('click', (e) => {\n e.preventDefault()\n var form = document.getElementById('newEmployeeForm')\n if (!form.checkValidity()) {\n form.reportValidity()\n } else {\n const formData = new FormData();\n formData.append('email', document.getElementById('email').value.toString());\n formData.append('fullname', document.getElementById('fullname').value.toString());\n formData.append('phone_number', document.getElementById('phone').value.toString());\n formData.append('job_id', document.getElementById('jobId').value.toString());\n formData.append('profile', document.getElementById('profile').files[0]);\n \n console.log(formData)\n \n fetch('/api/v1/employees',{\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Client-ID': 'SAGRI'\n },\n body: formData\n }).then(response => response.json())\n .then(data => {\n if(data.error){\n document.getElementById('result').innerHTML = '

Đã có lỗi trong quá trình nộp hồ sơ, vui lòng thử lại sau

'\n } else {\n document.getElementById('result').innerHTML = '

Nộp hồ sơ thành công

'\n }\n \n })\n .catch(error => {\n console.error('Error:', error);\n });\n return false;\n }\n \n if (value.length < 10 || value.length > 14){\n document.getElementById('result').innerHTML = '

Số điện thoại phải từ 10 đến 14 kí tự

'\n } \n })\n }\n\n const openPopupBtn = document.getElementById('openPopupBtn');\n const popupContainer = document.getElementById('popupContainer');\n const closePopupBtn = document.getElementById('closePopupBtn');\n if (openPopupBtn) {\n openPopupBtn.addEventListener('click', () => {\n popupContainer.style.display = 'block'; // Show the popup container\n });\n closePopupBtn.addEventListener('click', () => {\n popupContainer.style.display = 'none'; // Hide the popup container\n });\n document.addEventListener('click', function(event) {\n if (!popupContainer.contains(event.target) && event.target !== openPopupBtn) {\n popupContainer.style.display = 'none'; // Hide the popup\n }\n });\n }\n}\n","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n/*\nStimulus 3.2.1\nCopyright © 2023 Basecamp, LLC\n */\nclass EventListener {\n constructor(eventTarget, eventName, eventOptions) {\n this.eventTarget = eventTarget;\n this.eventName = eventName;\n this.eventOptions = eventOptions;\n this.unorderedBindings = new Set();\n }\n connect() {\n this.eventTarget.addEventListener(this.eventName, this, this.eventOptions);\n }\n disconnect() {\n this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions);\n }\n bindingConnected(binding) {\n this.unorderedBindings.add(binding);\n }\n bindingDisconnected(binding) {\n this.unorderedBindings.delete(binding);\n }\n handleEvent(event) {\n const extendedEvent = extendEvent(event);\n for (const binding of this.bindings) {\n if (extendedEvent.immediatePropagationStopped) {\n break;\n } else {\n binding.handleEvent(extendedEvent);\n }\n }\n }\n hasBindings() {\n return this.unorderedBindings.size > 0;\n }\n get bindings() {\n return Array.from(this.unorderedBindings).sort((left, right) => {\n const leftIndex = left.index,\n rightIndex = right.index;\n return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0;\n });\n }\n}\nfunction extendEvent(event) {\n if (\"immediatePropagationStopped\" in event) {\n return event;\n } else {\n const stopImmediatePropagation = event.stopImmediatePropagation;\n return Object.assign(event, {\n immediatePropagationStopped: false,\n stopImmediatePropagation() {\n this.immediatePropagationStopped = true;\n stopImmediatePropagation.call(this);\n }\n });\n }\n}\nclass Dispatcher {\n constructor(application) {\n this.application = application;\n this.eventListenerMaps = new Map();\n this.started = false;\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.eventListeners.forEach(eventListener => eventListener.connect());\n }\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.eventListeners.forEach(eventListener => eventListener.disconnect());\n }\n }\n get eventListeners() {\n return Array.from(this.eventListenerMaps.values()).reduce((listeners, map) => listeners.concat(Array.from(map.values())), []);\n }\n bindingConnected(binding) {\n this.fetchEventListenerForBinding(binding).bindingConnected(binding);\n }\n bindingDisconnected(binding) {\n let clearEventListeners = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);\n if (clearEventListeners) this.clearEventListenersForBinding(binding);\n }\n handleError(error, message) {\n let detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n this.application.handleError(error, `Error ${message}`, detail);\n }\n clearEventListenersForBinding(binding) {\n const eventListener = this.fetchEventListenerForBinding(binding);\n if (!eventListener.hasBindings()) {\n eventListener.disconnect();\n this.removeMappedEventListenerFor(binding);\n }\n }\n removeMappedEventListenerFor(binding) {\n const eventTarget = binding.eventTarget,\n eventName = binding.eventName,\n eventOptions = binding.eventOptions;\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n eventListenerMap.delete(cacheKey);\n if (eventListenerMap.size == 0) this.eventListenerMaps.delete(eventTarget);\n }\n fetchEventListenerForBinding(binding) {\n const eventTarget = binding.eventTarget,\n eventName = binding.eventName,\n eventOptions = binding.eventOptions;\n return this.fetchEventListener(eventTarget, eventName, eventOptions);\n }\n fetchEventListener(eventTarget, eventName, eventOptions) {\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n let eventListener = eventListenerMap.get(cacheKey);\n if (!eventListener) {\n eventListener = this.createEventListener(eventTarget, eventName, eventOptions);\n eventListenerMap.set(cacheKey, eventListener);\n }\n return eventListener;\n }\n createEventListener(eventTarget, eventName, eventOptions) {\n const eventListener = new EventListener(eventTarget, eventName, eventOptions);\n if (this.started) {\n eventListener.connect();\n }\n return eventListener;\n }\n fetchEventListenerMapForEventTarget(eventTarget) {\n let eventListenerMap = this.eventListenerMaps.get(eventTarget);\n if (!eventListenerMap) {\n eventListenerMap = new Map();\n this.eventListenerMaps.set(eventTarget, eventListenerMap);\n }\n return eventListenerMap;\n }\n cacheKey(eventName, eventOptions) {\n const parts = [eventName];\n Object.keys(eventOptions).sort().forEach(key => {\n parts.push(`${eventOptions[key] ? \"\" : \"!\"}${key}`);\n });\n return parts.join(\":\");\n }\n}\nconst defaultActionDescriptorFilters = {\n stop(_ref) {\n let event = _ref.event,\n value = _ref.value;\n if (value) event.stopPropagation();\n return true;\n },\n prevent(_ref2) {\n let event = _ref2.event,\n value = _ref2.value;\n if (value) event.preventDefault();\n return true;\n },\n self(_ref3) {\n let event = _ref3.event,\n value = _ref3.value,\n element = _ref3.element;\n if (value) {\n return element === event.target;\n } else {\n return true;\n }\n }\n};\nconst descriptorPattern = /^(?:(?:([^.]+?)\\+)?(.+?)(?:\\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;\nfunction parseActionDescriptorString(descriptorString) {\n const source = descriptorString.trim();\n const matches = source.match(descriptorPattern) || [];\n let eventName = matches[2];\n let keyFilter = matches[3];\n if (keyFilter && ![\"keydown\", \"keyup\", \"keypress\"].includes(eventName)) {\n eventName += `.${keyFilter}`;\n keyFilter = \"\";\n }\n return {\n eventTarget: parseEventTarget(matches[4]),\n eventName,\n eventOptions: matches[7] ? parseEventOptions(matches[7]) : {},\n identifier: matches[5],\n methodName: matches[6],\n keyFilter: matches[1] || keyFilter\n };\n}\nfunction parseEventTarget(eventTargetName) {\n if (eventTargetName == \"window\") {\n return window;\n } else if (eventTargetName == \"document\") {\n return document;\n }\n}\nfunction parseEventOptions(eventOptions) {\n return eventOptions.split(\":\").reduce((options, token) => Object.assign(options, {\n [token.replace(/^!/, \"\")]: !/^!/.test(token)\n }), {});\n}\nfunction stringifyEventTarget(eventTarget) {\n if (eventTarget == window) {\n return \"window\";\n } else if (eventTarget == document) {\n return \"document\";\n }\n}\nfunction camelize(value) {\n return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase());\n}\nfunction namespaceCamelize(value) {\n return camelize(value.replace(/--/g, \"-\").replace(/__/g, \"_\"));\n}\nfunction capitalize(value) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\nfunction dasherize(value) {\n return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`);\n}\nfunction tokenize(value) {\n return value.match(/[^\\s]+/g) || [];\n}\nfunction isSomething(object) {\n return object !== null && object !== undefined;\n}\nfunction hasProperty(object, property) {\n return Object.prototype.hasOwnProperty.call(object, property);\n}\nconst allModifiers = [\"meta\", \"ctrl\", \"alt\", \"shift\"];\nclass Action {\n constructor(element, index, descriptor, schema) {\n this.element = element;\n this.index = index;\n this.eventTarget = descriptor.eventTarget || element;\n this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error(\"missing event name\");\n this.eventOptions = descriptor.eventOptions || {};\n this.identifier = descriptor.identifier || error(\"missing identifier\");\n this.methodName = descriptor.methodName || error(\"missing method name\");\n this.keyFilter = descriptor.keyFilter || \"\";\n this.schema = schema;\n }\n static forToken(token, schema) {\n return new this(token.element, token.index, parseActionDescriptorString(token.content), schema);\n }\n toString() {\n const eventFilter = this.keyFilter ? `.${this.keyFilter}` : \"\";\n const eventTarget = this.eventTargetName ? `@${this.eventTargetName}` : \"\";\n return `${this.eventName}${eventFilter}${eventTarget}->${this.identifier}#${this.methodName}`;\n }\n shouldIgnoreKeyboardEvent(event) {\n if (!this.keyFilter) {\n return false;\n }\n const filters = this.keyFilter.split(\"+\");\n if (this.keyFilterDissatisfied(event, filters)) {\n return true;\n }\n const standardFilter = filters.filter(key => !allModifiers.includes(key))[0];\n if (!standardFilter) {\n return false;\n }\n if (!hasProperty(this.keyMappings, standardFilter)) {\n error(`contains unknown key filter: ${this.keyFilter}`);\n }\n return this.keyMappings[standardFilter].toLowerCase() !== event.key.toLowerCase();\n }\n shouldIgnoreMouseEvent(event) {\n if (!this.keyFilter) {\n return false;\n }\n const filters = [this.keyFilter];\n if (this.keyFilterDissatisfied(event, filters)) {\n return true;\n }\n return false;\n }\n get params() {\n const params = {};\n const pattern = new RegExp(`^data-${this.identifier}-(.+)-param$`, \"i\");\n for (const _ref4 of Array.from(this.element.attributes)) {\n const name = _ref4.name;\n const value = _ref4.value;\n const match = name.match(pattern);\n const key = match && match[1];\n if (key) {\n params[camelize(key)] = typecast(value);\n }\n }\n return params;\n }\n get eventTargetName() {\n return stringifyEventTarget(this.eventTarget);\n }\n get keyMappings() {\n return this.schema.keyMappings;\n }\n keyFilterDissatisfied(event, filters) {\n const _allModifiers$map = allModifiers.map(modifier => filters.includes(modifier)),\n _allModifiers$map2 = _slicedToArray(_allModifiers$map, 4),\n meta = _allModifiers$map2[0],\n ctrl = _allModifiers$map2[1],\n alt = _allModifiers$map2[2],\n shift = _allModifiers$map2[3];\n return event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== alt || event.shiftKey !== shift;\n }\n}\nconst defaultEventNames = {\n a: () => \"click\",\n button: () => \"click\",\n form: () => \"submit\",\n details: () => \"toggle\",\n input: e => e.getAttribute(\"type\") == \"submit\" ? \"click\" : \"input\",\n select: () => \"change\",\n textarea: () => \"input\"\n};\nfunction getDefaultEventNameForElement(element) {\n const tagName = element.tagName.toLowerCase();\n if (tagName in defaultEventNames) {\n return defaultEventNames[tagName](element);\n }\n}\nfunction error(message) {\n throw new Error(message);\n}\nfunction typecast(value) {\n try {\n return JSON.parse(value);\n } catch (o_O) {\n return value;\n }\n}\nclass Binding {\n constructor(context, action) {\n this.context = context;\n this.action = action;\n }\n get index() {\n return this.action.index;\n }\n get eventTarget() {\n return this.action.eventTarget;\n }\n get eventOptions() {\n return this.action.eventOptions;\n }\n get identifier() {\n return this.context.identifier;\n }\n handleEvent(event) {\n const actionEvent = this.prepareActionEvent(event);\n if (this.willBeInvokedByEvent(event) && this.applyEventModifiers(actionEvent)) {\n this.invokeWithEvent(actionEvent);\n }\n }\n get eventName() {\n return this.action.eventName;\n }\n get method() {\n const method = this.controller[this.methodName];\n if (typeof method == \"function\") {\n return method;\n }\n throw new Error(`Action \"${this.action}\" references undefined method \"${this.methodName}\"`);\n }\n applyEventModifiers(event) {\n const element = this.action.element;\n const actionDescriptorFilters = this.context.application.actionDescriptorFilters;\n const controller = this.context.controller;\n let passes = true;\n for (const _ref5 of Object.entries(this.eventOptions)) {\n var _ref6 = _slicedToArray(_ref5, 2);\n const name = _ref6[0];\n const value = _ref6[1];\n if (name in actionDescriptorFilters) {\n const filter = actionDescriptorFilters[name];\n passes = passes && filter({\n name,\n value,\n event,\n element,\n controller\n });\n } else {\n continue;\n }\n }\n return passes;\n }\n prepareActionEvent(event) {\n return Object.assign(event, {\n params: this.action.params\n });\n }\n invokeWithEvent(event) {\n const target = event.target,\n currentTarget = event.currentTarget;\n try {\n this.method.call(this.controller, event);\n this.context.logDebugActivity(this.methodName, {\n event,\n target,\n currentTarget,\n action: this.methodName\n });\n } catch (error) {\n const identifier = this.identifier,\n controller = this.controller,\n element = this.element,\n index = this.index;\n const detail = {\n identifier,\n controller,\n element,\n index,\n event\n };\n this.context.handleError(error, `invoking action \"${this.action}\"`, detail);\n }\n }\n willBeInvokedByEvent(event) {\n const eventTarget = event.target;\n if (event instanceof KeyboardEvent && this.action.shouldIgnoreKeyboardEvent(event)) {\n return false;\n }\n if (event instanceof MouseEvent && this.action.shouldIgnoreMouseEvent(event)) {\n return false;\n }\n if (this.element === eventTarget) {\n return true;\n } else if (eventTarget instanceof Element && this.element.contains(eventTarget)) {\n return this.scope.containsElement(eventTarget);\n } else {\n return this.scope.containsElement(this.action.element);\n }\n }\n get controller() {\n return this.context.controller;\n }\n get methodName() {\n return this.action.methodName;\n }\n get element() {\n return this.scope.element;\n }\n get scope() {\n return this.context.scope;\n }\n}\nclass ElementObserver {\n constructor(element, delegate) {\n this.mutationObserverInit = {\n attributes: true,\n childList: true,\n subtree: true\n };\n this.element = element;\n this.started = false;\n this.delegate = delegate;\n this.elements = new Set();\n this.mutationObserver = new MutationObserver(mutations => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.refresh();\n }\n }\n pause(callback) {\n if (this.started) {\n this.mutationObserver.disconnect();\n this.started = false;\n }\n callback();\n if (!this.started) {\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.started = true;\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n const matches = new Set(this.matchElementsInTree());\n for (const element of Array.from(this.elements)) {\n if (!matches.has(element)) {\n this.removeElement(element);\n }\n }\n for (const element of Array.from(matches)) {\n this.addElement(element);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n if (mutation.type == \"attributes\") {\n this.processAttributeChange(mutation.target, mutation.attributeName);\n } else if (mutation.type == \"childList\") {\n this.processRemovedNodes(mutation.removedNodes);\n this.processAddedNodes(mutation.addedNodes);\n }\n }\n processAttributeChange(element, attributeName) {\n if (this.elements.has(element)) {\n if (this.delegate.elementAttributeChanged && this.matchElement(element)) {\n this.delegate.elementAttributeChanged(element, attributeName);\n } else {\n this.removeElement(element);\n }\n } else if (this.matchElement(element)) {\n this.addElement(element);\n }\n }\n processRemovedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element) {\n this.processTree(element, this.removeElement);\n }\n }\n }\n processAddedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element && this.elementIsActive(element)) {\n this.processTree(element, this.addElement);\n }\n }\n }\n matchElement(element) {\n return this.delegate.matchElement(element);\n }\n matchElementsInTree() {\n let tree = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.element;\n return this.delegate.matchElementsInTree(tree);\n }\n processTree(tree, processor) {\n for (const element of this.matchElementsInTree(tree)) {\n processor.call(this, element);\n }\n }\n elementFromNode(node) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n return node;\n }\n }\n elementIsActive(element) {\n if (element.isConnected != this.element.isConnected) {\n return false;\n } else {\n return this.element.contains(element);\n }\n }\n addElement(element) {\n if (!this.elements.has(element)) {\n if (this.elementIsActive(element)) {\n this.elements.add(element);\n if (this.delegate.elementMatched) {\n this.delegate.elementMatched(element);\n }\n }\n }\n }\n removeElement(element) {\n if (this.elements.has(element)) {\n this.elements.delete(element);\n if (this.delegate.elementUnmatched) {\n this.delegate.elementUnmatched(element);\n }\n }\n }\n}\nclass AttributeObserver {\n constructor(element, attributeName, delegate) {\n this.attributeName = attributeName;\n this.delegate = delegate;\n this.elementObserver = new ElementObserver(element, this);\n }\n get element() {\n return this.elementObserver.element;\n }\n get selector() {\n return `[${this.attributeName}]`;\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get started() {\n return this.elementObserver.started;\n }\n matchElement(element) {\n return element.hasAttribute(this.attributeName);\n }\n matchElementsInTree(tree) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(this.selector));\n return match.concat(matches);\n }\n elementMatched(element) {\n if (this.delegate.elementMatchedAttribute) {\n this.delegate.elementMatchedAttribute(element, this.attributeName);\n }\n }\n elementUnmatched(element) {\n if (this.delegate.elementUnmatchedAttribute) {\n this.delegate.elementUnmatchedAttribute(element, this.attributeName);\n }\n }\n elementAttributeChanged(element, attributeName) {\n if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) {\n this.delegate.elementAttributeValueChanged(element, attributeName);\n }\n }\n}\nfunction add(map, key, value) {\n fetch(map, key).add(value);\n}\nfunction del(map, key, value) {\n fetch(map, key).delete(value);\n prune(map, key);\n}\nfunction fetch(map, key) {\n let values = map.get(key);\n if (!values) {\n values = new Set();\n map.set(key, values);\n }\n return values;\n}\nfunction prune(map, key) {\n const values = map.get(key);\n if (values != null && values.size == 0) {\n map.delete(key);\n }\n}\nclass Multimap {\n constructor() {\n this.valuesByKey = new Map();\n }\n get keys() {\n return Array.from(this.valuesByKey.keys());\n }\n get values() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((values, set) => values.concat(Array.from(set)), []);\n }\n get size() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((size, set) => size + set.size, 0);\n }\n add(key, value) {\n add(this.valuesByKey, key, value);\n }\n delete(key, value) {\n del(this.valuesByKey, key, value);\n }\n has(key, value) {\n const values = this.valuesByKey.get(key);\n return values != null && values.has(value);\n }\n hasKey(key) {\n return this.valuesByKey.has(key);\n }\n hasValue(value) {\n const sets = Array.from(this.valuesByKey.values());\n return sets.some(set => set.has(value));\n }\n getValuesForKey(key) {\n const values = this.valuesByKey.get(key);\n return values ? Array.from(values) : [];\n }\n getKeysForValue(value) {\n return Array.from(this.valuesByKey).filter(_ref7 => {\n let _ref8 = _slicedToArray(_ref7, 2),\n _key = _ref8[0],\n values = _ref8[1];\n return values.has(value);\n }).map(_ref9 => {\n let _ref10 = _slicedToArray(_ref9, 2),\n key = _ref10[0],\n _values = _ref10[1];\n return key;\n });\n }\n}\nclass IndexedMultimap extends Multimap {\n constructor() {\n super();\n this.keysByValue = new Map();\n }\n get values() {\n return Array.from(this.keysByValue.keys());\n }\n add(key, value) {\n super.add(key, value);\n add(this.keysByValue, value, key);\n }\n delete(key, value) {\n super.delete(key, value);\n del(this.keysByValue, value, key);\n }\n hasValue(value) {\n return this.keysByValue.has(value);\n }\n getKeysForValue(value) {\n const set = this.keysByValue.get(value);\n return set ? Array.from(set) : [];\n }\n}\nclass SelectorObserver {\n constructor(element, selector, delegate, details) {\n this._selector = selector;\n this.details = details;\n this.elementObserver = new ElementObserver(element, this);\n this.delegate = delegate;\n this.matchesByElement = new Multimap();\n }\n get started() {\n return this.elementObserver.started;\n }\n get selector() {\n return this._selector;\n }\n set selector(selector) {\n this._selector = selector;\n this.refresh();\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get element() {\n return this.elementObserver.element;\n }\n matchElement(element) {\n const selector = this.selector;\n if (selector) {\n const matches = element.matches(selector);\n if (this.delegate.selectorMatchElement) {\n return matches && this.delegate.selectorMatchElement(element, this.details);\n }\n return matches;\n } else {\n return false;\n }\n }\n matchElementsInTree(tree) {\n const selector = this.selector;\n if (selector) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(selector)).filter(match => this.matchElement(match));\n return match.concat(matches);\n } else {\n return [];\n }\n }\n elementMatched(element) {\n const selector = this.selector;\n if (selector) {\n this.selectorMatched(element, selector);\n }\n }\n elementUnmatched(element) {\n const selectors = this.matchesByElement.getKeysForValue(element);\n for (const selector of selectors) {\n this.selectorUnmatched(element, selector);\n }\n }\n elementAttributeChanged(element, _attributeName) {\n const selector = this.selector;\n if (selector) {\n const matches = this.matchElement(element);\n const matchedBefore = this.matchesByElement.has(selector, element);\n if (matches && !matchedBefore) {\n this.selectorMatched(element, selector);\n } else if (!matches && matchedBefore) {\n this.selectorUnmatched(element, selector);\n }\n }\n }\n selectorMatched(element, selector) {\n this.delegate.selectorMatched(element, selector, this.details);\n this.matchesByElement.add(selector, element);\n }\n selectorUnmatched(element, selector) {\n this.delegate.selectorUnmatched(element, selector, this.details);\n this.matchesByElement.delete(selector, element);\n }\n}\nclass StringMapObserver {\n constructor(element, delegate) {\n this.element = element;\n this.delegate = delegate;\n this.started = false;\n this.stringMap = new Map();\n this.mutationObserver = new MutationObserver(mutations => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, {\n attributes: true,\n attributeOldValue: true\n });\n this.refresh();\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n for (const attributeName of this.knownAttributeNames) {\n this.refreshAttribute(attributeName, null);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n const attributeName = mutation.attributeName;\n if (attributeName) {\n this.refreshAttribute(attributeName, mutation.oldValue);\n }\n }\n refreshAttribute(attributeName, oldValue) {\n const key = this.delegate.getStringMapKeyForAttribute(attributeName);\n if (key != null) {\n if (!this.stringMap.has(attributeName)) {\n this.stringMapKeyAdded(key, attributeName);\n }\n const value = this.element.getAttribute(attributeName);\n if (this.stringMap.get(attributeName) != value) {\n this.stringMapValueChanged(value, key, oldValue);\n }\n if (value == null) {\n const oldValue = this.stringMap.get(attributeName);\n this.stringMap.delete(attributeName);\n if (oldValue) this.stringMapKeyRemoved(key, attributeName, oldValue);\n } else {\n this.stringMap.set(attributeName, value);\n }\n }\n }\n stringMapKeyAdded(key, attributeName) {\n if (this.delegate.stringMapKeyAdded) {\n this.delegate.stringMapKeyAdded(key, attributeName);\n }\n }\n stringMapValueChanged(value, key, oldValue) {\n if (this.delegate.stringMapValueChanged) {\n this.delegate.stringMapValueChanged(value, key, oldValue);\n }\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n if (this.delegate.stringMapKeyRemoved) {\n this.delegate.stringMapKeyRemoved(key, attributeName, oldValue);\n }\n }\n get knownAttributeNames() {\n return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)));\n }\n get currentAttributeNames() {\n return Array.from(this.element.attributes).map(attribute => attribute.name);\n }\n get recordedAttributeNames() {\n return Array.from(this.stringMap.keys());\n }\n}\nclass TokenListObserver {\n constructor(element, attributeName, delegate) {\n this.attributeObserver = new AttributeObserver(element, attributeName, this);\n this.delegate = delegate;\n this.tokensByElement = new Multimap();\n }\n get started() {\n return this.attributeObserver.started;\n }\n start() {\n this.attributeObserver.start();\n }\n pause(callback) {\n this.attributeObserver.pause(callback);\n }\n stop() {\n this.attributeObserver.stop();\n }\n refresh() {\n this.attributeObserver.refresh();\n }\n get element() {\n return this.attributeObserver.element;\n }\n get attributeName() {\n return this.attributeObserver.attributeName;\n }\n elementMatchedAttribute(element) {\n this.tokensMatched(this.readTokensForElement(element));\n }\n elementAttributeValueChanged(element) {\n const _this$refreshTokensFo = this.refreshTokensForElement(element),\n _this$refreshTokensFo2 = _slicedToArray(_this$refreshTokensFo, 2),\n unmatchedTokens = _this$refreshTokensFo2[0],\n matchedTokens = _this$refreshTokensFo2[1];\n this.tokensUnmatched(unmatchedTokens);\n this.tokensMatched(matchedTokens);\n }\n elementUnmatchedAttribute(element) {\n this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));\n }\n tokensMatched(tokens) {\n tokens.forEach(token => this.tokenMatched(token));\n }\n tokensUnmatched(tokens) {\n tokens.forEach(token => this.tokenUnmatched(token));\n }\n tokenMatched(token) {\n this.delegate.tokenMatched(token);\n this.tokensByElement.add(token.element, token);\n }\n tokenUnmatched(token) {\n this.delegate.tokenUnmatched(token);\n this.tokensByElement.delete(token.element, token);\n }\n refreshTokensForElement(element) {\n const previousTokens = this.tokensByElement.getValuesForKey(element);\n const currentTokens = this.readTokensForElement(element);\n const firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(_ref11 => {\n let _ref12 = _slicedToArray(_ref11, 2),\n previousToken = _ref12[0],\n currentToken = _ref12[1];\n return !tokensAreEqual(previousToken, currentToken);\n });\n if (firstDifferingIndex == -1) {\n return [[], []];\n } else {\n return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];\n }\n }\n readTokensForElement(element) {\n const attributeName = this.attributeName;\n const tokenString = element.getAttribute(attributeName) || \"\";\n return parseTokenString(tokenString, element, attributeName);\n }\n}\nfunction parseTokenString(tokenString, element, attributeName) {\n return tokenString.trim().split(/\\s+/).filter(content => content.length).map((content, index) => ({\n element,\n attributeName,\n content,\n index\n }));\n}\nfunction zip(left, right) {\n const length = Math.max(left.length, right.length);\n return Array.from({\n length\n }, (_, index) => [left[index], right[index]]);\n}\nfunction tokensAreEqual(left, right) {\n return left && right && left.index == right.index && left.content == right.content;\n}\nclass ValueListObserver {\n constructor(element, attributeName, delegate) {\n this.tokenListObserver = new TokenListObserver(element, attributeName, this);\n this.delegate = delegate;\n this.parseResultsByToken = new WeakMap();\n this.valuesByTokenByElement = new WeakMap();\n }\n get started() {\n return this.tokenListObserver.started;\n }\n start() {\n this.tokenListObserver.start();\n }\n stop() {\n this.tokenListObserver.stop();\n }\n refresh() {\n this.tokenListObserver.refresh();\n }\n get element() {\n return this.tokenListObserver.element;\n }\n get attributeName() {\n return this.tokenListObserver.attributeName;\n }\n tokenMatched(token) {\n const element = token.element;\n const _this$fetchParseResul = this.fetchParseResultForToken(token),\n value = _this$fetchParseResul.value;\n if (value) {\n this.fetchValuesByTokenForElement(element).set(token, value);\n this.delegate.elementMatchedValue(element, value);\n }\n }\n tokenUnmatched(token) {\n const element = token.element;\n const _this$fetchParseResul2 = this.fetchParseResultForToken(token),\n value = _this$fetchParseResul2.value;\n if (value) {\n this.fetchValuesByTokenForElement(element).delete(token);\n this.delegate.elementUnmatchedValue(element, value);\n }\n }\n fetchParseResultForToken(token) {\n let parseResult = this.parseResultsByToken.get(token);\n if (!parseResult) {\n parseResult = this.parseToken(token);\n this.parseResultsByToken.set(token, parseResult);\n }\n return parseResult;\n }\n fetchValuesByTokenForElement(element) {\n let valuesByToken = this.valuesByTokenByElement.get(element);\n if (!valuesByToken) {\n valuesByToken = new Map();\n this.valuesByTokenByElement.set(element, valuesByToken);\n }\n return valuesByToken;\n }\n parseToken(token) {\n try {\n const value = this.delegate.parseValueForToken(token);\n return {\n value\n };\n } catch (error) {\n return {\n error\n };\n }\n }\n}\nclass BindingObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.bindingsByAction = new Map();\n }\n start() {\n if (!this.valueListObserver) {\n this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this);\n this.valueListObserver.start();\n }\n }\n stop() {\n if (this.valueListObserver) {\n this.valueListObserver.stop();\n delete this.valueListObserver;\n this.disconnectAllActions();\n }\n }\n get element() {\n return this.context.element;\n }\n get identifier() {\n return this.context.identifier;\n }\n get actionAttribute() {\n return this.schema.actionAttribute;\n }\n get schema() {\n return this.context.schema;\n }\n get bindings() {\n return Array.from(this.bindingsByAction.values());\n }\n connectAction(action) {\n const binding = new Binding(this.context, action);\n this.bindingsByAction.set(action, binding);\n this.delegate.bindingConnected(binding);\n }\n disconnectAction(action) {\n const binding = this.bindingsByAction.get(action);\n if (binding) {\n this.bindingsByAction.delete(action);\n this.delegate.bindingDisconnected(binding);\n }\n }\n disconnectAllActions() {\n this.bindings.forEach(binding => this.delegate.bindingDisconnected(binding, true));\n this.bindingsByAction.clear();\n }\n parseValueForToken(token) {\n const action = Action.forToken(token, this.schema);\n if (action.identifier == this.identifier) {\n return action;\n }\n }\n elementMatchedValue(element, action) {\n this.connectAction(action);\n }\n elementUnmatchedValue(element, action) {\n this.disconnectAction(action);\n }\n}\nclass ValueObserver {\n constructor(context, receiver) {\n this.context = context;\n this.receiver = receiver;\n this.stringMapObserver = new StringMapObserver(this.element, this);\n this.valueDescriptorMap = this.controller.valueDescriptorMap;\n }\n start() {\n this.stringMapObserver.start();\n this.invokeChangedCallbacksForDefaultValues();\n }\n stop() {\n this.stringMapObserver.stop();\n }\n get element() {\n return this.context.element;\n }\n get controller() {\n return this.context.controller;\n }\n getStringMapKeyForAttribute(attributeName) {\n if (attributeName in this.valueDescriptorMap) {\n return this.valueDescriptorMap[attributeName].name;\n }\n }\n stringMapKeyAdded(key, attributeName) {\n const descriptor = this.valueDescriptorMap[attributeName];\n if (!this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), descriptor.writer(descriptor.defaultValue));\n }\n }\n stringMapValueChanged(value, name, oldValue) {\n const descriptor = this.valueDescriptorNameMap[name];\n if (value === null) return;\n if (oldValue === null) {\n oldValue = descriptor.writer(descriptor.defaultValue);\n }\n this.invokeChangedCallback(name, value, oldValue);\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n const descriptor = this.valueDescriptorNameMap[key];\n if (this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), oldValue);\n } else {\n this.invokeChangedCallback(key, descriptor.writer(descriptor.defaultValue), oldValue);\n }\n }\n invokeChangedCallbacksForDefaultValues() {\n for (const _ref13 of this.valueDescriptors) {\n const key = _ref13.key;\n const name = _ref13.name;\n const defaultValue = _ref13.defaultValue;\n const writer = _ref13.writer;\n if (defaultValue != undefined && !this.controller.data.has(key)) {\n this.invokeChangedCallback(name, writer(defaultValue), undefined);\n }\n }\n }\n invokeChangedCallback(name, rawValue, rawOldValue) {\n const changedMethodName = `${name}Changed`;\n const changedMethod = this.receiver[changedMethodName];\n if (typeof changedMethod == \"function\") {\n const descriptor = this.valueDescriptorNameMap[name];\n try {\n const value = descriptor.reader(rawValue);\n let oldValue = rawOldValue;\n if (rawOldValue) {\n oldValue = descriptor.reader(rawOldValue);\n }\n changedMethod.call(this.receiver, value, oldValue);\n } catch (error) {\n if (error instanceof TypeError) {\n error.message = `Stimulus Value \"${this.context.identifier}.${descriptor.name}\" - ${error.message}`;\n }\n throw error;\n }\n }\n }\n get valueDescriptors() {\n const valueDescriptorMap = this.valueDescriptorMap;\n return Object.keys(valueDescriptorMap).map(key => valueDescriptorMap[key]);\n }\n get valueDescriptorNameMap() {\n const descriptors = {};\n Object.keys(this.valueDescriptorMap).forEach(key => {\n const descriptor = this.valueDescriptorMap[key];\n descriptors[descriptor.name] = descriptor;\n });\n return descriptors;\n }\n hasValue(attributeName) {\n const descriptor = this.valueDescriptorNameMap[attributeName];\n const hasMethodName = `has${capitalize(descriptor.name)}`;\n return this.receiver[hasMethodName];\n }\n}\nclass TargetObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.targetsByName = new Multimap();\n }\n start() {\n if (!this.tokenListObserver) {\n this.tokenListObserver = new TokenListObserver(this.element, this.attributeName, this);\n this.tokenListObserver.start();\n }\n }\n stop() {\n if (this.tokenListObserver) {\n this.disconnectAllTargets();\n this.tokenListObserver.stop();\n delete this.tokenListObserver;\n }\n }\n tokenMatched(_ref14) {\n let element = _ref14.element,\n name = _ref14.content;\n if (this.scope.containsElement(element)) {\n this.connectTarget(element, name);\n }\n }\n tokenUnmatched(_ref15) {\n let element = _ref15.element,\n name = _ref15.content;\n this.disconnectTarget(element, name);\n }\n connectTarget(element, name) {\n var _a;\n if (!this.targetsByName.has(name, element)) {\n this.targetsByName.add(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetConnected(element, name));\n }\n }\n disconnectTarget(element, name) {\n var _a;\n if (this.targetsByName.has(name, element)) {\n this.targetsByName.delete(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetDisconnected(element, name));\n }\n }\n disconnectAllTargets() {\n for (const name of this.targetsByName.keys) {\n for (const element of this.targetsByName.getValuesForKey(name)) {\n this.disconnectTarget(element, name);\n }\n }\n }\n get attributeName() {\n return `data-${this.context.identifier}-target`;\n }\n get element() {\n return this.context.element;\n }\n get scope() {\n return this.context.scope;\n }\n}\nfunction readInheritableStaticArrayValues(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce((values, constructor) => {\n getOwnStaticArrayValues(constructor, propertyName).forEach(name => values.add(name));\n return values;\n }, new Set()));\n}\nfunction readInheritableStaticObjectPairs(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return ancestors.reduce((pairs, constructor) => {\n pairs.push(...getOwnStaticObjectPairs(constructor, propertyName));\n return pairs;\n }, []);\n}\nfunction getAncestorsForConstructor(constructor) {\n const ancestors = [];\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n return ancestors.reverse();\n}\nfunction getOwnStaticArrayValues(constructor, propertyName) {\n const definition = constructor[propertyName];\n return Array.isArray(definition) ? definition : [];\n}\nfunction getOwnStaticObjectPairs(constructor, propertyName) {\n const definition = constructor[propertyName];\n return definition ? Object.keys(definition).map(key => [key, definition[key]]) : [];\n}\nclass OutletObserver {\n constructor(context, delegate) {\n this.started = false;\n this.context = context;\n this.delegate = delegate;\n this.outletsByName = new Multimap();\n this.outletElementsByName = new Multimap();\n this.selectorObserverMap = new Map();\n this.attributeObserverMap = new Map();\n }\n start() {\n if (!this.started) {\n this.outletDefinitions.forEach(outletName => {\n this.setupSelectorObserverForOutlet(outletName);\n this.setupAttributeObserverForOutlet(outletName);\n });\n this.started = true;\n this.dependentContexts.forEach(context => context.refresh());\n }\n }\n refresh() {\n this.selectorObserverMap.forEach(observer => observer.refresh());\n this.attributeObserverMap.forEach(observer => observer.refresh());\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.disconnectAllOutlets();\n this.stopSelectorObservers();\n this.stopAttributeObservers();\n }\n }\n stopSelectorObservers() {\n if (this.selectorObserverMap.size > 0) {\n this.selectorObserverMap.forEach(observer => observer.stop());\n this.selectorObserverMap.clear();\n }\n }\n stopAttributeObservers() {\n if (this.attributeObserverMap.size > 0) {\n this.attributeObserverMap.forEach(observer => observer.stop());\n this.attributeObserverMap.clear();\n }\n }\n selectorMatched(element, _selector, _ref16) {\n let outletName = _ref16.outletName;\n const outlet = this.getOutlet(element, outletName);\n if (outlet) {\n this.connectOutlet(outlet, element, outletName);\n }\n }\n selectorUnmatched(element, _selector, _ref17) {\n let outletName = _ref17.outletName;\n const outlet = this.getOutletFromMap(element, outletName);\n if (outlet) {\n this.disconnectOutlet(outlet, element, outletName);\n }\n }\n selectorMatchElement(element, _ref18) {\n let outletName = _ref18.outletName;\n const selector = this.selector(outletName);\n const hasOutlet = this.hasOutlet(element, outletName);\n const hasOutletController = element.matches(`[${this.schema.controllerAttribute}~=${outletName}]`);\n if (selector) {\n return hasOutlet && hasOutletController && element.matches(selector);\n } else {\n return false;\n }\n }\n elementMatchedAttribute(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n elementAttributeValueChanged(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n elementUnmatchedAttribute(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n connectOutlet(outlet, element, outletName) {\n var _a;\n if (!this.outletElementsByName.has(outletName, element)) {\n this.outletsByName.add(outletName, outlet);\n this.outletElementsByName.add(outletName, element);\n (_a = this.selectorObserverMap.get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletConnected(outlet, element, outletName));\n }\n }\n disconnectOutlet(outlet, element, outletName) {\n var _a;\n if (this.outletElementsByName.has(outletName, element)) {\n this.outletsByName.delete(outletName, outlet);\n this.outletElementsByName.delete(outletName, element);\n (_a = this.selectorObserverMap.get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletDisconnected(outlet, element, outletName));\n }\n }\n disconnectAllOutlets() {\n for (const outletName of this.outletElementsByName.keys) {\n for (const element of this.outletElementsByName.getValuesForKey(outletName)) {\n for (const outlet of this.outletsByName.getValuesForKey(outletName)) {\n this.disconnectOutlet(outlet, element, outletName);\n }\n }\n }\n }\n updateSelectorObserverForOutlet(outletName) {\n const observer = this.selectorObserverMap.get(outletName);\n if (observer) {\n observer.selector = this.selector(outletName);\n }\n }\n setupSelectorObserverForOutlet(outletName) {\n const selector = this.selector(outletName);\n const selectorObserver = new SelectorObserver(document.body, selector, this, {\n outletName\n });\n this.selectorObserverMap.set(outletName, selectorObserver);\n selectorObserver.start();\n }\n setupAttributeObserverForOutlet(outletName) {\n const attributeName = this.attributeNameForOutletName(outletName);\n const attributeObserver = new AttributeObserver(this.scope.element, attributeName, this);\n this.attributeObserverMap.set(outletName, attributeObserver);\n attributeObserver.start();\n }\n selector(outletName) {\n return this.scope.outlets.getSelectorForOutletName(outletName);\n }\n attributeNameForOutletName(outletName) {\n return this.scope.schema.outletAttributeForScope(this.identifier, outletName);\n }\n getOutletNameFromOutletAttributeName(attributeName) {\n return this.outletDefinitions.find(outletName => this.attributeNameForOutletName(outletName) === attributeName);\n }\n get outletDependencies() {\n const dependencies = new Multimap();\n this.router.modules.forEach(module => {\n const constructor = module.definition.controllerConstructor;\n const outlets = readInheritableStaticArrayValues(constructor, \"outlets\");\n outlets.forEach(outlet => dependencies.add(outlet, module.identifier));\n });\n return dependencies;\n }\n get outletDefinitions() {\n return this.outletDependencies.getKeysForValue(this.identifier);\n }\n get dependentControllerIdentifiers() {\n return this.outletDependencies.getValuesForKey(this.identifier);\n }\n get dependentContexts() {\n const identifiers = this.dependentControllerIdentifiers;\n return this.router.contexts.filter(context => identifiers.includes(context.identifier));\n }\n hasOutlet(element, outletName) {\n return !!this.getOutlet(element, outletName) || !!this.getOutletFromMap(element, outletName);\n }\n getOutlet(element, outletName) {\n return this.application.getControllerForElementAndIdentifier(element, outletName);\n }\n getOutletFromMap(element, outletName) {\n return this.outletsByName.getValuesForKey(outletName).find(outlet => outlet.element === element);\n }\n get scope() {\n return this.context.scope;\n }\n get schema() {\n return this.context.schema;\n }\n get identifier() {\n return this.context.identifier;\n }\n get application() {\n return this.context.application;\n }\n get router() {\n return this.application.router;\n }\n}\nclass Context {\n constructor(module, scope) {\n var _this = this;\n this.logDebugActivity = function (functionName) {\n let detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n const identifier = _this.identifier,\n controller = _this.controller,\n element = _this.element;\n detail = Object.assign({\n identifier,\n controller,\n element\n }, detail);\n _this.application.logDebugActivity(_this.identifier, functionName, detail);\n };\n this.module = module;\n this.scope = scope;\n this.controller = new module.controllerConstructor(this);\n this.bindingObserver = new BindingObserver(this, this.dispatcher);\n this.valueObserver = new ValueObserver(this, this.controller);\n this.targetObserver = new TargetObserver(this, this);\n this.outletObserver = new OutletObserver(this, this);\n try {\n this.controller.initialize();\n this.logDebugActivity(\"initialize\");\n } catch (error) {\n this.handleError(error, \"initializing controller\");\n }\n }\n connect() {\n this.bindingObserver.start();\n this.valueObserver.start();\n this.targetObserver.start();\n this.outletObserver.start();\n try {\n this.controller.connect();\n this.logDebugActivity(\"connect\");\n } catch (error) {\n this.handleError(error, \"connecting controller\");\n }\n }\n refresh() {\n this.outletObserver.refresh();\n }\n disconnect() {\n try {\n this.controller.disconnect();\n this.logDebugActivity(\"disconnect\");\n } catch (error) {\n this.handleError(error, \"disconnecting controller\");\n }\n this.outletObserver.stop();\n this.targetObserver.stop();\n this.valueObserver.stop();\n this.bindingObserver.stop();\n }\n get application() {\n return this.module.application;\n }\n get identifier() {\n return this.module.identifier;\n }\n get schema() {\n return this.application.schema;\n }\n get dispatcher() {\n return this.application.dispatcher;\n }\n get element() {\n return this.scope.element;\n }\n get parentElement() {\n return this.element.parentElement;\n }\n handleError(error, message) {\n let detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n const identifier = this.identifier,\n controller = this.controller,\n element = this.element;\n detail = Object.assign({\n identifier,\n controller,\n element\n }, detail);\n this.application.handleError(error, `Error ${message}`, detail);\n }\n targetConnected(element, name) {\n this.invokeControllerMethod(`${name}TargetConnected`, element);\n }\n targetDisconnected(element, name) {\n this.invokeControllerMethod(`${name}TargetDisconnected`, element);\n }\n outletConnected(outlet, element, name) {\n this.invokeControllerMethod(`${namespaceCamelize(name)}OutletConnected`, outlet, element);\n }\n outletDisconnected(outlet, element, name) {\n this.invokeControllerMethod(`${namespaceCamelize(name)}OutletDisconnected`, outlet, element);\n }\n invokeControllerMethod(methodName) {\n const controller = this.controller;\n if (typeof controller[methodName] == \"function\") {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n controller[methodName](...args);\n }\n }\n}\nfunction bless(constructor) {\n return shadow(constructor, getBlessedProperties(constructor));\n}\nfunction shadow(constructor, properties) {\n const shadowConstructor = extend(constructor);\n const shadowProperties = getShadowProperties(constructor.prototype, properties);\n Object.defineProperties(shadowConstructor.prototype, shadowProperties);\n return shadowConstructor;\n}\nfunction getBlessedProperties(constructor) {\n const blessings = readInheritableStaticArrayValues(constructor, \"blessings\");\n return blessings.reduce((blessedProperties, blessing) => {\n const properties = blessing(constructor);\n for (const key in properties) {\n const descriptor = blessedProperties[key] || {};\n blessedProperties[key] = Object.assign(descriptor, properties[key]);\n }\n return blessedProperties;\n }, {});\n}\nfunction getShadowProperties(prototype, properties) {\n return getOwnKeys(properties).reduce((shadowProperties, key) => {\n const descriptor = getShadowedDescriptor(prototype, properties, key);\n if (descriptor) {\n Object.assign(shadowProperties, {\n [key]: descriptor\n });\n }\n return shadowProperties;\n }, {});\n}\nfunction getShadowedDescriptor(prototype, properties, key) {\n const shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key);\n const shadowedByValue = shadowingDescriptor && \"value\" in shadowingDescriptor;\n if (!shadowedByValue) {\n const descriptor = Object.getOwnPropertyDescriptor(properties, key).value;\n if (shadowingDescriptor) {\n descriptor.get = shadowingDescriptor.get || descriptor.get;\n descriptor.set = shadowingDescriptor.set || descriptor.set;\n }\n return descriptor;\n }\n}\nconst getOwnKeys = (() => {\n if (typeof Object.getOwnPropertySymbols == \"function\") {\n return object => [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)];\n } else {\n return Object.getOwnPropertyNames;\n }\n})();\nconst extend = (() => {\n function extendWithReflect(constructor) {\n function extended() {\n return Reflect.construct(constructor, arguments, new.target);\n }\n extended.prototype = Object.create(constructor.prototype, {\n constructor: {\n value: extended\n }\n });\n Reflect.setPrototypeOf(extended, constructor);\n return extended;\n }\n function testReflectExtension() {\n const a = function () {\n this.a.call(this);\n };\n const b = extendWithReflect(a);\n b.prototype.a = function () {};\n return new b();\n }\n try {\n testReflectExtension();\n return extendWithReflect;\n } catch (error) {\n return constructor => class extended extends constructor {};\n }\n})();\nfunction blessDefinition(definition) {\n return {\n identifier: definition.identifier,\n controllerConstructor: bless(definition.controllerConstructor)\n };\n}\nclass Module {\n constructor(application, definition) {\n this.application = application;\n this.definition = blessDefinition(definition);\n this.contextsByScope = new WeakMap();\n this.connectedContexts = new Set();\n }\n get identifier() {\n return this.definition.identifier;\n }\n get controllerConstructor() {\n return this.definition.controllerConstructor;\n }\n get contexts() {\n return Array.from(this.connectedContexts);\n }\n connectContextForScope(scope) {\n const context = this.fetchContextForScope(scope);\n this.connectedContexts.add(context);\n context.connect();\n }\n disconnectContextForScope(scope) {\n const context = this.contextsByScope.get(scope);\n if (context) {\n this.connectedContexts.delete(context);\n context.disconnect();\n }\n }\n fetchContextForScope(scope) {\n let context = this.contextsByScope.get(scope);\n if (!context) {\n context = new Context(this, scope);\n this.contextsByScope.set(scope, context);\n }\n return context;\n }\n}\nclass ClassMap {\n constructor(scope) {\n this.scope = scope;\n }\n has(name) {\n return this.data.has(this.getDataKey(name));\n }\n get(name) {\n return this.getAll(name)[0];\n }\n getAll(name) {\n const tokenString = this.data.get(this.getDataKey(name)) || \"\";\n return tokenize(tokenString);\n }\n getAttributeName(name) {\n return this.data.getAttributeNameForKey(this.getDataKey(name));\n }\n getDataKey(name) {\n return `${name}-class`;\n }\n get data() {\n return this.scope.data;\n }\n}\nclass DataMap {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.getAttribute(name);\n }\n set(key, value) {\n const name = this.getAttributeNameForKey(key);\n this.element.setAttribute(name, value);\n return this.get(key);\n }\n has(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.hasAttribute(name);\n }\n delete(key) {\n if (this.has(key)) {\n const name = this.getAttributeNameForKey(key);\n this.element.removeAttribute(name);\n return true;\n } else {\n return false;\n }\n }\n getAttributeNameForKey(key) {\n return `data-${this.identifier}-${dasherize(key)}`;\n }\n}\nclass Guide {\n constructor(logger) {\n this.warnedKeysByObject = new WeakMap();\n this.logger = logger;\n }\n warn(object, key, message) {\n let warnedKeys = this.warnedKeysByObject.get(object);\n if (!warnedKeys) {\n warnedKeys = new Set();\n this.warnedKeysByObject.set(object, warnedKeys);\n }\n if (!warnedKeys.has(key)) {\n warnedKeys.add(key);\n this.logger.warn(message, object);\n }\n }\n}\nfunction attributeValueContainsToken(attributeName, token) {\n return `[${attributeName}~=\"${token}\"]`;\n}\nclass TargetSet {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(targetName) {\n return this.find(targetName) != null;\n }\n find() {\n for (var _len2 = arguments.length, targetNames = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {\n targetNames[_key3] = arguments[_key3];\n }\n return targetNames.reduce((target, targetName) => target || this.findTarget(targetName) || this.findLegacyTarget(targetName), undefined);\n }\n findAll() {\n for (var _len3 = arguments.length, targetNames = new Array(_len3), _key4 = 0; _key4 < _len3; _key4++) {\n targetNames[_key4] = arguments[_key4];\n }\n return targetNames.reduce((targets, targetName) => [...targets, ...this.findAllTargets(targetName), ...this.findAllLegacyTargets(targetName)], []);\n }\n findTarget(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findElement(selector);\n }\n findAllTargets(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findAllElements(selector);\n }\n getSelectorForTargetName(targetName) {\n const attributeName = this.schema.targetAttributeForScope(this.identifier);\n return attributeValueContainsToken(attributeName, targetName);\n }\n findLegacyTarget(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.deprecate(this.scope.findElement(selector), targetName);\n }\n findAllLegacyTargets(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.scope.findAllElements(selector).map(element => this.deprecate(element, targetName));\n }\n getLegacySelectorForTargetName(targetName) {\n const targetDescriptor = `${this.identifier}.${targetName}`;\n return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor);\n }\n deprecate(element, targetName) {\n if (element) {\n const identifier = this.identifier;\n const attributeName = this.schema.targetAttribute;\n const revisedAttributeName = this.schema.targetAttributeForScope(identifier);\n this.guide.warn(element, `target:${targetName}`, `Please replace ${attributeName}=\"${identifier}.${targetName}\" with ${revisedAttributeName}=\"${targetName}\". ` + `The ${attributeName} attribute is deprecated and will be removed in a future version of Stimulus.`);\n }\n return element;\n }\n get guide() {\n return this.scope.guide;\n }\n}\nclass OutletSet {\n constructor(scope, controllerElement) {\n this.scope = scope;\n this.controllerElement = controllerElement;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(outletName) {\n return this.find(outletName) != null;\n }\n find() {\n for (var _len4 = arguments.length, outletNames = new Array(_len4), _key5 = 0; _key5 < _len4; _key5++) {\n outletNames[_key5] = arguments[_key5];\n }\n return outletNames.reduce((outlet, outletName) => outlet || this.findOutlet(outletName), undefined);\n }\n findAll() {\n for (var _len5 = arguments.length, outletNames = new Array(_len5), _key6 = 0; _key6 < _len5; _key6++) {\n outletNames[_key6] = arguments[_key6];\n }\n return outletNames.reduce((outlets, outletName) => [...outlets, ...this.findAllOutlets(outletName)], []);\n }\n getSelectorForOutletName(outletName) {\n const attributeName = this.schema.outletAttributeForScope(this.identifier, outletName);\n return this.controllerElement.getAttribute(attributeName);\n }\n findOutlet(outletName) {\n const selector = this.getSelectorForOutletName(outletName);\n if (selector) return this.findElement(selector, outletName);\n }\n findAllOutlets(outletName) {\n const selector = this.getSelectorForOutletName(outletName);\n return selector ? this.findAllElements(selector, outletName) : [];\n }\n findElement(selector, outletName) {\n const elements = this.scope.queryElements(selector);\n return elements.filter(element => this.matchesElement(element, selector, outletName))[0];\n }\n findAllElements(selector, outletName) {\n const elements = this.scope.queryElements(selector);\n return elements.filter(element => this.matchesElement(element, selector, outletName));\n }\n matchesElement(element, selector, outletName) {\n const controllerAttribute = element.getAttribute(this.scope.schema.controllerAttribute) || \"\";\n return element.matches(selector) && controllerAttribute.split(\" \").includes(outletName);\n }\n}\nclass Scope {\n constructor(schema, element, identifier, logger) {\n this.targets = new TargetSet(this);\n this.classes = new ClassMap(this);\n this.data = new DataMap(this);\n this.containsElement = element => {\n return element.closest(this.controllerSelector) === this.element;\n };\n this.schema = schema;\n this.element = element;\n this.identifier = identifier;\n this.guide = new Guide(logger);\n this.outlets = new OutletSet(this.documentScope, element);\n }\n findElement(selector) {\n return this.element.matches(selector) ? this.element : this.queryElements(selector).find(this.containsElement);\n }\n findAllElements(selector) {\n return [...(this.element.matches(selector) ? [this.element] : []), ...this.queryElements(selector).filter(this.containsElement)];\n }\n queryElements(selector) {\n return Array.from(this.element.querySelectorAll(selector));\n }\n get controllerSelector() {\n return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier);\n }\n get isDocumentScope() {\n return this.element === document.documentElement;\n }\n get documentScope() {\n return this.isDocumentScope ? this : new Scope(this.schema, document.documentElement, this.identifier, this.guide.logger);\n }\n}\nclass ScopeObserver {\n constructor(element, schema, delegate) {\n this.element = element;\n this.schema = schema;\n this.delegate = delegate;\n this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this);\n this.scopesByIdentifierByElement = new WeakMap();\n this.scopeReferenceCounts = new WeakMap();\n }\n start() {\n this.valueListObserver.start();\n }\n stop() {\n this.valueListObserver.stop();\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n parseValueForToken(token) {\n const element = token.element,\n identifier = token.content;\n return this.parseValueForElementAndIdentifier(element, identifier);\n }\n parseValueForElementAndIdentifier(element, identifier) {\n const scopesByIdentifier = this.fetchScopesByIdentifierForElement(element);\n let scope = scopesByIdentifier.get(identifier);\n if (!scope) {\n scope = this.delegate.createScopeForElementAndIdentifier(element, identifier);\n scopesByIdentifier.set(identifier, scope);\n }\n return scope;\n }\n elementMatchedValue(element, value) {\n const referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;\n this.scopeReferenceCounts.set(value, referenceCount);\n if (referenceCount == 1) {\n this.delegate.scopeConnected(value);\n }\n }\n elementUnmatchedValue(element, value) {\n const referenceCount = this.scopeReferenceCounts.get(value);\n if (referenceCount) {\n this.scopeReferenceCounts.set(value, referenceCount - 1);\n if (referenceCount == 1) {\n this.delegate.scopeDisconnected(value);\n }\n }\n }\n fetchScopesByIdentifierForElement(element) {\n let scopesByIdentifier = this.scopesByIdentifierByElement.get(element);\n if (!scopesByIdentifier) {\n scopesByIdentifier = new Map();\n this.scopesByIdentifierByElement.set(element, scopesByIdentifier);\n }\n return scopesByIdentifier;\n }\n}\nclass Router {\n constructor(application) {\n this.application = application;\n this.scopeObserver = new ScopeObserver(this.element, this.schema, this);\n this.scopesByIdentifier = new Multimap();\n this.modulesByIdentifier = new Map();\n }\n get element() {\n return this.application.element;\n }\n get schema() {\n return this.application.schema;\n }\n get logger() {\n return this.application.logger;\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n get modules() {\n return Array.from(this.modulesByIdentifier.values());\n }\n get contexts() {\n return this.modules.reduce((contexts, module) => contexts.concat(module.contexts), []);\n }\n start() {\n this.scopeObserver.start();\n }\n stop() {\n this.scopeObserver.stop();\n }\n loadDefinition(definition) {\n this.unloadIdentifier(definition.identifier);\n const module = new Module(this.application, definition);\n this.connectModule(module);\n const afterLoad = definition.controllerConstructor.afterLoad;\n if (afterLoad) {\n afterLoad.call(definition.controllerConstructor, definition.identifier, this.application);\n }\n }\n unloadIdentifier(identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n this.disconnectModule(module);\n }\n }\n getContextForElementAndIdentifier(element, identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n return module.contexts.find(context => context.element == element);\n }\n }\n proposeToConnectScopeForElementAndIdentifier(element, identifier) {\n const scope = this.scopeObserver.parseValueForElementAndIdentifier(element, identifier);\n if (scope) {\n this.scopeObserver.elementMatchedValue(scope.element, scope);\n } else {\n console.error(`Couldn't find or create scope for identifier: \"${identifier}\" and element:`, element);\n }\n }\n handleError(error, message, detail) {\n this.application.handleError(error, message, detail);\n }\n createScopeForElementAndIdentifier(element, identifier) {\n return new Scope(this.schema, element, identifier, this.logger);\n }\n scopeConnected(scope) {\n this.scopesByIdentifier.add(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.connectContextForScope(scope);\n }\n }\n scopeDisconnected(scope) {\n this.scopesByIdentifier.delete(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.disconnectContextForScope(scope);\n }\n }\n connectModule(module) {\n this.modulesByIdentifier.set(module.identifier, module);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(scope => module.connectContextForScope(scope));\n }\n disconnectModule(module) {\n this.modulesByIdentifier.delete(module.identifier);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(scope => module.disconnectContextForScope(scope));\n }\n}\nconst defaultSchema = {\n controllerAttribute: \"data-controller\",\n actionAttribute: \"data-action\",\n targetAttribute: \"data-target\",\n targetAttributeForScope: identifier => `data-${identifier}-target`,\n outletAttributeForScope: (identifier, outlet) => `data-${identifier}-${outlet}-outlet`,\n keyMappings: Object.assign(Object.assign({\n enter: \"Enter\",\n tab: \"Tab\",\n esc: \"Escape\",\n space: \" \",\n up: \"ArrowUp\",\n down: \"ArrowDown\",\n left: \"ArrowLeft\",\n right: \"ArrowRight\",\n home: \"Home\",\n end: \"End\",\n page_up: \"PageUp\",\n page_down: \"PageDown\"\n }, objectFromEntries(\"abcdefghijklmnopqrstuvwxyz\".split(\"\").map(c => [c, c]))), objectFromEntries(\"0123456789\".split(\"\").map(n => [n, n])))\n};\nfunction objectFromEntries(array) {\n return array.reduce((memo, _ref19) => {\n let _ref20 = _slicedToArray(_ref19, 2),\n k = _ref20[0],\n v = _ref20[1];\n return Object.assign(Object.assign({}, memo), {\n [k]: v\n });\n }, {});\n}\nclass Application {\n constructor() {\n var _this2 = this;\n let element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.documentElement;\n let schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultSchema;\n this.logger = console;\n this.debug = false;\n this.logDebugActivity = function (identifier, functionName) {\n let detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n if (_this2.debug) {\n _this2.logFormattedMessage(identifier, functionName, detail);\n }\n };\n this.element = element;\n this.schema = schema;\n this.dispatcher = new Dispatcher(this);\n this.router = new Router(this);\n this.actionDescriptorFilters = Object.assign({}, defaultActionDescriptorFilters);\n }\n static start(element, schema) {\n const application = new this(element, schema);\n application.start();\n return application;\n }\n async start() {\n await domReady();\n this.logDebugActivity(\"application\", \"starting\");\n this.dispatcher.start();\n this.router.start();\n this.logDebugActivity(\"application\", \"start\");\n }\n stop() {\n this.logDebugActivity(\"application\", \"stopping\");\n this.dispatcher.stop();\n this.router.stop();\n this.logDebugActivity(\"application\", \"stop\");\n }\n register(identifier, controllerConstructor) {\n this.load({\n identifier,\n controllerConstructor\n });\n }\n registerActionOption(name, filter) {\n this.actionDescriptorFilters[name] = filter;\n }\n load(head) {\n for (var _len6 = arguments.length, rest = new Array(_len6 > 1 ? _len6 - 1 : 0), _key7 = 1; _key7 < _len6; _key7++) {\n rest[_key7 - 1] = arguments[_key7];\n }\n const definitions = Array.isArray(head) ? head : [head, ...rest];\n definitions.forEach(definition => {\n if (definition.controllerConstructor.shouldLoad) {\n this.router.loadDefinition(definition);\n }\n });\n }\n unload(head) {\n for (var _len7 = arguments.length, rest = new Array(_len7 > 1 ? _len7 - 1 : 0), _key8 = 1; _key8 < _len7; _key8++) {\n rest[_key8 - 1] = arguments[_key8];\n }\n const identifiers = Array.isArray(head) ? head : [head, ...rest];\n identifiers.forEach(identifier => this.router.unloadIdentifier(identifier));\n }\n get controllers() {\n return this.router.contexts.map(context => context.controller);\n }\n getControllerForElementAndIdentifier(element, identifier) {\n const context = this.router.getContextForElementAndIdentifier(element, identifier);\n return context ? context.controller : null;\n }\n handleError(error, message, detail) {\n var _a;\n this.logger.error(`%s\\n\\n%o\\n\\n%o`, message, error, detail);\n (_a = window.onerror) === null || _a === void 0 ? void 0 : _a.call(window, message, \"\", 0, 0, error);\n }\n logFormattedMessage(identifier, functionName) {\n let detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n detail = Object.assign({\n application: this\n }, detail);\n this.logger.groupCollapsed(`${identifier} #${functionName}`);\n this.logger.log(\"details:\", Object.assign({}, detail));\n this.logger.groupEnd();\n }\n}\nfunction domReady() {\n return new Promise(resolve => {\n if (document.readyState == \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", () => resolve());\n } else {\n resolve();\n }\n });\n}\nfunction ClassPropertiesBlessing(constructor) {\n const classes = readInheritableStaticArrayValues(constructor, \"classes\");\n return classes.reduce((properties, classDefinition) => {\n return Object.assign(properties, propertiesForClassDefinition(classDefinition));\n }, {});\n}\nfunction propertiesForClassDefinition(key) {\n return {\n [`${key}Class`]: {\n get() {\n const classes = this.classes;\n if (classes.has(key)) {\n return classes.get(key);\n } else {\n const attribute = classes.getAttributeName(key);\n throw new Error(`Missing attribute \"${attribute}\"`);\n }\n }\n },\n [`${key}Classes`]: {\n get() {\n return this.classes.getAll(key);\n }\n },\n [`has${capitalize(key)}Class`]: {\n get() {\n return this.classes.has(key);\n }\n }\n };\n}\nfunction OutletPropertiesBlessing(constructor) {\n const outlets = readInheritableStaticArrayValues(constructor, \"outlets\");\n return outlets.reduce((properties, outletDefinition) => {\n return Object.assign(properties, propertiesForOutletDefinition(outletDefinition));\n }, {});\n}\nfunction getOutletController(controller, element, identifier) {\n return controller.application.getControllerForElementAndIdentifier(element, identifier);\n}\nfunction getControllerAndEnsureConnectedScope(controller, element, outletName) {\n let outletController = getOutletController(controller, element, outletName);\n if (outletController) return outletController;\n controller.application.router.proposeToConnectScopeForElementAndIdentifier(element, outletName);\n outletController = getOutletController(controller, element, outletName);\n if (outletController) return outletController;\n}\nfunction propertiesForOutletDefinition(name) {\n const camelizedName = namespaceCamelize(name);\n return {\n [`${camelizedName}Outlet`]: {\n get() {\n const outletElement = this.outlets.find(name);\n const selector = this.outlets.getSelectorForOutletName(name);\n if (outletElement) {\n const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name);\n if (outletController) return outletController;\n throw new Error(`The provided outlet element is missing an outlet controller \"${name}\" instance for host controller \"${this.identifier}\"`);\n }\n throw new Error(`Missing outlet element \"${name}\" for host controller \"${this.identifier}\". Stimulus couldn't find a matching outlet element using selector \"${selector}\".`);\n }\n },\n [`${camelizedName}Outlets`]: {\n get() {\n const outlets = this.outlets.findAll(name);\n if (outlets.length > 0) {\n return outlets.map(outletElement => {\n const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name);\n if (outletController) return outletController;\n console.warn(`The provided outlet element is missing an outlet controller \"${name}\" instance for host controller \"${this.identifier}\"`, outletElement);\n }).filter(controller => controller);\n }\n return [];\n }\n },\n [`${camelizedName}OutletElement`]: {\n get() {\n const outletElement = this.outlets.find(name);\n const selector = this.outlets.getSelectorForOutletName(name);\n if (outletElement) {\n return outletElement;\n } else {\n throw new Error(`Missing outlet element \"${name}\" for host controller \"${this.identifier}\". Stimulus couldn't find a matching outlet element using selector \"${selector}\".`);\n }\n }\n },\n [`${camelizedName}OutletElements`]: {\n get() {\n return this.outlets.findAll(name);\n }\n },\n [`has${capitalize(camelizedName)}Outlet`]: {\n get() {\n return this.outlets.has(name);\n }\n }\n };\n}\nfunction TargetPropertiesBlessing(constructor) {\n const targets = readInheritableStaticArrayValues(constructor, \"targets\");\n return targets.reduce((properties, targetDefinition) => {\n return Object.assign(properties, propertiesForTargetDefinition(targetDefinition));\n }, {});\n}\nfunction propertiesForTargetDefinition(name) {\n return {\n [`${name}Target`]: {\n get() {\n const target = this.targets.find(name);\n if (target) {\n return target;\n } else {\n throw new Error(`Missing target element \"${name}\" for \"${this.identifier}\" controller`);\n }\n }\n },\n [`${name}Targets`]: {\n get() {\n return this.targets.findAll(name);\n }\n },\n [`has${capitalize(name)}Target`]: {\n get() {\n return this.targets.has(name);\n }\n }\n };\n}\nfunction ValuePropertiesBlessing(constructor) {\n const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, \"values\");\n const propertyDescriptorMap = {\n valueDescriptorMap: {\n get() {\n return valueDefinitionPairs.reduce((result, valueDefinitionPair) => {\n const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier);\n const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key);\n return Object.assign(result, {\n [attributeName]: valueDescriptor\n });\n }, {});\n }\n }\n };\n return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => {\n return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair));\n }, propertyDescriptorMap);\n}\nfunction propertiesForValueDefinitionPair(valueDefinitionPair, controller) {\n const definition = parseValueDefinitionPair(valueDefinitionPair, controller);\n const key = definition.key,\n name = definition.name,\n read = definition.reader,\n write = definition.writer;\n return {\n [name]: {\n get() {\n const value = this.data.get(key);\n if (value !== null) {\n return read(value);\n } else {\n return definition.defaultValue;\n }\n },\n set(value) {\n if (value === undefined) {\n this.data.delete(key);\n } else {\n this.data.set(key, write(value));\n }\n }\n },\n [`has${capitalize(name)}`]: {\n get() {\n return this.data.has(key) || definition.hasCustomDefaultValue;\n }\n }\n };\n}\nfunction parseValueDefinitionPair(_ref21, controller) {\n let _ref22 = _slicedToArray(_ref21, 2),\n token = _ref22[0],\n typeDefinition = _ref22[1];\n return valueDescriptorForTokenAndTypeDefinition({\n controller,\n token,\n typeDefinition\n });\n}\nfunction parseValueTypeConstant(constant) {\n switch (constant) {\n case Array:\n return \"array\";\n case Boolean:\n return \"boolean\";\n case Number:\n return \"number\";\n case Object:\n return \"object\";\n case String:\n return \"string\";\n }\n}\nfunction parseValueTypeDefault(defaultValue) {\n switch (typeof defaultValue) {\n case \"boolean\":\n return \"boolean\";\n case \"number\":\n return \"number\";\n case \"string\":\n return \"string\";\n }\n if (Array.isArray(defaultValue)) return \"array\";\n if (Object.prototype.toString.call(defaultValue) === \"[object Object]\") return \"object\";\n}\nfunction parseValueTypeObject(payload) {\n const controller = payload.controller,\n token = payload.token,\n typeObject = payload.typeObject;\n const hasType = isSomething(typeObject.type);\n const hasDefault = isSomething(typeObject.default);\n const fullObject = hasType && hasDefault;\n const onlyType = hasType && !hasDefault;\n const onlyDefault = !hasType && hasDefault;\n const typeFromObject = parseValueTypeConstant(typeObject.type);\n const typeFromDefaultValue = parseValueTypeDefault(payload.typeObject.default);\n if (onlyType) return typeFromObject;\n if (onlyDefault) return typeFromDefaultValue;\n if (typeFromObject !== typeFromDefaultValue) {\n const propertyPath = controller ? `${controller}.${token}` : token;\n throw new Error(`The specified default value for the Stimulus Value \"${propertyPath}\" must match the defined type \"${typeFromObject}\". The provided default value of \"${typeObject.default}\" is of type \"${typeFromDefaultValue}\".`);\n }\n if (fullObject) return typeFromObject;\n}\nfunction parseValueTypeDefinition(payload) {\n const controller = payload.controller,\n token = payload.token,\n typeDefinition = payload.typeDefinition;\n const typeObject = {\n controller,\n token,\n typeObject: typeDefinition\n };\n const typeFromObject = parseValueTypeObject(typeObject);\n const typeFromDefaultValue = parseValueTypeDefault(typeDefinition);\n const typeFromConstant = parseValueTypeConstant(typeDefinition);\n const type = typeFromObject || typeFromDefaultValue || typeFromConstant;\n if (type) return type;\n const propertyPath = controller ? `${controller}.${typeDefinition}` : token;\n throw new Error(`Unknown value type \"${propertyPath}\" for \"${token}\" value`);\n}\nfunction defaultValueForDefinition(typeDefinition) {\n const constant = parseValueTypeConstant(typeDefinition);\n if (constant) return defaultValuesByType[constant];\n const hasDefault = hasProperty(typeDefinition, \"default\");\n const hasType = hasProperty(typeDefinition, \"type\");\n const typeObject = typeDefinition;\n if (hasDefault) return typeObject.default;\n if (hasType) {\n const type = typeObject.type;\n const constantFromType = parseValueTypeConstant(type);\n if (constantFromType) return defaultValuesByType[constantFromType];\n }\n return typeDefinition;\n}\nfunction valueDescriptorForTokenAndTypeDefinition(payload) {\n const token = payload.token,\n typeDefinition = payload.typeDefinition;\n const key = `${dasherize(token)}-value`;\n const type = parseValueTypeDefinition(payload);\n return {\n type,\n key,\n name: camelize(key),\n get defaultValue() {\n return defaultValueForDefinition(typeDefinition);\n },\n get hasCustomDefaultValue() {\n return parseValueTypeDefault(typeDefinition) !== undefined;\n },\n reader: readers[type],\n writer: writers[type] || writers.default\n };\n}\nconst defaultValuesByType = {\n get array() {\n return [];\n },\n boolean: false,\n number: 0,\n get object() {\n return {};\n },\n string: \"\"\n};\nconst readers = {\n array(value) {\n const array = JSON.parse(value);\n if (!Array.isArray(array)) {\n throw new TypeError(`expected value of type \"array\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(array)}\"`);\n }\n return array;\n },\n boolean(value) {\n return !(value == \"0\" || String(value).toLowerCase() == \"false\");\n },\n number(value) {\n return Number(value.replace(/_/g, \"\"));\n },\n object(value) {\n const object = JSON.parse(value);\n if (object === null || typeof object != \"object\" || Array.isArray(object)) {\n throw new TypeError(`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(object)}\"`);\n }\n return object;\n },\n string(value) {\n return value;\n }\n};\nconst writers = {\n default: writeString,\n array: writeJSON,\n object: writeJSON\n};\nfunction writeJSON(value) {\n return JSON.stringify(value);\n}\nfunction writeString(value) {\n return `${value}`;\n}\nclass Controller {\n constructor(context) {\n this.context = context;\n }\n static get shouldLoad() {\n return true;\n }\n static afterLoad(_identifier, _application) {\n return;\n }\n get application() {\n return this.context.application;\n }\n get scope() {\n return this.context.scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get targets() {\n return this.scope.targets;\n }\n get outlets() {\n return this.scope.outlets;\n }\n get classes() {\n return this.scope.classes;\n }\n get data() {\n return this.scope.data;\n }\n initialize() {}\n connect() {}\n disconnect() {}\n dispatch(eventName) {\n let _ref23 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref23$target = _ref23.target,\n target = _ref23$target === void 0 ? this.element : _ref23$target,\n _ref23$detail = _ref23.detail,\n detail = _ref23$detail === void 0 ? {} : _ref23$detail,\n _ref23$prefix = _ref23.prefix,\n prefix = _ref23$prefix === void 0 ? this.identifier : _ref23$prefix,\n _ref23$bubbles = _ref23.bubbles,\n bubbles = _ref23$bubbles === void 0 ? true : _ref23$bubbles,\n _ref23$cancelable = _ref23.cancelable,\n cancelable = _ref23$cancelable === void 0 ? true : _ref23$cancelable;\n const type = prefix ? `${prefix}:${eventName}` : eventName;\n const event = new CustomEvent(type, {\n detail,\n bubbles,\n cancelable\n });\n target.dispatchEvent(event);\n return event;\n }\n}\nController.blessings = [ClassPropertiesBlessing, TargetPropertiesBlessing, ValuePropertiesBlessing, OutletPropertiesBlessing];\nController.targets = [];\nController.outlets = [];\nController.values = {};\nexport { Application, AttributeObserver, Context, Controller, ElementObserver, IndexedMultimap, Multimap, SelectorObserver, StringMapObserver, TokenListObserver, ValueListObserver, add, defaultSchema, del, fetch, prune };","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n/*\nStimulus 3.2.1\nCopyright © 2023 Basecamp, LLC\n */\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Stimulus = {}));\n})(this, function (exports) {\n 'use strict';\n\n class EventListener {\n constructor(eventTarget, eventName, eventOptions) {\n this.eventTarget = eventTarget;\n this.eventName = eventName;\n this.eventOptions = eventOptions;\n this.unorderedBindings = new Set();\n }\n connect() {\n this.eventTarget.addEventListener(this.eventName, this, this.eventOptions);\n }\n disconnect() {\n this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions);\n }\n bindingConnected(binding) {\n this.unorderedBindings.add(binding);\n }\n bindingDisconnected(binding) {\n this.unorderedBindings.delete(binding);\n }\n handleEvent(event) {\n const extendedEvent = extendEvent(event);\n for (const binding of this.bindings) {\n if (extendedEvent.immediatePropagationStopped) {\n break;\n } else {\n binding.handleEvent(extendedEvent);\n }\n }\n }\n hasBindings() {\n return this.unorderedBindings.size > 0;\n }\n get bindings() {\n return Array.from(this.unorderedBindings).sort((left, right) => {\n const leftIndex = left.index,\n rightIndex = right.index;\n return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0;\n });\n }\n }\n function extendEvent(event) {\n if (\"immediatePropagationStopped\" in event) {\n return event;\n } else {\n const stopImmediatePropagation = event.stopImmediatePropagation;\n return Object.assign(event, {\n immediatePropagationStopped: false,\n stopImmediatePropagation() {\n this.immediatePropagationStopped = true;\n stopImmediatePropagation.call(this);\n }\n });\n }\n }\n class Dispatcher {\n constructor(application) {\n this.application = application;\n this.eventListenerMaps = new Map();\n this.started = false;\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.eventListeners.forEach(eventListener => eventListener.connect());\n }\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.eventListeners.forEach(eventListener => eventListener.disconnect());\n }\n }\n get eventListeners() {\n return Array.from(this.eventListenerMaps.values()).reduce((listeners, map) => listeners.concat(Array.from(map.values())), []);\n }\n bindingConnected(binding) {\n this.fetchEventListenerForBinding(binding).bindingConnected(binding);\n }\n bindingDisconnected(binding) {\n let clearEventListeners = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);\n if (clearEventListeners) this.clearEventListenersForBinding(binding);\n }\n handleError(error, message) {\n let detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n this.application.handleError(error, `Error ${message}`, detail);\n }\n clearEventListenersForBinding(binding) {\n const eventListener = this.fetchEventListenerForBinding(binding);\n if (!eventListener.hasBindings()) {\n eventListener.disconnect();\n this.removeMappedEventListenerFor(binding);\n }\n }\n removeMappedEventListenerFor(binding) {\n const eventTarget = binding.eventTarget,\n eventName = binding.eventName,\n eventOptions = binding.eventOptions;\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n eventListenerMap.delete(cacheKey);\n if (eventListenerMap.size == 0) this.eventListenerMaps.delete(eventTarget);\n }\n fetchEventListenerForBinding(binding) {\n const eventTarget = binding.eventTarget,\n eventName = binding.eventName,\n eventOptions = binding.eventOptions;\n return this.fetchEventListener(eventTarget, eventName, eventOptions);\n }\n fetchEventListener(eventTarget, eventName, eventOptions) {\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n let eventListener = eventListenerMap.get(cacheKey);\n if (!eventListener) {\n eventListener = this.createEventListener(eventTarget, eventName, eventOptions);\n eventListenerMap.set(cacheKey, eventListener);\n }\n return eventListener;\n }\n createEventListener(eventTarget, eventName, eventOptions) {\n const eventListener = new EventListener(eventTarget, eventName, eventOptions);\n if (this.started) {\n eventListener.connect();\n }\n return eventListener;\n }\n fetchEventListenerMapForEventTarget(eventTarget) {\n let eventListenerMap = this.eventListenerMaps.get(eventTarget);\n if (!eventListenerMap) {\n eventListenerMap = new Map();\n this.eventListenerMaps.set(eventTarget, eventListenerMap);\n }\n return eventListenerMap;\n }\n cacheKey(eventName, eventOptions) {\n const parts = [eventName];\n Object.keys(eventOptions).sort().forEach(key => {\n parts.push(`${eventOptions[key] ? \"\" : \"!\"}${key}`);\n });\n return parts.join(\":\");\n }\n }\n const defaultActionDescriptorFilters = {\n stop(_ref) {\n let event = _ref.event,\n value = _ref.value;\n if (value) event.stopPropagation();\n return true;\n },\n prevent(_ref2) {\n let event = _ref2.event,\n value = _ref2.value;\n if (value) event.preventDefault();\n return true;\n },\n self(_ref3) {\n let event = _ref3.event,\n value = _ref3.value,\n element = _ref3.element;\n if (value) {\n return element === event.target;\n } else {\n return true;\n }\n }\n };\n const descriptorPattern = /^(?:(?:([^.]+?)\\+)?(.+?)(?:\\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;\n function parseActionDescriptorString(descriptorString) {\n const source = descriptorString.trim();\n const matches = source.match(descriptorPattern) || [];\n let eventName = matches[2];\n let keyFilter = matches[3];\n if (keyFilter && ![\"keydown\", \"keyup\", \"keypress\"].includes(eventName)) {\n eventName += `.${keyFilter}`;\n keyFilter = \"\";\n }\n return {\n eventTarget: parseEventTarget(matches[4]),\n eventName,\n eventOptions: matches[7] ? parseEventOptions(matches[7]) : {},\n identifier: matches[5],\n methodName: matches[6],\n keyFilter: matches[1] || keyFilter\n };\n }\n function parseEventTarget(eventTargetName) {\n if (eventTargetName == \"window\") {\n return window;\n } else if (eventTargetName == \"document\") {\n return document;\n }\n }\n function parseEventOptions(eventOptions) {\n return eventOptions.split(\":\").reduce((options, token) => Object.assign(options, {\n [token.replace(/^!/, \"\")]: !/^!/.test(token)\n }), {});\n }\n function stringifyEventTarget(eventTarget) {\n if (eventTarget == window) {\n return \"window\";\n } else if (eventTarget == document) {\n return \"document\";\n }\n }\n function camelize(value) {\n return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase());\n }\n function namespaceCamelize(value) {\n return camelize(value.replace(/--/g, \"-\").replace(/__/g, \"_\"));\n }\n function capitalize(value) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n }\n function dasherize(value) {\n return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`);\n }\n function tokenize(value) {\n return value.match(/[^\\s]+/g) || [];\n }\n function isSomething(object) {\n return object !== null && object !== undefined;\n }\n function hasProperty(object, property) {\n return Object.prototype.hasOwnProperty.call(object, property);\n }\n const allModifiers = [\"meta\", \"ctrl\", \"alt\", \"shift\"];\n class Action {\n constructor(element, index, descriptor, schema) {\n this.element = element;\n this.index = index;\n this.eventTarget = descriptor.eventTarget || element;\n this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error(\"missing event name\");\n this.eventOptions = descriptor.eventOptions || {};\n this.identifier = descriptor.identifier || error(\"missing identifier\");\n this.methodName = descriptor.methodName || error(\"missing method name\");\n this.keyFilter = descriptor.keyFilter || \"\";\n this.schema = schema;\n }\n static forToken(token, schema) {\n return new this(token.element, token.index, parseActionDescriptorString(token.content), schema);\n }\n toString() {\n const eventFilter = this.keyFilter ? `.${this.keyFilter}` : \"\";\n const eventTarget = this.eventTargetName ? `@${this.eventTargetName}` : \"\";\n return `${this.eventName}${eventFilter}${eventTarget}->${this.identifier}#${this.methodName}`;\n }\n shouldIgnoreKeyboardEvent(event) {\n if (!this.keyFilter) {\n return false;\n }\n const filters = this.keyFilter.split(\"+\");\n if (this.keyFilterDissatisfied(event, filters)) {\n return true;\n }\n const standardFilter = filters.filter(key => !allModifiers.includes(key))[0];\n if (!standardFilter) {\n return false;\n }\n if (!hasProperty(this.keyMappings, standardFilter)) {\n error(`contains unknown key filter: ${this.keyFilter}`);\n }\n return this.keyMappings[standardFilter].toLowerCase() !== event.key.toLowerCase();\n }\n shouldIgnoreMouseEvent(event) {\n if (!this.keyFilter) {\n return false;\n }\n const filters = [this.keyFilter];\n if (this.keyFilterDissatisfied(event, filters)) {\n return true;\n }\n return false;\n }\n get params() {\n const params = {};\n const pattern = new RegExp(`^data-${this.identifier}-(.+)-param$`, \"i\");\n for (const _ref4 of Array.from(this.element.attributes)) {\n const name = _ref4.name;\n const value = _ref4.value;\n const match = name.match(pattern);\n const key = match && match[1];\n if (key) {\n params[camelize(key)] = typecast(value);\n }\n }\n return params;\n }\n get eventTargetName() {\n return stringifyEventTarget(this.eventTarget);\n }\n get keyMappings() {\n return this.schema.keyMappings;\n }\n keyFilterDissatisfied(event, filters) {\n const _allModifiers$map = allModifiers.map(modifier => filters.includes(modifier)),\n _allModifiers$map2 = _slicedToArray(_allModifiers$map, 4),\n meta = _allModifiers$map2[0],\n ctrl = _allModifiers$map2[1],\n alt = _allModifiers$map2[2],\n shift = _allModifiers$map2[3];\n return event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== alt || event.shiftKey !== shift;\n }\n }\n const defaultEventNames = {\n a: () => \"click\",\n button: () => \"click\",\n form: () => \"submit\",\n details: () => \"toggle\",\n input: e => e.getAttribute(\"type\") == \"submit\" ? \"click\" : \"input\",\n select: () => \"change\",\n textarea: () => \"input\"\n };\n function getDefaultEventNameForElement(element) {\n const tagName = element.tagName.toLowerCase();\n if (tagName in defaultEventNames) {\n return defaultEventNames[tagName](element);\n }\n }\n function error(message) {\n throw new Error(message);\n }\n function typecast(value) {\n try {\n return JSON.parse(value);\n } catch (o_O) {\n return value;\n }\n }\n class Binding {\n constructor(context, action) {\n this.context = context;\n this.action = action;\n }\n get index() {\n return this.action.index;\n }\n get eventTarget() {\n return this.action.eventTarget;\n }\n get eventOptions() {\n return this.action.eventOptions;\n }\n get identifier() {\n return this.context.identifier;\n }\n handleEvent(event) {\n const actionEvent = this.prepareActionEvent(event);\n if (this.willBeInvokedByEvent(event) && this.applyEventModifiers(actionEvent)) {\n this.invokeWithEvent(actionEvent);\n }\n }\n get eventName() {\n return this.action.eventName;\n }\n get method() {\n const method = this.controller[this.methodName];\n if (typeof method == \"function\") {\n return method;\n }\n throw new Error(`Action \"${this.action}\" references undefined method \"${this.methodName}\"`);\n }\n applyEventModifiers(event) {\n const element = this.action.element;\n const actionDescriptorFilters = this.context.application.actionDescriptorFilters;\n const controller = this.context.controller;\n let passes = true;\n for (const _ref5 of Object.entries(this.eventOptions)) {\n var _ref6 = _slicedToArray(_ref5, 2);\n const name = _ref6[0];\n const value = _ref6[1];\n if (name in actionDescriptorFilters) {\n const filter = actionDescriptorFilters[name];\n passes = passes && filter({\n name,\n value,\n event,\n element,\n controller\n });\n } else {\n continue;\n }\n }\n return passes;\n }\n prepareActionEvent(event) {\n return Object.assign(event, {\n params: this.action.params\n });\n }\n invokeWithEvent(event) {\n const target = event.target,\n currentTarget = event.currentTarget;\n try {\n this.method.call(this.controller, event);\n this.context.logDebugActivity(this.methodName, {\n event,\n target,\n currentTarget,\n action: this.methodName\n });\n } catch (error) {\n const identifier = this.identifier,\n controller = this.controller,\n element = this.element,\n index = this.index;\n const detail = {\n identifier,\n controller,\n element,\n index,\n event\n };\n this.context.handleError(error, `invoking action \"${this.action}\"`, detail);\n }\n }\n willBeInvokedByEvent(event) {\n const eventTarget = event.target;\n if (event instanceof KeyboardEvent && this.action.shouldIgnoreKeyboardEvent(event)) {\n return false;\n }\n if (event instanceof MouseEvent && this.action.shouldIgnoreMouseEvent(event)) {\n return false;\n }\n if (this.element === eventTarget) {\n return true;\n } else if (eventTarget instanceof Element && this.element.contains(eventTarget)) {\n return this.scope.containsElement(eventTarget);\n } else {\n return this.scope.containsElement(this.action.element);\n }\n }\n get controller() {\n return this.context.controller;\n }\n get methodName() {\n return this.action.methodName;\n }\n get element() {\n return this.scope.element;\n }\n get scope() {\n return this.context.scope;\n }\n }\n class ElementObserver {\n constructor(element, delegate) {\n this.mutationObserverInit = {\n attributes: true,\n childList: true,\n subtree: true\n };\n this.element = element;\n this.started = false;\n this.delegate = delegate;\n this.elements = new Set();\n this.mutationObserver = new MutationObserver(mutations => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.refresh();\n }\n }\n pause(callback) {\n if (this.started) {\n this.mutationObserver.disconnect();\n this.started = false;\n }\n callback();\n if (!this.started) {\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.started = true;\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n const matches = new Set(this.matchElementsInTree());\n for (const element of Array.from(this.elements)) {\n if (!matches.has(element)) {\n this.removeElement(element);\n }\n }\n for (const element of Array.from(matches)) {\n this.addElement(element);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n if (mutation.type == \"attributes\") {\n this.processAttributeChange(mutation.target, mutation.attributeName);\n } else if (mutation.type == \"childList\") {\n this.processRemovedNodes(mutation.removedNodes);\n this.processAddedNodes(mutation.addedNodes);\n }\n }\n processAttributeChange(element, attributeName) {\n if (this.elements.has(element)) {\n if (this.delegate.elementAttributeChanged && this.matchElement(element)) {\n this.delegate.elementAttributeChanged(element, attributeName);\n } else {\n this.removeElement(element);\n }\n } else if (this.matchElement(element)) {\n this.addElement(element);\n }\n }\n processRemovedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element) {\n this.processTree(element, this.removeElement);\n }\n }\n }\n processAddedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element && this.elementIsActive(element)) {\n this.processTree(element, this.addElement);\n }\n }\n }\n matchElement(element) {\n return this.delegate.matchElement(element);\n }\n matchElementsInTree() {\n let tree = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.element;\n return this.delegate.matchElementsInTree(tree);\n }\n processTree(tree, processor) {\n for (const element of this.matchElementsInTree(tree)) {\n processor.call(this, element);\n }\n }\n elementFromNode(node) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n return node;\n }\n }\n elementIsActive(element) {\n if (element.isConnected != this.element.isConnected) {\n return false;\n } else {\n return this.element.contains(element);\n }\n }\n addElement(element) {\n if (!this.elements.has(element)) {\n if (this.elementIsActive(element)) {\n this.elements.add(element);\n if (this.delegate.elementMatched) {\n this.delegate.elementMatched(element);\n }\n }\n }\n }\n removeElement(element) {\n if (this.elements.has(element)) {\n this.elements.delete(element);\n if (this.delegate.elementUnmatched) {\n this.delegate.elementUnmatched(element);\n }\n }\n }\n }\n class AttributeObserver {\n constructor(element, attributeName, delegate) {\n this.attributeName = attributeName;\n this.delegate = delegate;\n this.elementObserver = new ElementObserver(element, this);\n }\n get element() {\n return this.elementObserver.element;\n }\n get selector() {\n return `[${this.attributeName}]`;\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get started() {\n return this.elementObserver.started;\n }\n matchElement(element) {\n return element.hasAttribute(this.attributeName);\n }\n matchElementsInTree(tree) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(this.selector));\n return match.concat(matches);\n }\n elementMatched(element) {\n if (this.delegate.elementMatchedAttribute) {\n this.delegate.elementMatchedAttribute(element, this.attributeName);\n }\n }\n elementUnmatched(element) {\n if (this.delegate.elementUnmatchedAttribute) {\n this.delegate.elementUnmatchedAttribute(element, this.attributeName);\n }\n }\n elementAttributeChanged(element, attributeName) {\n if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) {\n this.delegate.elementAttributeValueChanged(element, attributeName);\n }\n }\n }\n function add(map, key, value) {\n fetch(map, key).add(value);\n }\n function del(map, key, value) {\n fetch(map, key).delete(value);\n prune(map, key);\n }\n function fetch(map, key) {\n let values = map.get(key);\n if (!values) {\n values = new Set();\n map.set(key, values);\n }\n return values;\n }\n function prune(map, key) {\n const values = map.get(key);\n if (values != null && values.size == 0) {\n map.delete(key);\n }\n }\n class Multimap {\n constructor() {\n this.valuesByKey = new Map();\n }\n get keys() {\n return Array.from(this.valuesByKey.keys());\n }\n get values() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((values, set) => values.concat(Array.from(set)), []);\n }\n get size() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((size, set) => size + set.size, 0);\n }\n add(key, value) {\n add(this.valuesByKey, key, value);\n }\n delete(key, value) {\n del(this.valuesByKey, key, value);\n }\n has(key, value) {\n const values = this.valuesByKey.get(key);\n return values != null && values.has(value);\n }\n hasKey(key) {\n return this.valuesByKey.has(key);\n }\n hasValue(value) {\n const sets = Array.from(this.valuesByKey.values());\n return sets.some(set => set.has(value));\n }\n getValuesForKey(key) {\n const values = this.valuesByKey.get(key);\n return values ? Array.from(values) : [];\n }\n getKeysForValue(value) {\n return Array.from(this.valuesByKey).filter(_ref7 => {\n let _ref8 = _slicedToArray(_ref7, 2),\n _key = _ref8[0],\n values = _ref8[1];\n return values.has(value);\n }).map(_ref9 => {\n let _ref10 = _slicedToArray(_ref9, 2),\n key = _ref10[0],\n _values = _ref10[1];\n return key;\n });\n }\n }\n class IndexedMultimap extends Multimap {\n constructor() {\n super();\n this.keysByValue = new Map();\n }\n get values() {\n return Array.from(this.keysByValue.keys());\n }\n add(key, value) {\n super.add(key, value);\n add(this.keysByValue, value, key);\n }\n delete(key, value) {\n super.delete(key, value);\n del(this.keysByValue, value, key);\n }\n hasValue(value) {\n return this.keysByValue.has(value);\n }\n getKeysForValue(value) {\n const set = this.keysByValue.get(value);\n return set ? Array.from(set) : [];\n }\n }\n class SelectorObserver {\n constructor(element, selector, delegate, details) {\n this._selector = selector;\n this.details = details;\n this.elementObserver = new ElementObserver(element, this);\n this.delegate = delegate;\n this.matchesByElement = new Multimap();\n }\n get started() {\n return this.elementObserver.started;\n }\n get selector() {\n return this._selector;\n }\n set selector(selector) {\n this._selector = selector;\n this.refresh();\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get element() {\n return this.elementObserver.element;\n }\n matchElement(element) {\n const selector = this.selector;\n if (selector) {\n const matches = element.matches(selector);\n if (this.delegate.selectorMatchElement) {\n return matches && this.delegate.selectorMatchElement(element, this.details);\n }\n return matches;\n } else {\n return false;\n }\n }\n matchElementsInTree(tree) {\n const selector = this.selector;\n if (selector) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(selector)).filter(match => this.matchElement(match));\n return match.concat(matches);\n } else {\n return [];\n }\n }\n elementMatched(element) {\n const selector = this.selector;\n if (selector) {\n this.selectorMatched(element, selector);\n }\n }\n elementUnmatched(element) {\n const selectors = this.matchesByElement.getKeysForValue(element);\n for (const selector of selectors) {\n this.selectorUnmatched(element, selector);\n }\n }\n elementAttributeChanged(element, _attributeName) {\n const selector = this.selector;\n if (selector) {\n const matches = this.matchElement(element);\n const matchedBefore = this.matchesByElement.has(selector, element);\n if (matches && !matchedBefore) {\n this.selectorMatched(element, selector);\n } else if (!matches && matchedBefore) {\n this.selectorUnmatched(element, selector);\n }\n }\n }\n selectorMatched(element, selector) {\n this.delegate.selectorMatched(element, selector, this.details);\n this.matchesByElement.add(selector, element);\n }\n selectorUnmatched(element, selector) {\n this.delegate.selectorUnmatched(element, selector, this.details);\n this.matchesByElement.delete(selector, element);\n }\n }\n class StringMapObserver {\n constructor(element, delegate) {\n this.element = element;\n this.delegate = delegate;\n this.started = false;\n this.stringMap = new Map();\n this.mutationObserver = new MutationObserver(mutations => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, {\n attributes: true,\n attributeOldValue: true\n });\n this.refresh();\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n for (const attributeName of this.knownAttributeNames) {\n this.refreshAttribute(attributeName, null);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n const attributeName = mutation.attributeName;\n if (attributeName) {\n this.refreshAttribute(attributeName, mutation.oldValue);\n }\n }\n refreshAttribute(attributeName, oldValue) {\n const key = this.delegate.getStringMapKeyForAttribute(attributeName);\n if (key != null) {\n if (!this.stringMap.has(attributeName)) {\n this.stringMapKeyAdded(key, attributeName);\n }\n const value = this.element.getAttribute(attributeName);\n if (this.stringMap.get(attributeName) != value) {\n this.stringMapValueChanged(value, key, oldValue);\n }\n if (value == null) {\n const oldValue = this.stringMap.get(attributeName);\n this.stringMap.delete(attributeName);\n if (oldValue) this.stringMapKeyRemoved(key, attributeName, oldValue);\n } else {\n this.stringMap.set(attributeName, value);\n }\n }\n }\n stringMapKeyAdded(key, attributeName) {\n if (this.delegate.stringMapKeyAdded) {\n this.delegate.stringMapKeyAdded(key, attributeName);\n }\n }\n stringMapValueChanged(value, key, oldValue) {\n if (this.delegate.stringMapValueChanged) {\n this.delegate.stringMapValueChanged(value, key, oldValue);\n }\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n if (this.delegate.stringMapKeyRemoved) {\n this.delegate.stringMapKeyRemoved(key, attributeName, oldValue);\n }\n }\n get knownAttributeNames() {\n return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)));\n }\n get currentAttributeNames() {\n return Array.from(this.element.attributes).map(attribute => attribute.name);\n }\n get recordedAttributeNames() {\n return Array.from(this.stringMap.keys());\n }\n }\n class TokenListObserver {\n constructor(element, attributeName, delegate) {\n this.attributeObserver = new AttributeObserver(element, attributeName, this);\n this.delegate = delegate;\n this.tokensByElement = new Multimap();\n }\n get started() {\n return this.attributeObserver.started;\n }\n start() {\n this.attributeObserver.start();\n }\n pause(callback) {\n this.attributeObserver.pause(callback);\n }\n stop() {\n this.attributeObserver.stop();\n }\n refresh() {\n this.attributeObserver.refresh();\n }\n get element() {\n return this.attributeObserver.element;\n }\n get attributeName() {\n return this.attributeObserver.attributeName;\n }\n elementMatchedAttribute(element) {\n this.tokensMatched(this.readTokensForElement(element));\n }\n elementAttributeValueChanged(element) {\n const _this$refreshTokensFo = this.refreshTokensForElement(element),\n _this$refreshTokensFo2 = _slicedToArray(_this$refreshTokensFo, 2),\n unmatchedTokens = _this$refreshTokensFo2[0],\n matchedTokens = _this$refreshTokensFo2[1];\n this.tokensUnmatched(unmatchedTokens);\n this.tokensMatched(matchedTokens);\n }\n elementUnmatchedAttribute(element) {\n this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));\n }\n tokensMatched(tokens) {\n tokens.forEach(token => this.tokenMatched(token));\n }\n tokensUnmatched(tokens) {\n tokens.forEach(token => this.tokenUnmatched(token));\n }\n tokenMatched(token) {\n this.delegate.tokenMatched(token);\n this.tokensByElement.add(token.element, token);\n }\n tokenUnmatched(token) {\n this.delegate.tokenUnmatched(token);\n this.tokensByElement.delete(token.element, token);\n }\n refreshTokensForElement(element) {\n const previousTokens = this.tokensByElement.getValuesForKey(element);\n const currentTokens = this.readTokensForElement(element);\n const firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(_ref11 => {\n let _ref12 = _slicedToArray(_ref11, 2),\n previousToken = _ref12[0],\n currentToken = _ref12[1];\n return !tokensAreEqual(previousToken, currentToken);\n });\n if (firstDifferingIndex == -1) {\n return [[], []];\n } else {\n return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];\n }\n }\n readTokensForElement(element) {\n const attributeName = this.attributeName;\n const tokenString = element.getAttribute(attributeName) || \"\";\n return parseTokenString(tokenString, element, attributeName);\n }\n }\n function parseTokenString(tokenString, element, attributeName) {\n return tokenString.trim().split(/\\s+/).filter(content => content.length).map((content, index) => ({\n element,\n attributeName,\n content,\n index\n }));\n }\n function zip(left, right) {\n const length = Math.max(left.length, right.length);\n return Array.from({\n length\n }, (_, index) => [left[index], right[index]]);\n }\n function tokensAreEqual(left, right) {\n return left && right && left.index == right.index && left.content == right.content;\n }\n class ValueListObserver {\n constructor(element, attributeName, delegate) {\n this.tokenListObserver = new TokenListObserver(element, attributeName, this);\n this.delegate = delegate;\n this.parseResultsByToken = new WeakMap();\n this.valuesByTokenByElement = new WeakMap();\n }\n get started() {\n return this.tokenListObserver.started;\n }\n start() {\n this.tokenListObserver.start();\n }\n stop() {\n this.tokenListObserver.stop();\n }\n refresh() {\n this.tokenListObserver.refresh();\n }\n get element() {\n return this.tokenListObserver.element;\n }\n get attributeName() {\n return this.tokenListObserver.attributeName;\n }\n tokenMatched(token) {\n const element = token.element;\n const _this$fetchParseResul = this.fetchParseResultForToken(token),\n value = _this$fetchParseResul.value;\n if (value) {\n this.fetchValuesByTokenForElement(element).set(token, value);\n this.delegate.elementMatchedValue(element, value);\n }\n }\n tokenUnmatched(token) {\n const element = token.element;\n const _this$fetchParseResul2 = this.fetchParseResultForToken(token),\n value = _this$fetchParseResul2.value;\n if (value) {\n this.fetchValuesByTokenForElement(element).delete(token);\n this.delegate.elementUnmatchedValue(element, value);\n }\n }\n fetchParseResultForToken(token) {\n let parseResult = this.parseResultsByToken.get(token);\n if (!parseResult) {\n parseResult = this.parseToken(token);\n this.parseResultsByToken.set(token, parseResult);\n }\n return parseResult;\n }\n fetchValuesByTokenForElement(element) {\n let valuesByToken = this.valuesByTokenByElement.get(element);\n if (!valuesByToken) {\n valuesByToken = new Map();\n this.valuesByTokenByElement.set(element, valuesByToken);\n }\n return valuesByToken;\n }\n parseToken(token) {\n try {\n const value = this.delegate.parseValueForToken(token);\n return {\n value\n };\n } catch (error) {\n return {\n error\n };\n }\n }\n }\n class BindingObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.bindingsByAction = new Map();\n }\n start() {\n if (!this.valueListObserver) {\n this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this);\n this.valueListObserver.start();\n }\n }\n stop() {\n if (this.valueListObserver) {\n this.valueListObserver.stop();\n delete this.valueListObserver;\n this.disconnectAllActions();\n }\n }\n get element() {\n return this.context.element;\n }\n get identifier() {\n return this.context.identifier;\n }\n get actionAttribute() {\n return this.schema.actionAttribute;\n }\n get schema() {\n return this.context.schema;\n }\n get bindings() {\n return Array.from(this.bindingsByAction.values());\n }\n connectAction(action) {\n const binding = new Binding(this.context, action);\n this.bindingsByAction.set(action, binding);\n this.delegate.bindingConnected(binding);\n }\n disconnectAction(action) {\n const binding = this.bindingsByAction.get(action);\n if (binding) {\n this.bindingsByAction.delete(action);\n this.delegate.bindingDisconnected(binding);\n }\n }\n disconnectAllActions() {\n this.bindings.forEach(binding => this.delegate.bindingDisconnected(binding, true));\n this.bindingsByAction.clear();\n }\n parseValueForToken(token) {\n const action = Action.forToken(token, this.schema);\n if (action.identifier == this.identifier) {\n return action;\n }\n }\n elementMatchedValue(element, action) {\n this.connectAction(action);\n }\n elementUnmatchedValue(element, action) {\n this.disconnectAction(action);\n }\n }\n class ValueObserver {\n constructor(context, receiver) {\n this.context = context;\n this.receiver = receiver;\n this.stringMapObserver = new StringMapObserver(this.element, this);\n this.valueDescriptorMap = this.controller.valueDescriptorMap;\n }\n start() {\n this.stringMapObserver.start();\n this.invokeChangedCallbacksForDefaultValues();\n }\n stop() {\n this.stringMapObserver.stop();\n }\n get element() {\n return this.context.element;\n }\n get controller() {\n return this.context.controller;\n }\n getStringMapKeyForAttribute(attributeName) {\n if (attributeName in this.valueDescriptorMap) {\n return this.valueDescriptorMap[attributeName].name;\n }\n }\n stringMapKeyAdded(key, attributeName) {\n const descriptor = this.valueDescriptorMap[attributeName];\n if (!this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), descriptor.writer(descriptor.defaultValue));\n }\n }\n stringMapValueChanged(value, name, oldValue) {\n const descriptor = this.valueDescriptorNameMap[name];\n if (value === null) return;\n if (oldValue === null) {\n oldValue = descriptor.writer(descriptor.defaultValue);\n }\n this.invokeChangedCallback(name, value, oldValue);\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n const descriptor = this.valueDescriptorNameMap[key];\n if (this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), oldValue);\n } else {\n this.invokeChangedCallback(key, descriptor.writer(descriptor.defaultValue), oldValue);\n }\n }\n invokeChangedCallbacksForDefaultValues() {\n for (const _ref13 of this.valueDescriptors) {\n const key = _ref13.key;\n const name = _ref13.name;\n const defaultValue = _ref13.defaultValue;\n const writer = _ref13.writer;\n if (defaultValue != undefined && !this.controller.data.has(key)) {\n this.invokeChangedCallback(name, writer(defaultValue), undefined);\n }\n }\n }\n invokeChangedCallback(name, rawValue, rawOldValue) {\n const changedMethodName = `${name}Changed`;\n const changedMethod = this.receiver[changedMethodName];\n if (typeof changedMethod == \"function\") {\n const descriptor = this.valueDescriptorNameMap[name];\n try {\n const value = descriptor.reader(rawValue);\n let oldValue = rawOldValue;\n if (rawOldValue) {\n oldValue = descriptor.reader(rawOldValue);\n }\n changedMethod.call(this.receiver, value, oldValue);\n } catch (error) {\n if (error instanceof TypeError) {\n error.message = `Stimulus Value \"${this.context.identifier}.${descriptor.name}\" - ${error.message}`;\n }\n throw error;\n }\n }\n }\n get valueDescriptors() {\n const valueDescriptorMap = this.valueDescriptorMap;\n return Object.keys(valueDescriptorMap).map(key => valueDescriptorMap[key]);\n }\n get valueDescriptorNameMap() {\n const descriptors = {};\n Object.keys(this.valueDescriptorMap).forEach(key => {\n const descriptor = this.valueDescriptorMap[key];\n descriptors[descriptor.name] = descriptor;\n });\n return descriptors;\n }\n hasValue(attributeName) {\n const descriptor = this.valueDescriptorNameMap[attributeName];\n const hasMethodName = `has${capitalize(descriptor.name)}`;\n return this.receiver[hasMethodName];\n }\n }\n class TargetObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.targetsByName = new Multimap();\n }\n start() {\n if (!this.tokenListObserver) {\n this.tokenListObserver = new TokenListObserver(this.element, this.attributeName, this);\n this.tokenListObserver.start();\n }\n }\n stop() {\n if (this.tokenListObserver) {\n this.disconnectAllTargets();\n this.tokenListObserver.stop();\n delete this.tokenListObserver;\n }\n }\n tokenMatched(_ref14) {\n let element = _ref14.element,\n name = _ref14.content;\n if (this.scope.containsElement(element)) {\n this.connectTarget(element, name);\n }\n }\n tokenUnmatched(_ref15) {\n let element = _ref15.element,\n name = _ref15.content;\n this.disconnectTarget(element, name);\n }\n connectTarget(element, name) {\n var _a;\n if (!this.targetsByName.has(name, element)) {\n this.targetsByName.add(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetConnected(element, name));\n }\n }\n disconnectTarget(element, name) {\n var _a;\n if (this.targetsByName.has(name, element)) {\n this.targetsByName.delete(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetDisconnected(element, name));\n }\n }\n disconnectAllTargets() {\n for (const name of this.targetsByName.keys) {\n for (const element of this.targetsByName.getValuesForKey(name)) {\n this.disconnectTarget(element, name);\n }\n }\n }\n get attributeName() {\n return `data-${this.context.identifier}-target`;\n }\n get element() {\n return this.context.element;\n }\n get scope() {\n return this.context.scope;\n }\n }\n function readInheritableStaticArrayValues(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce((values, constructor) => {\n getOwnStaticArrayValues(constructor, propertyName).forEach(name => values.add(name));\n return values;\n }, new Set()));\n }\n function readInheritableStaticObjectPairs(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return ancestors.reduce((pairs, constructor) => {\n pairs.push(...getOwnStaticObjectPairs(constructor, propertyName));\n return pairs;\n }, []);\n }\n function getAncestorsForConstructor(constructor) {\n const ancestors = [];\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n return ancestors.reverse();\n }\n function getOwnStaticArrayValues(constructor, propertyName) {\n const definition = constructor[propertyName];\n return Array.isArray(definition) ? definition : [];\n }\n function getOwnStaticObjectPairs(constructor, propertyName) {\n const definition = constructor[propertyName];\n return definition ? Object.keys(definition).map(key => [key, definition[key]]) : [];\n }\n class OutletObserver {\n constructor(context, delegate) {\n this.started = false;\n this.context = context;\n this.delegate = delegate;\n this.outletsByName = new Multimap();\n this.outletElementsByName = new Multimap();\n this.selectorObserverMap = new Map();\n this.attributeObserverMap = new Map();\n }\n start() {\n if (!this.started) {\n this.outletDefinitions.forEach(outletName => {\n this.setupSelectorObserverForOutlet(outletName);\n this.setupAttributeObserverForOutlet(outletName);\n });\n this.started = true;\n this.dependentContexts.forEach(context => context.refresh());\n }\n }\n refresh() {\n this.selectorObserverMap.forEach(observer => observer.refresh());\n this.attributeObserverMap.forEach(observer => observer.refresh());\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.disconnectAllOutlets();\n this.stopSelectorObservers();\n this.stopAttributeObservers();\n }\n }\n stopSelectorObservers() {\n if (this.selectorObserverMap.size > 0) {\n this.selectorObserverMap.forEach(observer => observer.stop());\n this.selectorObserverMap.clear();\n }\n }\n stopAttributeObservers() {\n if (this.attributeObserverMap.size > 0) {\n this.attributeObserverMap.forEach(observer => observer.stop());\n this.attributeObserverMap.clear();\n }\n }\n selectorMatched(element, _selector, _ref16) {\n let outletName = _ref16.outletName;\n const outlet = this.getOutlet(element, outletName);\n if (outlet) {\n this.connectOutlet(outlet, element, outletName);\n }\n }\n selectorUnmatched(element, _selector, _ref17) {\n let outletName = _ref17.outletName;\n const outlet = this.getOutletFromMap(element, outletName);\n if (outlet) {\n this.disconnectOutlet(outlet, element, outletName);\n }\n }\n selectorMatchElement(element, _ref18) {\n let outletName = _ref18.outletName;\n const selector = this.selector(outletName);\n const hasOutlet = this.hasOutlet(element, outletName);\n const hasOutletController = element.matches(`[${this.schema.controllerAttribute}~=${outletName}]`);\n if (selector) {\n return hasOutlet && hasOutletController && element.matches(selector);\n } else {\n return false;\n }\n }\n elementMatchedAttribute(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n elementAttributeValueChanged(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n elementUnmatchedAttribute(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n connectOutlet(outlet, element, outletName) {\n var _a;\n if (!this.outletElementsByName.has(outletName, element)) {\n this.outletsByName.add(outletName, outlet);\n this.outletElementsByName.add(outletName, element);\n (_a = this.selectorObserverMap.get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletConnected(outlet, element, outletName));\n }\n }\n disconnectOutlet(outlet, element, outletName) {\n var _a;\n if (this.outletElementsByName.has(outletName, element)) {\n this.outletsByName.delete(outletName, outlet);\n this.outletElementsByName.delete(outletName, element);\n (_a = this.selectorObserverMap.get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletDisconnected(outlet, element, outletName));\n }\n }\n disconnectAllOutlets() {\n for (const outletName of this.outletElementsByName.keys) {\n for (const element of this.outletElementsByName.getValuesForKey(outletName)) {\n for (const outlet of this.outletsByName.getValuesForKey(outletName)) {\n this.disconnectOutlet(outlet, element, outletName);\n }\n }\n }\n }\n updateSelectorObserverForOutlet(outletName) {\n const observer = this.selectorObserverMap.get(outletName);\n if (observer) {\n observer.selector = this.selector(outletName);\n }\n }\n setupSelectorObserverForOutlet(outletName) {\n const selector = this.selector(outletName);\n const selectorObserver = new SelectorObserver(document.body, selector, this, {\n outletName\n });\n this.selectorObserverMap.set(outletName, selectorObserver);\n selectorObserver.start();\n }\n setupAttributeObserverForOutlet(outletName) {\n const attributeName = this.attributeNameForOutletName(outletName);\n const attributeObserver = new AttributeObserver(this.scope.element, attributeName, this);\n this.attributeObserverMap.set(outletName, attributeObserver);\n attributeObserver.start();\n }\n selector(outletName) {\n return this.scope.outlets.getSelectorForOutletName(outletName);\n }\n attributeNameForOutletName(outletName) {\n return this.scope.schema.outletAttributeForScope(this.identifier, outletName);\n }\n getOutletNameFromOutletAttributeName(attributeName) {\n return this.outletDefinitions.find(outletName => this.attributeNameForOutletName(outletName) === attributeName);\n }\n get outletDependencies() {\n const dependencies = new Multimap();\n this.router.modules.forEach(module => {\n const constructor = module.definition.controllerConstructor;\n const outlets = readInheritableStaticArrayValues(constructor, \"outlets\");\n outlets.forEach(outlet => dependencies.add(outlet, module.identifier));\n });\n return dependencies;\n }\n get outletDefinitions() {\n return this.outletDependencies.getKeysForValue(this.identifier);\n }\n get dependentControllerIdentifiers() {\n return this.outletDependencies.getValuesForKey(this.identifier);\n }\n get dependentContexts() {\n const identifiers = this.dependentControllerIdentifiers;\n return this.router.contexts.filter(context => identifiers.includes(context.identifier));\n }\n hasOutlet(element, outletName) {\n return !!this.getOutlet(element, outletName) || !!this.getOutletFromMap(element, outletName);\n }\n getOutlet(element, outletName) {\n return this.application.getControllerForElementAndIdentifier(element, outletName);\n }\n getOutletFromMap(element, outletName) {\n return this.outletsByName.getValuesForKey(outletName).find(outlet => outlet.element === element);\n }\n get scope() {\n return this.context.scope;\n }\n get schema() {\n return this.context.schema;\n }\n get identifier() {\n return this.context.identifier;\n }\n get application() {\n return this.context.application;\n }\n get router() {\n return this.application.router;\n }\n }\n class Context {\n constructor(module, scope) {\n var _this = this;\n this.logDebugActivity = function (functionName) {\n let detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n const identifier = _this.identifier,\n controller = _this.controller,\n element = _this.element;\n detail = Object.assign({\n identifier,\n controller,\n element\n }, detail);\n _this.application.logDebugActivity(_this.identifier, functionName, detail);\n };\n this.module = module;\n this.scope = scope;\n this.controller = new module.controllerConstructor(this);\n this.bindingObserver = new BindingObserver(this, this.dispatcher);\n this.valueObserver = new ValueObserver(this, this.controller);\n this.targetObserver = new TargetObserver(this, this);\n this.outletObserver = new OutletObserver(this, this);\n try {\n this.controller.initialize();\n this.logDebugActivity(\"initialize\");\n } catch (error) {\n this.handleError(error, \"initializing controller\");\n }\n }\n connect() {\n this.bindingObserver.start();\n this.valueObserver.start();\n this.targetObserver.start();\n this.outletObserver.start();\n try {\n this.controller.connect();\n this.logDebugActivity(\"connect\");\n } catch (error) {\n this.handleError(error, \"connecting controller\");\n }\n }\n refresh() {\n this.outletObserver.refresh();\n }\n disconnect() {\n try {\n this.controller.disconnect();\n this.logDebugActivity(\"disconnect\");\n } catch (error) {\n this.handleError(error, \"disconnecting controller\");\n }\n this.outletObserver.stop();\n this.targetObserver.stop();\n this.valueObserver.stop();\n this.bindingObserver.stop();\n }\n get application() {\n return this.module.application;\n }\n get identifier() {\n return this.module.identifier;\n }\n get schema() {\n return this.application.schema;\n }\n get dispatcher() {\n return this.application.dispatcher;\n }\n get element() {\n return this.scope.element;\n }\n get parentElement() {\n return this.element.parentElement;\n }\n handleError(error, message) {\n let detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n const identifier = this.identifier,\n controller = this.controller,\n element = this.element;\n detail = Object.assign({\n identifier,\n controller,\n element\n }, detail);\n this.application.handleError(error, `Error ${message}`, detail);\n }\n targetConnected(element, name) {\n this.invokeControllerMethod(`${name}TargetConnected`, element);\n }\n targetDisconnected(element, name) {\n this.invokeControllerMethod(`${name}TargetDisconnected`, element);\n }\n outletConnected(outlet, element, name) {\n this.invokeControllerMethod(`${namespaceCamelize(name)}OutletConnected`, outlet, element);\n }\n outletDisconnected(outlet, element, name) {\n this.invokeControllerMethod(`${namespaceCamelize(name)}OutletDisconnected`, outlet, element);\n }\n invokeControllerMethod(methodName) {\n const controller = this.controller;\n if (typeof controller[methodName] == \"function\") {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n controller[methodName](...args);\n }\n }\n }\n function bless(constructor) {\n return shadow(constructor, getBlessedProperties(constructor));\n }\n function shadow(constructor, properties) {\n const shadowConstructor = extend(constructor);\n const shadowProperties = getShadowProperties(constructor.prototype, properties);\n Object.defineProperties(shadowConstructor.prototype, shadowProperties);\n return shadowConstructor;\n }\n function getBlessedProperties(constructor) {\n const blessings = readInheritableStaticArrayValues(constructor, \"blessings\");\n return blessings.reduce((blessedProperties, blessing) => {\n const properties = blessing(constructor);\n for (const key in properties) {\n const descriptor = blessedProperties[key] || {};\n blessedProperties[key] = Object.assign(descriptor, properties[key]);\n }\n return blessedProperties;\n }, {});\n }\n function getShadowProperties(prototype, properties) {\n return getOwnKeys(properties).reduce((shadowProperties, key) => {\n const descriptor = getShadowedDescriptor(prototype, properties, key);\n if (descriptor) {\n Object.assign(shadowProperties, {\n [key]: descriptor\n });\n }\n return shadowProperties;\n }, {});\n }\n function getShadowedDescriptor(prototype, properties, key) {\n const shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key);\n const shadowedByValue = shadowingDescriptor && \"value\" in shadowingDescriptor;\n if (!shadowedByValue) {\n const descriptor = Object.getOwnPropertyDescriptor(properties, key).value;\n if (shadowingDescriptor) {\n descriptor.get = shadowingDescriptor.get || descriptor.get;\n descriptor.set = shadowingDescriptor.set || descriptor.set;\n }\n return descriptor;\n }\n }\n const getOwnKeys = (() => {\n if (typeof Object.getOwnPropertySymbols == \"function\") {\n return object => [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)];\n } else {\n return Object.getOwnPropertyNames;\n }\n })();\n const extend = (() => {\n function extendWithReflect(constructor) {\n function extended() {\n return Reflect.construct(constructor, arguments, new.target);\n }\n extended.prototype = Object.create(constructor.prototype, {\n constructor: {\n value: extended\n }\n });\n Reflect.setPrototypeOf(extended, constructor);\n return extended;\n }\n function testReflectExtension() {\n const a = function () {\n this.a.call(this);\n };\n const b = extendWithReflect(a);\n b.prototype.a = function () {};\n return new b();\n }\n try {\n testReflectExtension();\n return extendWithReflect;\n } catch (error) {\n return constructor => class extended extends constructor {};\n }\n })();\n function blessDefinition(definition) {\n return {\n identifier: definition.identifier,\n controllerConstructor: bless(definition.controllerConstructor)\n };\n }\n class Module {\n constructor(application, definition) {\n this.application = application;\n this.definition = blessDefinition(definition);\n this.contextsByScope = new WeakMap();\n this.connectedContexts = new Set();\n }\n get identifier() {\n return this.definition.identifier;\n }\n get controllerConstructor() {\n return this.definition.controllerConstructor;\n }\n get contexts() {\n return Array.from(this.connectedContexts);\n }\n connectContextForScope(scope) {\n const context = this.fetchContextForScope(scope);\n this.connectedContexts.add(context);\n context.connect();\n }\n disconnectContextForScope(scope) {\n const context = this.contextsByScope.get(scope);\n if (context) {\n this.connectedContexts.delete(context);\n context.disconnect();\n }\n }\n fetchContextForScope(scope) {\n let context = this.contextsByScope.get(scope);\n if (!context) {\n context = new Context(this, scope);\n this.contextsByScope.set(scope, context);\n }\n return context;\n }\n }\n class ClassMap {\n constructor(scope) {\n this.scope = scope;\n }\n has(name) {\n return this.data.has(this.getDataKey(name));\n }\n get(name) {\n return this.getAll(name)[0];\n }\n getAll(name) {\n const tokenString = this.data.get(this.getDataKey(name)) || \"\";\n return tokenize(tokenString);\n }\n getAttributeName(name) {\n return this.data.getAttributeNameForKey(this.getDataKey(name));\n }\n getDataKey(name) {\n return `${name}-class`;\n }\n get data() {\n return this.scope.data;\n }\n }\n class DataMap {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.getAttribute(name);\n }\n set(key, value) {\n const name = this.getAttributeNameForKey(key);\n this.element.setAttribute(name, value);\n return this.get(key);\n }\n has(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.hasAttribute(name);\n }\n delete(key) {\n if (this.has(key)) {\n const name = this.getAttributeNameForKey(key);\n this.element.removeAttribute(name);\n return true;\n } else {\n return false;\n }\n }\n getAttributeNameForKey(key) {\n return `data-${this.identifier}-${dasherize(key)}`;\n }\n }\n class Guide {\n constructor(logger) {\n this.warnedKeysByObject = new WeakMap();\n this.logger = logger;\n }\n warn(object, key, message) {\n let warnedKeys = this.warnedKeysByObject.get(object);\n if (!warnedKeys) {\n warnedKeys = new Set();\n this.warnedKeysByObject.set(object, warnedKeys);\n }\n if (!warnedKeys.has(key)) {\n warnedKeys.add(key);\n this.logger.warn(message, object);\n }\n }\n }\n function attributeValueContainsToken(attributeName, token) {\n return `[${attributeName}~=\"${token}\"]`;\n }\n class TargetSet {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(targetName) {\n return this.find(targetName) != null;\n }\n find() {\n for (var _len2 = arguments.length, targetNames = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {\n targetNames[_key3] = arguments[_key3];\n }\n return targetNames.reduce((target, targetName) => target || this.findTarget(targetName) || this.findLegacyTarget(targetName), undefined);\n }\n findAll() {\n for (var _len3 = arguments.length, targetNames = new Array(_len3), _key4 = 0; _key4 < _len3; _key4++) {\n targetNames[_key4] = arguments[_key4];\n }\n return targetNames.reduce((targets, targetName) => [...targets, ...this.findAllTargets(targetName), ...this.findAllLegacyTargets(targetName)], []);\n }\n findTarget(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findElement(selector);\n }\n findAllTargets(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findAllElements(selector);\n }\n getSelectorForTargetName(targetName) {\n const attributeName = this.schema.targetAttributeForScope(this.identifier);\n return attributeValueContainsToken(attributeName, targetName);\n }\n findLegacyTarget(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.deprecate(this.scope.findElement(selector), targetName);\n }\n findAllLegacyTargets(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.scope.findAllElements(selector).map(element => this.deprecate(element, targetName));\n }\n getLegacySelectorForTargetName(targetName) {\n const targetDescriptor = `${this.identifier}.${targetName}`;\n return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor);\n }\n deprecate(element, targetName) {\n if (element) {\n const identifier = this.identifier;\n const attributeName = this.schema.targetAttribute;\n const revisedAttributeName = this.schema.targetAttributeForScope(identifier);\n this.guide.warn(element, `target:${targetName}`, `Please replace ${attributeName}=\"${identifier}.${targetName}\" with ${revisedAttributeName}=\"${targetName}\". ` + `The ${attributeName} attribute is deprecated and will be removed in a future version of Stimulus.`);\n }\n return element;\n }\n get guide() {\n return this.scope.guide;\n }\n }\n class OutletSet {\n constructor(scope, controllerElement) {\n this.scope = scope;\n this.controllerElement = controllerElement;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(outletName) {\n return this.find(outletName) != null;\n }\n find() {\n for (var _len4 = arguments.length, outletNames = new Array(_len4), _key5 = 0; _key5 < _len4; _key5++) {\n outletNames[_key5] = arguments[_key5];\n }\n return outletNames.reduce((outlet, outletName) => outlet || this.findOutlet(outletName), undefined);\n }\n findAll() {\n for (var _len5 = arguments.length, outletNames = new Array(_len5), _key6 = 0; _key6 < _len5; _key6++) {\n outletNames[_key6] = arguments[_key6];\n }\n return outletNames.reduce((outlets, outletName) => [...outlets, ...this.findAllOutlets(outletName)], []);\n }\n getSelectorForOutletName(outletName) {\n const attributeName = this.schema.outletAttributeForScope(this.identifier, outletName);\n return this.controllerElement.getAttribute(attributeName);\n }\n findOutlet(outletName) {\n const selector = this.getSelectorForOutletName(outletName);\n if (selector) return this.findElement(selector, outletName);\n }\n findAllOutlets(outletName) {\n const selector = this.getSelectorForOutletName(outletName);\n return selector ? this.findAllElements(selector, outletName) : [];\n }\n findElement(selector, outletName) {\n const elements = this.scope.queryElements(selector);\n return elements.filter(element => this.matchesElement(element, selector, outletName))[0];\n }\n findAllElements(selector, outletName) {\n const elements = this.scope.queryElements(selector);\n return elements.filter(element => this.matchesElement(element, selector, outletName));\n }\n matchesElement(element, selector, outletName) {\n const controllerAttribute = element.getAttribute(this.scope.schema.controllerAttribute) || \"\";\n return element.matches(selector) && controllerAttribute.split(\" \").includes(outletName);\n }\n }\n class Scope {\n constructor(schema, element, identifier, logger) {\n this.targets = new TargetSet(this);\n this.classes = new ClassMap(this);\n this.data = new DataMap(this);\n this.containsElement = element => {\n return element.closest(this.controllerSelector) === this.element;\n };\n this.schema = schema;\n this.element = element;\n this.identifier = identifier;\n this.guide = new Guide(logger);\n this.outlets = new OutletSet(this.documentScope, element);\n }\n findElement(selector) {\n return this.element.matches(selector) ? this.element : this.queryElements(selector).find(this.containsElement);\n }\n findAllElements(selector) {\n return [...(this.element.matches(selector) ? [this.element] : []), ...this.queryElements(selector).filter(this.containsElement)];\n }\n queryElements(selector) {\n return Array.from(this.element.querySelectorAll(selector));\n }\n get controllerSelector() {\n return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier);\n }\n get isDocumentScope() {\n return this.element === document.documentElement;\n }\n get documentScope() {\n return this.isDocumentScope ? this : new Scope(this.schema, document.documentElement, this.identifier, this.guide.logger);\n }\n }\n class ScopeObserver {\n constructor(element, schema, delegate) {\n this.element = element;\n this.schema = schema;\n this.delegate = delegate;\n this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this);\n this.scopesByIdentifierByElement = new WeakMap();\n this.scopeReferenceCounts = new WeakMap();\n }\n start() {\n this.valueListObserver.start();\n }\n stop() {\n this.valueListObserver.stop();\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n parseValueForToken(token) {\n const element = token.element,\n identifier = token.content;\n return this.parseValueForElementAndIdentifier(element, identifier);\n }\n parseValueForElementAndIdentifier(element, identifier) {\n const scopesByIdentifier = this.fetchScopesByIdentifierForElement(element);\n let scope = scopesByIdentifier.get(identifier);\n if (!scope) {\n scope = this.delegate.createScopeForElementAndIdentifier(element, identifier);\n scopesByIdentifier.set(identifier, scope);\n }\n return scope;\n }\n elementMatchedValue(element, value) {\n const referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;\n this.scopeReferenceCounts.set(value, referenceCount);\n if (referenceCount == 1) {\n this.delegate.scopeConnected(value);\n }\n }\n elementUnmatchedValue(element, value) {\n const referenceCount = this.scopeReferenceCounts.get(value);\n if (referenceCount) {\n this.scopeReferenceCounts.set(value, referenceCount - 1);\n if (referenceCount == 1) {\n this.delegate.scopeDisconnected(value);\n }\n }\n }\n fetchScopesByIdentifierForElement(element) {\n let scopesByIdentifier = this.scopesByIdentifierByElement.get(element);\n if (!scopesByIdentifier) {\n scopesByIdentifier = new Map();\n this.scopesByIdentifierByElement.set(element, scopesByIdentifier);\n }\n return scopesByIdentifier;\n }\n }\n class Router {\n constructor(application) {\n this.application = application;\n this.scopeObserver = new ScopeObserver(this.element, this.schema, this);\n this.scopesByIdentifier = new Multimap();\n this.modulesByIdentifier = new Map();\n }\n get element() {\n return this.application.element;\n }\n get schema() {\n return this.application.schema;\n }\n get logger() {\n return this.application.logger;\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n get modules() {\n return Array.from(this.modulesByIdentifier.values());\n }\n get contexts() {\n return this.modules.reduce((contexts, module) => contexts.concat(module.contexts), []);\n }\n start() {\n this.scopeObserver.start();\n }\n stop() {\n this.scopeObserver.stop();\n }\n loadDefinition(definition) {\n this.unloadIdentifier(definition.identifier);\n const module = new Module(this.application, definition);\n this.connectModule(module);\n const afterLoad = definition.controllerConstructor.afterLoad;\n if (afterLoad) {\n afterLoad.call(definition.controllerConstructor, definition.identifier, this.application);\n }\n }\n unloadIdentifier(identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n this.disconnectModule(module);\n }\n }\n getContextForElementAndIdentifier(element, identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n return module.contexts.find(context => context.element == element);\n }\n }\n proposeToConnectScopeForElementAndIdentifier(element, identifier) {\n const scope = this.scopeObserver.parseValueForElementAndIdentifier(element, identifier);\n if (scope) {\n this.scopeObserver.elementMatchedValue(scope.element, scope);\n } else {\n console.error(`Couldn't find or create scope for identifier: \"${identifier}\" and element:`, element);\n }\n }\n handleError(error, message, detail) {\n this.application.handleError(error, message, detail);\n }\n createScopeForElementAndIdentifier(element, identifier) {\n return new Scope(this.schema, element, identifier, this.logger);\n }\n scopeConnected(scope) {\n this.scopesByIdentifier.add(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.connectContextForScope(scope);\n }\n }\n scopeDisconnected(scope) {\n this.scopesByIdentifier.delete(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.disconnectContextForScope(scope);\n }\n }\n connectModule(module) {\n this.modulesByIdentifier.set(module.identifier, module);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(scope => module.connectContextForScope(scope));\n }\n disconnectModule(module) {\n this.modulesByIdentifier.delete(module.identifier);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(scope => module.disconnectContextForScope(scope));\n }\n }\n const defaultSchema = {\n controllerAttribute: \"data-controller\",\n actionAttribute: \"data-action\",\n targetAttribute: \"data-target\",\n targetAttributeForScope: identifier => `data-${identifier}-target`,\n outletAttributeForScope: (identifier, outlet) => `data-${identifier}-${outlet}-outlet`,\n keyMappings: Object.assign(Object.assign({\n enter: \"Enter\",\n tab: \"Tab\",\n esc: \"Escape\",\n space: \" \",\n up: \"ArrowUp\",\n down: \"ArrowDown\",\n left: \"ArrowLeft\",\n right: \"ArrowRight\",\n home: \"Home\",\n end: \"End\",\n page_up: \"PageUp\",\n page_down: \"PageDown\"\n }, objectFromEntries(\"abcdefghijklmnopqrstuvwxyz\".split(\"\").map(c => [c, c]))), objectFromEntries(\"0123456789\".split(\"\").map(n => [n, n])))\n };\n function objectFromEntries(array) {\n return array.reduce((memo, _ref19) => {\n let _ref20 = _slicedToArray(_ref19, 2),\n k = _ref20[0],\n v = _ref20[1];\n return Object.assign(Object.assign({}, memo), {\n [k]: v\n });\n }, {});\n }\n class Application {\n constructor() {\n var _this2 = this;\n let element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.documentElement;\n let schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultSchema;\n this.logger = console;\n this.debug = false;\n this.logDebugActivity = function (identifier, functionName) {\n let detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n if (_this2.debug) {\n _this2.logFormattedMessage(identifier, functionName, detail);\n }\n };\n this.element = element;\n this.schema = schema;\n this.dispatcher = new Dispatcher(this);\n this.router = new Router(this);\n this.actionDescriptorFilters = Object.assign({}, defaultActionDescriptorFilters);\n }\n static start(element, schema) {\n const application = new this(element, schema);\n application.start();\n return application;\n }\n async start() {\n await domReady();\n this.logDebugActivity(\"application\", \"starting\");\n this.dispatcher.start();\n this.router.start();\n this.logDebugActivity(\"application\", \"start\");\n }\n stop() {\n this.logDebugActivity(\"application\", \"stopping\");\n this.dispatcher.stop();\n this.router.stop();\n this.logDebugActivity(\"application\", \"stop\");\n }\n register(identifier, controllerConstructor) {\n this.load({\n identifier,\n controllerConstructor\n });\n }\n registerActionOption(name, filter) {\n this.actionDescriptorFilters[name] = filter;\n }\n load(head) {\n for (var _len6 = arguments.length, rest = new Array(_len6 > 1 ? _len6 - 1 : 0), _key7 = 1; _key7 < _len6; _key7++) {\n rest[_key7 - 1] = arguments[_key7];\n }\n const definitions = Array.isArray(head) ? head : [head, ...rest];\n definitions.forEach(definition => {\n if (definition.controllerConstructor.shouldLoad) {\n this.router.loadDefinition(definition);\n }\n });\n }\n unload(head) {\n for (var _len7 = arguments.length, rest = new Array(_len7 > 1 ? _len7 - 1 : 0), _key8 = 1; _key8 < _len7; _key8++) {\n rest[_key8 - 1] = arguments[_key8];\n }\n const identifiers = Array.isArray(head) ? head : [head, ...rest];\n identifiers.forEach(identifier => this.router.unloadIdentifier(identifier));\n }\n get controllers() {\n return this.router.contexts.map(context => context.controller);\n }\n getControllerForElementAndIdentifier(element, identifier) {\n const context = this.router.getContextForElementAndIdentifier(element, identifier);\n return context ? context.controller : null;\n }\n handleError(error, message, detail) {\n var _a;\n this.logger.error(`%s\\n\\n%o\\n\\n%o`, message, error, detail);\n (_a = window.onerror) === null || _a === void 0 ? void 0 : _a.call(window, message, \"\", 0, 0, error);\n }\n logFormattedMessage(identifier, functionName) {\n let detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n detail = Object.assign({\n application: this\n }, detail);\n this.logger.groupCollapsed(`${identifier} #${functionName}`);\n this.logger.log(\"details:\", Object.assign({}, detail));\n this.logger.groupEnd();\n }\n }\n function domReady() {\n return new Promise(resolve => {\n if (document.readyState == \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", () => resolve());\n } else {\n resolve();\n }\n });\n }\n function ClassPropertiesBlessing(constructor) {\n const classes = readInheritableStaticArrayValues(constructor, \"classes\");\n return classes.reduce((properties, classDefinition) => {\n return Object.assign(properties, propertiesForClassDefinition(classDefinition));\n }, {});\n }\n function propertiesForClassDefinition(key) {\n return {\n [`${key}Class`]: {\n get() {\n const classes = this.classes;\n if (classes.has(key)) {\n return classes.get(key);\n } else {\n const attribute = classes.getAttributeName(key);\n throw new Error(`Missing attribute \"${attribute}\"`);\n }\n }\n },\n [`${key}Classes`]: {\n get() {\n return this.classes.getAll(key);\n }\n },\n [`has${capitalize(key)}Class`]: {\n get() {\n return this.classes.has(key);\n }\n }\n };\n }\n function OutletPropertiesBlessing(constructor) {\n const outlets = readInheritableStaticArrayValues(constructor, \"outlets\");\n return outlets.reduce((properties, outletDefinition) => {\n return Object.assign(properties, propertiesForOutletDefinition(outletDefinition));\n }, {});\n }\n function getOutletController(controller, element, identifier) {\n return controller.application.getControllerForElementAndIdentifier(element, identifier);\n }\n function getControllerAndEnsureConnectedScope(controller, element, outletName) {\n let outletController = getOutletController(controller, element, outletName);\n if (outletController) return outletController;\n controller.application.router.proposeToConnectScopeForElementAndIdentifier(element, outletName);\n outletController = getOutletController(controller, element, outletName);\n if (outletController) return outletController;\n }\n function propertiesForOutletDefinition(name) {\n const camelizedName = namespaceCamelize(name);\n return {\n [`${camelizedName}Outlet`]: {\n get() {\n const outletElement = this.outlets.find(name);\n const selector = this.outlets.getSelectorForOutletName(name);\n if (outletElement) {\n const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name);\n if (outletController) return outletController;\n throw new Error(`The provided outlet element is missing an outlet controller \"${name}\" instance for host controller \"${this.identifier}\"`);\n }\n throw new Error(`Missing outlet element \"${name}\" for host controller \"${this.identifier}\". Stimulus couldn't find a matching outlet element using selector \"${selector}\".`);\n }\n },\n [`${camelizedName}Outlets`]: {\n get() {\n const outlets = this.outlets.findAll(name);\n if (outlets.length > 0) {\n return outlets.map(outletElement => {\n const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name);\n if (outletController) return outletController;\n console.warn(`The provided outlet element is missing an outlet controller \"${name}\" instance for host controller \"${this.identifier}\"`, outletElement);\n }).filter(controller => controller);\n }\n return [];\n }\n },\n [`${camelizedName}OutletElement`]: {\n get() {\n const outletElement = this.outlets.find(name);\n const selector = this.outlets.getSelectorForOutletName(name);\n if (outletElement) {\n return outletElement;\n } else {\n throw new Error(`Missing outlet element \"${name}\" for host controller \"${this.identifier}\". Stimulus couldn't find a matching outlet element using selector \"${selector}\".`);\n }\n }\n },\n [`${camelizedName}OutletElements`]: {\n get() {\n return this.outlets.findAll(name);\n }\n },\n [`has${capitalize(camelizedName)}Outlet`]: {\n get() {\n return this.outlets.has(name);\n }\n }\n };\n }\n function TargetPropertiesBlessing(constructor) {\n const targets = readInheritableStaticArrayValues(constructor, \"targets\");\n return targets.reduce((properties, targetDefinition) => {\n return Object.assign(properties, propertiesForTargetDefinition(targetDefinition));\n }, {});\n }\n function propertiesForTargetDefinition(name) {\n return {\n [`${name}Target`]: {\n get() {\n const target = this.targets.find(name);\n if (target) {\n return target;\n } else {\n throw new Error(`Missing target element \"${name}\" for \"${this.identifier}\" controller`);\n }\n }\n },\n [`${name}Targets`]: {\n get() {\n return this.targets.findAll(name);\n }\n },\n [`has${capitalize(name)}Target`]: {\n get() {\n return this.targets.has(name);\n }\n }\n };\n }\n function ValuePropertiesBlessing(constructor) {\n const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, \"values\");\n const propertyDescriptorMap = {\n valueDescriptorMap: {\n get() {\n return valueDefinitionPairs.reduce((result, valueDefinitionPair) => {\n const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier);\n const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key);\n return Object.assign(result, {\n [attributeName]: valueDescriptor\n });\n }, {});\n }\n }\n };\n return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => {\n return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair));\n }, propertyDescriptorMap);\n }\n function propertiesForValueDefinitionPair(valueDefinitionPair, controller) {\n const definition = parseValueDefinitionPair(valueDefinitionPair, controller);\n const key = definition.key,\n name = definition.name,\n read = definition.reader,\n write = definition.writer;\n return {\n [name]: {\n get() {\n const value = this.data.get(key);\n if (value !== null) {\n return read(value);\n } else {\n return definition.defaultValue;\n }\n },\n set(value) {\n if (value === undefined) {\n this.data.delete(key);\n } else {\n this.data.set(key, write(value));\n }\n }\n },\n [`has${capitalize(name)}`]: {\n get() {\n return this.data.has(key) || definition.hasCustomDefaultValue;\n }\n }\n };\n }\n function parseValueDefinitionPair(_ref21, controller) {\n let _ref22 = _slicedToArray(_ref21, 2),\n token = _ref22[0],\n typeDefinition = _ref22[1];\n return valueDescriptorForTokenAndTypeDefinition({\n controller,\n token,\n typeDefinition\n });\n }\n function parseValueTypeConstant(constant) {\n switch (constant) {\n case Array:\n return \"array\";\n case Boolean:\n return \"boolean\";\n case Number:\n return \"number\";\n case Object:\n return \"object\";\n case String:\n return \"string\";\n }\n }\n function parseValueTypeDefault(defaultValue) {\n switch (typeof defaultValue) {\n case \"boolean\":\n return \"boolean\";\n case \"number\":\n return \"number\";\n case \"string\":\n return \"string\";\n }\n if (Array.isArray(defaultValue)) return \"array\";\n if (Object.prototype.toString.call(defaultValue) === \"[object Object]\") return \"object\";\n }\n function parseValueTypeObject(payload) {\n const controller = payload.controller,\n token = payload.token,\n typeObject = payload.typeObject;\n const hasType = isSomething(typeObject.type);\n const hasDefault = isSomething(typeObject.default);\n const fullObject = hasType && hasDefault;\n const onlyType = hasType && !hasDefault;\n const onlyDefault = !hasType && hasDefault;\n const typeFromObject = parseValueTypeConstant(typeObject.type);\n const typeFromDefaultValue = parseValueTypeDefault(payload.typeObject.default);\n if (onlyType) return typeFromObject;\n if (onlyDefault) return typeFromDefaultValue;\n if (typeFromObject !== typeFromDefaultValue) {\n const propertyPath = controller ? `${controller}.${token}` : token;\n throw new Error(`The specified default value for the Stimulus Value \"${propertyPath}\" must match the defined type \"${typeFromObject}\". The provided default value of \"${typeObject.default}\" is of type \"${typeFromDefaultValue}\".`);\n }\n if (fullObject) return typeFromObject;\n }\n function parseValueTypeDefinition(payload) {\n const controller = payload.controller,\n token = payload.token,\n typeDefinition = payload.typeDefinition;\n const typeObject = {\n controller,\n token,\n typeObject: typeDefinition\n };\n const typeFromObject = parseValueTypeObject(typeObject);\n const typeFromDefaultValue = parseValueTypeDefault(typeDefinition);\n const typeFromConstant = parseValueTypeConstant(typeDefinition);\n const type = typeFromObject || typeFromDefaultValue || typeFromConstant;\n if (type) return type;\n const propertyPath = controller ? `${controller}.${typeDefinition}` : token;\n throw new Error(`Unknown value type \"${propertyPath}\" for \"${token}\" value`);\n }\n function defaultValueForDefinition(typeDefinition) {\n const constant = parseValueTypeConstant(typeDefinition);\n if (constant) return defaultValuesByType[constant];\n const hasDefault = hasProperty(typeDefinition, \"default\");\n const hasType = hasProperty(typeDefinition, \"type\");\n const typeObject = typeDefinition;\n if (hasDefault) return typeObject.default;\n if (hasType) {\n const type = typeObject.type;\n const constantFromType = parseValueTypeConstant(type);\n if (constantFromType) return defaultValuesByType[constantFromType];\n }\n return typeDefinition;\n }\n function valueDescriptorForTokenAndTypeDefinition(payload) {\n const token = payload.token,\n typeDefinition = payload.typeDefinition;\n const key = `${dasherize(token)}-value`;\n const type = parseValueTypeDefinition(payload);\n return {\n type,\n key,\n name: camelize(key),\n get defaultValue() {\n return defaultValueForDefinition(typeDefinition);\n },\n get hasCustomDefaultValue() {\n return parseValueTypeDefault(typeDefinition) !== undefined;\n },\n reader: readers[type],\n writer: writers[type] || writers.default\n };\n }\n const defaultValuesByType = {\n get array() {\n return [];\n },\n boolean: false,\n number: 0,\n get object() {\n return {};\n },\n string: \"\"\n };\n const readers = {\n array(value) {\n const array = JSON.parse(value);\n if (!Array.isArray(array)) {\n throw new TypeError(`expected value of type \"array\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(array)}\"`);\n }\n return array;\n },\n boolean(value) {\n return !(value == \"0\" || String(value).toLowerCase() == \"false\");\n },\n number(value) {\n return Number(value.replace(/_/g, \"\"));\n },\n object(value) {\n const object = JSON.parse(value);\n if (object === null || typeof object != \"object\" || Array.isArray(object)) {\n throw new TypeError(`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(object)}\"`);\n }\n return object;\n },\n string(value) {\n return value;\n }\n };\n const writers = {\n default: writeString,\n array: writeJSON,\n object: writeJSON\n };\n function writeJSON(value) {\n return JSON.stringify(value);\n }\n function writeString(value) {\n return `${value}`;\n }\n class Controller {\n constructor(context) {\n this.context = context;\n }\n static get shouldLoad() {\n return true;\n }\n static afterLoad(_identifier, _application) {\n return;\n }\n get application() {\n return this.context.application;\n }\n get scope() {\n return this.context.scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get targets() {\n return this.scope.targets;\n }\n get outlets() {\n return this.scope.outlets;\n }\n get classes() {\n return this.scope.classes;\n }\n get data() {\n return this.scope.data;\n }\n initialize() {}\n connect() {}\n disconnect() {}\n dispatch(eventName) {\n let _ref23 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref23$target = _ref23.target,\n target = _ref23$target === void 0 ? this.element : _ref23$target,\n _ref23$detail = _ref23.detail,\n detail = _ref23$detail === void 0 ? {} : _ref23$detail,\n _ref23$prefix = _ref23.prefix,\n prefix = _ref23$prefix === void 0 ? this.identifier : _ref23$prefix,\n _ref23$bubbles = _ref23.bubbles,\n bubbles = _ref23$bubbles === void 0 ? true : _ref23$bubbles,\n _ref23$cancelable = _ref23.cancelable,\n cancelable = _ref23$cancelable === void 0 ? true : _ref23$cancelable;\n const type = prefix ? `${prefix}:${eventName}` : eventName;\n const event = new CustomEvent(type, {\n detail,\n bubbles,\n cancelable\n });\n target.dispatchEvent(event);\n return event;\n }\n }\n Controller.blessings = [ClassPropertiesBlessing, TargetPropertiesBlessing, ValuePropertiesBlessing, OutletPropertiesBlessing];\n Controller.targets = [];\n Controller.outlets = [];\n Controller.values = {};\n exports.Application = Application;\n exports.AttributeObserver = AttributeObserver;\n exports.Context = Context;\n exports.Controller = Controller;\n exports.ElementObserver = ElementObserver;\n exports.IndexedMultimap = IndexedMultimap;\n exports.Multimap = Multimap;\n exports.SelectorObserver = SelectorObserver;\n exports.StringMapObserver = StringMapObserver;\n exports.TokenListObserver = TokenListObserver;\n exports.ValueListObserver = ValueListObserver;\n exports.add = add;\n exports.defaultSchema = defaultSchema;\n exports.del = del;\n exports.fetch = fetch;\n exports.prune = prune;\n Object.defineProperty(exports, '__esModule', {\n value: true\n });\n});","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n });\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n if (!areValidElements(reference, popper)) {\n return instance;\n }\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref) {\n var name = _ref.name,\n _ref$options = _ref.options,\n options = _ref$options === void 0 ? {} : _ref$options,\n effect = _ref.effect;\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n var noopFn = function noopFn() {};\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n return false;\n}","import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' ||\n // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument :\n // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) ||\n // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n var currentNode = getParentNode(element);\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n return offsetParent || getContainingBlock(element) || window;\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n return (\n // this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot ||\n // step into the shadow DOM of the parent of a slotted node\n element.parentNode || (\n // DOM Element detected\n isShadowRoot(element) ? element.host : null) ||\n // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n );\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n return getScrollParent(getParentNode(node));\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n return node;\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getWindow from \"./getWindow.js\";\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\nexport { isElement, isHTMLElement, isShadowRoot };","import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n if (list === void 0) {\n list = [];\n }\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList :\n // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","export * from \"./enums.js\";\nexport * from \"./modifiers/index.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport { popperGenerator, detectOverflow, createPopper as createPopperBase } from \"./createPopper.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper } from \"./popper.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\";","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\nfunction arrow(_ref) {\n var _state$modifiersData$;\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n if (!arrowElement || !popperOffsets) {\n return;\n }\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n if (!arrowElement) {\n return;\n }\n }\n if (!contains(state.elements.popper, arrowElement)) {\n return;\n }\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref, win) {\n var x = _ref.x,\n y = _ref.y;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n offsetParent = offsetParent;\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height :\n // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width :\n // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }, getWindow(popper)) : {\n x: x,\n y: y\n };\n x = _ref4.x;\n y = _ref4.y;\n if (gpuAcceleration) {\n var _Object$assign;\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n if (state.modifiersData[name]._skip) {\n return;\n }\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n var _basePlacement = getBasePlacement(placement);\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n checksMap.set(placement, checks);\n }\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n if (_ret === \"break\") break;\n }\n }\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","export { default as applyStyles } from \"./applyStyles.js\";\nexport { default as arrow } from \"./arrow.js\";\nexport { default as computeStyles } from \"./computeStyles.js\";\nexport { default as eventListeners } from \"./eventListeners.js\";\nexport { default as flip } from \"./flip.js\";\nexport { default as hide } from \"./hide.js\";\nexport { default as offset } from \"./offset.js\";\nexport { default as popperOffsets } from \"./popperOffsets.js\";\nexport { default as preventOverflow } from \"./preventOverflow.js\";","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","import computeOffsets from \"../utils/computeOffsets.js\";\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n if (!popperOffsets) {\n return;\n }\n if (checkMainAxis) {\n var _offsetModifierState$;\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n if (checkAltAxis) {\n var _offsetModifierState$2;\n var _mainSide = mainAxis === 'x' ? top : left;\n var _altSide = mainAxis === 'x' ? bottom : right;\n var _offset = popperOffsets[altAxis];\n var _len = altAxis === 'y' ? 'height' : 'width';\n var _min = _offset + overflow[_mainSide];\n var _max = _offset - overflow[_altSide];\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow };","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n default:\n }\n }\n return offsets;\n}","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n return pending;\n };\n}","import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n return overflowOffsets;\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","export default function getUAString() {\n var uaData = navigator.userAgentData;\n if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n return navigator.userAgent;\n}","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}","var sparkMd5 = {\n exports: {}\n};\n(function (module, exports) {\n (function (factory) {\n {\n module.exports = factory();\n }\n })(function (undefined$1) {\n var hex_chr = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n d = x[3];\n a += (b & c | ~b & d) + k[0] - 680876936 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[1] - 389564586 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[2] + 606105819 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[3] - 1044525330 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[4] - 176418897 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[5] + 1200080426 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[6] - 1473231341 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[7] - 45705983 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[8] + 1770035416 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[9] - 1958414417 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[10] - 42063 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[11] - 1990404162 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[12] + 1804603682 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[13] - 40341101 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[14] - 1502002290 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[15] + 1236535329 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & d | c & ~d) + k[1] - 165796510 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[6] - 1069501632 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[11] + 643717713 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[0] - 373897302 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[5] - 701558691 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[10] + 38016083 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[15] - 660478335 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[4] - 405537848 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[9] + 568446438 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[14] - 1019803690 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[3] - 187363961 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[8] + 1163531501 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[13] - 1444681467 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[2] - 51403784 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[7] + 1735328473 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[12] - 1926607734 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b ^ c ^ d) + k[5] - 378558 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[8] - 2022574463 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[11] + 1839030562 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[14] - 35309556 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[1] - 1530992060 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[4] + 1272893353 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[7] - 155497632 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[10] - 1094730640 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[13] + 681279174 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[0] - 358537222 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[3] - 722521979 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[6] + 76029189 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[9] - 640364487 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[12] - 421815835 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[15] + 530742520 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[2] - 995338651 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n x[0] = a + x[0] | 0;\n x[1] = b + x[1] | 0;\n x[2] = c + x[2] | 0;\n x[3] = d + x[3] | 0;\n }\n function md5blk(s) {\n var md5blks = [],\n i;\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);\n }\n return md5blks;\n }\n function md5blk_array(a) {\n var md5blks = [],\n i;\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);\n }\n return md5blks;\n }\n function md51(s) {\n var n = s.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\n s = s.substring(i - 64);\n length = s.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);\n }\n tail[i >> 2] |= 128 << (i % 4 << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(state, tail);\n return state;\n }\n function md51_array(a) {\n var n = a.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\n a = i - 64 < n ? a.subarray(i - 64) : new Uint8Array(0);\n length = a.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << (i % 4 << 3);\n }\n tail[i >> 2] |= 128 << (i % 4 << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(state, tail);\n return state;\n }\n function rhex(n) {\n var s = \"\",\n j;\n for (j = 0; j < 4; j += 1) {\n s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15];\n }\n return s;\n }\n function hex(x) {\n var i;\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n return x.join(\"\");\n }\n if (hex(md51(\"hello\")) !== \"5d41402abc4b2a76b9719d911017c592\") ;\n if (typeof ArrayBuffer !== \"undefined\" && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = val | 0 || 0;\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n return Math.min(val, length);\n }\n ArrayBuffer.prototype.slice = function (from, to) {\n var length = this.byteLength,\n begin = clamp(from, length),\n end = length,\n num,\n target,\n targetArray,\n sourceArray;\n if (to !== undefined$1) {\n end = clamp(to, length);\n }\n if (begin > end) {\n return new ArrayBuffer(0);\n }\n num = end - begin;\n target = new ArrayBuffer(num);\n targetArray = new Uint8Array(target);\n sourceArray = new Uint8Array(this, begin, num);\n targetArray.set(sourceArray);\n return target;\n };\n })();\n }\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n return str;\n }\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n return returnUInt8Array ? arr : buff;\n }\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\n function concatenateArrayBuffers(first, second, returnUInt8Array) {\n var result = new Uint8Array(first.byteLength + second.byteLength);\n result.set(new Uint8Array(first));\n result.set(new Uint8Array(second), first.byteLength);\n return returnUInt8Array ? result : result.buffer;\n }\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n return String.fromCharCode.apply(String, bytes);\n }\n function SparkMD5() {\n this.reset();\n }\n SparkMD5.prototype.append = function (str) {\n this.appendBinary(toUtf8(str));\n return this;\n };\n SparkMD5.prototype.appendBinary = function (contents) {\n this._buff += contents;\n this._length += contents.length;\n var length = this._buff.length,\n i;\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n this._buff = this._buff.substring(i - 64);\n return this;\n };\n SparkMD5.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n i,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n ret;\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3);\n }\n this._finish(tail, length);\n ret = hex(this._hash);\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n this.reset();\n return ret;\n };\n SparkMD5.prototype.reset = function () {\n this._buff = \"\";\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n return this;\n };\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash.slice()\n };\n };\n SparkMD5.prototype.setState = function (state) {\n this._buff = state.buff;\n this._length = state.length;\n this._hash = state.hash;\n return this;\n };\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\n SparkMD5.prototype._finish = function (tail, length) {\n var i = length,\n tmp,\n lo,\n hi;\n tail[i >> 2] |= 128 << (i % 4 << 3);\n if (i > 55) {\n md5cycle(this._hash, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n tmp = this._length * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(this._hash, tail);\n };\n SparkMD5.hash = function (str, raw) {\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n return raw ? hexToBinaryString(ret) : ret;\n };\n SparkMD5.ArrayBuffer = function () {\n this.reset();\n };\n SparkMD5.ArrayBuffer.prototype.append = function (arr) {\n var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),\n length = buff.length,\n i;\n this._length += arr.byteLength;\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n this._buff = i - 64 < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n return this;\n };\n SparkMD5.ArrayBuffer.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n i,\n ret;\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << (i % 4 << 3);\n }\n this._finish(tail, length);\n ret = hex(this._hash);\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n this.reset();\n return ret;\n };\n SparkMD5.ArrayBuffer.prototype.reset = function () {\n this._buff = new Uint8Array(0);\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n return this;\n };\n SparkMD5.ArrayBuffer.prototype.getState = function () {\n var state = SparkMD5.prototype.getState.call(this);\n state.buff = arrayBuffer2Utf8Str(state.buff);\n return state;\n };\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n return SparkMD5.prototype.setState.call(this, state);\n };\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n SparkMD5.ArrayBuffer.hash = function (arr, raw) {\n var hash = md51_array(new Uint8Array(arr)),\n ret = hex(hash);\n return raw ? hexToBinaryString(ret) : ret;\n };\n return SparkMD5;\n });\n})(sparkMd5);\nvar SparkMD5 = sparkMd5.exports;\nconst fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;\nclass FileChecksum {\n static create(file, callback) {\n const instance = new FileChecksum(file);\n instance.create(callback);\n }\n constructor(file) {\n this.file = file;\n this.chunkSize = 2097152;\n this.chunkCount = Math.ceil(this.file.size / this.chunkSize);\n this.chunkIndex = 0;\n }\n create(callback) {\n this.callback = callback;\n this.md5Buffer = new SparkMD5.ArrayBuffer();\n this.fileReader = new FileReader();\n this.fileReader.addEventListener(\"load\", event => this.fileReaderDidLoad(event));\n this.fileReader.addEventListener(\"error\", event => this.fileReaderDidError(event));\n this.readNextChunk();\n }\n fileReaderDidLoad(event) {\n this.md5Buffer.append(event.target.result);\n if (!this.readNextChunk()) {\n const binaryDigest = this.md5Buffer.end(true);\n const base64digest = btoa(binaryDigest);\n this.callback(null, base64digest);\n }\n }\n fileReaderDidError(event) {\n this.callback(`Error reading ${this.file.name}`);\n }\n readNextChunk() {\n if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) {\n const start = this.chunkIndex * this.chunkSize;\n const end = Math.min(start + this.chunkSize, this.file.size);\n const bytes = fileSlice.call(this.file, start, end);\n this.fileReader.readAsArrayBuffer(bytes);\n this.chunkIndex++;\n return true;\n } else {\n return false;\n }\n }\n}\nfunction getMetaValue(name) {\n const element = findElement(document.head, `meta[name=\"${name}\"]`);\n if (element) {\n return element.getAttribute(\"content\");\n }\n}\nfunction findElements(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n const elements = root.querySelectorAll(selector);\n return toArray(elements);\n}\nfunction findElement(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n return root.querySelector(selector);\n}\nfunction dispatchEvent(element, type) {\n let eventInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n const disabled = element.disabled;\n const bubbles = eventInit.bubbles,\n cancelable = eventInit.cancelable,\n detail = eventInit.detail;\n const event = document.createEvent(\"Event\");\n event.initEvent(type, bubbles || true, cancelable || true);\n event.detail = detail || {};\n try {\n element.disabled = false;\n element.dispatchEvent(event);\n } finally {\n element.disabled = disabled;\n }\n return event;\n}\nfunction toArray(value) {\n if (Array.isArray(value)) {\n return value;\n } else if (Array.from) {\n return Array.from(value);\n } else {\n return [].slice.call(value);\n }\n}\nclass BlobRecord {\n constructor(file, checksum, url) {\n let customHeaders = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n this.file = file;\n this.attributes = {\n filename: file.name,\n content_type: file.type || \"application/octet-stream\",\n byte_size: file.size,\n checksum: checksum\n };\n this.xhr = new XMLHttpRequest();\n this.xhr.open(\"POST\", url, true);\n this.xhr.responseType = \"json\";\n this.xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n this.xhr.setRequestHeader(\"Accept\", \"application/json\");\n this.xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n Object.keys(customHeaders).forEach(headerKey => {\n this.xhr.setRequestHeader(headerKey, customHeaders[headerKey]);\n });\n const csrfToken = getMetaValue(\"csrf-token\");\n if (csrfToken != undefined) {\n this.xhr.setRequestHeader(\"X-CSRF-Token\", csrfToken);\n }\n this.xhr.addEventListener(\"load\", event => this.requestDidLoad(event));\n this.xhr.addEventListener(\"error\", event => this.requestDidError(event));\n }\n get status() {\n return this.xhr.status;\n }\n get response() {\n const _this$xhr = this.xhr,\n responseType = _this$xhr.responseType,\n response = _this$xhr.response;\n if (responseType == \"json\") {\n return response;\n } else {\n return JSON.parse(response);\n }\n }\n create(callback) {\n this.callback = callback;\n this.xhr.send(JSON.stringify({\n blob: this.attributes\n }));\n }\n requestDidLoad(event) {\n if (this.status >= 200 && this.status < 300) {\n const response = this.response;\n const direct_upload = response.direct_upload;\n delete response.direct_upload;\n this.attributes = response;\n this.directUploadData = direct_upload;\n this.callback(null, this.toJSON());\n } else {\n this.requestDidError(event);\n }\n }\n requestDidError(event) {\n this.callback(`Error creating Blob for \"${this.file.name}\". Status: ${this.status}`);\n }\n toJSON() {\n const result = {};\n for (const key in this.attributes) {\n result[key] = this.attributes[key];\n }\n return result;\n }\n}\nclass BlobUpload {\n constructor(blob) {\n this.blob = blob;\n this.file = blob.file;\n const _blob$directUploadDat = blob.directUploadData,\n url = _blob$directUploadDat.url,\n headers = _blob$directUploadDat.headers;\n this.xhr = new XMLHttpRequest();\n this.xhr.open(\"PUT\", url, true);\n this.xhr.responseType = \"text\";\n for (const key in headers) {\n this.xhr.setRequestHeader(key, headers[key]);\n }\n this.xhr.addEventListener(\"load\", event => this.requestDidLoad(event));\n this.xhr.addEventListener(\"error\", event => this.requestDidError(event));\n }\n create(callback) {\n this.callback = callback;\n this.xhr.send(this.file.slice());\n }\n requestDidLoad(event) {\n const _this$xhr2 = this.xhr,\n status = _this$xhr2.status,\n response = _this$xhr2.response;\n if (status >= 200 && status < 300) {\n this.callback(null, response);\n } else {\n this.requestDidError(event);\n }\n }\n requestDidError(event) {\n this.callback(`Error storing \"${this.file.name}\". Status: ${this.xhr.status}`);\n }\n}\nlet id = 0;\nclass DirectUpload {\n constructor(file, url, delegate) {\n let customHeaders = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n this.id = ++id;\n this.file = file;\n this.url = url;\n this.delegate = delegate;\n this.customHeaders = customHeaders;\n }\n create(callback) {\n FileChecksum.create(this.file, (error, checksum) => {\n if (error) {\n callback(error);\n return;\n }\n const blob = new BlobRecord(this.file, checksum, this.url, this.customHeaders);\n notify(this.delegate, \"directUploadWillCreateBlobWithXHR\", blob.xhr);\n blob.create(error => {\n if (error) {\n callback(error);\n } else {\n const upload = new BlobUpload(blob);\n notify(this.delegate, \"directUploadWillStoreFileWithXHR\", upload.xhr);\n upload.create(error => {\n if (error) {\n callback(error);\n } else {\n callback(null, blob.toJSON());\n }\n });\n }\n });\n });\n }\n}\nfunction notify(object, methodName) {\n if (object && typeof object[methodName] == \"function\") {\n for (var _len = arguments.length, messages = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n messages[_key - 2] = arguments[_key];\n }\n return object[methodName](...messages);\n }\n}\nclass DirectUploadController {\n constructor(input, file) {\n this.input = input;\n this.file = file;\n this.directUpload = new DirectUpload(this.file, this.url, this);\n this.dispatch(\"initialize\");\n }\n start(callback) {\n const hiddenInput = document.createElement(\"input\");\n hiddenInput.type = \"hidden\";\n hiddenInput.name = this.input.name;\n this.input.insertAdjacentElement(\"beforebegin\", hiddenInput);\n this.dispatch(\"start\");\n this.directUpload.create((error, attributes) => {\n if (error) {\n hiddenInput.parentNode.removeChild(hiddenInput);\n this.dispatchError(error);\n } else {\n hiddenInput.value = attributes.signed_id;\n }\n this.dispatch(\"end\");\n callback(error);\n });\n }\n uploadRequestDidProgress(event) {\n const progress = event.loaded / event.total * 100;\n if (progress) {\n this.dispatch(\"progress\", {\n progress: progress\n });\n }\n }\n get url() {\n return this.input.getAttribute(\"data-direct-upload-url\");\n }\n dispatch(name) {\n let detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n detail.file = this.file;\n detail.id = this.directUpload.id;\n return dispatchEvent(this.input, `direct-upload:${name}`, {\n detail: detail\n });\n }\n dispatchError(error) {\n const event = this.dispatch(\"error\", {\n error: error\n });\n if (!event.defaultPrevented) {\n alert(error);\n }\n }\n directUploadWillCreateBlobWithXHR(xhr) {\n this.dispatch(\"before-blob-request\", {\n xhr: xhr\n });\n }\n directUploadWillStoreFileWithXHR(xhr) {\n this.dispatch(\"before-storage-request\", {\n xhr: xhr\n });\n xhr.upload.addEventListener(\"progress\", event => this.uploadRequestDidProgress(event));\n }\n}\nconst inputSelector = \"input[type=file][data-direct-upload-url]:not([disabled])\";\nclass DirectUploadsController {\n constructor(form) {\n this.form = form;\n this.inputs = findElements(form, inputSelector).filter(input => input.files.length);\n }\n start(callback) {\n const controllers = this.createDirectUploadControllers();\n const startNextController = () => {\n const controller = controllers.shift();\n if (controller) {\n controller.start(error => {\n if (error) {\n callback(error);\n this.dispatch(\"end\");\n } else {\n startNextController();\n }\n });\n } else {\n callback();\n this.dispatch(\"end\");\n }\n };\n this.dispatch(\"start\");\n startNextController();\n }\n createDirectUploadControllers() {\n const controllers = [];\n this.inputs.forEach(input => {\n toArray(input.files).forEach(file => {\n const controller = new DirectUploadController(input, file);\n controllers.push(controller);\n });\n });\n return controllers;\n }\n dispatch(name) {\n let detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return dispatchEvent(this.form, `direct-uploads:${name}`, {\n detail: detail\n });\n }\n}\nconst processingAttribute = \"data-direct-uploads-processing\";\nconst submitButtonsByForm = new WeakMap();\nlet started = false;\nfunction start() {\n if (!started) {\n started = true;\n document.addEventListener(\"click\", didClick, true);\n document.addEventListener(\"submit\", didSubmitForm, true);\n document.addEventListener(\"ajax:before\", didSubmitRemoteElement);\n }\n}\nfunction didClick(event) {\n const target = event.target;\n if ((target.tagName == \"INPUT\" || target.tagName == \"BUTTON\") && target.type == \"submit\" && target.form) {\n submitButtonsByForm.set(target.form, target);\n }\n}\nfunction didSubmitForm(event) {\n handleFormSubmissionEvent(event);\n}\nfunction didSubmitRemoteElement(event) {\n if (event.target.tagName == \"FORM\") {\n handleFormSubmissionEvent(event);\n }\n}\nfunction handleFormSubmissionEvent(event) {\n const form = event.target;\n if (form.hasAttribute(processingAttribute)) {\n event.preventDefault();\n return;\n }\n const controller = new DirectUploadsController(form);\n const inputs = controller.inputs;\n if (inputs.length) {\n event.preventDefault();\n form.setAttribute(processingAttribute, \"\");\n inputs.forEach(disable);\n controller.start(error => {\n form.removeAttribute(processingAttribute);\n if (error) {\n inputs.forEach(enable);\n } else {\n submitForm(form);\n }\n });\n }\n}\nfunction submitForm(form) {\n let button = submitButtonsByForm.get(form) || findElement(form, \"input[type=submit], button[type=submit]\");\n if (button) {\n const _button = button,\n disabled = _button.disabled;\n button.disabled = false;\n button.focus();\n button.click();\n button.disabled = disabled;\n } else {\n button = document.createElement(\"input\");\n button.type = \"submit\";\n button.style.display = \"none\";\n form.appendChild(button);\n button.click();\n form.removeChild(button);\n }\n submitButtonsByForm.delete(form);\n}\nfunction disable(input) {\n input.disabled = true;\n}\nfunction enable(input) {\n input.disabled = false;\n}\nfunction autostart() {\n if (window.ActiveStorage) {\n start();\n }\n}\nsetTimeout(autostart, 1);\nexport { DirectUpload, DirectUploadController, DirectUploadsController, start };","import { FetchResponse } from './fetch_response';\nimport { RequestInterceptor } from './request_interceptor';\nimport { getCookie, compact, metaContent, stringEntriesFromFormData, mergeEntries } from './lib/utils';\nexport class FetchRequest {\n constructor(method, url) {\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n this.method = method;\n this.options = options;\n this.originalUrl = url.toString();\n }\n async perform() {\n try {\n const requestInterceptor = RequestInterceptor.get();\n if (requestInterceptor) {\n await requestInterceptor(this);\n }\n } catch (error) {\n console.error(error);\n }\n const response = new FetchResponse(await window.fetch(this.url, this.fetchOptions));\n if (response.unauthenticated && response.authenticationURL) {\n return Promise.reject(window.location.href = response.authenticationURL);\n }\n const responseStatusIsTurboStreamable = response.ok || response.unprocessableEntity;\n if (responseStatusIsTurboStreamable && response.isTurboStream) {\n await response.renderTurboStream();\n }\n return response;\n }\n addHeader(key, value) {\n const headers = this.additionalHeaders;\n headers[key] = value;\n this.options.headers = headers;\n }\n sameHostname() {\n if (!this.originalUrl.startsWith('http:')) {\n return true;\n }\n try {\n return new URL(this.originalUrl).hostname === window.location.hostname;\n } catch (_) {\n return true;\n }\n }\n get fetchOptions() {\n return {\n method: this.method.toUpperCase(),\n headers: this.headers,\n body: this.formattedBody,\n signal: this.signal,\n credentials: this.credentials,\n redirect: this.redirect\n };\n }\n get headers() {\n const baseHeaders = {\n 'X-Requested-With': 'XMLHttpRequest',\n 'Content-Type': this.contentType,\n Accept: this.accept\n };\n if (this.sameHostname()) {\n baseHeaders['X-CSRF-Token'] = this.csrfToken;\n }\n return compact(Object.assign(baseHeaders, this.additionalHeaders));\n }\n get csrfToken() {\n return getCookie(metaContent('csrf-param')) || metaContent('csrf-token');\n }\n get contentType() {\n if (this.options.contentType) {\n return this.options.contentType;\n } else if (this.body == null || this.body instanceof window.FormData) {\n return undefined;\n } else if (this.body instanceof window.File) {\n return this.body.type;\n }\n return 'application/json';\n }\n get accept() {\n switch (this.responseKind) {\n case 'html':\n return 'text/html, application/xhtml+xml';\n case 'turbo-stream':\n return 'text/vnd.turbo-stream.html, text/html, application/xhtml+xml';\n case 'json':\n return 'application/json, application/vnd.api+json';\n default:\n return '*/*';\n }\n }\n get body() {\n return this.options.body;\n }\n get query() {\n const originalQuery = (this.originalUrl.split('?')[1] || '').split('#')[0];\n const params = new URLSearchParams(originalQuery);\n let requestQuery = this.options.query;\n if (requestQuery instanceof window.FormData) {\n requestQuery = stringEntriesFromFormData(requestQuery);\n } else if (requestQuery instanceof window.URLSearchParams) {\n requestQuery = requestQuery.entries();\n } else {\n requestQuery = Object.entries(requestQuery || {});\n }\n mergeEntries(params, requestQuery);\n const query = params.toString();\n return query.length > 0 ? `?${query}` : '';\n }\n get url() {\n return this.originalUrl.split('?')[0].split('#')[0] + this.query;\n }\n get responseKind() {\n return this.options.responseKind || 'html';\n }\n get signal() {\n return this.options.signal;\n }\n get redirect() {\n return this.options.redirect || 'follow';\n }\n get credentials() {\n return this.options.credentials || 'same-origin';\n }\n get additionalHeaders() {\n return this.options.headers || {};\n }\n get formattedBody() {\n const bodyIsAString = Object.prototype.toString.call(this.body) === '[object String]';\n const contentTypeIsJson = this.headers['Content-Type'] === 'application/json';\n if (contentTypeIsJson && !bodyIsAString) {\n return JSON.stringify(this.body);\n }\n return this.body;\n }\n}","export class FetchResponse {\n constructor(response) {\n this.response = response;\n }\n get statusCode() {\n return this.response.status;\n }\n get redirected() {\n return this.response.redirected;\n }\n get ok() {\n return this.response.ok;\n }\n get unauthenticated() {\n return this.statusCode === 401;\n }\n get unprocessableEntity() {\n return this.statusCode === 422;\n }\n get authenticationURL() {\n return this.response.headers.get('WWW-Authenticate');\n }\n get contentType() {\n const contentType = this.response.headers.get('Content-Type') || '';\n return contentType.replace(/;.*$/, '');\n }\n get headers() {\n return this.response.headers;\n }\n get html() {\n if (this.contentType.match(/^(application|text)\\/(html|xhtml\\+xml)$/)) {\n return this.text;\n }\n return Promise.reject(new Error(`Expected an HTML response but got \"${this.contentType}\" instead`));\n }\n get json() {\n if (this.contentType.match(/^application\\/.*json$/)) {\n return this.responseJson || (this.responseJson = this.response.json());\n }\n return Promise.reject(new Error(`Expected a JSON response but got \"${this.contentType}\" instead`));\n }\n get text() {\n return this.responseText || (this.responseText = this.response.text());\n }\n get isTurboStream() {\n return this.contentType.match(/^text\\/vnd\\.turbo-stream\\.html/);\n }\n async renderTurboStream() {\n if (this.isTurboStream) {\n if (window.Turbo) {\n await window.Turbo.renderStreamMessage(await this.text);\n } else {\n console.warn('You must set `window.Turbo = Turbo` to automatically process Turbo Stream events with request.js');\n }\n } else {\n return Promise.reject(new Error(`Expected a Turbo Stream response but got \"${this.contentType}\" instead`));\n }\n }\n}","import { FetchRequest } from './fetch_request';\nimport { FetchResponse } from './fetch_response';\nimport { RequestInterceptor } from './request_interceptor';\nimport { get, post, put, patch, destroy } from './verbs';\nexport { FetchRequest, FetchResponse, RequestInterceptor, get, post, put, patch, destroy };","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nexport function getCookie(name) {\n const cookies = document.cookie ? document.cookie.split('; ') : [];\n const prefix = `${encodeURIComponent(name)}=`;\n const cookie = cookies.find(cookie => cookie.startsWith(prefix));\n if (cookie) {\n const value = cookie.split('=').slice(1).join('=');\n if (value) {\n return decodeURIComponent(value);\n }\n }\n}\nexport function compact(object) {\n const result = {};\n for (const key in object) {\n const value = object[key];\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result;\n}\nexport function metaContent(name) {\n const element = document.head.querySelector(`meta[name=\"${name}\"]`);\n return element && element.content;\n}\nexport function stringEntriesFromFormData(formData) {\n return [...formData].reduce((entries, _ref) => {\n let _ref2 = _slicedToArray(_ref, 2),\n name = _ref2[0],\n value = _ref2[1];\n return entries.concat(typeof value === 'string' ? [[name, value]] : []);\n }, []);\n}\nexport function mergeEntries(searchParams, entries) {\n for (const _ref3 of entries) {\n var _ref4 = _slicedToArray(_ref3, 2);\n const name = _ref4[0];\n const value = _ref4[1];\n if (value instanceof window.File) continue;\n if (searchParams.has(name) && !name.includes('[]')) {\n searchParams.delete(name);\n searchParams.set(name, value);\n } else {\n searchParams.append(name, value);\n }\n }\n}","export class RequestInterceptor {\n static register(interceptor) {\n this.interceptor = interceptor;\n }\n static get() {\n return this.interceptor;\n }\n static reset() {\n this.interceptor = undefined;\n }\n}","import { FetchRequest } from './fetch_request';\nasync function get(url, options) {\n const request = new FetchRequest('get', url, options);\n return request.perform();\n}\nasync function post(url, options) {\n const request = new FetchRequest('post', url, options);\n return request.perform();\n}\nasync function put(url, options) {\n const request = new FetchRequest('put', url, options);\n return request.perform();\n}\nasync function patch(url, options) {\n const request = new FetchRequest('patch', url, options);\n return request.perform();\n}\nasync function destroy(url, options) {\n const request = new FetchRequest('delete', url, options);\n return request.perform();\n}\nexport { get, post, put, patch, destroy };","import $ewBKy$justextend from \"just-extend\";\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\nclass $4040acfd8584338d$export$2e2bcd8739ae039 {\n // Add an event listener for given event\n on(event, fn) {\n this._callbacks = this._callbacks || {};\n // Create namespace for this event\n if (!this._callbacks[event]) this._callbacks[event] = [];\n this._callbacks[event].push(fn);\n return this;\n }\n emit(event) {\n this._callbacks = this._callbacks || {};\n let callbacks = this._callbacks[event];\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (callbacks) for (let callback of callbacks) callback.apply(this, args);\n // trigger a corresponding DOM event\n if (this.element) this.element.dispatchEvent(this.makeEvent(\"dropzone:\" + event, {\n args: args\n }));\n return this;\n }\n makeEvent(eventName, detail) {\n let params = {\n bubbles: true,\n cancelable: true,\n detail: detail\n };\n if (typeof window.CustomEvent === \"function\") return new CustomEvent(eventName, params);else {\n // IE 11 support\n // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent\n var evt = document.createEvent(\"CustomEvent\");\n evt.initCustomEvent(eventName, params.bubbles, params.cancelable, params.detail);\n return evt;\n }\n }\n // Remove event listener for given event. If fn is not provided, all event\n // listeners for that event will be removed. If neither is provided, all\n // event listeners will be removed.\n off(event, fn) {\n if (!this._callbacks || arguments.length === 0) {\n this._callbacks = {};\n return this;\n }\n // specific event\n let callbacks = this._callbacks[event];\n if (!callbacks) return this;\n // remove all handlers\n if (arguments.length === 1) {\n delete this._callbacks[event];\n return this;\n }\n // remove specific handler\n for (let i = 0; i < callbacks.length; i++) {\n let callback = callbacks[i];\n if (callback === fn) {\n callbacks.splice(i, 1);\n break;\n }\n }\n return this;\n }\n}\nvar $fd6031f88dce2e32$exports = {};\n$fd6031f88dce2e32$exports = \"
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n
\\n \\n \\n \\n
\\n
\\n \\n \\n \\n
\\n
\\n\";\nlet $4ca367182776f80b$var$defaultOptions = {\n /**\n * Has to be specified on elements other than form (or when the form doesn't\n * have an `action` attribute).\n *\n * You can also provide a function that will be called with `files` and\n * `dataBlocks` and must return the url as string.\n */\n url: null,\n /**\n * Can be changed to `\"put\"` if necessary. You can also provide a function\n * that will be called with `files` and must return the method (since `v3.12.0`).\n */\n method: \"post\",\n /**\n * Will be set on the XHRequest.\n */\n withCredentials: false,\n /**\n * The timeout for the XHR requests in milliseconds (since `v4.4.0`).\n * If set to null or 0, no timeout is going to be set.\n */\n timeout: null,\n /**\n * How many file uploads to process in parallel (See the\n * Enqueuing file uploads documentation section for more info)\n */\n parallelUploads: 2,\n /**\n * Whether to send multiple files in one request. If\n * this it set to true, then the fallback file input element will\n * have the `multiple` attribute as well. This option will\n * also trigger additional events (like `processingmultiple`). See the events\n * documentation section for more information.\n */\n uploadMultiple: false,\n /**\n * Whether you want files to be uploaded in chunks to your server. This can't be\n * used in combination with `uploadMultiple`.\n *\n * See [chunksUploaded](#config-chunksUploaded) for the callback to finalise an upload.\n */\n chunking: false,\n /**\n * If `chunking` is enabled, this defines whether **every** file should be chunked,\n * even if the file size is below chunkSize. This means, that the additional chunk\n * form data will be submitted and the `chunksUploaded` callback will be invoked.\n */\n forceChunking: false,\n /**\n * If `chunking` is `true`, then this defines the chunk size in bytes.\n */\n chunkSize: 2097152,\n /**\n * If `true`, the individual chunks of a file are being uploaded simultaneously.\n */\n parallelChunkUploads: false,\n /**\n * Whether a chunk should be retried if it fails.\n */\n retryChunks: false,\n /**\n * If `retryChunks` is true, how many times should it be retried.\n */\n retryChunksLimit: 3,\n /**\n * The maximum filesize (in MiB) that is allowed to be uploaded.\n */\n maxFilesize: 256,\n /**\n * The name of the file param that gets transferred.\n * **NOTE**: If you have the option `uploadMultiple` set to `true`, then\n * Dropzone will append `[]` to the name.\n */\n paramName: \"file\",\n /**\n * Whether thumbnails for images should be generated\n */\n createImageThumbnails: true,\n /**\n * In MB. When the filename exceeds this limit, the thumbnail will not be generated.\n */\n maxThumbnailFilesize: 10,\n /**\n * If `null`, the ratio of the image will be used to calculate it.\n */\n thumbnailWidth: 120,\n /**\n * The same as `thumbnailWidth`. If both are null, images will not be resized.\n */\n thumbnailHeight: 120,\n /**\n * How the images should be scaled down in case both, `thumbnailWidth` and `thumbnailHeight` are provided.\n * Can be either `contain` or `crop`.\n */\n thumbnailMethod: \"crop\",\n /**\n * If set, images will be resized to these dimensions before being **uploaded**.\n * If only one, `resizeWidth` **or** `resizeHeight` is provided, the original aspect\n * ratio of the file will be preserved.\n *\n * The `options.transformFile` function uses these options, so if the `transformFile` function\n * is overridden, these options don't do anything.\n */\n resizeWidth: null,\n /**\n * See `resizeWidth`.\n */\n resizeHeight: null,\n /**\n * The mime type of the resized image (before it gets uploaded to the server).\n * If `null` the original mime type will be used. To force jpeg, for example, use `image/jpeg`.\n * See `resizeWidth` for more information.\n */\n resizeMimeType: null,\n /**\n * The quality of the resized images. See `resizeWidth`.\n */\n resizeQuality: 0.8,\n /**\n * How the images should be scaled down in case both, `resizeWidth` and `resizeHeight` are provided.\n * Can be either `contain` or `crop`.\n */\n resizeMethod: \"contain\",\n /**\n * The base that is used to calculate the **displayed** filesize. You can\n * change this to 1024 if you would rather display kibibytes, mebibytes,\n * etc... 1024 is technically incorrect, because `1024 bytes` are `1 kibibyte`\n * not `1 kilobyte`. You can change this to `1024` if you don't care about\n * validity.\n */\n filesizeBase: 1000,\n /**\n * If not `null` defines how many files this Dropzone handles. If it exceeds,\n * the event `maxfilesexceeded` will be called. The dropzone element gets the\n * class `dz-max-files-reached` accordingly so you can provide visual\n * feedback.\n */\n maxFiles: null,\n /**\n * An optional object to send additional headers to the server. Eg:\n * `{ \"My-Awesome-Header\": \"header value\" }`\n */\n headers: null,\n /**\n * Should the default headers be set or not?\n * Accept: application/json <- for requesting json response\n * Cache-Control: no-cache <- Request shouldnt be cached\n * X-Requested-With: XMLHttpRequest <- We sent the request via XMLHttpRequest\n */\n defaultHeaders: true,\n /**\n * If `true`, the dropzone element itself will be clickable, if `false`\n * nothing will be clickable.\n *\n * You can also pass an HTML element, a CSS selector (for multiple elements)\n * or an array of those. In that case, all of those elements will trigger an\n * upload when clicked.\n */\n clickable: true,\n /**\n * Whether hidden files in directories should be ignored.\n */\n ignoreHiddenFiles: true,\n /**\n * The default implementation of `accept` checks the file's mime type or\n * extension against this list. This is a comma separated list of mime\n * types or file extensions.\n *\n * Eg.: `image/*,application/pdf,.psd`\n *\n * If the Dropzone is `clickable` this option will also be used as\n * [`accept`](https://developer.mozilla.org/en-US/docs/HTML/Element/input#attr-accept)\n * parameter on the hidden file input as well.\n */\n acceptedFiles: null,\n /**\n * **Deprecated!**\n * Use acceptedFiles instead.\n */\n acceptedMimeTypes: null,\n /**\n * If false, files will be added to the queue but the queue will not be\n * processed automatically.\n * This can be useful if you need some additional user input before sending\n * files (or if you want want all files sent at once).\n * If you're ready to send the file simply call `myDropzone.processQueue()`.\n *\n * See the [enqueuing file uploads](#enqueuing-file-uploads) documentation\n * section for more information.\n */\n autoProcessQueue: true,\n /**\n * If false, files added to the dropzone will not be queued by default.\n * You'll have to call `enqueueFile(file)` manually.\n */\n autoQueue: true,\n /**\n * If `true`, this will add a link to every file preview to remove or cancel (if\n * already uploading) the file. The `dictCancelUpload`, `dictCancelUploadConfirmation`\n * and `dictRemoveFile` options are used for the wording.\n */\n addRemoveLinks: false,\n /**\n * Defines where to display the file previews – if `null` the\n * Dropzone element itself is used. Can be a plain `HTMLElement` or a CSS\n * selector. The element should have the `dropzone-previews` class so\n * the previews are displayed properly.\n */\n previewsContainer: null,\n /**\n * Set this to `true` if you don't want previews to be shown.\n */\n disablePreviews: false,\n /**\n * This is the element the hidden input field (which is used when clicking on the\n * dropzone to trigger file selection) will be appended to. This might\n * be important in case you use frameworks to switch the content of your page.\n *\n * Can be a selector string, or an element directly.\n */\n hiddenInputContainer: \"body\",\n /**\n * If null, no capture type will be specified\n * If camera, mobile devices will skip the file selection and choose camera\n * If microphone, mobile devices will skip the file selection and choose the microphone\n * If camcorder, mobile devices will skip the file selection and choose the camera in video mode\n * On apple devices multiple must be set to false. AcceptedFiles may need to\n * be set to an appropriate mime type (e.g. \"image/*\", \"audio/*\", or \"video/*\").\n */\n capture: null,\n /**\n * **Deprecated**. Use `renameFile` instead.\n */\n renameFilename: null,\n /**\n * A function that is invoked before the file is uploaded to the server and renames the file.\n * This function gets the `File` as argument and can use the `file.name`. The actual name of the\n * file that gets used during the upload can be accessed through `file.upload.filename`.\n */\n renameFile: null,\n /**\n * If `true` the fallback will be forced. This is very useful to test your server\n * implementations first and make sure that everything works as\n * expected without dropzone if you experience problems, and to test\n * how your fallbacks will look.\n */\n forceFallback: false,\n /**\n * The text used before any files are dropped.\n */\n dictDefaultMessage: \"Drop files here to upload\",\n /**\n * The text that replaces the default message text it the browser is not supported.\n */\n dictFallbackMessage: \"Your browser does not support drag'n'drop file uploads.\",\n /**\n * The text that will be added before the fallback form.\n * If you provide a fallback element yourself, or if this option is `null` this will\n * be ignored.\n */\n dictFallbackText: \"Please use the fallback form below to upload your files like in the olden days.\",\n /**\n * If the filesize is too big.\n * `{{filesize}}` and `{{maxFilesize}}` will be replaced with the respective configuration values.\n */\n dictFileTooBig: \"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.\",\n /**\n * If the file doesn't match the file type.\n */\n dictInvalidFileType: \"You can't upload files of this type.\",\n /**\n * If the server response was invalid.\n * `{{statusCode}}` will be replaced with the servers status code.\n */\n dictResponseError: \"Server responded with {{statusCode}} code.\",\n /**\n * If `addRemoveLinks` is true, the text to be used for the cancel upload link.\n */\n dictCancelUpload: \"Cancel upload\",\n /**\n * The text that is displayed if an upload was manually canceled\n */\n dictUploadCanceled: \"Upload canceled.\",\n /**\n * If `addRemoveLinks` is true, the text to be used for confirmation when cancelling upload.\n */\n dictCancelUploadConfirmation: \"Are you sure you want to cancel this upload?\",\n /**\n * If `addRemoveLinks` is true, the text to be used to remove a file.\n */\n dictRemoveFile: \"Remove file\",\n /**\n * If this is not null, then the user will be prompted before removing a file.\n */\n dictRemoveFileConfirmation: null,\n /**\n * Displayed if `maxFiles` is st and exceeded.\n * The string `{{maxFiles}}` will be replaced by the configuration value.\n */\n dictMaxFilesExceeded: \"You can not upload any more files.\",\n /**\n * Allows you to translate the different units. Starting with `tb` for terabytes and going down to\n * `b` for bytes.\n */\n dictFileSizeUnits: {\n tb: \"TB\",\n gb: \"GB\",\n mb: \"MB\",\n kb: \"KB\",\n b: \"b\"\n },\n /**\n * Called when dropzone initialized\n * You can add event listeners here\n */\n init() {},\n /**\n * Can be an **object** of additional parameters to transfer to the server, **or** a `Function`\n * that gets invoked with the `files`, `xhr` and, if it's a chunked upload, `chunk` arguments. In case\n * of a function, this needs to return a map.\n *\n * The default implementation does nothing for normal uploads, but adds relevant information for\n * chunked uploads.\n *\n * This is the same as adding hidden input fields in the form element.\n */\n params(files, xhr, chunk) {\n if (chunk) return {\n dzuuid: chunk.file.upload.uuid,\n dzchunkindex: chunk.index,\n dztotalfilesize: chunk.file.size,\n dzchunksize: this.options.chunkSize,\n dztotalchunkcount: chunk.file.upload.totalChunkCount,\n dzchunkbyteoffset: chunk.index * this.options.chunkSize\n };\n },\n /**\n * A function that gets a [file](https://developer.mozilla.org/en-US/docs/DOM/File)\n * and a `done` function as parameters.\n *\n * If the done function is invoked without arguments, the file is \"accepted\" and will\n * be processed. If you pass an error message, the file is rejected, and the error\n * message will be displayed.\n * This function will not be called if the file is too big or doesn't match the mime types.\n */\n accept(file, done) {\n return done();\n },\n /**\n * The callback that will be invoked when all chunks have been uploaded for a file.\n * It gets the file for which the chunks have been uploaded as the first parameter,\n * and the `done` function as second. `done()` needs to be invoked when everything\n * needed to finish the upload process is done.\n */\n chunksUploaded: function (file, done) {\n done();\n },\n /**\n * Sends the file as binary blob in body instead of form data.\n * If this is set, the `params` option will be ignored.\n * It's an error to set this to `true` along with `uploadMultiple` since\n * multiple files cannot be in a single binary body.\n */\n binaryBody: false,\n /**\n * Gets called when the browser is not supported.\n * The default implementation shows the fallback input field and adds\n * a text.\n */\n fallback() {\n // This code should pass in IE7... :(\n let messageElement;\n this.element.className = `${this.element.className} dz-browser-not-supported`;\n for (let child of this.element.getElementsByTagName(\"div\")) if (/(^| )dz-message($| )/.test(child.className)) {\n messageElement = child;\n child.className = \"dz-message\"; // Removes the 'dz-default' class\n break;\n }\n if (!messageElement) {\n messageElement = $3ed269f2f0fb224b$export$2e2bcd8739ae039.createElement('
');\n this.element.appendChild(messageElement);\n }\n let span = messageElement.getElementsByTagName(\"span\")[0];\n if (span) {\n if (span.textContent != null) span.textContent = this.options.dictFallbackMessage;else if (span.innerText != null) span.innerText = this.options.dictFallbackMessage;\n }\n return this.element.appendChild(this.getFallbackForm());\n },\n /**\n * Gets called to calculate the thumbnail dimensions.\n *\n * It gets `file`, `width` and `height` (both may be `null`) as parameters and must return an object containing:\n *\n * - `srcWidth` & `srcHeight` (required)\n * - `trgWidth` & `trgHeight` (required)\n * - `srcX` & `srcY` (optional, default `0`)\n * - `trgX` & `trgY` (optional, default `0`)\n *\n * Those values are going to be used by `ctx.drawImage()`.\n */\n resize(file, width, height, resizeMethod) {\n let info = {\n srcX: 0,\n srcY: 0,\n srcWidth: file.width,\n srcHeight: file.height\n };\n let srcRatio = file.width / file.height;\n // Automatically calculate dimensions if not specified\n if (width == null && height == null) {\n width = info.srcWidth;\n height = info.srcHeight;\n } else if (width == null) width = height * srcRatio;else if (height == null) height = width / srcRatio;\n // Make sure images aren't upscaled\n width = Math.min(width, info.srcWidth);\n height = Math.min(height, info.srcHeight);\n let trgRatio = width / height;\n if (info.srcWidth > width || info.srcHeight > height) {\n // Image is bigger and needs rescaling\n if (resizeMethod === \"crop\") {\n if (srcRatio > trgRatio) {\n info.srcHeight = file.height;\n info.srcWidth = info.srcHeight * trgRatio;\n } else {\n info.srcWidth = file.width;\n info.srcHeight = info.srcWidth / trgRatio;\n }\n } else if (resizeMethod === \"contain\") {\n // Method 'contain'\n if (srcRatio > trgRatio) height = width / srcRatio;else width = height * srcRatio;\n } else throw new Error(`Unknown resizeMethod '${resizeMethod}'`);\n }\n info.srcX = (file.width - info.srcWidth) / 2;\n info.srcY = (file.height - info.srcHeight) / 2;\n info.trgWidth = width;\n info.trgHeight = height;\n return info;\n },\n /**\n * Can be used to transform the file (for example, resize an image if necessary).\n *\n * The default implementation uses `resizeWidth` and `resizeHeight` (if provided) and resizes\n * images according to those dimensions.\n *\n * Gets the `file` as the first parameter, and a `done()` function as the second, that needs\n * to be invoked with the file when the transformation is done.\n */\n transformFile(file, done) {\n if ((this.options.resizeWidth || this.options.resizeHeight) && file.type.match(/image.*/)) return this.resizeImage(file, this.options.resizeWidth, this.options.resizeHeight, this.options.resizeMethod, done);else return done(file);\n },\n /**\n * A string that contains the template used for each dropped\n * file. Change it to fulfill your needs but make sure to properly\n * provide all elements.\n *\n * If you want to use an actual HTML element instead of providing a String\n * as a config option, you could create a div with the id `tpl`,\n * put the template inside it and provide the element like this:\n *\n * document\n * .querySelector('#tpl')\n * .innerHTML\n *\n */\n previewTemplate: /*@__PURE__*/$parcel$interopDefault($fd6031f88dce2e32$exports),\n /*\n Those functions register themselves to the events on init and handle all\n the user interface specific stuff. Overwriting them won't break the upload\n but can break the way it's displayed.\n You can overwrite them if you don't like the default behavior. If you just\n want to add an additional event handler, register it on the dropzone object\n and don't overwrite those options.\n */ // Those are self explanatory and simply concern the DragnDrop.\n drop(e) {\n return this.element.classList.remove(\"dz-drag-hover\");\n },\n dragstart(e) {},\n dragend(e) {\n return this.element.classList.remove(\"dz-drag-hover\");\n },\n dragenter(e) {\n return this.element.classList.add(\"dz-drag-hover\");\n },\n dragover(e) {\n return this.element.classList.add(\"dz-drag-hover\");\n },\n dragleave(e) {\n return this.element.classList.remove(\"dz-drag-hover\");\n },\n paste(e) {},\n // Called whenever there are no files left in the dropzone anymore, and the\n // dropzone should be displayed as if in the initial state.\n reset() {\n return this.element.classList.remove(\"dz-started\");\n },\n // Called when a file is added to the queue\n // Receives `file`\n addedfile(file) {\n if (this.element === this.previewsContainer) this.element.classList.add(\"dz-started\");\n if (this.previewsContainer && !this.options.disablePreviews) {\n file.previewElement = $3ed269f2f0fb224b$export$2e2bcd8739ae039.createElement(this.options.previewTemplate.trim());\n file.previewTemplate = file.previewElement; // Backwards compatibility\n this.previewsContainer.appendChild(file.previewElement);\n for (var node of file.previewElement.querySelectorAll(\"[data-dz-name]\")) node.textContent = file.name;\n for (node of file.previewElement.querySelectorAll(\"[data-dz-size]\")) node.innerHTML = this.filesize(file.size);\n if (this.options.addRemoveLinks) {\n file._removeLink = $3ed269f2f0fb224b$export$2e2bcd8739ae039.createElement(`${this.options.dictRemoveFile}`);\n file.previewElement.appendChild(file._removeLink);\n }\n let removeFileEvent = e => {\n e.preventDefault();\n e.stopPropagation();\n if (file.status === $3ed269f2f0fb224b$export$2e2bcd8739ae039.UPLOADING) return $3ed269f2f0fb224b$export$2e2bcd8739ae039.confirm(this.options.dictCancelUploadConfirmation, () => this.removeFile(file));else {\n if (this.options.dictRemoveFileConfirmation) return $3ed269f2f0fb224b$export$2e2bcd8739ae039.confirm(this.options.dictRemoveFileConfirmation, () => this.removeFile(file));else return this.removeFile(file);\n }\n };\n for (let removeLink of file.previewElement.querySelectorAll(\"[data-dz-remove]\")) removeLink.addEventListener(\"click\", removeFileEvent);\n }\n },\n // Called whenever a file is removed.\n removedfile(file) {\n if (file.previewElement != null && file.previewElement.parentNode != null) file.previewElement.parentNode.removeChild(file.previewElement);\n return this._updateMaxFilesReachedClass();\n },\n // Called when a thumbnail has been generated\n // Receives `file` and `dataUrl`\n thumbnail(file, dataUrl) {\n if (file.previewElement) {\n file.previewElement.classList.remove(\"dz-file-preview\");\n for (let thumbnailElement of file.previewElement.querySelectorAll(\"[data-dz-thumbnail]\")) {\n thumbnailElement.alt = file.name;\n thumbnailElement.src = dataUrl;\n }\n return setTimeout(() => file.previewElement.classList.add(\"dz-image-preview\"), 1);\n }\n },\n // Called whenever an error occurs\n // Receives `file` and `message`\n error(file, message) {\n if (file.previewElement) {\n file.previewElement.classList.add(\"dz-error\");\n if (typeof message !== \"string\" && message.error) message = message.error;\n for (let node of file.previewElement.querySelectorAll(\"[data-dz-errormessage]\")) node.textContent = message;\n }\n },\n errormultiple() {},\n // Called when a file gets processed. Since there is a cue, not all added\n // files are processed immediately.\n // Receives `file`\n processing(file) {\n if (file.previewElement) {\n file.previewElement.classList.add(\"dz-processing\");\n if (file._removeLink) return file._removeLink.innerHTML = this.options.dictCancelUpload;\n }\n },\n processingmultiple() {},\n // Called whenever the upload progress gets updated.\n // Receives `file`, `progress` (percentage 0-100) and `bytesSent`.\n // To get the total number of bytes of the file, use `file.size`\n uploadprogress(file, progress, bytesSent) {\n if (file.previewElement) for (let node of file.previewElement.querySelectorAll(\"[data-dz-uploadprogress]\")) node.nodeName === \"PROGRESS\" ? node.value = progress : node.style.width = `${progress}%`;\n },\n // Called whenever the total upload progress gets updated.\n // Called with totalUploadProgress (0-100), totalBytes and totalBytesSent\n totaluploadprogress() {},\n // Called just before the file is sent. Gets the `xhr` object as second\n // parameter, so you can modify it (for example to add a CSRF token) and a\n // `formData` object to add additional information.\n sending() {},\n sendingmultiple() {},\n // When the complete upload is finished and successful\n // Receives `file`\n success(file) {\n if (file.previewElement) return file.previewElement.classList.add(\"dz-success\");\n },\n successmultiple() {},\n // When the upload is canceled.\n canceled(file) {\n return this.emit(\"error\", file, this.options.dictUploadCanceled);\n },\n canceledmultiple() {},\n // When the upload is finished, either with success or an error.\n // Receives `file`\n complete(file) {\n if (file._removeLink) file._removeLink.innerHTML = this.options.dictRemoveFile;\n if (file.previewElement) return file.previewElement.classList.add(\"dz-complete\");\n },\n completemultiple() {},\n maxfilesexceeded() {},\n maxfilesreached() {},\n queuecomplete() {},\n addedfiles() {}\n};\nvar $4ca367182776f80b$export$2e2bcd8739ae039 = $4ca367182776f80b$var$defaultOptions;\nclass $3ed269f2f0fb224b$export$2e2bcd8739ae039 extends $4040acfd8584338d$export$2e2bcd8739ae039 {\n static initClass() {\n // Exposing the emitter class, mainly for tests\n this.prototype.Emitter = $4040acfd8584338d$export$2e2bcd8739ae039;\n /*\n This is a list of all available events you can register on a dropzone object.\n You can register an event handler like this:\n dropzone.on(\"dragEnter\", function() { });\n */\n this.prototype.events = [\"drop\", \"dragstart\", \"dragend\", \"dragenter\", \"dragover\", \"dragleave\", \"addedfile\", \"addedfiles\", \"removedfile\", \"thumbnail\", \"error\", \"errormultiple\", \"processing\", \"processingmultiple\", \"uploadprogress\", \"totaluploadprogress\", \"sending\", \"sendingmultiple\", \"success\", \"successmultiple\", \"canceled\", \"canceledmultiple\", \"complete\", \"completemultiple\", \"reset\", \"maxfilesexceeded\", \"maxfilesreached\", \"queuecomplete\"];\n this.prototype._thumbnailQueue = [];\n this.prototype._processingThumbnail = false;\n }\n // Returns all files that have been accepted\n getAcceptedFiles() {\n return this.files.filter(file => file.accepted).map(file => file);\n }\n // Returns all files that have been rejected\n // Not sure when that's going to be useful, but added for completeness.\n getRejectedFiles() {\n return this.files.filter(file => !file.accepted).map(file => file);\n }\n getFilesWithStatus(status) {\n return this.files.filter(file => file.status === status).map(file => file);\n }\n // Returns all files that are in the queue\n getQueuedFiles() {\n return this.getFilesWithStatus($3ed269f2f0fb224b$export$2e2bcd8739ae039.QUEUED);\n }\n getUploadingFiles() {\n return this.getFilesWithStatus($3ed269f2f0fb224b$export$2e2bcd8739ae039.UPLOADING);\n }\n getAddedFiles() {\n return this.getFilesWithStatus($3ed269f2f0fb224b$export$2e2bcd8739ae039.ADDED);\n }\n // Files that are either queued or uploading\n getActiveFiles() {\n return this.files.filter(file => file.status === $3ed269f2f0fb224b$export$2e2bcd8739ae039.UPLOADING || file.status === $3ed269f2f0fb224b$export$2e2bcd8739ae039.QUEUED).map(file => file);\n }\n // The function that gets called when Dropzone is initialized. You\n // can (and should) setup event listeners inside this function.\n init() {\n // In case it isn't set already\n if (this.element.tagName === \"form\") this.element.setAttribute(\"enctype\", \"multipart/form-data\");\n if (this.element.classList.contains(\"dropzone\") && !this.element.querySelector(\".dz-message\")) this.element.appendChild($3ed269f2f0fb224b$export$2e2bcd8739ae039.createElement(`
`));\n if (this.clickableElements.length) {\n let setupHiddenFileInput = () => {\n if (this.hiddenFileInput) this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);\n this.hiddenFileInput = document.createElement(\"input\");\n this.hiddenFileInput.setAttribute(\"type\", \"file\");\n if (this.options.maxFiles === null || this.options.maxFiles > 1) this.hiddenFileInput.setAttribute(\"multiple\", \"multiple\");\n this.hiddenFileInput.className = \"dz-hidden-input\";\n if (this.options.acceptedFiles !== null) this.hiddenFileInput.setAttribute(\"accept\", this.options.acceptedFiles);\n if (this.options.capture !== null) this.hiddenFileInput.setAttribute(\"capture\", this.options.capture);\n // Making sure that no one can \"tab\" into this field.\n this.hiddenFileInput.setAttribute(\"tabindex\", \"-1\");\n // Not setting `display=\"none\"` because some browsers don't accept clicks\n // on elements that aren't displayed.\n this.hiddenFileInput.style.visibility = \"hidden\";\n this.hiddenFileInput.style.position = \"absolute\";\n this.hiddenFileInput.style.top = \"0\";\n this.hiddenFileInput.style.left = \"0\";\n this.hiddenFileInput.style.height = \"0\";\n this.hiddenFileInput.style.width = \"0\";\n $3ed269f2f0fb224b$export$2e2bcd8739ae039.getElement(this.options.hiddenInputContainer, \"hiddenInputContainer\").appendChild(this.hiddenFileInput);\n this.hiddenFileInput.addEventListener(\"change\", () => {\n let files = this.hiddenFileInput.files;\n if (files.length) for (let file of files) this.addFile(file);\n this.emit(\"addedfiles\", files);\n setupHiddenFileInput();\n });\n };\n setupHiddenFileInput();\n }\n this.URL = window.URL !== null ? window.URL : window.webkitURL;\n // Setup all event listeners on the Dropzone object itself.\n // They're not in @setupEventListeners() because they shouldn't be removed\n // again when the dropzone gets disabled.\n for (let eventName of this.events) this.on(eventName, this.options[eventName]);\n this.on(\"uploadprogress\", () => this.updateTotalUploadProgress());\n this.on(\"removedfile\", () => this.updateTotalUploadProgress());\n this.on(\"canceled\", file => this.emit(\"complete\", file));\n // Emit a `queuecomplete` event if all files finished uploading.\n this.on(\"complete\", file => {\n if (this.getAddedFiles().length === 0 && this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0)\n // This needs to be deferred so that `queuecomplete` really triggers after `complete`\n return setTimeout(() => this.emit(\"queuecomplete\"), 0);\n });\n const containsFiles = function (e) {\n if (e.dataTransfer.types)\n // Because e.dataTransfer.types is an Object in\n // IE, we need to iterate like this instead of\n // using e.dataTransfer.types.some()\n for (var i = 0; i < e.dataTransfer.types.length; i++) {\n if (e.dataTransfer.types[i] === \"Files\") return true;\n }\n return false;\n };\n let noPropagation = function (e) {\n // If there are no files, we don't want to stop\n // propagation so we don't interfere with other\n // drag and drop behaviour.\n if (!containsFiles(e)) return;\n e.stopPropagation();\n if (e.preventDefault) return e.preventDefault();else return e.returnValue = false;\n };\n // Create the listeners\n this.listeners = [{\n element: this.element,\n events: {\n dragstart: e => {\n return this.emit(\"dragstart\", e);\n },\n dragenter: e => {\n noPropagation(e);\n return this.emit(\"dragenter\", e);\n },\n dragover: e => {\n // Makes it possible to drag files from chrome's download bar\n // http://stackoverflow.com/questions/19526430/drag-and-drop-file-uploads-from-chrome-downloads-bar\n // Try is required to prevent bug in Internet Explorer 11 (SCRIPT65535 exception)\n let efct;\n try {\n efct = e.dataTransfer.effectAllowed;\n } catch (error) {}\n e.dataTransfer.dropEffect = \"move\" === efct || \"linkMove\" === efct ? \"move\" : \"copy\";\n noPropagation(e);\n return this.emit(\"dragover\", e);\n },\n dragleave: e => {\n return this.emit(\"dragleave\", e);\n },\n drop: e => {\n noPropagation(e);\n return this.drop(e);\n },\n dragend: e => {\n return this.emit(\"dragend\", e);\n }\n }\n }];\n this.clickableElements.forEach(clickableElement => {\n return this.listeners.push({\n element: clickableElement,\n events: {\n click: evt => {\n // Only the actual dropzone or the message element should trigger file selection\n if (clickableElement !== this.element || evt.target === this.element || $3ed269f2f0fb224b$export$2e2bcd8739ae039.elementInside(evt.target, this.element.querySelector(\".dz-message\"))) this.hiddenFileInput.click(); // Forward the click\n return true;\n }\n }\n });\n });\n this.enable();\n return this.options.init.call(this);\n }\n // Not fully tested yet\n destroy() {\n this.disable();\n this.removeAllFiles(true);\n if (this.hiddenFileInput != null ? this.hiddenFileInput.parentNode : undefined) {\n this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);\n this.hiddenFileInput = null;\n }\n delete this.element.dropzone;\n return $3ed269f2f0fb224b$export$2e2bcd8739ae039.instances.splice($3ed269f2f0fb224b$export$2e2bcd8739ae039.instances.indexOf(this), 1);\n }\n updateTotalUploadProgress() {\n let totalUploadProgress;\n let totalBytesSent = 0;\n let totalBytes = 0;\n let activeFiles = this.getActiveFiles();\n if (activeFiles.length) {\n for (let file of this.getActiveFiles()) {\n totalBytesSent += file.upload.bytesSent;\n totalBytes += file.upload.total;\n }\n totalUploadProgress = 100 * totalBytesSent / totalBytes;\n } else totalUploadProgress = 100;\n return this.emit(\"totaluploadprogress\", totalUploadProgress, totalBytes, totalBytesSent);\n }\n // @options.paramName can be a function taking one parameter rather than a string.\n // A parameter name for a file is obtained simply by calling this with an index number.\n _getParamName(n) {\n if (typeof this.options.paramName === \"function\") return this.options.paramName(n);else return `${this.options.paramName}${this.options.uploadMultiple ? `[${n}]` : \"\"}`;\n }\n // If @options.renameFile is a function,\n // the function will be used to rename the file.name before appending it to the formData\n _renameFile(file) {\n if (typeof this.options.renameFile !== \"function\") return file.name;\n return this.options.renameFile(file);\n }\n // Returns a form that can be used as fallback if the browser does not support DragnDrop\n //\n // If the dropzone is already a form, only the input field and button are returned. Otherwise a complete form element is provided.\n // This code has to pass in IE7 :(\n getFallbackForm() {\n let existingFallback, form;\n if (existingFallback = this.getExistingFallback()) return existingFallback;\n let fieldsString = '
';\n if (this.options.dictFallbackText) fieldsString += `

${this.options.dictFallbackText}

`;\n fieldsString += `
`;\n let fields = $3ed269f2f0fb224b$export$2e2bcd8739ae039.createElement(fieldsString);\n if (this.element.tagName !== \"FORM\") {\n form = $3ed269f2f0fb224b$export$2e2bcd8739ae039.createElement(`
`);\n form.appendChild(fields);\n } else {\n // Make sure that the enctype and method attributes are set properly\n this.element.setAttribute(\"enctype\", \"multipart/form-data\");\n this.element.setAttribute(\"method\", this.options.method);\n }\n return form != null ? form : fields;\n }\n // Returns the fallback elements if they exist already\n //\n // This code has to pass in IE7 :(\n getExistingFallback() {\n let getFallback = function (elements) {\n for (let el of elements) {\n if (/(^| )fallback($| )/.test(el.className)) return el;\n }\n };\n for (let tagName of [\"div\", \"form\"]) {\n var fallback;\n if (fallback = getFallback(this.element.getElementsByTagName(tagName))) return fallback;\n }\n }\n // Activates all listeners stored in @listeners\n setupEventListeners() {\n return this.listeners.map(elementListeners => (() => {\n let result = [];\n for (let event in elementListeners.events) {\n let listener = elementListeners.events[event];\n result.push(elementListeners.element.addEventListener(event, listener, false));\n }\n return result;\n })());\n }\n // Deactivates all listeners stored in @listeners\n removeEventListeners() {\n return this.listeners.map(elementListeners => (() => {\n let result = [];\n for (let event in elementListeners.events) {\n let listener = elementListeners.events[event];\n result.push(elementListeners.element.removeEventListener(event, listener, false));\n }\n return result;\n })());\n }\n // Removes all event listeners and cancels all files in the queue or being processed.\n disable() {\n this.clickableElements.forEach(element => element.classList.remove(\"dz-clickable\"));\n this.removeEventListeners();\n this.disabled = true;\n return this.files.map(file => this.cancelUpload(file));\n }\n enable() {\n delete this.disabled;\n this.clickableElements.forEach(element => element.classList.add(\"dz-clickable\"));\n return this.setupEventListeners();\n }\n // Returns a nicely formatted filesize\n filesize(size) {\n let selectedSize = 0;\n let selectedUnit = \"b\";\n if (size > 0) {\n let units = [\"tb\", \"gb\", \"mb\", \"kb\", \"b\"];\n for (let i = 0; i < units.length; i++) {\n let unit = units[i];\n let cutoff = Math.pow(this.options.filesizeBase, 4 - i) / 10;\n if (size >= cutoff) {\n selectedSize = size / Math.pow(this.options.filesizeBase, 4 - i);\n selectedUnit = unit;\n break;\n }\n }\n selectedSize = Math.round(10 * selectedSize) / 10; // Cutting of digits\n }\n\n return `${selectedSize} ${this.options.dictFileSizeUnits[selectedUnit]}`;\n }\n // Adds or removes the `dz-max-files-reached` class from the form.\n _updateMaxFilesReachedClass() {\n if (this.options.maxFiles != null && this.getAcceptedFiles().length >= this.options.maxFiles) {\n if (this.getAcceptedFiles().length === this.options.maxFiles) this.emit(\"maxfilesreached\", this.files);\n return this.element.classList.add(\"dz-max-files-reached\");\n } else return this.element.classList.remove(\"dz-max-files-reached\");\n }\n drop(e) {\n if (!e.dataTransfer) return;\n this.emit(\"drop\", e);\n // Convert the FileList to an Array\n // This is necessary for IE11\n let files = [];\n for (let i = 0; i < e.dataTransfer.files.length; i++) files[i] = e.dataTransfer.files[i];\n // Even if it's a folder, files.length will contain the folders.\n if (files.length) {\n let items = e.dataTransfer.items;\n if (items && items.length && items[0].webkitGetAsEntry != null)\n // The browser supports dropping of folders, so handle items instead of files\n this._addFilesFromItems(items);else this.handleFiles(files);\n }\n this.emit(\"addedfiles\", files);\n }\n paste(e) {\n if ($3ed269f2f0fb224b$var$__guard__(e != null ? e.clipboardData : undefined, x => x.items) == null) return;\n this.emit(\"paste\", e);\n let items = e.clipboardData.items;\n if (items.length) return this._addFilesFromItems(items);\n }\n handleFiles(files) {\n for (let file of files) this.addFile(file);\n }\n // When a folder is dropped (or files are pasted), items must be handled\n // instead of files.\n _addFilesFromItems(items) {\n return (() => {\n let result = [];\n for (let item of items) {\n var entry;\n if (item.webkitGetAsEntry != null && (entry = item.webkitGetAsEntry())) {\n if (entry.isFile) result.push(this.addFile(item.getAsFile()));else if (entry.isDirectory)\n // Append all files from that directory to files\n result.push(this._addFilesFromDirectory(entry, entry.name));else result.push(undefined);\n } else if (item.getAsFile != null) {\n if (item.kind == null || item.kind === \"file\") result.push(this.addFile(item.getAsFile()));else result.push(undefined);\n } else result.push(undefined);\n }\n return result;\n })();\n }\n // Goes through the directory, and adds each file it finds recursively\n _addFilesFromDirectory(directory, path) {\n let dirReader = directory.createReader();\n let errorHandler = error => $3ed269f2f0fb224b$var$__guardMethod__(console, \"log\", o => o.log(error));\n var readEntries = () => {\n return dirReader.readEntries(entries => {\n if (entries.length > 0) {\n for (let entry of entries) {\n if (entry.isFile) entry.file(file => {\n if (this.options.ignoreHiddenFiles && file.name.substring(0, 1) === \".\") return;\n file.fullPath = `${path}/${file.name}`;\n return this.addFile(file);\n });else if (entry.isDirectory) this._addFilesFromDirectory(entry, `${path}/${entry.name}`);\n }\n // Recursively call readEntries() again, since browser only handle\n // the first 100 entries.\n // See: https://developer.mozilla.org/en-US/docs/Web/API/DirectoryReader#readEntries\n readEntries();\n }\n return null;\n }, errorHandler);\n };\n return readEntries();\n }\n // If `done()` is called without argument the file is accepted\n // If you call it with an error message, the file is rejected\n // (This allows for asynchronous validation)\n //\n // This function checks the filesize, and if the file.type passes the\n // `acceptedFiles` check.\n accept(file, done) {\n if (this.options.maxFilesize && file.size > this.options.maxFilesize * 1048576) done(this.options.dictFileTooBig.replace(\"{{filesize}}\", Math.round(file.size / 1024 / 10.24) / 100).replace(\"{{maxFilesize}}\", this.options.maxFilesize));else if (!$3ed269f2f0fb224b$export$2e2bcd8739ae039.isValidFile(file, this.options.acceptedFiles)) done(this.options.dictInvalidFileType);else if (this.options.maxFiles != null && this.getAcceptedFiles().length >= this.options.maxFiles) {\n done(this.options.dictMaxFilesExceeded.replace(\"{{maxFiles}}\", this.options.maxFiles));\n this.emit(\"maxfilesexceeded\", file);\n } else this.options.accept.call(this, file, done);\n }\n addFile(file) {\n file.upload = {\n uuid: $3ed269f2f0fb224b$export$2e2bcd8739ae039.uuidv4(),\n progress: 0,\n // Setting the total upload size to file.size for the beginning\n // It's actual different than the size to be transmitted.\n total: file.size,\n bytesSent: 0,\n filename: this._renameFile(file)\n };\n this.files.push(file);\n file.status = $3ed269f2f0fb224b$export$2e2bcd8739ae039.ADDED;\n this.emit(\"addedfile\", file);\n this._enqueueThumbnail(file);\n this.accept(file, error => {\n if (error) {\n file.accepted = false;\n this._errorProcessing([file], error); // Will set the file.status\n } else {\n file.accepted = true;\n if (this.options.autoQueue) this.enqueueFile(file);\n // Will set .accepted = true\n }\n\n this._updateMaxFilesReachedClass();\n });\n }\n // Wrapper for enqueueFile\n enqueueFiles(files) {\n for (let file of files) this.enqueueFile(file);\n return null;\n }\n enqueueFile(file) {\n if (file.status === $3ed269f2f0fb224b$export$2e2bcd8739ae039.ADDED && file.accepted === true) {\n file.status = $3ed269f2f0fb224b$export$2e2bcd8739ae039.QUEUED;\n if (this.options.autoProcessQueue) return setTimeout(() => this.processQueue(), 0); // Deferring the call\n } else throw new Error(\"This file can't be queued because it has already been processed or was rejected.\");\n }\n _enqueueThumbnail(file) {\n if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1048576) {\n this._thumbnailQueue.push(file);\n return setTimeout(() => this._processThumbnailQueue(), 0); // Deferring the call\n }\n }\n\n _processThumbnailQueue() {\n if (this._processingThumbnail || this._thumbnailQueue.length === 0) return;\n this._processingThumbnail = true;\n let file = this._thumbnailQueue.shift();\n return this.createThumbnail(file, this.options.thumbnailWidth, this.options.thumbnailHeight, this.options.thumbnailMethod, true, dataUrl => {\n this.emit(\"thumbnail\", file, dataUrl);\n this._processingThumbnail = false;\n return this._processThumbnailQueue();\n });\n }\n // Can be called by the user to remove a file\n removeFile(file) {\n if (file.status === $3ed269f2f0fb224b$export$2e2bcd8739ae039.UPLOADING) this.cancelUpload(file);\n this.files = $3ed269f2f0fb224b$var$without(this.files, file);\n this.emit(\"removedfile\", file);\n if (this.files.length === 0) return this.emit(\"reset\");\n }\n // Removes all files that aren't currently processed from the list\n removeAllFiles(cancelIfNecessary) {\n // Create a copy of files since removeFile() changes the @files array.\n if (cancelIfNecessary == null) cancelIfNecessary = false;\n for (let file of this.files.slice()) if (file.status !== $3ed269f2f0fb224b$export$2e2bcd8739ae039.UPLOADING || cancelIfNecessary) this.removeFile(file);\n return null;\n }\n // Resizes an image before it gets sent to the server. This function is the default behavior of\n // `options.transformFile` if `resizeWidth` or `resizeHeight` are set. The callback is invoked with\n // the resized blob.\n resizeImage(file, width, height, resizeMethod, callback) {\n return this.createThumbnail(file, width, height, resizeMethod, true, (dataUrl, canvas) => {\n if (canvas == null)\n // The image has not been resized\n return callback(file);else {\n let resizeMimeType = this.options.resizeMimeType;\n if (resizeMimeType == null) resizeMimeType = file.type;\n let resizedDataURL = canvas.toDataURL(resizeMimeType, this.options.resizeQuality);\n if (resizeMimeType === \"image/jpeg\" || resizeMimeType === \"image/jpg\")\n // Now add the original EXIF information\n resizedDataURL = $3ed269f2f0fb224b$var$ExifRestore.restore(file.dataURL, resizedDataURL);\n return callback($3ed269f2f0fb224b$export$2e2bcd8739ae039.dataURItoBlob(resizedDataURL));\n }\n });\n }\n createThumbnail(file, width, height, resizeMethod, fixOrientation, callback) {\n let fileReader = new FileReader();\n fileReader.onload = () => {\n file.dataURL = fileReader.result;\n // Don't bother creating a thumbnail for SVG images since they're vector\n if (file.type === \"image/svg+xml\") {\n if (callback != null) callback(fileReader.result);\n return;\n }\n this.createThumbnailFromUrl(file, width, height, resizeMethod, fixOrientation, callback);\n };\n fileReader.readAsDataURL(file);\n }\n // `mockFile` needs to have these attributes:\n //\n // { name: 'name', size: 12345, imageUrl: '' }\n //\n // `callback` will be invoked when the image has been downloaded and displayed.\n // `crossOrigin` will be added to the `img` tag when accessing the file.\n displayExistingFile(mockFile, imageUrl, callback, crossOrigin) {\n let resizeThumbnail = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n this.emit(\"addedfile\", mockFile);\n this.emit(\"complete\", mockFile);\n if (!resizeThumbnail) {\n this.emit(\"thumbnail\", mockFile, imageUrl);\n if (callback) callback();\n } else {\n let onDone = thumbnail => {\n this.emit(\"thumbnail\", mockFile, thumbnail);\n if (callback) callback();\n };\n mockFile.dataURL = imageUrl;\n this.createThumbnailFromUrl(mockFile, this.options.thumbnailWidth, this.options.thumbnailHeight, this.options.thumbnailMethod, this.options.fixOrientation, onDone, crossOrigin);\n }\n }\n createThumbnailFromUrl(file, width, height, resizeMethod, fixOrientation, callback, crossOrigin) {\n // Not using `new Image` here because of a bug in latest Chrome versions.\n // See https://github.com/enyo/dropzone/pull/226\n let img = document.createElement(\"img\");\n if (crossOrigin) img.crossOrigin = crossOrigin;\n // fixOrientation is not needed anymore with browsers handling imageOrientation\n fixOrientation = getComputedStyle(document.body)[\"imageOrientation\"] == \"from-image\" ? false : fixOrientation;\n img.onload = () => {\n let loadExif = callback => callback(1);\n if (typeof EXIF !== \"undefined\" && EXIF !== null && fixOrientation) loadExif = callback => EXIF.getData(img, function () {\n return callback(EXIF.getTag(this, \"Orientation\"));\n });\n return loadExif(orientation => {\n file.width = img.width;\n file.height = img.height;\n let resizeInfo = this.options.resize.call(this, file, width, height, resizeMethod);\n let canvas = document.createElement(\"canvas\");\n let ctx = canvas.getContext(\"2d\");\n canvas.width = resizeInfo.trgWidth;\n canvas.height = resizeInfo.trgHeight;\n if (orientation > 4) {\n canvas.width = resizeInfo.trgHeight;\n canvas.height = resizeInfo.trgWidth;\n }\n switch (orientation) {\n case 2:\n // horizontal flip\n ctx.translate(canvas.width, 0);\n ctx.scale(-1, 1);\n break;\n case 3:\n // 180° rotate left\n ctx.translate(canvas.width, canvas.height);\n ctx.rotate(Math.PI);\n break;\n case 4:\n // vertical flip\n ctx.translate(0, canvas.height);\n ctx.scale(1, -1);\n break;\n case 5:\n // vertical flip + 90 rotate right\n ctx.rotate(0.5 * Math.PI);\n ctx.scale(1, -1);\n break;\n case 6:\n // 90° rotate right\n ctx.rotate(0.5 * Math.PI);\n ctx.translate(0, -canvas.width);\n break;\n case 7:\n // horizontal flip + 90 rotate right\n ctx.rotate(0.5 * Math.PI);\n ctx.translate(canvas.height, -canvas.width);\n ctx.scale(-1, 1);\n break;\n case 8:\n // 90° rotate left\n ctx.rotate(-0.5 * Math.PI);\n ctx.translate(-canvas.height, 0);\n break;\n }\n // This is a bugfix for iOS' scaling bug.\n $3ed269f2f0fb224b$var$drawImageIOSFix(ctx, img, resizeInfo.srcX != null ? resizeInfo.srcX : 0, resizeInfo.srcY != null ? resizeInfo.srcY : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, resizeInfo.trgX != null ? resizeInfo.trgX : 0, resizeInfo.trgY != null ? resizeInfo.trgY : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);\n let thumbnail = canvas.toDataURL(\"image/png\");\n if (callback != null) return callback(thumbnail, canvas);\n });\n };\n if (callback != null) img.onerror = callback;\n return img.src = file.dataURL;\n }\n // Goes through the queue and processes files if there aren't too many already.\n processQueue() {\n let parallelUploads = this.options.parallelUploads;\n let processingLength = this.getUploadingFiles().length;\n let i = processingLength;\n // There are already at least as many files uploading than should be\n if (processingLength >= parallelUploads) return;\n let queuedFiles = this.getQueuedFiles();\n if (!(queuedFiles.length > 0)) return;\n if (this.options.uploadMultiple)\n // The files should be uploaded in one request\n return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));else while (i < parallelUploads) {\n if (!queuedFiles.length) return;\n // Nothing left to process\n this.processFile(queuedFiles.shift());\n i++;\n }\n }\n // Wrapper for `processFiles`\n processFile(file) {\n return this.processFiles([file]);\n }\n // Loads the file, then calls finishedLoading()\n processFiles(files) {\n for (let file of files) {\n file.processing = true; // Backwards compatibility\n file.status = $3ed269f2f0fb224b$export$2e2bcd8739ae039.UPLOADING;\n this.emit(\"processing\", file);\n }\n if (this.options.uploadMultiple) this.emit(\"processingmultiple\", files);\n return this.uploadFiles(files);\n }\n _getFilesWithXhr(xhr) {\n let files;\n return files = this.files.filter(file => file.xhr === xhr).map(file => file);\n }\n // Cancels the file upload and sets the status to CANCELED\n // **if** the file is actually being uploaded.\n // If it's still in the queue, the file is being removed from it and the status\n // set to CANCELED.\n cancelUpload(file) {\n if (file.status === $3ed269f2f0fb224b$export$2e2bcd8739ae039.UPLOADING) {\n let groupedFiles = this._getFilesWithXhr(file.xhr);\n for (let groupedFile of groupedFiles) groupedFile.status = $3ed269f2f0fb224b$export$2e2bcd8739ae039.CANCELED;\n if (typeof file.xhr !== \"undefined\") file.xhr.abort();\n for (let groupedFile1 of groupedFiles) this.emit(\"canceled\", groupedFile1);\n if (this.options.uploadMultiple) this.emit(\"canceledmultiple\", groupedFiles);\n } else if (file.status === $3ed269f2f0fb224b$export$2e2bcd8739ae039.ADDED || file.status === $3ed269f2f0fb224b$export$2e2bcd8739ae039.QUEUED) {\n file.status = $3ed269f2f0fb224b$export$2e2bcd8739ae039.CANCELED;\n this.emit(\"canceled\", file);\n if (this.options.uploadMultiple) this.emit(\"canceledmultiple\", [file]);\n }\n if (this.options.autoProcessQueue) return this.processQueue();\n }\n resolveOption(option) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n if (typeof option === \"function\") return option.apply(this, args);\n return option;\n }\n uploadFile(file) {\n return this.uploadFiles([file]);\n }\n uploadFiles(files) {\n this._transformFiles(files, transformedFiles => {\n if (this.options.chunking) {\n // Chunking is not allowed to be used with `uploadMultiple` so we know\n // that there is only __one__file.\n let transformedFile = transformedFiles[0];\n files[0].upload.chunked = this.options.chunking && (this.options.forceChunking || transformedFile.size > this.options.chunkSize);\n files[0].upload.totalChunkCount = Math.ceil(transformedFile.size / this.options.chunkSize);\n }\n if (files[0].upload.chunked) {\n // This file should be sent in chunks!\n // If the chunking option is set, we **know** that there can only be **one** file, since\n // uploadMultiple is not allowed with this option.\n let file = files[0];\n let transformedFile = transformedFiles[0];\n let startedChunkCount = 0;\n file.upload.chunks = [];\n let handleNextChunk = () => {\n let chunkIndex = 0;\n // Find the next item in file.upload.chunks that is not defined yet.\n while (file.upload.chunks[chunkIndex] !== undefined) chunkIndex++;\n // This means, that all chunks have already been started.\n if (chunkIndex >= file.upload.totalChunkCount) return;\n startedChunkCount++;\n let start = chunkIndex * this.options.chunkSize;\n let end = Math.min(start + this.options.chunkSize, transformedFile.size);\n let dataBlock = {\n name: this._getParamName(0),\n data: transformedFile.webkitSlice ? transformedFile.webkitSlice(start, end) : transformedFile.slice(start, end),\n filename: file.upload.filename,\n chunkIndex: chunkIndex\n };\n file.upload.chunks[chunkIndex] = {\n file: file,\n index: chunkIndex,\n dataBlock: dataBlock,\n status: $3ed269f2f0fb224b$export$2e2bcd8739ae039.UPLOADING,\n progress: 0,\n retries: 0\n };\n this._uploadData(files, [dataBlock]);\n };\n file.upload.finishedChunkUpload = (chunk, response) => {\n let allFinished = true;\n chunk.status = $3ed269f2f0fb224b$export$2e2bcd8739ae039.SUCCESS;\n // Clear the data from the chunk\n chunk.dataBlock = null;\n chunk.response = chunk.xhr.responseText;\n chunk.responseHeaders = chunk.xhr.getAllResponseHeaders();\n // Leaving this reference to xhr will cause memory leaks.\n chunk.xhr = null;\n for (let i = 0; i < file.upload.totalChunkCount; i++) {\n if (file.upload.chunks[i] === undefined) return handleNextChunk();\n if (file.upload.chunks[i].status !== $3ed269f2f0fb224b$export$2e2bcd8739ae039.SUCCESS) allFinished = false;\n }\n if (allFinished) this.options.chunksUploaded(file, () => {\n this._finished(files, response, null);\n });\n };\n if (this.options.parallelChunkUploads) for (let i = 0; i < file.upload.totalChunkCount; i++) handleNextChunk();else handleNextChunk();\n } else {\n let dataBlocks = [];\n for (let i = 0; i < files.length; i++) dataBlocks[i] = {\n name: this._getParamName(i),\n data: transformedFiles[i],\n filename: files[i].upload.filename\n };\n this._uploadData(files, dataBlocks);\n }\n });\n }\n /// Returns the right chunk for given file and xhr\n _getChunk(file, xhr) {\n for (let i = 0; i < file.upload.totalChunkCount; i++) {\n if (file.upload.chunks[i] !== undefined && file.upload.chunks[i].xhr === xhr) return file.upload.chunks[i];\n }\n }\n // This function actually uploads the file(s) to the server.\n //\n // If dataBlocks contains the actual data to upload (meaning, that this could\n // either be transformed files, or individual chunks for chunked upload) then\n // they will be used for the actual data to upload.\n _uploadData(files, dataBlocks) {\n let xhr = new XMLHttpRequest();\n // Put the xhr object in the file objects to be able to reference it later.\n for (let file of files) file.xhr = xhr;\n if (files[0].upload.chunked)\n // Put the xhr object in the right chunk object, so it can be associated\n // later, and found with _getChunk.\n files[0].upload.chunks[dataBlocks[0].chunkIndex].xhr = xhr;\n let method = this.resolveOption(this.options.method, files, dataBlocks);\n let url = this.resolveOption(this.options.url, files, dataBlocks);\n xhr.open(method, url, true);\n // Setting the timeout after open because of IE11 issue: https://gitlab.com/meno/dropzone/issues/8\n let timeout = this.resolveOption(this.options.timeout, files);\n if (timeout) xhr.timeout = this.resolveOption(this.options.timeout, files);\n // Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179\n xhr.withCredentials = !!this.options.withCredentials;\n xhr.onload = e => {\n this._finishedUploading(files, xhr, e);\n };\n xhr.ontimeout = () => {\n this._handleUploadError(files, xhr, `Request timedout after ${this.options.timeout / 1000} seconds`);\n };\n xhr.onerror = () => {\n this._handleUploadError(files, xhr);\n };\n // Some browsers do not have the .upload property\n let progressObj = xhr.upload != null ? xhr.upload : xhr;\n progressObj.onprogress = e => this._updateFilesUploadProgress(files, xhr, e);\n let headers = this.options.defaultHeaders ? {\n Accept: \"application/json\",\n \"Cache-Control\": \"no-cache\",\n \"X-Requested-With\": \"XMLHttpRequest\"\n } : {};\n if (this.options.binaryBody) headers[\"Content-Type\"] = files[0].type;\n if (this.options.headers) $ewBKy$justextend(headers, this.options.headers);\n for (let headerName in headers) {\n let headerValue = headers[headerName];\n if (headerValue) xhr.setRequestHeader(headerName, headerValue);\n }\n if (this.options.binaryBody) {\n // Since the file is going to be sent as binary body, it doesn't make\n // any sense to generate `FormData` for it.\n for (let file of files) this.emit(\"sending\", file, xhr);\n if (this.options.uploadMultiple) this.emit(\"sendingmultiple\", files, xhr);\n this.submitRequest(xhr, null, files);\n } else {\n let formData = new FormData();\n // Adding all @options parameters\n if (this.options.params) {\n let additionalParams = this.options.params;\n if (typeof additionalParams === \"function\") additionalParams = additionalParams.call(this, files, xhr, files[0].upload.chunked ? this._getChunk(files[0], xhr) : null);\n for (let key in additionalParams) {\n let value = additionalParams[key];\n if (Array.isArray(value))\n // The additional parameter contains an array,\n // so lets iterate over it to attach each value\n // individually.\n for (let i = 0; i < value.length; i++) formData.append(key, value[i]);else formData.append(key, value);\n }\n }\n // Let the user add additional data if necessary\n for (let file of files) this.emit(\"sending\", file, xhr, formData);\n if (this.options.uploadMultiple) this.emit(\"sendingmultiple\", files, xhr, formData);\n this._addFormElementData(formData);\n // Finally add the files\n // Has to be last because some servers (eg: S3) expect the file to be the last parameter\n for (let i = 0; i < dataBlocks.length; i++) {\n let dataBlock = dataBlocks[i];\n formData.append(dataBlock.name, dataBlock.data, dataBlock.filename);\n }\n this.submitRequest(xhr, formData, files);\n }\n }\n // Transforms all files with this.options.transformFile and invokes done with the transformed files when done.\n _transformFiles(files, done) {\n let transformedFiles = [];\n // Clumsy way of handling asynchronous calls, until I get to add a proper Future library.\n let doneCounter = 0;\n for (let i = 0; i < files.length; i++) this.options.transformFile.call(this, files[i], transformedFile => {\n transformedFiles[i] = transformedFile;\n if (++doneCounter === files.length) done(transformedFiles);\n });\n }\n // Takes care of adding other input elements of the form to the AJAX request\n _addFormElementData(formData) {\n // Take care of other input elements\n if (this.element.tagName === \"FORM\") for (let input of this.element.querySelectorAll(\"input, textarea, select, button\")) {\n let inputName = input.getAttribute(\"name\");\n let inputType = input.getAttribute(\"type\");\n if (inputType) inputType = inputType.toLowerCase();\n // If the input doesn't have a name, we can't use it.\n if (typeof inputName === \"undefined\" || inputName === null) continue;\n if (input.tagName === \"SELECT\" && input.hasAttribute(\"multiple\")) {\n // Possibly multiple values\n for (let option of input.options) if (option.selected) formData.append(inputName, option.value);\n } else if (!inputType || inputType !== \"checkbox\" && inputType !== \"radio\" || input.checked) formData.append(inputName, input.value);\n }\n }\n // Invoked when there is new progress information about given files.\n // If e is not provided, it is assumed that the upload is finished.\n _updateFilesUploadProgress(files, xhr, e) {\n if (!files[0].upload.chunked)\n // Handle file uploads without chunking\n for (let file of files) {\n if (file.upload.total && file.upload.bytesSent && file.upload.bytesSent == file.upload.total) continue;\n if (e) {\n file.upload.progress = 100 * e.loaded / e.total;\n file.upload.total = e.total;\n file.upload.bytesSent = e.loaded;\n } else {\n // No event, so we're at 100%\n file.upload.progress = 100;\n file.upload.bytesSent = file.upload.total;\n }\n this.emit(\"uploadprogress\", file, file.upload.progress, file.upload.bytesSent);\n } else {\n // Handle chunked file uploads\n // Chunked upload is not compatible with uploading multiple files in one\n // request, so we know there's only one file.\n let file = files[0];\n // Since this is a chunked upload, we need to update the appropriate chunk\n // progress.\n let chunk = this._getChunk(file, xhr);\n if (e) {\n chunk.progress = 100 * e.loaded / e.total;\n chunk.total = e.total;\n chunk.bytesSent = e.loaded;\n } else {\n // No event, so we're at 100%\n chunk.progress = 100;\n chunk.bytesSent = chunk.total;\n }\n // Now tally the *file* upload progress from its individual chunks\n file.upload.progress = 0;\n file.upload.total = 0;\n file.upload.bytesSent = 0;\n for (let i = 0; i < file.upload.totalChunkCount; i++) if (file.upload.chunks[i] && typeof file.upload.chunks[i].progress !== \"undefined\") {\n file.upload.progress += file.upload.chunks[i].progress;\n file.upload.total += file.upload.chunks[i].total;\n file.upload.bytesSent += file.upload.chunks[i].bytesSent;\n }\n // Since the process is a percentage, we need to divide by the amount of\n // chunks we've used.\n file.upload.progress = file.upload.progress / file.upload.totalChunkCount;\n this.emit(\"uploadprogress\", file, file.upload.progress, file.upload.bytesSent);\n }\n }\n _finishedUploading(files, xhr, e) {\n let response;\n if (files[0].status === $3ed269f2f0fb224b$export$2e2bcd8739ae039.CANCELED) return;\n if (xhr.readyState !== 4) return;\n if (xhr.responseType !== \"arraybuffer\" && xhr.responseType !== \"blob\") {\n response = xhr.responseText;\n if (xhr.getResponseHeader(\"content-type\") && ~xhr.getResponseHeader(\"content-type\").indexOf(\"application/json\")) try {\n response = JSON.parse(response);\n } catch (error) {\n e = error;\n response = \"Invalid JSON response from server.\";\n }\n }\n this._updateFilesUploadProgress(files, xhr);\n if (!(200 <= xhr.status && xhr.status < 300)) this._handleUploadError(files, xhr, response);else if (files[0].upload.chunked) files[0].upload.finishedChunkUpload(this._getChunk(files[0], xhr), response);else this._finished(files, response, e);\n }\n _handleUploadError(files, xhr, response) {\n if (files[0].status === $3ed269f2f0fb224b$export$2e2bcd8739ae039.CANCELED) return;\n if (files[0].upload.chunked && this.options.retryChunks) {\n let chunk = this._getChunk(files[0], xhr);\n if (chunk.retries++ < this.options.retryChunksLimit) {\n this._uploadData(files, [chunk.dataBlock]);\n return;\n } else console.warn(\"Retried this chunk too often. Giving up.\");\n }\n this._errorProcessing(files, response || this.options.dictResponseError.replace(\"{{statusCode}}\", xhr.status), xhr);\n }\n submitRequest(xhr, formData, files) {\n if (xhr.readyState != 1) {\n console.warn(\"Cannot send this request because the XMLHttpRequest.readyState is not OPENED.\");\n return;\n }\n if (this.options.binaryBody) {\n if (files[0].upload.chunked) {\n const chunk = this._getChunk(files[0], xhr);\n xhr.send(chunk.dataBlock.data);\n } else xhr.send(files[0]);\n } else xhr.send(formData);\n }\n // Called internally when processing is finished.\n // Individual callbacks have to be called in the appropriate sections.\n _finished(files, responseText, e) {\n for (let file of files) {\n file.status = $3ed269f2f0fb224b$export$2e2bcd8739ae039.SUCCESS;\n this.emit(\"success\", file, responseText, e);\n this.emit(\"complete\", file);\n }\n if (this.options.uploadMultiple) {\n this.emit(\"successmultiple\", files, responseText, e);\n this.emit(\"completemultiple\", files);\n }\n if (this.options.autoProcessQueue) return this.processQueue();\n }\n // Called internally when processing is finished.\n // Individual callbacks have to be called in the appropriate sections.\n _errorProcessing(files, message, xhr) {\n for (let file of files) {\n file.status = $3ed269f2f0fb224b$export$2e2bcd8739ae039.ERROR;\n this.emit(\"error\", file, message, xhr);\n this.emit(\"complete\", file);\n }\n if (this.options.uploadMultiple) {\n this.emit(\"errormultiple\", files, message, xhr);\n this.emit(\"completemultiple\", files);\n }\n if (this.options.autoProcessQueue) return this.processQueue();\n }\n static uuidv4() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n let r = Math.random() * 16 | 0,\n v = c === \"x\" ? r : r & 3 | 8;\n return v.toString(16);\n });\n }\n constructor(el, options) {\n super();\n let fallback, left;\n this.element = el;\n this.clickableElements = [];\n this.listeners = [];\n this.files = []; // All files\n if (typeof this.element === \"string\") this.element = document.querySelector(this.element);\n // Not checking if instance of HTMLElement or Element since IE9 is extremely weird.\n if (!this.element || this.element.nodeType == null) throw new Error(\"Invalid dropzone element.\");\n if (this.element.dropzone) throw new Error(\"Dropzone already attached.\");\n // Now add this dropzone to the instances.\n $3ed269f2f0fb224b$export$2e2bcd8739ae039.instances.push(this);\n // Put the dropzone inside the element itself.\n this.element.dropzone = this;\n let elementOptions = (left = $3ed269f2f0fb224b$export$2e2bcd8739ae039.optionsForElement(this.element)) != null ? left : {};\n this.options = $ewBKy$justextend(true, {}, $4ca367182776f80b$export$2e2bcd8739ae039, elementOptions, options != null ? options : {});\n this.options.previewTemplate = this.options.previewTemplate.replace(/\\n*/g, \"\");\n // If the browser failed, just call the fallback and leave\n if (this.options.forceFallback || !$3ed269f2f0fb224b$export$2e2bcd8739ae039.isBrowserSupported()) return this.options.fallback.call(this);\n // @options.url = @element.getAttribute \"action\" unless @options.url?\n if (this.options.url == null) this.options.url = this.element.getAttribute(\"action\");\n if (!this.options.url) throw new Error(\"No URL provided.\");\n if (this.options.acceptedFiles && this.options.acceptedMimeTypes) throw new Error(\"You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.\");\n if (this.options.uploadMultiple && this.options.chunking) throw new Error(\"You cannot set both: uploadMultiple and chunking.\");\n if (this.options.binaryBody && this.options.uploadMultiple) throw new Error(\"You cannot set both: binaryBody and uploadMultiple.\");\n // Backwards compatibility\n if (this.options.acceptedMimeTypes) {\n this.options.acceptedFiles = this.options.acceptedMimeTypes;\n delete this.options.acceptedMimeTypes;\n }\n // Backwards compatibility\n if (this.options.renameFilename != null) this.options.renameFile = file => this.options.renameFilename.call(this, file.name, file);\n if (typeof this.options.method === \"string\") this.options.method = this.options.method.toUpperCase();\n if ((fallback = this.getExistingFallback()) && fallback.parentNode)\n // Remove the fallback\n fallback.parentNode.removeChild(fallback);\n // Display previews in the previewsContainer element or the Dropzone element unless explicitly set to false\n if (this.options.previewsContainer !== false) {\n if (this.options.previewsContainer) this.previewsContainer = $3ed269f2f0fb224b$export$2e2bcd8739ae039.getElement(this.options.previewsContainer, \"previewsContainer\");else this.previewsContainer = this.element;\n }\n if (this.options.clickable) {\n if (this.options.clickable === true) this.clickableElements = [this.element];else this.clickableElements = $3ed269f2f0fb224b$export$2e2bcd8739ae039.getElements(this.options.clickable, \"clickable\");\n }\n this.init();\n }\n}\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.initClass();\n// This is a map of options for your different dropzones. Add configurations\n// to this object for your different dropzone elemens.\n//\n// Example:\n//\n// Dropzone.options.myDropzoneElementId = { maxFilesize: 1 };\n//\n// And in html:\n//\n//
\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.options = {};\n// Returns the options for an element or undefined if none available.\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.optionsForElement = function (element) {\n // Get the `Dropzone.options.elementId` for this element if it exists\n if (element.getAttribute(\"id\")) return $3ed269f2f0fb224b$export$2e2bcd8739ae039.options[$3ed269f2f0fb224b$var$camelize(element.getAttribute(\"id\"))];else return undefined;\n};\n// Holds a list of all dropzone instances\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.instances = [];\n// Returns the dropzone for given element if any\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.forElement = function (element) {\n if (typeof element === \"string\") element = document.querySelector(element);\n if ((element != null ? element.dropzone : undefined) == null) throw new Error(\"No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.\");\n return element.dropzone;\n};\n// Looks for all .dropzone elements and creates a dropzone for them\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.discover = function () {\n let dropzones;\n if (document.querySelectorAll) dropzones = document.querySelectorAll(\".dropzone\");else {\n dropzones = [];\n // IE :(\n let checkElements = elements => (() => {\n let result = [];\n for (let el of elements) if (/(^| )dropzone($| )/.test(el.className)) result.push(dropzones.push(el));else result.push(undefined);\n return result;\n })();\n checkElements(document.getElementsByTagName(\"div\"));\n checkElements(document.getElementsByTagName(\"form\"));\n }\n return (() => {\n let result = [];\n for (let dropzone of dropzones)\n // Create a dropzone unless auto discover has been disabled for specific element\n if ($3ed269f2f0fb224b$export$2e2bcd8739ae039.optionsForElement(dropzone) !== false) result.push(new $3ed269f2f0fb224b$export$2e2bcd8739ae039(dropzone));else result.push(undefined);\n return result;\n })();\n};\n// Some browsers support drag and drog functionality, but not correctly.\n//\n// So I created a blocklist of userAgents. Yes, yes. Browser sniffing, I know.\n// But what to do when browsers *theoretically* support an API, but crash\n// when using it.\n//\n// This is a list of regular expressions tested against navigator.userAgent\n//\n// ** It should only be used on browser that *do* support the API, but\n// incorrectly **\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.blockedBrowsers = [\n// The mac os and windows phone version of opera 12 seems to have a problem with the File drag'n'drop API.\n/opera.*(Macintosh|Windows Phone).*version\\/12/i];\n// Checks if the browser is supported\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.isBrowserSupported = function () {\n let capableBrowser = true;\n if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {\n if (!(\"classList\" in document.createElement(\"a\"))) capableBrowser = false;else {\n if ($3ed269f2f0fb224b$export$2e2bcd8739ae039.blacklistedBrowsers !== undefined)\n // Since this has been renamed, this makes sure we don't break older\n // configuration.\n $3ed269f2f0fb224b$export$2e2bcd8739ae039.blockedBrowsers = $3ed269f2f0fb224b$export$2e2bcd8739ae039.blacklistedBrowsers;\n // The browser supports the API, but may be blocked.\n for (let regex of $3ed269f2f0fb224b$export$2e2bcd8739ae039.blockedBrowsers) if (regex.test(navigator.userAgent)) {\n capableBrowser = false;\n continue;\n }\n }\n } else capableBrowser = false;\n return capableBrowser;\n};\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.dataURItoBlob = function (dataURI) {\n // convert base64 to raw binary data held in a string\n // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this\n let byteString = atob(dataURI.split(\",\")[1]);\n // separate out the mime component\n let mimeString = dataURI.split(\",\")[0].split(\":\")[1].split(\";\")[0];\n // write the bytes of the string to an ArrayBuffer\n let ab = new ArrayBuffer(byteString.length);\n let ia = new Uint8Array(ab);\n for (let i = 0, end = byteString.length, asc = 0 <= end; asc ? i <= end : i >= end; asc ? i++ : i--) ia[i] = byteString.charCodeAt(i);\n // write the ArrayBuffer to a blob\n return new Blob([ab], {\n type: mimeString\n });\n};\n// Returns an array without the rejected item\nconst $3ed269f2f0fb224b$var$without = (list, rejectedItem) => list.filter(item => item !== rejectedItem).map(item => item);\n// abc-def_ghi -> abcDefGhi\nconst $3ed269f2f0fb224b$var$camelize = str => str.replace(/[\\-_](\\w)/g, match => match.charAt(1).toUpperCase());\n// Creates an element from string\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.createElement = function (string) {\n let div = document.createElement(\"div\");\n div.innerHTML = string;\n return div.childNodes[0];\n};\n// Tests if given element is inside (or simply is) the container\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.elementInside = function (element, container) {\n if (element === container) return true;\n // Coffeescript doesn't support do/while loops\n while (element = element.parentNode) {\n if (element === container) return true;\n }\n return false;\n};\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.getElement = function (el, name) {\n let element;\n if (typeof el === \"string\") element = document.querySelector(el);else if (el.nodeType != null) element = el;\n if (element == null) throw new Error(`Invalid \\`${name}\\` option provided. Please provide a CSS selector or a plain HTML element.`);\n return element;\n};\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.getElements = function (els, name) {\n let el, elements;\n if (els instanceof Array) {\n elements = [];\n try {\n for (el of els) elements.push(this.getElement(el, name));\n } catch (e) {\n elements = null;\n }\n } else if (typeof els === \"string\") {\n elements = [];\n for (el of document.querySelectorAll(els)) elements.push(el);\n } else if (els.nodeType != null) elements = [els];\n if (elements == null || !elements.length) throw new Error(`Invalid \\`${name}\\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);\n return elements;\n};\n// Asks the user the question and calls accepted or rejected accordingly\n//\n// The default implementation just uses `window.confirm` and then calls the\n// appropriate callback.\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.confirm = function (question, accepted, rejected) {\n if (window.confirm(question)) return accepted();else if (rejected != null) return rejected();\n};\n// Validates the mime type like this:\n//\n// https://developer.mozilla.org/en-US/docs/HTML/Element/input#attr-accept\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.isValidFile = function (file, acceptedFiles) {\n if (!acceptedFiles) return true;\n // If there are no accepted mime types, it's OK\n acceptedFiles = acceptedFiles.split(\",\");\n let mimeType = file.type;\n let baseMimeType = mimeType.replace(/\\/.*$/, \"\");\n for (let validType of acceptedFiles) {\n validType = validType.trim();\n if (validType.charAt(0) === \".\") {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) return true;\n } else if (/\\/\\*$/.test(validType)) {\n // This is something like a image/* mime type\n if (baseMimeType === validType.replace(/\\/.*$/, \"\")) return true;\n } else {\n if (mimeType === validType) return true;\n }\n }\n return false;\n};\n// Augment jQuery\nif (typeof jQuery !== \"undefined\" && jQuery !== null) jQuery.fn.dropzone = function (options) {\n return this.each(function () {\n return new $3ed269f2f0fb224b$export$2e2bcd8739ae039(this, options);\n });\n};\n// Dropzone file status codes\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.ADDED = \"added\";\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.QUEUED = \"queued\";\n// For backwards compatibility. Now, if a file is accepted, it's either queued\n// or uploading.\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.ACCEPTED = $3ed269f2f0fb224b$export$2e2bcd8739ae039.QUEUED;\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.UPLOADING = \"uploading\";\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.PROCESSING = $3ed269f2f0fb224b$export$2e2bcd8739ae039.UPLOADING; // alias\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.CANCELED = \"canceled\";\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.ERROR = \"error\";\n$3ed269f2f0fb224b$export$2e2bcd8739ae039.SUCCESS = \"success\";\n/*\n\n Bugfix for iOS 6 and 7\n Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios\n based on the work of https://github.com/stomita/ios-imagefile-megapixel\n\n */ // Detecting vertical squash in loaded image.\n// Fixes a bug which squash image vertically while drawing into canvas for some images.\n// This is a bug in iOS6 devices. This function from https://github.com/stomita/ios-imagefile-megapixel\nlet $3ed269f2f0fb224b$var$detectVerticalSquash = function (img) {\n let iw = img.naturalWidth;\n let ih = img.naturalHeight;\n let canvas = document.createElement(\"canvas\");\n canvas.width = 1;\n canvas.height = ih;\n let ctx = canvas.getContext(\"2d\");\n ctx.drawImage(img, 0, 0);\n let _ctx$getImageData = ctx.getImageData(1, 0, 1, ih),\n data = _ctx$getImageData.data;\n // search image edge pixel position in case it is squashed vertically.\n let sy = 0;\n let ey = ih;\n let py = ih;\n while (py > sy) {\n let alpha = data[(py - 1) * 4 + 3];\n if (alpha === 0) ey = py;else sy = py;\n py = ey + sy >> 1;\n }\n let ratio = py / ih;\n if (ratio === 0) return 1;else return ratio;\n};\n// A replacement for context.drawImage\n// (args are for source and destination).\nvar $3ed269f2f0fb224b$var$drawImageIOSFix = function (ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) {\n let vertSquashRatio = $3ed269f2f0fb224b$var$detectVerticalSquash(img);\n return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);\n};\n// Based on MinifyJpeg\n// Source: http://www.perry.cz/files/ExifRestorer.js\n// http://elicon.blog57.fc2.com/blog-entry-206.html\nclass $3ed269f2f0fb224b$var$ExifRestore {\n static initClass() {\n this.KEY_STR = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n }\n static encode64(input) {\n let output = \"\";\n let chr1 = undefined;\n let chr2 = undefined;\n let chr3 = \"\";\n let enc1 = undefined;\n let enc2 = undefined;\n let enc3 = undefined;\n let enc4 = \"\";\n let i = 0;\n while (true) {\n chr1 = input[i++];\n chr2 = input[i++];\n chr3 = input[i++];\n enc1 = chr1 >> 2;\n enc2 = (chr1 & 3) << 4 | chr2 >> 4;\n enc3 = (chr2 & 15) << 2 | chr3 >> 6;\n enc4 = chr3 & 63;\n if (isNaN(chr2)) enc3 = enc4 = 64;else if (isNaN(chr3)) enc4 = 64;\n output = output + this.KEY_STR.charAt(enc1) + this.KEY_STR.charAt(enc2) + this.KEY_STR.charAt(enc3) + this.KEY_STR.charAt(enc4);\n chr1 = chr2 = chr3 = \"\";\n enc1 = enc2 = enc3 = enc4 = \"\";\n if (!(i < input.length)) break;\n }\n return output;\n }\n static restore(origFileBase64, resizedFileBase64) {\n if (!origFileBase64.match(\"data:image/jpeg;base64,\")) return resizedFileBase64;\n let rawImage = this.decode64(origFileBase64.replace(\"data:image/jpeg;base64,\", \"\"));\n let segments = this.slice2Segments(rawImage);\n let image = this.exifManipulation(resizedFileBase64, segments);\n return `data:image/jpeg;base64,${this.encode64(image)}`;\n }\n static exifManipulation(resizedFileBase64, segments) {\n let exifArray = this.getExifArray(segments);\n let newImageArray = this.insertExif(resizedFileBase64, exifArray);\n let aBuffer = new Uint8Array(newImageArray);\n return aBuffer;\n }\n static getExifArray(segments) {\n let seg = undefined;\n let x = 0;\n while (x < segments.length) {\n seg = segments[x];\n if (seg[0] === 255 & seg[1] === 225) return seg;\n x++;\n }\n return [];\n }\n static insertExif(resizedFileBase64, exifArray) {\n let imageData = resizedFileBase64.replace(\"data:image/jpeg;base64,\", \"\");\n let buf = this.decode64(imageData);\n let separatePoint = buf.indexOf(255, 3);\n let mae = buf.slice(0, separatePoint);\n let ato = buf.slice(separatePoint);\n let array = mae;\n array = array.concat(exifArray);\n array = array.concat(ato);\n return array;\n }\n static slice2Segments(rawImageArray) {\n let head = 0;\n let segments = [];\n while (true) {\n var length;\n if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 218) break;\n if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 216) head += 2;else {\n length = rawImageArray[head + 2] * 256 + rawImageArray[head + 3];\n let endPoint = head + length + 2;\n let seg = rawImageArray.slice(head, endPoint);\n segments.push(seg);\n head = endPoint;\n }\n if (head > rawImageArray.length) break;\n }\n return segments;\n }\n static decode64(input) {\n let output = \"\";\n let chr1 = undefined;\n let chr2 = undefined;\n let chr3 = \"\";\n let enc1 = undefined;\n let enc2 = undefined;\n let enc3 = undefined;\n let enc4 = \"\";\n let i = 0;\n let buf = [];\n // remove all characters that are not A-Z, a-z, 0-9, +, /, or =\n let base64test = /[^A-Za-z0-9\\+\\/\\=]/g;\n if (base64test.exec(input)) console.warn(\"There were invalid base64 characters in the input text.\\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\\nExpect errors in decoding.\");\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n while (true) {\n enc1 = this.KEY_STR.indexOf(input.charAt(i++));\n enc2 = this.KEY_STR.indexOf(input.charAt(i++));\n enc3 = this.KEY_STR.indexOf(input.charAt(i++));\n enc4 = this.KEY_STR.indexOf(input.charAt(i++));\n chr1 = enc1 << 2 | enc2 >> 4;\n chr2 = (enc2 & 15) << 4 | enc3 >> 2;\n chr3 = (enc3 & 3) << 6 | enc4;\n buf.push(chr1);\n if (enc3 !== 64) buf.push(chr2);\n if (enc4 !== 64) buf.push(chr3);\n chr1 = chr2 = chr3 = \"\";\n enc1 = enc2 = enc3 = enc4 = \"\";\n if (!(i < input.length)) break;\n }\n return buf;\n }\n}\n$3ed269f2f0fb224b$var$ExifRestore.initClass();\n/*\n * contentloaded.js\n *\n * Author: Diego Perini (diego.perini at gmail.com)\n * Summary: cross-browser wrapper for DOMContentLoaded\n * Updated: 20101020\n * License: MIT\n * Version: 1.2\n *\n * URL:\n * http://javascript.nwbox.com/ContentLoaded/\n * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE\n */ // @win window reference\n// @fn function reference\nlet $3ed269f2f0fb224b$var$contentLoaded = function (win, fn) {\n let done = false;\n let top = true;\n let doc = win.document;\n let root = doc.documentElement;\n let add = doc.addEventListener ? \"addEventListener\" : \"attachEvent\";\n let rem = doc.addEventListener ? \"removeEventListener\" : \"detachEvent\";\n let pre = doc.addEventListener ? \"\" : \"on\";\n var init = function (e) {\n if (e.type === \"readystatechange\" && doc.readyState !== \"complete\") return;\n (e.type === \"load\" ? win : doc)[rem](pre + e.type, init, false);\n if (!done && (done = true)) return fn.call(win, e.type || e);\n };\n var poll = function () {\n try {\n root.doScroll(\"left\");\n } catch (e) {\n setTimeout(poll, 50);\n return;\n }\n return init(\"poll\");\n };\n if (doc.readyState !== \"complete\") {\n if (doc.createEventObject && root.doScroll) {\n try {\n top = !win.frameElement;\n } catch (error) {}\n if (top) poll();\n }\n doc[add](pre + \"DOMContentLoaded\", init, false);\n doc[add](pre + \"readystatechange\", init, false);\n return win[add](pre + \"load\", init, false);\n }\n};\nfunction $3ed269f2f0fb224b$var$__guard__(value, transform) {\n return typeof value !== \"undefined\" && value !== null ? transform(value) : undefined;\n}\nfunction $3ed269f2f0fb224b$var$__guardMethod__(obj, methodName, transform) {\n if (typeof obj !== \"undefined\" && obj !== null && typeof obj[methodName] === \"function\") return transform(obj, methodName);else return undefined;\n}\nexport { $3ed269f2f0fb224b$export$2e2bcd8739ae039 as default, $3ed269f2f0fb224b$export$2e2bcd8739ae039 as Dropzone };","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nimport instances from '../../dom/instances';\nvar Default = {\n alwaysOpen: false,\n activeClasses: 'bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white',\n inactiveClasses: 'text-gray-500 dark:text-gray-400',\n onOpen: function () {},\n onClose: function () {},\n onToggle: function () {}\n};\nvar Accordion = /** @class */function () {\n function Accordion(accordionEl, items, options) {\n if (accordionEl === void 0) {\n accordionEl = null;\n }\n if (items === void 0) {\n items = [];\n }\n if (options === void 0) {\n options = Default;\n }\n this._accordionEl = accordionEl;\n this._items = items;\n this._options = __assign(__assign({}, Default), options);\n this._initialized = false;\n this.init();\n instances.addInstance('Accordion', this, this._accordionEl.id, true);\n }\n Accordion.prototype.init = function () {\n var _this = this;\n if (this._items.length && !this._initialized) {\n // show accordion item based on click\n this._items.forEach(function (item) {\n if (item.active) {\n _this.open(item.id);\n }\n var clickHandler = function () {\n _this.toggle(item.id);\n };\n item.triggerEl.addEventListener('click', clickHandler);\n // Store the clickHandler in a property of the item for removal later\n item.clickHandler = clickHandler;\n });\n this._initialized = true;\n }\n };\n Accordion.prototype.destroy = function () {\n if (this._items.length && this._initialized) {\n this._items.forEach(function (item) {\n item.triggerEl.removeEventListener('click', item.clickHandler);\n // Clean up by deleting the clickHandler property from the item\n delete item.clickHandler;\n });\n this._initialized = false;\n }\n };\n Accordion.prototype.removeInstance = function () {\n instances.removeInstance('Accordion', this._accordionEl.id);\n };\n Accordion.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Accordion.prototype.getItem = function (id) {\n return this._items.filter(function (item) {\n return item.id === id;\n })[0];\n };\n Accordion.prototype.open = function (id) {\n var _a, _b;\n var _this = this;\n var item = this.getItem(id);\n // don't hide other accordions if always open\n if (!this._options.alwaysOpen) {\n this._items.map(function (i) {\n var _a, _b;\n if (i !== item) {\n (_a = i.triggerEl.classList).remove.apply(_a, _this._options.activeClasses.split(' '));\n (_b = i.triggerEl.classList).add.apply(_b, _this._options.inactiveClasses.split(' '));\n i.targetEl.classList.add('hidden');\n i.triggerEl.setAttribute('aria-expanded', 'false');\n i.active = false;\n // rotate icon if set\n if (i.iconEl) {\n i.iconEl.classList.remove('rotate-180');\n }\n }\n });\n }\n // show active item\n (_a = item.triggerEl.classList).add.apply(_a, this._options.activeClasses.split(' '));\n (_b = item.triggerEl.classList).remove.apply(_b, this._options.inactiveClasses.split(' '));\n item.triggerEl.setAttribute('aria-expanded', 'true');\n item.targetEl.classList.remove('hidden');\n item.active = true;\n // rotate icon if set\n if (item.iconEl) {\n item.iconEl.classList.add('rotate-180');\n }\n // callback function\n this._options.onOpen(this, item);\n };\n Accordion.prototype.toggle = function (id) {\n var item = this.getItem(id);\n if (item.active) {\n this.close(id);\n } else {\n this.open(id);\n }\n // callback function\n this._options.onToggle(this, item);\n };\n Accordion.prototype.close = function (id) {\n var _a, _b;\n var item = this.getItem(id);\n (_a = item.triggerEl.classList).remove.apply(_a, this._options.activeClasses.split(' '));\n (_b = item.triggerEl.classList).add.apply(_b, this._options.inactiveClasses.split(' '));\n item.targetEl.classList.add('hidden');\n item.triggerEl.setAttribute('aria-expanded', 'false');\n item.active = false;\n // rotate icon if set\n if (item.iconEl) {\n item.iconEl.classList.remove('rotate-180');\n }\n // callback function\n this._options.onClose(this, item);\n };\n return Accordion;\n}();\nexport function initAccordions() {\n document.querySelectorAll('[data-accordion]').forEach(function ($accordionEl) {\n var alwaysOpen = $accordionEl.getAttribute('data-accordion');\n var activeClasses = $accordionEl.getAttribute('data-active-classes');\n var inactiveClasses = $accordionEl.getAttribute('data-inactive-classes');\n var items = [];\n $accordionEl.querySelectorAll('[data-accordion-target]').forEach(function ($triggerEl) {\n // Consider only items that directly belong to $accordionEl\n // (to make nested accordions work).\n if ($triggerEl.closest('[data-accordion]') === $accordionEl) {\n var item = {\n id: $triggerEl.getAttribute('data-accordion-target'),\n triggerEl: $triggerEl,\n targetEl: document.querySelector($triggerEl.getAttribute('data-accordion-target')),\n iconEl: $triggerEl.querySelector('[data-accordion-icon]'),\n active: $triggerEl.getAttribute('aria-expanded') === 'true' ? true : false\n };\n items.push(item);\n }\n });\n new Accordion($accordionEl, items, {\n alwaysOpen: alwaysOpen === 'open' ? true : false,\n activeClasses: activeClasses ? activeClasses : Default.activeClasses,\n inactiveClasses: inactiveClasses ? inactiveClasses : Default.inactiveClasses\n });\n });\n}\nif (typeof window !== 'undefined') {\n window.Accordion = Accordion;\n window.initAccordions = initAccordions;\n}\nexport default Accordion;","export {};","export {};","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nimport instances from '../../dom/instances';\nvar Default = {\n defaultPosition: 0,\n indicators: {\n items: [],\n activeClasses: 'bg-white dark:bg-gray-800',\n inactiveClasses: 'bg-white/50 dark:bg-gray-800/50 hover:bg-white dark:hover:bg-gray-800'\n },\n interval: 3000,\n onNext: function () {},\n onPrev: function () {},\n onChange: function () {}\n};\nvar Carousel = /** @class */function () {\n function Carousel(carouselEl, items, options) {\n if (carouselEl === void 0) {\n carouselEl = null;\n }\n if (items === void 0) {\n items = [];\n }\n if (options === void 0) {\n options = Default;\n }\n this._carouselEl = carouselEl;\n this._items = items;\n this._options = __assign(__assign(__assign({}, Default), options), {\n indicators: __assign(__assign({}, Default.indicators), options.indicators)\n });\n this._activeItem = this.getItem(this._options.defaultPosition);\n this._indicators = this._options.indicators.items;\n this._intervalDuration = this._options.interval;\n this._intervalInstance = null;\n this._initialized = false;\n this.init();\n instances.addInstance('Carousel', this, this._carouselEl.id, true);\n }\n /**\n * initialize carousel and items based on active one\n */\n Carousel.prototype.init = function () {\n var _this = this;\n if (this._items.length && !this._initialized) {\n this._items.map(function (item) {\n item.el.classList.add('absolute', 'inset-0', 'transition-transform', 'transform');\n });\n // if no active item is set then first position is default\n if (this._getActiveItem()) {\n this.slideTo(this._getActiveItem().position);\n } else {\n this.slideTo(0);\n }\n this._indicators.map(function (indicator, position) {\n indicator.el.addEventListener('click', function () {\n _this.slideTo(position);\n });\n });\n this._initialized = true;\n }\n };\n Carousel.prototype.destroy = function () {\n if (this._initialized) {\n this._initialized = false;\n }\n };\n Carousel.prototype.removeInstance = function () {\n instances.removeInstance('Carousel', this._carouselEl.id);\n };\n Carousel.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Carousel.prototype.getItem = function (position) {\n return this._items[position];\n };\n /**\n * Slide to the element based on id\n * @param {*} position\n */\n Carousel.prototype.slideTo = function (position) {\n var nextItem = this._items[position];\n var rotationItems = {\n left: nextItem.position === 0 ? this._items[this._items.length - 1] : this._items[nextItem.position - 1],\n middle: nextItem,\n right: nextItem.position === this._items.length - 1 ? this._items[0] : this._items[nextItem.position + 1]\n };\n this._rotate(rotationItems);\n this._setActiveItem(nextItem);\n if (this._intervalInstance) {\n this.pause();\n this.cycle();\n }\n this._options.onChange(this);\n };\n /**\n * Based on the currently active item it will go to the next position\n */\n Carousel.prototype.next = function () {\n var activeItem = this._getActiveItem();\n var nextItem = null;\n // check if last item\n if (activeItem.position === this._items.length - 1) {\n nextItem = this._items[0];\n } else {\n nextItem = this._items[activeItem.position + 1];\n }\n this.slideTo(nextItem.position);\n // callback function\n this._options.onNext(this);\n };\n /**\n * Based on the currently active item it will go to the previous position\n */\n Carousel.prototype.prev = function () {\n var activeItem = this._getActiveItem();\n var prevItem = null;\n // check if first item\n if (activeItem.position === 0) {\n prevItem = this._items[this._items.length - 1];\n } else {\n prevItem = this._items[activeItem.position - 1];\n }\n this.slideTo(prevItem.position);\n // callback function\n this._options.onPrev(this);\n };\n /**\n * This method applies the transform classes based on the left, middle, and right rotation carousel items\n * @param {*} rotationItems\n */\n Carousel.prototype._rotate = function (rotationItems) {\n // reset\n this._items.map(function (item) {\n item.el.classList.add('hidden');\n });\n // left item (previously active)\n rotationItems.left.el.classList.remove('-translate-x-full', 'translate-x-full', 'translate-x-0', 'hidden', 'z-20');\n rotationItems.left.el.classList.add('-translate-x-full', 'z-10');\n // currently active item\n rotationItems.middle.el.classList.remove('-translate-x-full', 'translate-x-full', 'translate-x-0', 'hidden', 'z-10');\n rotationItems.middle.el.classList.add('translate-x-0', 'z-20');\n // right item (upcoming active)\n rotationItems.right.el.classList.remove('-translate-x-full', 'translate-x-full', 'translate-x-0', 'hidden', 'z-20');\n rotationItems.right.el.classList.add('translate-x-full', 'z-10');\n };\n /**\n * Set an interval to cycle through the carousel items\n */\n Carousel.prototype.cycle = function () {\n var _this = this;\n if (typeof window !== 'undefined') {\n this._intervalInstance = window.setInterval(function () {\n _this.next();\n }, this._intervalDuration);\n }\n };\n /**\n * Clears the cycling interval\n */\n Carousel.prototype.pause = function () {\n clearInterval(this._intervalInstance);\n };\n /**\n * Get the currently active item\n */\n Carousel.prototype._getActiveItem = function () {\n return this._activeItem;\n };\n /**\n * Set the currently active item and data attribute\n * @param {*} position\n */\n Carousel.prototype._setActiveItem = function (item) {\n var _a, _b;\n var _this = this;\n this._activeItem = item;\n var position = item.position;\n // update the indicators if available\n if (this._indicators.length) {\n this._indicators.map(function (indicator) {\n var _a, _b;\n indicator.el.setAttribute('aria-current', 'false');\n (_a = indicator.el.classList).remove.apply(_a, _this._options.indicators.activeClasses.split(' '));\n (_b = indicator.el.classList).add.apply(_b, _this._options.indicators.inactiveClasses.split(' '));\n });\n (_a = this._indicators[position].el.classList).add.apply(_a, this._options.indicators.activeClasses.split(' '));\n (_b = this._indicators[position].el.classList).remove.apply(_b, this._options.indicators.inactiveClasses.split(' '));\n this._indicators[position].el.setAttribute('aria-current', 'true');\n }\n };\n return Carousel;\n}();\nexport function initCarousels() {\n document.querySelectorAll('[data-carousel]').forEach(function ($carouselEl) {\n var interval = $carouselEl.getAttribute('data-carousel-interval');\n var slide = $carouselEl.getAttribute('data-carousel') === 'slide' ? true : false;\n var items = [];\n var defaultPosition = 0;\n if ($carouselEl.querySelectorAll('[data-carousel-item]').length) {\n Array.from($carouselEl.querySelectorAll('[data-carousel-item]')).map(function ($carouselItemEl, position) {\n items.push({\n position: position,\n el: $carouselItemEl\n });\n if ($carouselItemEl.getAttribute('data-carousel-item') === 'active') {\n defaultPosition = position;\n }\n });\n }\n var indicators = [];\n if ($carouselEl.querySelectorAll('[data-carousel-slide-to]').length) {\n Array.from($carouselEl.querySelectorAll('[data-carousel-slide-to]')).map(function ($indicatorEl) {\n indicators.push({\n position: parseInt($indicatorEl.getAttribute('data-carousel-slide-to')),\n el: $indicatorEl\n });\n });\n }\n var carousel = new Carousel($carouselEl, items, {\n defaultPosition: defaultPosition,\n indicators: {\n items: indicators\n },\n interval: interval ? interval : Default.interval\n });\n if (slide) {\n carousel.cycle();\n }\n // check for controls\n var carouselNextEl = $carouselEl.querySelector('[data-carousel-next]');\n var carouselPrevEl = $carouselEl.querySelector('[data-carousel-prev]');\n if (carouselNextEl) {\n carouselNextEl.addEventListener('click', function () {\n carousel.next();\n });\n }\n if (carouselPrevEl) {\n carouselPrevEl.addEventListener('click', function () {\n carousel.prev();\n });\n }\n });\n}\nif (typeof window !== 'undefined') {\n window.Carousel = Carousel;\n window.initCarousels = initCarousels;\n}\nexport default Carousel;","export {};","export {};","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nimport instances from '../../dom/instances';\nvar Default = {\n onCollapse: function () {},\n onExpand: function () {},\n onToggle: function () {}\n};\nvar Collapse = /** @class */function () {\n function Collapse(targetEl, triggerEl, options) {\n if (targetEl === void 0) {\n targetEl = null;\n }\n if (triggerEl === void 0) {\n triggerEl = null;\n }\n if (options === void 0) {\n options = Default;\n }\n this._targetEl = targetEl;\n this._triggerEl = triggerEl;\n this._options = __assign(__assign({}, Default), options);\n this._visible = false;\n this._initialized = false;\n this.init();\n instances.addInstance('Collapse', this, this._targetEl.id, true);\n }\n Collapse.prototype.init = function () {\n var _this = this;\n if (this._triggerEl && this._targetEl && !this._initialized) {\n if (this._triggerEl.hasAttribute('aria-expanded')) {\n this._visible = this._triggerEl.getAttribute('aria-expanded') === 'true';\n } else {\n // fix until v2 not to break previous single collapses which became dismiss\n this._visible = !this._targetEl.classList.contains('hidden');\n }\n this._clickHandler = function () {\n _this.toggle();\n };\n this._triggerEl.addEventListener('click', this._clickHandler);\n this._initialized = true;\n }\n };\n Collapse.prototype.destroy = function () {\n if (this._triggerEl && this._initialized) {\n this._triggerEl.removeEventListener('click', this._clickHandler);\n this._initialized = false;\n }\n };\n Collapse.prototype.removeInstance = function () {\n instances.removeInstance('Collapse', this._targetEl.id);\n };\n Collapse.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Collapse.prototype.collapse = function () {\n this._targetEl.classList.add('hidden');\n if (this._triggerEl) {\n this._triggerEl.setAttribute('aria-expanded', 'false');\n }\n this._visible = false;\n // callback function\n this._options.onCollapse(this);\n };\n Collapse.prototype.expand = function () {\n this._targetEl.classList.remove('hidden');\n if (this._triggerEl) {\n this._triggerEl.setAttribute('aria-expanded', 'true');\n }\n this._visible = true;\n // callback function\n this._options.onExpand(this);\n };\n Collapse.prototype.toggle = function () {\n if (this._visible) {\n this.collapse();\n } else {\n this.expand();\n }\n // callback function\n this._options.onToggle(this);\n };\n return Collapse;\n}();\nexport function initCollapses() {\n document.querySelectorAll('[data-collapse-toggle]').forEach(function ($triggerEl) {\n var targetId = $triggerEl.getAttribute('data-collapse-toggle');\n var $targetEl = document.getElementById(targetId);\n // check if the target element exists\n if ($targetEl) {\n new Collapse($targetEl, $triggerEl);\n } else {\n console.error(\"The target element with id \\\"\".concat(targetId, \"\\\" does not exist. Please check the data-collapse-toggle attribute.\"));\n }\n });\n}\nif (typeof window !== 'undefined') {\n window.Collapse = Collapse;\n window.initCollapses = initCollapses;\n}\nexport default Collapse;","export {};","export {};","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nimport instances from '../../dom/instances';\nvar Default = {\n triggerType: 'hover',\n onShow: function () {},\n onHide: function () {},\n onToggle: function () {}\n};\nvar Dial = /** @class */function () {\n function Dial(parentEl, triggerEl, targetEl, options) {\n if (parentEl === void 0) {\n parentEl = null;\n }\n if (triggerEl === void 0) {\n triggerEl = null;\n }\n if (targetEl === void 0) {\n targetEl = null;\n }\n if (options === void 0) {\n options = Default;\n }\n this._parentEl = parentEl;\n this._triggerEl = triggerEl;\n this._targetEl = targetEl;\n this._options = __assign(__assign({}, Default), options);\n this._visible = false;\n this._initialized = false;\n this.init();\n instances.addInstance('Dial', this, this._targetEl.id, true);\n }\n Dial.prototype.init = function () {\n var _this = this;\n if (this._triggerEl && this._targetEl && !this._initialized) {\n var triggerEventTypes = this._getTriggerEventTypes(this._options.triggerType);\n this._showEventHandler = function () {\n _this.show();\n };\n triggerEventTypes.showEvents.forEach(function (ev) {\n _this._triggerEl.addEventListener(ev, _this._showEventHandler);\n _this._targetEl.addEventListener(ev, _this._showEventHandler);\n });\n this._hideEventHandler = function () {\n if (!_this._parentEl.matches(':hover')) {\n _this.hide();\n }\n };\n triggerEventTypes.hideEvents.forEach(function (ev) {\n _this._parentEl.addEventListener(ev, _this._hideEventHandler);\n });\n this._initialized = true;\n }\n };\n Dial.prototype.destroy = function () {\n var _this = this;\n if (this._initialized) {\n var triggerEventTypes = this._getTriggerEventTypes(this._options.triggerType);\n triggerEventTypes.showEvents.forEach(function (ev) {\n _this._triggerEl.removeEventListener(ev, _this._showEventHandler);\n _this._targetEl.removeEventListener(ev, _this._showEventHandler);\n });\n triggerEventTypes.hideEvents.forEach(function (ev) {\n _this._parentEl.removeEventListener(ev, _this._hideEventHandler);\n });\n this._initialized = false;\n }\n };\n Dial.prototype.removeInstance = function () {\n instances.removeInstance('Dial', this._targetEl.id);\n };\n Dial.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Dial.prototype.hide = function () {\n this._targetEl.classList.add('hidden');\n if (this._triggerEl) {\n this._triggerEl.setAttribute('aria-expanded', 'false');\n }\n this._visible = false;\n // callback function\n this._options.onHide(this);\n };\n Dial.prototype.show = function () {\n this._targetEl.classList.remove('hidden');\n if (this._triggerEl) {\n this._triggerEl.setAttribute('aria-expanded', 'true');\n }\n this._visible = true;\n // callback function\n this._options.onShow(this);\n };\n Dial.prototype.toggle = function () {\n if (this._visible) {\n this.hide();\n } else {\n this.show();\n }\n };\n Dial.prototype.isHidden = function () {\n return !this._visible;\n };\n Dial.prototype.isVisible = function () {\n return this._visible;\n };\n Dial.prototype._getTriggerEventTypes = function (triggerType) {\n switch (triggerType) {\n case 'hover':\n return {\n showEvents: ['mouseenter', 'focus'],\n hideEvents: ['mouseleave', 'blur']\n };\n case 'click':\n return {\n showEvents: ['click', 'focus'],\n hideEvents: ['focusout', 'blur']\n };\n case 'none':\n return {\n showEvents: [],\n hideEvents: []\n };\n default:\n return {\n showEvents: ['mouseenter', 'focus'],\n hideEvents: ['mouseleave', 'blur']\n };\n }\n };\n return Dial;\n}();\nexport function initDials() {\n document.querySelectorAll('[data-dial-init]').forEach(function ($parentEl) {\n var $triggerEl = $parentEl.querySelector('[data-dial-toggle]');\n if ($triggerEl) {\n var dialId = $triggerEl.getAttribute('data-dial-toggle');\n var $dialEl = document.getElementById(dialId);\n if ($dialEl) {\n var triggerType = $triggerEl.getAttribute('data-dial-trigger');\n new Dial($parentEl, $triggerEl, $dialEl, {\n triggerType: triggerType ? triggerType : Default.triggerType\n });\n } else {\n console.error(\"Dial with id \".concat(dialId, \" does not exist. Are you sure that the data-dial-toggle attribute points to the correct modal id?\"));\n }\n } else {\n console.error(\"Dial with id \".concat($parentEl.id, \" does not have a trigger element. Are you sure that the data-dial-toggle attribute exists?\"));\n }\n });\n}\nif (typeof window !== 'undefined') {\n window.Dial = Dial;\n window.initDials = initDials;\n}\nexport default Dial;","export {};","export {};","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nimport instances from '../../dom/instances';\nvar Default = {\n transition: 'transition-opacity',\n duration: 300,\n timing: 'ease-out',\n onHide: function () {}\n};\nvar Dismiss = /** @class */function () {\n function Dismiss(targetEl, triggerEl, options) {\n if (targetEl === void 0) {\n targetEl = null;\n }\n if (triggerEl === void 0) {\n triggerEl = null;\n }\n if (options === void 0) {\n options = Default;\n }\n this._targetEl = targetEl;\n this._triggerEl = triggerEl;\n this._options = __assign(__assign({}, Default), options);\n this._initialized = false;\n this.init();\n instances.addInstance('Dismiss', this, this._targetEl.id, true);\n }\n Dismiss.prototype.init = function () {\n var _this = this;\n if (this._triggerEl && this._targetEl && !this._initialized) {\n this._clickHandler = function () {\n _this.hide();\n };\n this._triggerEl.addEventListener('click', this._clickHandler);\n this._initialized = true;\n }\n };\n Dismiss.prototype.destroy = function () {\n if (this._triggerEl && this._initialized) {\n this._triggerEl.removeEventListener('click', this._clickHandler);\n this._initialized = false;\n }\n };\n Dismiss.prototype.removeInstance = function () {\n instances.removeInstance('Dismiss', this._targetEl.id);\n };\n Dismiss.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Dismiss.prototype.hide = function () {\n var _this = this;\n this._targetEl.classList.add(this._options.transition, \"duration-\".concat(this._options.duration), this._options.timing, 'opacity-0');\n setTimeout(function () {\n _this._targetEl.classList.add('hidden');\n }, this._options.duration);\n // callback function\n this._options.onHide(this, this._targetEl);\n };\n return Dismiss;\n}();\nexport function initDismisses() {\n document.querySelectorAll('[data-dismiss-target]').forEach(function ($triggerEl) {\n var targetId = $triggerEl.getAttribute('data-dismiss-target');\n var $dismissEl = document.querySelector(targetId);\n if ($dismissEl) {\n new Dismiss($dismissEl, $triggerEl);\n } else {\n console.error(\"The dismiss element with id \\\"\".concat(targetId, \"\\\" does not exist. Please check the data-dismiss-target attribute.\"));\n }\n });\n}\nif (typeof window !== 'undefined') {\n window.Dismiss = Dismiss;\n window.initDismisses = initDismisses;\n}\nexport default Dismiss;","export {};","export {};","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nimport instances from '../../dom/instances';\nvar Default = {\n placement: 'left',\n bodyScrolling: false,\n backdrop: true,\n edge: false,\n edgeOffset: 'bottom-[60px]',\n backdropClasses: 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-30',\n onShow: function () {},\n onHide: function () {},\n onToggle: function () {}\n};\nvar Drawer = /** @class */function () {\n function Drawer(targetEl, options) {\n if (targetEl === void 0) {\n targetEl = null;\n }\n if (options === void 0) {\n options = Default;\n }\n this._targetEl = targetEl;\n this._options = __assign(__assign({}, Default), options);\n this._visible = false;\n this._initialized = false;\n this.init();\n instances.addInstance('Drawer', this, this._targetEl.id, true);\n }\n Drawer.prototype.init = function () {\n var _this = this;\n // set initial accessibility attributes\n if (this._targetEl && !this._initialized) {\n this._targetEl.setAttribute('aria-hidden', 'true');\n this._targetEl.classList.add('transition-transform');\n // set base placement classes\n this._getPlacementClasses(this._options.placement).base.map(function (c) {\n _this._targetEl.classList.add(c);\n });\n this._handleEscapeKey = function (event) {\n if (event.key === 'Escape') {\n // if 'Escape' key is pressed\n if (_this.isVisible()) {\n // if the Drawer is visible\n _this.hide(); // hide the Drawer\n }\n }\n };\n // add keyboard event listener to document\n document.addEventListener('keydown', this._handleEscapeKey);\n this._initialized = true;\n }\n };\n Drawer.prototype.destroy = function () {\n if (this._initialized) {\n this.hide();\n // Remove the keyboard event listener\n document.removeEventListener('keydown', this._handleEscapeKey);\n this._initialized = false;\n }\n };\n Drawer.prototype.removeInstance = function () {\n instances.removeInstance('Drawer', this._targetEl.id);\n };\n Drawer.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Drawer.prototype.hide = function () {\n var _this = this;\n // based on the edge option show placement classes\n if (this._options.edge) {\n this._getPlacementClasses(this._options.placement + '-edge').active.map(function (c) {\n _this._targetEl.classList.remove(c);\n });\n this._getPlacementClasses(this._options.placement + '-edge').inactive.map(function (c) {\n _this._targetEl.classList.add(c);\n });\n } else {\n this._getPlacementClasses(this._options.placement).active.map(function (c) {\n _this._targetEl.classList.remove(c);\n });\n this._getPlacementClasses(this._options.placement).inactive.map(function (c) {\n _this._targetEl.classList.add(c);\n });\n }\n // set accessibility attributes\n this._targetEl.setAttribute('aria-hidden', 'true');\n this._targetEl.removeAttribute('aria-modal');\n this._targetEl.removeAttribute('role');\n // enable body scroll\n if (!this._options.bodyScrolling) {\n document.body.classList.remove('overflow-hidden');\n }\n // destroy backdrop\n if (this._options.backdrop) {\n this._destroyBackdropEl();\n }\n this._visible = false;\n // callback function\n this._options.onHide(this);\n };\n Drawer.prototype.show = function () {\n var _this = this;\n if (this._options.edge) {\n this._getPlacementClasses(this._options.placement + '-edge').active.map(function (c) {\n _this._targetEl.classList.add(c);\n });\n this._getPlacementClasses(this._options.placement + '-edge').inactive.map(function (c) {\n _this._targetEl.classList.remove(c);\n });\n } else {\n this._getPlacementClasses(this._options.placement).active.map(function (c) {\n _this._targetEl.classList.add(c);\n });\n this._getPlacementClasses(this._options.placement).inactive.map(function (c) {\n _this._targetEl.classList.remove(c);\n });\n }\n // set accessibility attributes\n this._targetEl.setAttribute('aria-modal', 'true');\n this._targetEl.setAttribute('role', 'dialog');\n this._targetEl.removeAttribute('aria-hidden');\n // disable body scroll\n if (!this._options.bodyScrolling) {\n document.body.classList.add('overflow-hidden');\n }\n // show backdrop\n if (this._options.backdrop) {\n this._createBackdrop();\n }\n this._visible = true;\n // callback function\n this._options.onShow(this);\n };\n Drawer.prototype.toggle = function () {\n if (this.isVisible()) {\n this.hide();\n } else {\n this.show();\n }\n };\n Drawer.prototype._createBackdrop = function () {\n var _a;\n var _this = this;\n if (!this._visible) {\n var backdropEl = document.createElement('div');\n backdropEl.setAttribute('drawer-backdrop', '');\n (_a = backdropEl.classList).add.apply(_a, this._options.backdropClasses.split(' '));\n document.querySelector('body').append(backdropEl);\n backdropEl.addEventListener('click', function () {\n _this.hide();\n });\n }\n };\n Drawer.prototype._destroyBackdropEl = function () {\n if (this._visible) {\n document.querySelector('[drawer-backdrop]').remove();\n }\n };\n Drawer.prototype._getPlacementClasses = function (placement) {\n switch (placement) {\n case 'top':\n return {\n base: ['top-0', 'left-0', 'right-0'],\n active: ['transform-none'],\n inactive: ['-translate-y-full']\n };\n case 'right':\n return {\n base: ['right-0', 'top-0'],\n active: ['transform-none'],\n inactive: ['translate-x-full']\n };\n case 'bottom':\n return {\n base: ['bottom-0', 'left-0', 'right-0'],\n active: ['transform-none'],\n inactive: ['translate-y-full']\n };\n case 'left':\n return {\n base: ['left-0', 'top-0'],\n active: ['transform-none'],\n inactive: ['-translate-x-full']\n };\n case 'bottom-edge':\n return {\n base: ['left-0', 'top-0'],\n active: ['transform-none'],\n inactive: ['translate-y-full', this._options.edgeOffset]\n };\n default:\n return {\n base: ['left-0', 'top-0'],\n active: ['transform-none'],\n inactive: ['-translate-x-full']\n };\n }\n };\n Drawer.prototype.isHidden = function () {\n return !this._visible;\n };\n Drawer.prototype.isVisible = function () {\n return this._visible;\n };\n return Drawer;\n}();\nexport function initDrawers() {\n document.querySelectorAll('[data-drawer-target]').forEach(function ($triggerEl) {\n // mandatory\n var drawerId = $triggerEl.getAttribute('data-drawer-target');\n var $drawerEl = document.getElementById(drawerId);\n if ($drawerEl) {\n // optional\n var placement = $triggerEl.getAttribute('data-drawer-placement');\n var bodyScrolling = $triggerEl.getAttribute('data-drawer-body-scrolling');\n var backdrop = $triggerEl.getAttribute('data-drawer-backdrop');\n var edge = $triggerEl.getAttribute('data-drawer-edge');\n var edgeOffset = $triggerEl.getAttribute('data-drawer-edge-offset');\n if (!instances.instanceExists('Drawer', $drawerEl.getAttribute('id'))) {\n new Drawer($drawerEl, {\n placement: placement ? placement : Default.placement,\n bodyScrolling: bodyScrolling ? bodyScrolling === 'true' ? true : false : Default.bodyScrolling,\n backdrop: backdrop ? backdrop === 'true' ? true : false : Default.backdrop,\n edge: edge ? edge === 'true' ? true : false : Default.edge,\n edgeOffset: edgeOffset ? edgeOffset : Default.edgeOffset\n });\n }\n } else {\n console.error(\"Drawer with id \".concat(drawerId, \" not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?\"));\n }\n });\n document.querySelectorAll('[data-drawer-toggle]').forEach(function ($triggerEl) {\n var drawerId = $triggerEl.getAttribute('data-drawer-toggle');\n var $drawerEl = document.getElementById(drawerId);\n if ($drawerEl) {\n var drawer_1 = instances.getInstance('Drawer', $drawerEl.getAttribute('id'));\n if (drawer_1) {\n $triggerEl.addEventListener('click', function () {\n drawer_1.toggle();\n });\n } else {\n console.error(\"Drawer with id \".concat(drawerId, \" has not been initialized. Please initialize it using the data-drawer-target attribute.\"));\n }\n } else {\n console.error(\"Drawer with id \".concat(drawerId, \" not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?\"));\n }\n });\n document.querySelectorAll('[data-drawer-dismiss], [data-drawer-hide]').forEach(function ($triggerEl) {\n var drawerId = $triggerEl.getAttribute('data-drawer-dismiss') ? $triggerEl.getAttribute('data-drawer-dismiss') : $triggerEl.getAttribute('data-drawer-hide');\n var $drawerEl = document.getElementById(drawerId);\n if ($drawerEl) {\n var drawer_2 = instances.getInstance('Drawer', $drawerEl.getAttribute('id'));\n if (drawer_2) {\n $triggerEl.addEventListener('click', function () {\n drawer_2.hide();\n });\n } else {\n console.error(\"Drawer with id \".concat(drawerId, \" has not been initialized. Please initialize it using the data-drawer-target attribute.\"));\n }\n } else {\n console.error(\"Drawer with id \".concat(drawerId, \" not found. Are you sure that the data-drawer-target attribute points to the correct drawer id\"));\n }\n });\n document.querySelectorAll('[data-drawer-show]').forEach(function ($triggerEl) {\n var drawerId = $triggerEl.getAttribute('data-drawer-show');\n var $drawerEl = document.getElementById(drawerId);\n if ($drawerEl) {\n var drawer_3 = instances.getInstance('Drawer', $drawerEl.getAttribute('id'));\n if (drawer_3) {\n $triggerEl.addEventListener('click', function () {\n drawer_3.show();\n });\n } else {\n console.error(\"Drawer with id \".concat(drawerId, \" has not been initialized. Please initialize it using the data-drawer-target attribute.\"));\n }\n } else {\n console.error(\"Drawer with id \".concat(drawerId, \" not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?\"));\n }\n });\n}\nif (typeof window !== 'undefined') {\n window.Drawer = Drawer;\n window.initDrawers = initDrawers;\n}\nexport default Drawer;","export {};","export {};","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nvar __spreadArray = this && this.__spreadArray || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n/* eslint-disable @typescript-eslint/no-empty-function */\nimport { createPopper } from '@popperjs/core';\nimport instances from '../../dom/instances';\nvar Default = {\n placement: 'bottom',\n triggerType: 'click',\n offsetSkidding: 0,\n offsetDistance: 10,\n delay: 300,\n ignoreClickOutsideClass: false,\n onShow: function () {},\n onHide: function () {},\n onToggle: function () {}\n};\nvar Dropdown = /** @class */function () {\n function Dropdown(targetElement, triggerElement, options) {\n if (targetElement === void 0) {\n targetElement = null;\n }\n if (triggerElement === void 0) {\n triggerElement = null;\n }\n if (options === void 0) {\n options = Default;\n }\n this._targetEl = targetElement;\n this._triggerEl = triggerElement;\n this._options = __assign(__assign({}, Default), options);\n this._popperInstance = null;\n this._visible = false;\n this._initialized = false;\n this.init();\n instances.addInstance('Dropdown', this, this._targetEl.id, true);\n }\n Dropdown.prototype.init = function () {\n if (this._triggerEl && this._targetEl && !this._initialized) {\n this._popperInstance = this._createPopperInstance();\n this._setupEventListeners();\n this._initialized = true;\n }\n };\n Dropdown.prototype.destroy = function () {\n var _this = this;\n var triggerEvents = this._getTriggerEvents();\n // Remove click event listeners for trigger element\n if (this._options.triggerType === 'click') {\n triggerEvents.showEvents.forEach(function (ev) {\n _this._triggerEl.removeEventListener(ev, _this._clickHandler);\n });\n }\n // Remove hover event listeners for trigger and target elements\n if (this._options.triggerType === 'hover') {\n triggerEvents.showEvents.forEach(function (ev) {\n _this._triggerEl.removeEventListener(ev, _this._hoverShowTriggerElHandler);\n _this._targetEl.removeEventListener(ev, _this._hoverShowTargetElHandler);\n });\n triggerEvents.hideEvents.forEach(function (ev) {\n _this._triggerEl.removeEventListener(ev, _this._hoverHideHandler);\n _this._targetEl.removeEventListener(ev, _this._hoverHideHandler);\n });\n }\n this._popperInstance.destroy();\n this._initialized = false;\n };\n Dropdown.prototype.removeInstance = function () {\n instances.removeInstance('Dropdown', this._targetEl.id);\n };\n Dropdown.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Dropdown.prototype._setupEventListeners = function () {\n var _this = this;\n var triggerEvents = this._getTriggerEvents();\n this._clickHandler = function () {\n _this.toggle();\n };\n // click event handling for trigger element\n if (this._options.triggerType === 'click') {\n triggerEvents.showEvents.forEach(function (ev) {\n _this._triggerEl.addEventListener(ev, _this._clickHandler);\n });\n }\n this._hoverShowTriggerElHandler = function (ev) {\n if (ev.type === 'click') {\n _this.toggle();\n } else {\n setTimeout(function () {\n _this.show();\n }, _this._options.delay);\n }\n };\n this._hoverShowTargetElHandler = function () {\n _this.show();\n };\n this._hoverHideHandler = function () {\n setTimeout(function () {\n if (!_this._targetEl.matches(':hover')) {\n _this.hide();\n }\n }, _this._options.delay);\n };\n // hover event handling for trigger element\n if (this._options.triggerType === 'hover') {\n triggerEvents.showEvents.forEach(function (ev) {\n _this._triggerEl.addEventListener(ev, _this._hoverShowTriggerElHandler);\n _this._targetEl.addEventListener(ev, _this._hoverShowTargetElHandler);\n });\n triggerEvents.hideEvents.forEach(function (ev) {\n _this._triggerEl.addEventListener(ev, _this._hoverHideHandler);\n _this._targetEl.addEventListener(ev, _this._hoverHideHandler);\n });\n }\n };\n Dropdown.prototype._createPopperInstance = function () {\n return createPopper(this._triggerEl, this._targetEl, {\n placement: this._options.placement,\n modifiers: [{\n name: 'offset',\n options: {\n offset: [this._options.offsetSkidding, this._options.offsetDistance]\n }\n }]\n });\n };\n Dropdown.prototype._setupClickOutsideListener = function () {\n var _this = this;\n this._clickOutsideEventListener = function (ev) {\n _this._handleClickOutside(ev, _this._targetEl);\n };\n document.body.addEventListener('click', this._clickOutsideEventListener, true);\n };\n Dropdown.prototype._removeClickOutsideListener = function () {\n document.body.removeEventListener('click', this._clickOutsideEventListener, true);\n };\n Dropdown.prototype._handleClickOutside = function (ev, targetEl) {\n var clickedEl = ev.target;\n // Ignore clicks on the trigger element (ie. a datepicker input)\n var ignoreClickOutsideClass = this._options.ignoreClickOutsideClass;\n var isIgnored = false;\n if (ignoreClickOutsideClass) {\n var ignoredClickOutsideEls = document.querySelectorAll(\".\".concat(ignoreClickOutsideClass));\n ignoredClickOutsideEls.forEach(function (el) {\n if (el.contains(clickedEl)) {\n isIgnored = true;\n return;\n }\n });\n }\n // Ignore clicks on the target element (ie. dropdown itself)\n if (clickedEl !== targetEl && !targetEl.contains(clickedEl) && !this._triggerEl.contains(clickedEl) && !isIgnored && this.isVisible()) {\n this.hide();\n }\n };\n Dropdown.prototype._getTriggerEvents = function () {\n switch (this._options.triggerType) {\n case 'hover':\n return {\n showEvents: ['mouseenter', 'click'],\n hideEvents: ['mouseleave']\n };\n case 'click':\n return {\n showEvents: ['click'],\n hideEvents: []\n };\n case 'none':\n return {\n showEvents: [],\n hideEvents: []\n };\n default:\n return {\n showEvents: ['click'],\n hideEvents: []\n };\n }\n };\n Dropdown.prototype.toggle = function () {\n if (this.isVisible()) {\n this.hide();\n } else {\n this.show();\n }\n this._options.onToggle(this);\n };\n Dropdown.prototype.isVisible = function () {\n return this._visible;\n };\n Dropdown.prototype.show = function () {\n this._targetEl.classList.remove('hidden');\n this._targetEl.classList.add('block');\n // Enable the event listeners\n this._popperInstance.setOptions(function (options) {\n return __assign(__assign({}, options), {\n modifiers: __spreadArray(__spreadArray([], options.modifiers, true), [{\n name: 'eventListeners',\n enabled: true\n }], false)\n });\n });\n this._setupClickOutsideListener();\n // Update its position\n this._popperInstance.update();\n this._visible = true;\n // callback function\n this._options.onShow(this);\n };\n Dropdown.prototype.hide = function () {\n this._targetEl.classList.remove('block');\n this._targetEl.classList.add('hidden');\n // Disable the event listeners\n this._popperInstance.setOptions(function (options) {\n return __assign(__assign({}, options), {\n modifiers: __spreadArray(__spreadArray([], options.modifiers, true), [{\n name: 'eventListeners',\n enabled: false\n }], false)\n });\n });\n this._visible = false;\n this._removeClickOutsideListener();\n // callback function\n this._options.onHide(this);\n };\n return Dropdown;\n}();\nexport function initDropdowns() {\n document.querySelectorAll('[data-dropdown-toggle]').forEach(function ($triggerEl) {\n var dropdownId = $triggerEl.getAttribute('data-dropdown-toggle');\n var $dropdownEl = document.getElementById(dropdownId);\n if ($dropdownEl) {\n var placement = $triggerEl.getAttribute('data-dropdown-placement');\n var offsetSkidding = $triggerEl.getAttribute('data-dropdown-offset-skidding');\n var offsetDistance = $triggerEl.getAttribute('data-dropdown-offset-distance');\n var triggerType = $triggerEl.getAttribute('data-dropdown-trigger');\n var delay = $triggerEl.getAttribute('data-dropdown-delay');\n var ignoreClickOutsideClass = $triggerEl.getAttribute('data-dropdown-ignore-click-outside-class');\n new Dropdown($dropdownEl, $triggerEl, {\n placement: placement ? placement : Default.placement,\n triggerType: triggerType ? triggerType : Default.triggerType,\n offsetSkidding: offsetSkidding ? parseInt(offsetSkidding) : Default.offsetSkidding,\n offsetDistance: offsetDistance ? parseInt(offsetDistance) : Default.offsetDistance,\n delay: delay ? parseInt(delay) : Default.delay,\n ignoreClickOutsideClass: ignoreClickOutsideClass ? ignoreClickOutsideClass : Default.ignoreClickOutsideClass\n });\n } else {\n console.error(\"The dropdown element with id \\\"\".concat(dropdownId, \"\\\" does not exist. Please check the data-dropdown-toggle attribute.\"));\n }\n });\n}\nif (typeof window !== 'undefined') {\n window.Dropdown = Dropdown;\n window.initDropdowns = initDropdowns;\n}\nexport default Dropdown;","export {};","export {};","import { initAccordions } from './accordion';\nimport { initCarousels } from './carousel';\nimport { initCollapses } from './collapse';\nimport { initDials } from './dial';\nimport { initDismisses } from './dismiss';\nimport { initDrawers } from './drawer';\nimport { initDropdowns } from './dropdown';\nimport { initModals } from './modal';\nimport { initPopovers } from './popover';\nimport { initTabs } from './tabs';\nimport { initTooltips } from './tooltip';\nexport function initFlowbite() {\n initAccordions();\n initCollapses();\n initCarousels();\n initDismisses();\n initDropdowns();\n initModals();\n initDrawers();\n initTabs();\n initTooltips();\n initPopovers();\n initDials();\n}\nif (typeof window !== 'undefined') {\n window.initFlowbite = initFlowbite;\n}","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nimport instances from '../../dom/instances';\nvar Default = {\n placement: 'center',\n backdropClasses: 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40',\n backdrop: 'dynamic',\n closable: true,\n onHide: function () {},\n onShow: function () {},\n onToggle: function () {}\n};\nvar Modal = /** @class */function () {\n function Modal(targetEl, options) {\n if (targetEl === void 0) {\n targetEl = null;\n }\n if (options === void 0) {\n options = Default;\n }\n this._targetEl = targetEl;\n this._options = __assign(__assign({}, Default), options);\n this._isHidden = true;\n this._backdropEl = null;\n this._initialized = false;\n this.init();\n instances.addInstance('Modal', this, this._targetEl.id, true);\n }\n Modal.prototype.init = function () {\n var _this = this;\n if (this._targetEl && !this._initialized) {\n this._getPlacementClasses().map(function (c) {\n _this._targetEl.classList.add(c);\n });\n this._initialized = true;\n }\n };\n Modal.prototype.destroy = function () {\n if (this._initialized) {\n this.hide();\n this._initialized = false;\n }\n };\n Modal.prototype.removeInstance = function () {\n instances.removeInstance('Modal', this._targetEl.id);\n };\n Modal.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Modal.prototype._createBackdrop = function () {\n var _a;\n if (this._isHidden) {\n var backdropEl = document.createElement('div');\n backdropEl.setAttribute('modal-backdrop', '');\n (_a = backdropEl.classList).add.apply(_a, this._options.backdropClasses.split(' '));\n document.querySelector('body').append(backdropEl);\n this._backdropEl = backdropEl;\n }\n };\n Modal.prototype._destroyBackdropEl = function () {\n if (!this._isHidden) {\n document.querySelector('[modal-backdrop]').remove();\n }\n };\n Modal.prototype._setupModalCloseEventListeners = function () {\n var _this = this;\n if (this._options.backdrop === 'dynamic') {\n this._clickOutsideEventListener = function (ev) {\n _this._handleOutsideClick(ev.target);\n };\n this._targetEl.addEventListener('click', this._clickOutsideEventListener, true);\n }\n this._keydownEventListener = function (ev) {\n if (ev.key === 'Escape') {\n _this.hide();\n }\n };\n document.body.addEventListener('keydown', this._keydownEventListener, true);\n };\n Modal.prototype._removeModalCloseEventListeners = function () {\n if (this._options.backdrop === 'dynamic') {\n this._targetEl.removeEventListener('click', this._clickOutsideEventListener, true);\n }\n document.body.removeEventListener('keydown', this._keydownEventListener, true);\n };\n Modal.prototype._handleOutsideClick = function (target) {\n if (target === this._targetEl || target === this._backdropEl && this.isVisible()) {\n this.hide();\n }\n };\n Modal.prototype._getPlacementClasses = function () {\n switch (this._options.placement) {\n // top\n case 'top-left':\n return ['justify-start', 'items-start'];\n case 'top-center':\n return ['justify-center', 'items-start'];\n case 'top-right':\n return ['justify-end', 'items-start'];\n // center\n case 'center-left':\n return ['justify-start', 'items-center'];\n case 'center':\n return ['justify-center', 'items-center'];\n case 'center-right':\n return ['justify-end', 'items-center'];\n // bottom\n case 'bottom-left':\n return ['justify-start', 'items-end'];\n case 'bottom-center':\n return ['justify-center', 'items-end'];\n case 'bottom-right':\n return ['justify-end', 'items-end'];\n default:\n return ['justify-center', 'items-center'];\n }\n };\n Modal.prototype.toggle = function () {\n if (this._isHidden) {\n this.show();\n } else {\n this.hide();\n }\n // callback function\n this._options.onToggle(this);\n };\n Modal.prototype.show = function () {\n if (this.isHidden) {\n this._targetEl.classList.add('flex');\n this._targetEl.classList.remove('hidden');\n this._targetEl.setAttribute('aria-modal', 'true');\n this._targetEl.setAttribute('role', 'dialog');\n this._targetEl.removeAttribute('aria-hidden');\n this._createBackdrop();\n this._isHidden = false;\n // Add keyboard event listener to the document\n if (this._options.closable) {\n this._setupModalCloseEventListeners();\n }\n // prevent body scroll\n document.body.classList.add('overflow-hidden');\n // callback function\n this._options.onShow(this);\n }\n };\n Modal.prototype.hide = function () {\n if (this.isVisible) {\n this._targetEl.classList.add('hidden');\n this._targetEl.classList.remove('flex');\n this._targetEl.setAttribute('aria-hidden', 'true');\n this._targetEl.removeAttribute('aria-modal');\n this._targetEl.removeAttribute('role');\n this._destroyBackdropEl();\n this._isHidden = true;\n // re-apply body scroll\n document.body.classList.remove('overflow-hidden');\n if (this._options.closable) {\n this._removeModalCloseEventListeners();\n }\n // callback function\n this._options.onHide(this);\n }\n };\n Modal.prototype.isVisible = function () {\n return !this._isHidden;\n };\n Modal.prototype.isHidden = function () {\n return this._isHidden;\n };\n return Modal;\n}();\nexport function initModals() {\n // initiate modal based on data-modal-target\n document.querySelectorAll('[data-modal-target]').forEach(function ($triggerEl) {\n var modalId = $triggerEl.getAttribute('data-modal-target');\n var $modalEl = document.getElementById(modalId);\n if ($modalEl) {\n var placement = $modalEl.getAttribute('data-modal-placement');\n var backdrop = $modalEl.getAttribute('data-modal-backdrop');\n if (instances.instanceExists('Modal', $modalEl.getAttribute('id'))) {\n new Modal($modalEl, {\n placement: placement ? placement : Default.placement,\n backdrop: backdrop ? backdrop : Default.backdrop\n });\n }\n } else {\n console.error(\"Modal with id \".concat(modalId, \" does not exist. Are you sure that the data-modal-target attribute points to the correct modal id?.\"));\n }\n });\n // support pre v1.6.0 data-modal-toggle initialization\n document.querySelectorAll('[data-modal-toggle]').forEach(function ($triggerEl) {\n var modalId = $triggerEl.getAttribute('data-modal-toggle');\n var $modalEl = document.getElementById(modalId);\n if ($modalEl) {\n var placement = $modalEl.getAttribute('data-modal-placement');\n var backdrop = $modalEl.getAttribute('data-modal-backdrop');\n var modal_1;\n if (instances.instanceExists('Modal', $modalEl.getAttribute('id'))) {\n modal_1 = instances.getInstance('Modal', $modalEl.getAttribute('id'));\n } else {\n {\n modal_1 = new Modal($modalEl, {\n placement: placement ? placement : Default.placement,\n backdrop: backdrop ? backdrop : Default.backdrop\n });\n }\n }\n $triggerEl.addEventListener('click', function () {\n modal_1.toggle();\n });\n } else {\n console.error(\"Modal with id \".concat(modalId, \" does not exist. Are you sure that the data-modal-toggle attribute points to the correct modal id?\"));\n }\n });\n // show modal on click if exists based on id\n document.querySelectorAll('[data-modal-show]').forEach(function ($triggerEl) {\n var modalId = $triggerEl.getAttribute('data-modal-show');\n var $modalEl = document.getElementById(modalId);\n if ($modalEl) {\n if (instances.instanceExists('Modal', $modalEl.getAttribute('id'))) {\n var modal_2 = instances.getInstance('Modal', $modalEl.getAttribute('id'));\n $triggerEl.addEventListener('click', function () {\n modal_2.show();\n });\n } else {\n console.error(\"Modal with id \".concat(modalId, \" has not been initialized. Please initialize it using the data-modal-target attribute.\"));\n }\n } else {\n console.error(\"Modal with id \".concat(modalId, \" does not exist. Are you sure that the data-modal-show attribute points to the correct modal id?\"));\n }\n });\n // hide modal on click if exists based on id\n document.querySelectorAll('[data-modal-hide]').forEach(function ($triggerEl) {\n var modalId = $triggerEl.getAttribute('data-modal-hide');\n var $modalEl = document.getElementById(modalId);\n if ($modalEl) {\n if (instances.instanceExists('Modal', $modalEl.getAttribute('id'))) {\n var modal_3 = instances.getInstance('Modal', $modalEl.getAttribute('id'));\n $triggerEl.addEventListener('click', function () {\n modal_3.hide();\n });\n } else {\n console.error(\"Modal with id \".concat(modalId, \" has not been initialized. Please initialize it using the data-modal-target attribute.\"));\n }\n } else {\n console.error(\"Modal with id \".concat(modalId, \" does not exist. Are you sure that the data-modal-hide attribute points to the correct modal id?\"));\n }\n });\n}\nif (typeof window !== 'undefined') {\n window.Modal = Modal;\n window.initModals = initModals;\n}\nexport default Modal;","export {};","export {};","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nvar __spreadArray = this && this.__spreadArray || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n/* eslint-disable @typescript-eslint/no-empty-function */\nimport { createPopper } from '@popperjs/core';\nimport instances from '../../dom/instances';\nvar Default = {\n placement: 'top',\n offset: 10,\n triggerType: 'hover',\n onShow: function () {},\n onHide: function () {},\n onToggle: function () {}\n};\nvar Popover = /** @class */function () {\n function Popover(targetEl, triggerEl, options) {\n if (targetEl === void 0) {\n targetEl = null;\n }\n if (triggerEl === void 0) {\n triggerEl = null;\n }\n if (options === void 0) {\n options = Default;\n }\n this._targetEl = targetEl;\n this._triggerEl = triggerEl;\n this._options = __assign(__assign({}, Default), options);\n this._popperInstance = null;\n this._visible = false;\n this._initialized = false;\n this.init();\n instances.addInstance('Popover', this, this._targetEl.id, true);\n }\n Popover.prototype.init = function () {\n if (this._triggerEl && this._targetEl && !this._initialized) {\n this._setupEventListeners();\n this._popperInstance = this._createPopperInstance();\n this._initialized = true;\n }\n };\n Popover.prototype.destroy = function () {\n var _this = this;\n if (this._initialized) {\n // remove event listeners associated with the trigger element and target element\n var triggerEvents = this._getTriggerEvents();\n triggerEvents.showEvents.forEach(function (ev) {\n _this._triggerEl.removeEventListener(ev, _this._showHandler);\n _this._targetEl.removeEventListener(ev, _this._showHandler);\n });\n triggerEvents.hideEvents.forEach(function (ev) {\n _this._triggerEl.removeEventListener(ev, _this._hideHandler);\n _this._targetEl.removeEventListener(ev, _this._hideHandler);\n });\n // remove event listeners for keydown\n this._removeKeydownListener();\n // remove event listeners for click outside\n this._removeClickOutsideListener();\n // destroy the Popper instance if you have one (assuming this._popperInstance is the Popper instance)\n if (this._popperInstance) {\n this._popperInstance.destroy();\n }\n this._initialized = false;\n }\n };\n Popover.prototype.removeInstance = function () {\n instances.removeInstance('Popover', this._targetEl.id);\n };\n Popover.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Popover.prototype._setupEventListeners = function () {\n var _this = this;\n var triggerEvents = this._getTriggerEvents();\n this._showHandler = function () {\n _this.show();\n };\n this._hideHandler = function () {\n setTimeout(function () {\n if (!_this._targetEl.matches(':hover')) {\n _this.hide();\n }\n }, 100);\n };\n triggerEvents.showEvents.forEach(function (ev) {\n _this._triggerEl.addEventListener(ev, _this._showHandler);\n _this._targetEl.addEventListener(ev, _this._showHandler);\n });\n triggerEvents.hideEvents.forEach(function (ev) {\n _this._triggerEl.addEventListener(ev, _this._hideHandler);\n _this._targetEl.addEventListener(ev, _this._hideHandler);\n });\n };\n Popover.prototype._createPopperInstance = function () {\n return createPopper(this._triggerEl, this._targetEl, {\n placement: this._options.placement,\n modifiers: [{\n name: 'offset',\n options: {\n offset: [0, this._options.offset]\n }\n }]\n });\n };\n Popover.prototype._getTriggerEvents = function () {\n switch (this._options.triggerType) {\n case 'hover':\n return {\n showEvents: ['mouseenter', 'focus'],\n hideEvents: ['mouseleave', 'blur']\n };\n case 'click':\n return {\n showEvents: ['click', 'focus'],\n hideEvents: ['focusout', 'blur']\n };\n case 'none':\n return {\n showEvents: [],\n hideEvents: []\n };\n default:\n return {\n showEvents: ['mouseenter', 'focus'],\n hideEvents: ['mouseleave', 'blur']\n };\n }\n };\n Popover.prototype._setupKeydownListener = function () {\n var _this = this;\n this._keydownEventListener = function (ev) {\n if (ev.key === 'Escape') {\n _this.hide();\n }\n };\n document.body.addEventListener('keydown', this._keydownEventListener, true);\n };\n Popover.prototype._removeKeydownListener = function () {\n document.body.removeEventListener('keydown', this._keydownEventListener, true);\n };\n Popover.prototype._setupClickOutsideListener = function () {\n var _this = this;\n this._clickOutsideEventListener = function (ev) {\n _this._handleClickOutside(ev, _this._targetEl);\n };\n document.body.addEventListener('click', this._clickOutsideEventListener, true);\n };\n Popover.prototype._removeClickOutsideListener = function () {\n document.body.removeEventListener('click', this._clickOutsideEventListener, true);\n };\n Popover.prototype._handleClickOutside = function (ev, targetEl) {\n var clickedEl = ev.target;\n if (clickedEl !== targetEl && !targetEl.contains(clickedEl) && !this._triggerEl.contains(clickedEl) && this.isVisible()) {\n this.hide();\n }\n };\n Popover.prototype.isVisible = function () {\n return this._visible;\n };\n Popover.prototype.toggle = function () {\n if (this.isVisible()) {\n this.hide();\n } else {\n this.show();\n }\n this._options.onToggle(this);\n };\n Popover.prototype.show = function () {\n this._targetEl.classList.remove('opacity-0', 'invisible');\n this._targetEl.classList.add('opacity-100', 'visible');\n // Enable the event listeners\n this._popperInstance.setOptions(function (options) {\n return __assign(__assign({}, options), {\n modifiers: __spreadArray(__spreadArray([], options.modifiers, true), [{\n name: 'eventListeners',\n enabled: true\n }], false)\n });\n });\n // handle click outside\n this._setupClickOutsideListener();\n // handle esc keydown\n this._setupKeydownListener();\n // Update its position\n this._popperInstance.update();\n // set visibility to true\n this._visible = true;\n // callback function\n this._options.onShow(this);\n };\n Popover.prototype.hide = function () {\n this._targetEl.classList.remove('opacity-100', 'visible');\n this._targetEl.classList.add('opacity-0', 'invisible');\n // Disable the event listeners\n this._popperInstance.setOptions(function (options) {\n return __assign(__assign({}, options), {\n modifiers: __spreadArray(__spreadArray([], options.modifiers, true), [{\n name: 'eventListeners',\n enabled: false\n }], false)\n });\n });\n // handle click outside\n this._removeClickOutsideListener();\n // handle esc keydown\n this._removeKeydownListener();\n // set visibility to false\n this._visible = false;\n // callback function\n this._options.onHide(this);\n };\n return Popover;\n}();\nexport function initPopovers() {\n document.querySelectorAll('[data-popover-target]').forEach(function ($triggerEl) {\n var popoverID = $triggerEl.getAttribute('data-popover-target');\n var $popoverEl = document.getElementById(popoverID);\n if ($popoverEl) {\n var triggerType = $triggerEl.getAttribute('data-popover-trigger');\n var placement = $triggerEl.getAttribute('data-popover-placement');\n var offset = $triggerEl.getAttribute('data-popover-offset');\n new Popover($popoverEl, $triggerEl, {\n placement: placement ? placement : Default.placement,\n offset: offset ? parseInt(offset) : Default.offset,\n triggerType: triggerType ? triggerType : Default.triggerType\n });\n } else {\n console.error(\"The popover element with id \\\"\".concat(popoverID, \"\\\" does not exist. Please check the data-popover-target attribute.\"));\n }\n });\n}\nif (typeof window !== 'undefined') {\n window.Popover = Popover;\n window.initPopovers = initPopovers;\n}\nexport default Popover;","export {};","export {};","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nimport instances from '../../dom/instances';\nvar Default = {\n defaultTabId: null,\n activeClasses: 'text-blue-600 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-500 border-blue-600 dark:border-blue-500',\n inactiveClasses: 'dark:border-transparent text-gray-500 hover:text-gray-600 dark:text-gray-400 border-gray-100 hover:border-gray-300 dark:border-gray-700 dark:hover:text-gray-300',\n onShow: function () {}\n};\nvar Tabs = /** @class */function () {\n function Tabs(accordionEl, items, options) {\n if (accordionEl === void 0) {\n accordionEl = null;\n }\n if (items === void 0) {\n items = [];\n }\n if (options === void 0) {\n options = Default;\n }\n this._accordionEl = accordionEl;\n this._items = items;\n this._activeTab = options ? this.getTab(options.defaultTabId) : null;\n this._options = __assign(__assign({}, Default), options);\n this._initialized = false;\n this.init();\n instances.addInstance('Tabs', this, this._accordionEl.id, true);\n }\n Tabs.prototype.init = function () {\n var _this = this;\n if (this._items.length && !this._initialized) {\n // set the first tab as active if not set by explicitly\n if (!this._activeTab) {\n this.setActiveTab(this._items[0]);\n }\n // force show the first default tab\n this.show(this._activeTab.id, true);\n // show tab content based on click\n this._items.map(function (tab) {\n tab.triggerEl.addEventListener('click', function () {\n _this.show(tab.id);\n });\n });\n }\n };\n Tabs.prototype.destroy = function () {\n if (this._initialized) {\n this._initialized = false;\n }\n };\n Tabs.prototype.removeInstance = function () {\n this.destroy();\n instances.removeInstance('Tabs', this._accordionEl.id);\n };\n Tabs.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Tabs.prototype.getActiveTab = function () {\n return this._activeTab;\n };\n Tabs.prototype.setActiveTab = function (tab) {\n this._activeTab = tab;\n };\n Tabs.prototype.getTab = function (id) {\n return this._items.filter(function (t) {\n return t.id === id;\n })[0];\n };\n Tabs.prototype.show = function (id, forceShow) {\n var _a, _b;\n var _this = this;\n if (forceShow === void 0) {\n forceShow = false;\n }\n var tab = this.getTab(id);\n // don't do anything if already active\n if (tab === this._activeTab && !forceShow) {\n return;\n }\n // hide other tabs\n this._items.map(function (t) {\n var _a, _b;\n if (t !== tab) {\n (_a = t.triggerEl.classList).remove.apply(_a, _this._options.activeClasses.split(' '));\n (_b = t.triggerEl.classList).add.apply(_b, _this._options.inactiveClasses.split(' '));\n t.targetEl.classList.add('hidden');\n t.triggerEl.setAttribute('aria-selected', 'false');\n }\n });\n // show active tab\n (_a = tab.triggerEl.classList).add.apply(_a, this._options.activeClasses.split(' '));\n (_b = tab.triggerEl.classList).remove.apply(_b, this._options.inactiveClasses.split(' '));\n tab.triggerEl.setAttribute('aria-selected', 'true');\n tab.targetEl.classList.remove('hidden');\n this.setActiveTab(tab);\n // callback function\n this._options.onShow(this, tab);\n };\n return Tabs;\n}();\nexport function initTabs() {\n document.querySelectorAll('[data-tabs-toggle]').forEach(function ($parentEl) {\n var tabItems = [];\n var defaultTabId = null;\n $parentEl.querySelectorAll('[role=\"tab\"]').forEach(function ($triggerEl) {\n var isActive = $triggerEl.getAttribute('aria-selected') === 'true';\n var tab = {\n id: $triggerEl.getAttribute('data-tabs-target'),\n triggerEl: $triggerEl,\n targetEl: document.querySelector($triggerEl.getAttribute('data-tabs-target'))\n };\n tabItems.push(tab);\n if (isActive) {\n defaultTabId = tab.id;\n }\n });\n new Tabs($parentEl, tabItems, {\n defaultTabId: defaultTabId\n });\n });\n}\nif (typeof window !== 'undefined') {\n window.Tabs = Tabs;\n window.initTabs = initTabs;\n}\nexport default Tabs;","export {};","export {};","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (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};\nvar __spreadArray = this && this.__spreadArray || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n/* eslint-disable @typescript-eslint/no-empty-function */\nimport { createPopper } from '@popperjs/core';\nimport instances from '../../dom/instances';\nvar Default = {\n placement: 'top',\n triggerType: 'hover',\n onShow: function () {},\n onHide: function () {},\n onToggle: function () {}\n};\nvar Tooltip = /** @class */function () {\n function Tooltip(targetEl, triggerEl, options) {\n if (targetEl === void 0) {\n targetEl = null;\n }\n if (triggerEl === void 0) {\n triggerEl = null;\n }\n if (options === void 0) {\n options = Default;\n }\n this._targetEl = targetEl;\n this._triggerEl = triggerEl;\n this._options = __assign(__assign({}, Default), options);\n this._popperInstance = null;\n this._visible = false;\n this._initialized = false;\n this.init();\n instances.addInstance('Tooltip', this, this._targetEl.id, true);\n }\n Tooltip.prototype.init = function () {\n if (this._triggerEl && this._targetEl && !this._initialized) {\n this._setupEventListeners();\n this._popperInstance = this._createPopperInstance();\n this._initialized = true;\n }\n };\n Tooltip.prototype.destroy = function () {\n var _this = this;\n if (this._initialized) {\n // remove event listeners associated with the trigger element\n var triggerEvents = this._getTriggerEvents();\n triggerEvents.showEvents.forEach(function (ev) {\n _this._triggerEl.removeEventListener(ev, _this._showHandler);\n });\n triggerEvents.hideEvents.forEach(function (ev) {\n _this._triggerEl.removeEventListener(ev, _this._hideHandler);\n });\n // remove event listeners for keydown\n this._removeKeydownListener();\n // remove event listeners for click outside\n this._removeClickOutsideListener();\n // destroy the Popper instance if you have one (assuming this._popperInstance is the Popper instance)\n if (this._popperInstance) {\n this._popperInstance.destroy();\n }\n this._initialized = false;\n }\n };\n Tooltip.prototype.removeInstance = function () {\n instances.removeInstance('Tooltip', this._targetEl.id);\n };\n Tooltip.prototype.destroyAndRemoveInstance = function () {\n this.destroy();\n this.removeInstance();\n };\n Tooltip.prototype._setupEventListeners = function () {\n var _this = this;\n var triggerEvents = this._getTriggerEvents();\n this._showHandler = function () {\n _this.show();\n };\n this._hideHandler = function () {\n _this.hide();\n };\n triggerEvents.showEvents.forEach(function (ev) {\n _this._triggerEl.addEventListener(ev, _this._showHandler);\n });\n triggerEvents.hideEvents.forEach(function (ev) {\n _this._triggerEl.addEventListener(ev, _this._hideHandler);\n });\n };\n Tooltip.prototype._createPopperInstance = function () {\n return createPopper(this._triggerEl, this._targetEl, {\n placement: this._options.placement,\n modifiers: [{\n name: 'offset',\n options: {\n offset: [0, 8]\n }\n }]\n });\n };\n Tooltip.prototype._getTriggerEvents = function () {\n switch (this._options.triggerType) {\n case 'hover':\n return {\n showEvents: ['mouseenter', 'focus'],\n hideEvents: ['mouseleave', 'blur']\n };\n case 'click':\n return {\n showEvents: ['click', 'focus'],\n hideEvents: ['focusout', 'blur']\n };\n case 'none':\n return {\n showEvents: [],\n hideEvents: []\n };\n default:\n return {\n showEvents: ['mouseenter', 'focus'],\n hideEvents: ['mouseleave', 'blur']\n };\n }\n };\n Tooltip.prototype._setupKeydownListener = function () {\n var _this = this;\n this._keydownEventListener = function (ev) {\n if (ev.key === 'Escape') {\n _this.hide();\n }\n };\n document.body.addEventListener('keydown', this._keydownEventListener, true);\n };\n Tooltip.prototype._removeKeydownListener = function () {\n document.body.removeEventListener('keydown', this._keydownEventListener, true);\n };\n Tooltip.prototype._setupClickOutsideListener = function () {\n var _this = this;\n this._clickOutsideEventListener = function (ev) {\n _this._handleClickOutside(ev, _this._targetEl);\n };\n document.body.addEventListener('click', this._clickOutsideEventListener, true);\n };\n Tooltip.prototype._removeClickOutsideListener = function () {\n document.body.removeEventListener('click', this._clickOutsideEventListener, true);\n };\n Tooltip.prototype._handleClickOutside = function (ev, targetEl) {\n var clickedEl = ev.target;\n if (clickedEl !== targetEl && !targetEl.contains(clickedEl) && !this._triggerEl.contains(clickedEl) && this.isVisible()) {\n this.hide();\n }\n };\n Tooltip.prototype.isVisible = function () {\n return this._visible;\n };\n Tooltip.prototype.toggle = function () {\n if (this.isVisible()) {\n this.hide();\n } else {\n this.show();\n }\n };\n Tooltip.prototype.show = function () {\n this._targetEl.classList.remove('opacity-0', 'invisible');\n this._targetEl.classList.add('opacity-100', 'visible');\n // Enable the event listeners\n this._popperInstance.setOptions(function (options) {\n return __assign(__assign({}, options), {\n modifiers: __spreadArray(__spreadArray([], options.modifiers, true), [{\n name: 'eventListeners',\n enabled: true\n }], false)\n });\n });\n // handle click outside\n this._setupClickOutsideListener();\n // handle esc keydown\n this._setupKeydownListener();\n // Update its position\n this._popperInstance.update();\n // set visibility\n this._visible = true;\n // callback function\n this._options.onShow(this);\n };\n Tooltip.prototype.hide = function () {\n this._targetEl.classList.remove('opacity-100', 'visible');\n this._targetEl.classList.add('opacity-0', 'invisible');\n // Disable the event listeners\n this._popperInstance.setOptions(function (options) {\n return __assign(__assign({}, options), {\n modifiers: __spreadArray(__spreadArray([], options.modifiers, true), [{\n name: 'eventListeners',\n enabled: false\n }], false)\n });\n });\n // handle click outside\n this._removeClickOutsideListener();\n // handle esc keydown\n this._removeKeydownListener();\n // set visibility\n this._visible = false;\n // callback function\n this._options.onHide(this);\n };\n return Tooltip;\n}();\nexport function initTooltips() {\n document.querySelectorAll('[data-tooltip-target]').forEach(function ($triggerEl) {\n var tooltipId = $triggerEl.getAttribute('data-tooltip-target');\n var $tooltipEl = document.getElementById(tooltipId);\n if ($tooltipEl) {\n var triggerType = $triggerEl.getAttribute('data-tooltip-trigger');\n var placement = $triggerEl.getAttribute('data-tooltip-placement');\n new Tooltip($tooltipEl, $triggerEl, {\n placement: placement ? placement : Default.placement,\n triggerType: triggerType ? triggerType : Default.triggerType\n });\n } else {\n console.error(\"The tooltip element with id \\\"\".concat(tooltipId, \"\\\" does not exist. Please check the data-tooltip-target attribute.\"));\n }\n });\n}\nif (typeof window !== 'undefined') {\n window.Tooltip = Tooltip;\n window.initTooltips = initTooltips;\n}\nexport default Tooltip;","export {};","export {};","var Events = /** @class */function () {\n function Events(eventType, eventFunctions) {\n if (eventFunctions === void 0) {\n eventFunctions = [];\n }\n this._eventType = eventType;\n this._eventFunctions = eventFunctions;\n }\n Events.prototype.init = function () {\n var _this = this;\n this._eventFunctions.forEach(function (eventFunction) {\n if (typeof window !== 'undefined') {\n window.addEventListener(_this._eventType, eventFunction);\n }\n });\n };\n return Events;\n}();\nexport default Events;","var Instances = /** @class */function () {\n function Instances() {\n this._instances = {\n Accordion: {},\n Carousel: {},\n Collapse: {},\n Dial: {},\n Dismiss: {},\n Drawer: {},\n Dropdown: {},\n Modal: {},\n Popover: {},\n Tabs: {},\n Tooltip: {}\n };\n }\n Instances.prototype.addInstance = function (component, instance, id, forceOverride) {\n if (forceOverride === void 0) {\n forceOverride = false;\n }\n if (!this._instances[component]) {\n console.warn(\"Flowbite: Component \".concat(component, \" does not exist.\"));\n return false;\n }\n if (this._instances[component][id] && !forceOverride) {\n console.warn(\"Flowbite: Instance with ID \".concat(id, \" already exists.\"));\n return;\n }\n this._instances[component][id ? id : this._generateRandomId()] = instance;\n };\n Instances.prototype.getAllInstances = function () {\n return this._instances;\n };\n Instances.prototype.getInstances = function (component) {\n if (!this._instances[component]) {\n console.warn(\"Flowbite: Component \".concat(component, \" does not exist.\"));\n return false;\n }\n return this._instances[component];\n };\n Instances.prototype.getInstance = function (component, id) {\n if (!this._componentAndInstanceCheck(component, id)) {\n return;\n }\n if (!this._instances[component][id]) {\n console.warn(\"Flowbite: Instance with ID \".concat(id, \" does not exist.\"));\n return;\n }\n return this._instances[component][id];\n };\n Instances.prototype.destroyAndRemoveInstance = function (component, id) {\n if (!this._componentAndInstanceCheck(component, id)) {\n return;\n }\n this.destroyInstanceObject(component, id);\n this.removeInstance(component, id);\n };\n Instances.prototype.removeInstance = function (component, id) {\n if (!this._componentAndInstanceCheck(component, id)) {\n return;\n }\n this._instances[component][id].removeInstance();\n };\n Instances.prototype.destroyInstanceObject = function (component, id) {\n if (!this._componentAndInstanceCheck(component, id)) {\n return;\n }\n this._instances[component][id].destroy();\n };\n Instances.prototype.instanceExists = function (component, id) {\n if (!this._instances[component]) {\n return false;\n }\n if (!this._instances[component][id]) {\n return false;\n }\n return true;\n };\n Instances.prototype._generateRandomId = function () {\n return Math.random().toString(36).substr(2, 9);\n };\n Instances.prototype._componentAndInstanceCheck = function (component, id) {\n if (!this._instances[component]) {\n console.warn(\"Flowbite: Component \".concat(component, \" does not exist.\"));\n return false;\n }\n if (!this._instances[component][id]) {\n console.warn(\"Flowbite: Instance with ID \".concat(id, \" already exists.\"));\n return false;\n }\n return true;\n };\n return Instances;\n}();\nvar instances = new Instances();\nexport default instances;\nif (typeof window !== 'undefined') {\n window.FlowbiteInstances = instances;\n}","import Events from './dom/events';\nimport { initAccordions } from './components/accordion';\nimport { initCollapses } from './components/collapse';\nimport { initCarousels } from './components/carousel';\nimport { initDismisses } from './components/dismiss';\nimport { initDropdowns } from './components/dropdown';\nimport { initModals } from './components/modal';\nimport { initDrawers } from './components/drawer';\nimport { initTabs } from './components/tabs';\nimport { initTooltips } from './components/tooltip';\nimport { initPopovers } from './components/popover';\nimport { initDials } from './components/dial';\nimport './components/index';\n// setup events for data attributes\nvar events = new Events('load', [initAccordions, initCollapses, initCarousels, initDismisses, initDropdowns, initModals, initDrawers, initTabs, initTooltips, initPopovers, initDials]);\nevents.init();\n// export all components\nexport { default as Accordion } from './components/accordion';\nexport { default as Carousel } from './components/carousel';\nexport { default as Collapse } from './components/collapse';\nexport { default as Dial } from './components/dial';\nexport { default as Dismiss } from './components/dismiss';\nexport { default as Drawer } from './components/drawer';\nexport { default as Dropdown } from './components/dropdown';\nexport { default as Modal } from './components/modal';\nexport { default as Popover } from './components/popover';\nexport { default as Tabs } from './components/tabs';\nexport { default as Tooltip } from './components/tooltip';\n// export all types\nexport * from './components/accordion/types';\nexport * from './components/carousel/types';\nexport * from './components/collapse/types';\nexport * from './components/dial/types';\nexport * from './components/dismiss/types';\nexport * from './components/drawer/types';\nexport * from './components/dropdown/types';\nexport * from './components/modal/types';\nexport * from './components/popover/types';\nexport * from './components/tabs/types';\nexport * from './components/tooltip/types';\n// export all interfaces\nexport * from './components/accordion/interface';\nexport * from './components/carousel/interface';\nexport * from './components/collapse/interface';\nexport * from './components/dial/interface';\nexport * from './components/dismiss/interface';\nexport * from './components/drawer/interface';\nexport * from './components/dropdown/interface';\nexport * from './components/modal/interface';\nexport * from './components/popover/interface';\nexport * from './components/tabs/interface';\nexport * from './components/tooltip/interface';\n// export init functions\nexport { initAccordions } from './components/accordion';\nexport { initCarousels } from './components/carousel';\nexport { initCollapses } from './components/collapse';\nexport { initDials } from './components/dial';\nexport { initDismisses } from './components/dismiss';\nexport { initDrawers } from './components/drawer';\nexport { initDropdowns } from './components/dropdown';\nexport { initModals } from './components/modal';\nexport { initPopovers } from './components/popover';\nexport { initTabs } from './components/tabs';\nexport { initTooltips } from './components/tooltip';\n// export all init functions\nexport { initFlowbite } from './components/index';","/**! \n * hotkeys-js v3.13.2 \n * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. \n * \n * Copyright (c) 2023 kenny wong \n * https://github.com/jaywcjlove/hotkeys-js.git \n * \n * @website: https://jaywcjlove.github.io/hotkeys-js\n \n * Licensed under the MIT license \n */\n\nconst isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false;\n\n// 绑定事件\nfunction addEvent(object, event, method, useCapture) {\n if (object.addEventListener) {\n object.addEventListener(event, method, useCapture);\n } else if (object.attachEvent) {\n object.attachEvent(\"on\".concat(event), () => {\n method(window.event);\n });\n }\n}\n\n// 修饰键转换成对应的键码\nfunction getMods(modifier, key) {\n const mods = key.slice(0, key.length - 1);\n for (let i = 0; i < mods.length; i++) mods[i] = modifier[mods[i].toLowerCase()];\n return mods;\n}\n\n// 处理传的key字符串转换成数组\nfunction getKeys(key) {\n if (typeof key !== 'string') key = '';\n key = key.replace(/\\s/g, ''); // 匹配任何空白字符,包括空格、制表符、换页符等等\n const keys = key.split(','); // 同时设置多个快捷键,以','分割\n let index = keys.lastIndexOf('');\n\n // 快捷键可能包含',',需特殊处理\n for (; index >= 0;) {\n keys[index - 1] += ',';\n keys.splice(index, 1);\n index = keys.lastIndexOf('');\n }\n return keys;\n}\n\n// 比较修饰键的数组\nfunction compareArray(a1, a2) {\n const arr1 = a1.length >= a2.length ? a1 : a2;\n const arr2 = a1.length >= a2.length ? a2 : a1;\n let isIndex = true;\n for (let i = 0; i < arr1.length; i++) {\n if (arr2.indexOf(arr1[i]) === -1) isIndex = false;\n }\n return isIndex;\n}\n\n// Special Keys\nconst _keyMap = {\n backspace: 8,\n '⌫': 8,\n tab: 9,\n clear: 12,\n enter: 13,\n '↩': 13,\n return: 13,\n esc: 27,\n escape: 27,\n space: 32,\n left: 37,\n up: 38,\n right: 39,\n down: 40,\n del: 46,\n delete: 46,\n ins: 45,\n insert: 45,\n home: 36,\n end: 35,\n pageup: 33,\n pagedown: 34,\n capslock: 20,\n num_0: 96,\n num_1: 97,\n num_2: 98,\n num_3: 99,\n num_4: 100,\n num_5: 101,\n num_6: 102,\n num_7: 103,\n num_8: 104,\n num_9: 105,\n num_multiply: 106,\n num_add: 107,\n num_enter: 108,\n num_subtract: 109,\n num_decimal: 110,\n num_divide: 111,\n '⇪': 20,\n ',': 188,\n '.': 190,\n '/': 191,\n '`': 192,\n '-': isff ? 173 : 189,\n '=': isff ? 61 : 187,\n ';': isff ? 59 : 186,\n '\\'': 222,\n '[': 219,\n ']': 221,\n '\\\\': 220\n};\n\n// Modifier Keys\nconst _modifier = {\n // shiftKey\n '⇧': 16,\n shift: 16,\n // altKey\n '⌥': 18,\n alt: 18,\n option: 18,\n // ctrlKey\n '⌃': 17,\n ctrl: 17,\n control: 17,\n // metaKey\n '⌘': 91,\n cmd: 91,\n command: 91\n};\nconst modifierMap = {\n 16: 'shiftKey',\n 18: 'altKey',\n 17: 'ctrlKey',\n 91: 'metaKey',\n shiftKey: 16,\n ctrlKey: 17,\n altKey: 18,\n metaKey: 91\n};\nconst _mods = {\n 16: false,\n 18: false,\n 17: false,\n 91: false\n};\nconst _handlers = {};\n\n// F1~F12 special key\nfor (let k = 1; k < 20; k++) {\n _keyMap[\"f\".concat(k)] = 111 + k;\n}\nlet _downKeys = []; // 记录摁下的绑定键\nlet winListendFocus = false; // window是否已经监听了focus事件\nlet _scope = 'all'; // 默认热键范围\nconst elementHasBindEvent = []; // 已绑定事件的节点记录\n\n// 返回键码\nconst code = x => _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);\nconst getKey = x => Object.keys(_keyMap).find(k => _keyMap[k] === x);\nconst getModifier = x => Object.keys(_modifier).find(k => _modifier[k] === x);\n\n// 设置获取当前范围(默认为'所有')\nfunction setScope(scope) {\n _scope = scope || 'all';\n}\n// 获取当前范围\nfunction getScope() {\n return _scope || 'all';\n}\n// 获取摁下绑定键的键值\nfunction getPressedKeyCodes() {\n return _downKeys.slice(0);\n}\nfunction getPressedKeyString() {\n return _downKeys.map(c => getKey(c) || getModifier(c) || String.fromCharCode(c));\n}\nfunction getAllKeyCodes() {\n const result = [];\n Object.keys(_handlers).forEach(k => {\n _handlers[k].forEach(_ref => {\n let key = _ref.key,\n scope = _ref.scope,\n mods = _ref.mods,\n shortcut = _ref.shortcut;\n result.push({\n scope,\n shortcut,\n mods,\n keys: key.split('+').map(v => code(v))\n });\n });\n });\n return result;\n}\n\n// 表单控件控件判断 返回 Boolean\n// hotkey is effective only when filter return true\nfunction filter(event) {\n const target = event.target || event.srcElement;\n const tagName = target.tagName;\n let flag = true;\n // ignore: isContentEditable === 'true', and \";\n support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;\n\n // Support: IE <=9 only\n // IE <=9 replaces \";\n support.option = !!div.lastChild;\n })();\n\n // We have to close these tags to support XHTML (trac-13200)\n var wrapMap = {\n // XHTML parsers do not magically insert elements in the\n // same way that tag soup parsers do. So we cannot shorten\n // this by omitting or other required elements.\n thead: [1, \"\", \"
\"],\n col: [2, \"\", \"
\"],\n tr: [2, \"\", \"
\"],\n td: [3, \"\", \"
\"],\n _default: [0, \"\", \"\"]\n };\n wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\n wrapMap.th = wrapMap.td;\n\n // Support: IE <=9 only\n if (!support.option) {\n wrapMap.optgroup = wrapMap.option = [1, \"\"];\n }\n function getAll(context, tag) {\n // Support: IE <=9 - 11 only\n // Use typeof to avoid zero-argument method invocation on host objects (trac-15151)\n var ret;\n if (typeof context.getElementsByTagName !== \"undefined\") {\n ret = context.getElementsByTagName(tag || \"*\");\n } else if (typeof context.querySelectorAll !== \"undefined\") {\n ret = context.querySelectorAll(tag || \"*\");\n } else {\n ret = [];\n }\n if (tag === undefined || tag && nodeName(context, tag)) {\n return jQuery.merge([context], ret);\n }\n return ret;\n }\n\n // Mark scripts as having already been evaluated\n function setGlobalEval(elems, refElements) {\n var i = 0,\n l = elems.length;\n for (; i < l; i++) {\n dataPriv.set(elems[i], \"globalEval\", !refElements || dataPriv.get(refElements[i], \"globalEval\"));\n }\n }\n var rhtml = /<|&#?\\w+;/;\n function buildFragment(elems, context, scripts, selection, ignored) {\n var elem,\n tmp,\n tag,\n wrap,\n attached,\n j,\n fragment = context.createDocumentFragment(),\n nodes = [],\n i = 0,\n l = elems.length;\n for (; i < l; i++) {\n elem = elems[i];\n if (elem || elem === 0) {\n // Add nodes directly\n if (toType(elem) === \"object\") {\n // Support: Android <=4.0 only, PhantomJS 1 only\n // push.apply(_, arraylike) throws on ancient WebKit\n jQuery.merge(nodes, elem.nodeType ? [elem] : elem);\n\n // Convert non-html into a text node\n } else if (!rhtml.test(elem)) {\n nodes.push(context.createTextNode(elem));\n\n // Convert html into DOM nodes\n } else {\n tmp = tmp || fragment.appendChild(context.createElement(\"div\"));\n\n // Deserialize a standard representation\n tag = (rtagName.exec(elem) || [\"\", \"\"])[1].toLowerCase();\n wrap = wrapMap[tag] || wrapMap._default;\n tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];\n\n // Descend through wrappers to the right content\n j = wrap[0];\n while (j--) {\n tmp = tmp.lastChild;\n }\n\n // Support: Android <=4.0 only, PhantomJS 1 only\n // push.apply(_, arraylike) throws on ancient WebKit\n jQuery.merge(nodes, tmp.childNodes);\n\n // Remember the top-level container\n tmp = fragment.firstChild;\n\n // Ensure the created nodes are orphaned (trac-12392)\n tmp.textContent = \"\";\n }\n }\n }\n\n // Remove wrapper from fragment\n fragment.textContent = \"\";\n i = 0;\n while (elem = nodes[i++]) {\n // Skip elements already in the context collection (trac-4087)\n if (selection && jQuery.inArray(elem, selection) > -1) {\n if (ignored) {\n ignored.push(elem);\n }\n continue;\n }\n attached = isAttached(elem);\n\n // Append to fragment\n tmp = getAll(fragment.appendChild(elem), \"script\");\n\n // Preserve script evaluation history\n if (attached) {\n setGlobalEval(tmp);\n }\n\n // Capture executables\n if (scripts) {\n j = 0;\n while (elem = tmp[j++]) {\n if (rscriptType.test(elem.type || \"\")) {\n scripts.push(elem);\n }\n }\n }\n }\n return fragment;\n }\n var rtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n function returnTrue() {\n return true;\n }\n function returnFalse() {\n return false;\n }\n function on(elem, types, selector, data, fn, one) {\n var origFn, type;\n\n // Types can be a map of types/handlers\n if (typeof types === \"object\") {\n // ( types-Object, selector, data )\n if (typeof selector !== \"string\") {\n // ( types-Object, data )\n data = data || selector;\n selector = undefined;\n }\n for (type in types) {\n on(elem, type, selector, data, types[type], one);\n }\n return elem;\n }\n if (data == null && fn == null) {\n // ( types, fn )\n fn = selector;\n data = selector = undefined;\n } else if (fn == null) {\n if (typeof selector === \"string\") {\n // ( types, selector, fn )\n fn = data;\n data = undefined;\n } else {\n // ( types, data, fn )\n fn = data;\n data = selector;\n selector = undefined;\n }\n }\n if (fn === false) {\n fn = returnFalse;\n } else if (!fn) {\n return elem;\n }\n if (one === 1) {\n origFn = fn;\n fn = function (event) {\n // Can use an empty set, since event contains the info\n jQuery().off(event);\n return origFn.apply(this, arguments);\n };\n\n // Use same guid so caller can remove using origFn\n fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);\n }\n return elem.each(function () {\n jQuery.event.add(this, types, fn, data, selector);\n });\n }\n\n /*\n * Helper functions for managing events -- not part of the public interface.\n * Props to Dean Edwards' addEvent library for many of the ideas.\n */\n jQuery.event = {\n global: {},\n add: function (elem, types, handler, data, selector) {\n var handleObjIn,\n eventHandle,\n tmp,\n events,\n t,\n handleObj,\n special,\n handlers,\n type,\n namespaces,\n origType,\n elemData = dataPriv.get(elem);\n\n // Only attach events to objects that accept data\n if (!acceptData(elem)) {\n return;\n }\n\n // Caller can pass in an object of custom data in lieu of the handler\n if (handler.handler) {\n handleObjIn = handler;\n handler = handleObjIn.handler;\n selector = handleObjIn.selector;\n }\n\n // Ensure that invalid selectors throw exceptions at attach time\n // Evaluate against documentElement in case elem is a non-element node (e.g., document)\n if (selector) {\n jQuery.find.matchesSelector(documentElement, selector);\n }\n\n // Make sure that the handler has a unique ID, used to find/remove it later\n if (!handler.guid) {\n handler.guid = jQuery.guid++;\n }\n\n // Init the element's event structure and main handler, if this is the first\n if (!(events = elemData.events)) {\n events = elemData.events = Object.create(null);\n }\n if (!(eventHandle = elemData.handle)) {\n eventHandle = elemData.handle = function (e) {\n // Discard the second event of a jQuery.event.trigger() and\n // when an event is called after a page has unloaded\n return typeof jQuery !== \"undefined\" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;\n };\n }\n\n // Handle multiple events separated by a space\n types = (types || \"\").match(rnothtmlwhite) || [\"\"];\n t = types.length;\n while (t--) {\n tmp = rtypenamespace.exec(types[t]) || [];\n type = origType = tmp[1];\n namespaces = (tmp[2] || \"\").split(\".\").sort();\n\n // There *must* be a type, no attaching namespace-only handlers\n if (!type) {\n continue;\n }\n\n // If event changes its type, use the special event handlers for the changed type\n special = jQuery.event.special[type] || {};\n\n // If selector defined, determine special event api type, otherwise given type\n type = (selector ? special.delegateType : special.bindType) || type;\n\n // Update special based on newly reset type\n special = jQuery.event.special[type] || {};\n\n // handleObj is passed to all event handlers\n handleObj = jQuery.extend({\n type: type,\n origType: origType,\n data: data,\n handler: handler,\n guid: handler.guid,\n selector: selector,\n needsContext: selector && jQuery.expr.match.needsContext.test(selector),\n namespace: namespaces.join(\".\")\n }, handleObjIn);\n\n // Init the event handler queue if we're the first\n if (!(handlers = events[type])) {\n handlers = events[type] = [];\n handlers.delegateCount = 0;\n\n // Only use addEventListener if the special events handler returns false\n if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {\n if (elem.addEventListener) {\n elem.addEventListener(type, eventHandle);\n }\n }\n }\n if (special.add) {\n special.add.call(elem, handleObj);\n if (!handleObj.handler.guid) {\n handleObj.handler.guid = handler.guid;\n }\n }\n\n // Add to the element's handler list, delegates in front\n if (selector) {\n handlers.splice(handlers.delegateCount++, 0, handleObj);\n } else {\n handlers.push(handleObj);\n }\n\n // Keep track of which events have ever been used, for event optimization\n jQuery.event.global[type] = true;\n }\n },\n // Detach an event or set of events from an element\n remove: function (elem, types, handler, selector, mappedTypes) {\n var j,\n origCount,\n tmp,\n events,\n t,\n handleObj,\n special,\n handlers,\n type,\n namespaces,\n origType,\n elemData = dataPriv.hasData(elem) && dataPriv.get(elem);\n if (!elemData || !(events = elemData.events)) {\n return;\n }\n\n // Once for each type.namespace in types; type may be omitted\n types = (types || \"\").match(rnothtmlwhite) || [\"\"];\n t = types.length;\n while (t--) {\n tmp = rtypenamespace.exec(types[t]) || [];\n type = origType = tmp[1];\n namespaces = (tmp[2] || \"\").split(\".\").sort();\n\n // Unbind all events (on this namespace, if provided) for the element\n if (!type) {\n for (type in events) {\n jQuery.event.remove(elem, type + types[t], handler, selector, true);\n }\n continue;\n }\n special = jQuery.event.special[type] || {};\n type = (selector ? special.delegateType : special.bindType) || type;\n handlers = events[type] || [];\n tmp = tmp[2] && new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\");\n\n // Remove matching events\n origCount = j = handlers.length;\n while (j--) {\n handleObj = handlers[j];\n if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === \"**\" && handleObj.selector)) {\n handlers.splice(j, 1);\n if (handleObj.selector) {\n handlers.delegateCount--;\n }\n if (special.remove) {\n special.remove.call(elem, handleObj);\n }\n }\n }\n\n // Remove generic event handler if we removed something and no more handlers exist\n // (avoids potential for endless recursion during removal of special event handlers)\n if (origCount && !handlers.length) {\n if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {\n jQuery.removeEvent(elem, type, elemData.handle);\n }\n delete events[type];\n }\n }\n\n // Remove data and the expando if it's no longer used\n if (jQuery.isEmptyObject(events)) {\n dataPriv.remove(elem, \"handle events\");\n }\n },\n dispatch: function (nativeEvent) {\n var i,\n j,\n ret,\n matched,\n handleObj,\n handlerQueue,\n args = new Array(arguments.length),\n // Make a writable jQuery.Event from the native event object\n event = jQuery.event.fix(nativeEvent),\n handlers = (dataPriv.get(this, \"events\") || Object.create(null))[event.type] || [],\n special = jQuery.event.special[event.type] || {};\n\n // Use the fix-ed jQuery.Event rather than the (read-only) native event\n args[0] = event;\n for (i = 1; i < arguments.length; i++) {\n args[i] = arguments[i];\n }\n event.delegateTarget = this;\n\n // Call the preDispatch hook for the mapped type, and let it bail if desired\n if (special.preDispatch && special.preDispatch.call(this, event) === false) {\n return;\n }\n\n // Determine handlers\n handlerQueue = jQuery.event.handlers.call(this, event, handlers);\n\n // Run delegates first; they may want to stop propagation beneath us\n i = 0;\n while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {\n event.currentTarget = matched.elem;\n j = 0;\n while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {\n // If the event is namespaced, then each handler is only invoked if it is\n // specially universal or its namespaces are a superset of the event's.\n if (!event.rnamespace || handleObj.namespace === false || event.rnamespace.test(handleObj.namespace)) {\n event.handleObj = handleObj;\n event.data = handleObj.data;\n ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);\n if (ret !== undefined) {\n if ((event.result = ret) === false) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n }\n }\n\n // Call the postDispatch hook for the mapped type\n if (special.postDispatch) {\n special.postDispatch.call(this, event);\n }\n return event.result;\n },\n handlers: function (event, handlers) {\n var i,\n handleObj,\n sel,\n matchedHandlers,\n matchedSelectors,\n handlerQueue = [],\n delegateCount = handlers.delegateCount,\n cur = event.target;\n\n // Find delegate handlers\n if (delegateCount &&\n // Support: IE <=9\n // Black-hole SVG instance trees (trac-13180)\n cur.nodeType &&\n // Support: Firefox <=42\n // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)\n // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click\n // Support: IE 11 only\n // ...but not arrow key \"clicks\" of radio inputs, which can have `button` -1 (gh-2343)\n !(event.type === \"click\" && event.button >= 1)) {\n for (; cur !== this; cur = cur.parentNode || this) {\n // Don't check non-elements (trac-13208)\n // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)\n if (cur.nodeType === 1 && !(event.type === \"click\" && cur.disabled === true)) {\n matchedHandlers = [];\n matchedSelectors = {};\n for (i = 0; i < delegateCount; i++) {\n handleObj = handlers[i];\n\n // Don't conflict with Object.prototype properties (trac-13203)\n sel = handleObj.selector + \" \";\n if (matchedSelectors[sel] === undefined) {\n matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;\n }\n if (matchedSelectors[sel]) {\n matchedHandlers.push(handleObj);\n }\n }\n if (matchedHandlers.length) {\n handlerQueue.push({\n elem: cur,\n handlers: matchedHandlers\n });\n }\n }\n }\n }\n\n // Add the remaining (directly-bound) handlers\n cur = this;\n if (delegateCount < handlers.length) {\n handlerQueue.push({\n elem: cur,\n handlers: handlers.slice(delegateCount)\n });\n }\n return handlerQueue;\n },\n addProp: function (name, hook) {\n Object.defineProperty(jQuery.Event.prototype, name, {\n enumerable: true,\n configurable: true,\n get: isFunction(hook) ? function () {\n if (this.originalEvent) {\n return hook(this.originalEvent);\n }\n } : function () {\n if (this.originalEvent) {\n return this.originalEvent[name];\n }\n },\n set: function (value) {\n Object.defineProperty(this, name, {\n enumerable: true,\n configurable: true,\n writable: true,\n value: value\n });\n }\n });\n },\n fix: function (originalEvent) {\n return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);\n },\n special: {\n load: {\n // Prevent triggered image.load events from bubbling to window.load\n noBubble: true\n },\n click: {\n // Utilize native event to ensure correct state for checkable inputs\n setup: function (data) {\n // For mutual compressibility with _default, replace `this` access with a local var.\n // `|| data` is dead code meant only to preserve the variable through minification.\n var el = this || data;\n\n // Claim the first handler\n if (rcheckableType.test(el.type) && el.click && nodeName(el, \"input\")) {\n // dataPriv.set( el, \"click\", ... )\n leverageNative(el, \"click\", true);\n }\n\n // Return false to allow normal processing in the caller\n return false;\n },\n trigger: function (data) {\n // For mutual compressibility with _default, replace `this` access with a local var.\n // `|| data` is dead code meant only to preserve the variable through minification.\n var el = this || data;\n\n // Force setup before triggering a click\n if (rcheckableType.test(el.type) && el.click && nodeName(el, \"input\")) {\n leverageNative(el, \"click\");\n }\n\n // Return non-false to allow normal event-path propagation\n return true;\n },\n // For cross-browser consistency, suppress native .click() on links\n // Also prevent it if we're currently inside a leveraged native-event stack\n _default: function (event) {\n var target = event.target;\n return rcheckableType.test(target.type) && target.click && nodeName(target, \"input\") && dataPriv.get(target, \"click\") || nodeName(target, \"a\");\n }\n },\n beforeunload: {\n postDispatch: function (event) {\n // Support: Firefox 20+\n // Firefox doesn't alert if the returnValue field is not set.\n if (event.result !== undefined && event.originalEvent) {\n event.originalEvent.returnValue = event.result;\n }\n }\n }\n }\n };\n\n // Ensure the presence of an event listener that handles manually-triggered\n // synthetic events by interrupting progress until reinvoked in response to\n // *native* events that it fires directly, ensuring that state changes have\n // already occurred before other listeners are invoked.\n function leverageNative(el, type, isSetup) {\n // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add\n if (!isSetup) {\n if (dataPriv.get(el, type) === undefined) {\n jQuery.event.add(el, type, returnTrue);\n }\n return;\n }\n\n // Register the controller as a special universal handler for all event namespaces\n dataPriv.set(el, type, false);\n jQuery.event.add(el, type, {\n namespace: false,\n handler: function (event) {\n var result,\n saved = dataPriv.get(this, type);\n if (event.isTrigger & 1 && this[type]) {\n // Interrupt processing of the outer synthetic .trigger()ed event\n if (!saved) {\n // Store arguments for use when handling the inner native event\n // There will always be at least one argument (an event object), so this array\n // will not be confused with a leftover capture object.\n saved = slice.call(arguments);\n dataPriv.set(this, type, saved);\n\n // Trigger the native event and capture its result\n this[type]();\n result = dataPriv.get(this, type);\n dataPriv.set(this, type, false);\n if (saved !== result) {\n // Cancel the outer synthetic event\n event.stopImmediatePropagation();\n event.preventDefault();\n return result;\n }\n\n // If this is an inner synthetic event for an event with a bubbling surrogate\n // (focus or blur), assume that the surrogate already propagated from triggering\n // the native event and prevent that from happening again here.\n // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the\n // bubbling surrogate propagates *after* the non-bubbling base), but that seems\n // less bad than duplication.\n } else if ((jQuery.event.special[type] || {}).delegateType) {\n event.stopPropagation();\n }\n\n // If this is a native event triggered above, everything is now in order\n // Fire an inner synthetic event with the original arguments\n } else if (saved) {\n // ...and capture the result\n dataPriv.set(this, type, jQuery.event.trigger(saved[0], saved.slice(1), this));\n\n // Abort handling of the native event by all jQuery handlers while allowing\n // native handlers on the same element to run. On target, this is achieved\n // by stopping immediate propagation just on the jQuery event. However,\n // the native event is re-wrapped by a jQuery one on each level of the\n // propagation so the only way to stop it for jQuery is to stop it for\n // everyone via native `stopPropagation()`. This is not a problem for\n // focus/blur which don't bubble, but it does also stop click on checkboxes\n // and radios. We accept this limitation.\n event.stopPropagation();\n event.isImmediatePropagationStopped = returnTrue;\n }\n }\n });\n }\n jQuery.removeEvent = function (elem, type, handle) {\n // This \"if\" is needed for plain objects\n if (elem.removeEventListener) {\n elem.removeEventListener(type, handle);\n }\n };\n jQuery.Event = function (src, props) {\n // Allow instantiation without the 'new' keyword\n if (!(this instanceof jQuery.Event)) {\n return new jQuery.Event(src, props);\n }\n\n // Event object\n if (src && src.type) {\n this.originalEvent = src;\n this.type = src.type;\n\n // Events bubbling up the document may have been marked as prevented\n // by a handler lower down the tree; reflect the correct value.\n this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&\n // Support: Android <=2.3 only\n src.returnValue === false ? returnTrue : returnFalse;\n\n // Create target properties\n // Support: Safari <=6 - 7 only\n // Target should not be a text node (trac-504, trac-13143)\n this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;\n this.currentTarget = src.currentTarget;\n this.relatedTarget = src.relatedTarget;\n\n // Event type\n } else {\n this.type = src;\n }\n\n // Put explicitly provided properties onto the event object\n if (props) {\n jQuery.extend(this, props);\n }\n\n // Create a timestamp if incoming event doesn't have one\n this.timeStamp = src && src.timeStamp || Date.now();\n\n // Mark it as fixed\n this[jQuery.expando] = true;\n };\n\n // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\n jQuery.Event.prototype = {\n constructor: jQuery.Event,\n isDefaultPrevented: returnFalse,\n isPropagationStopped: returnFalse,\n isImmediatePropagationStopped: returnFalse,\n isSimulated: false,\n preventDefault: function () {\n var e = this.originalEvent;\n this.isDefaultPrevented = returnTrue;\n if (e && !this.isSimulated) {\n e.preventDefault();\n }\n },\n stopPropagation: function () {\n var e = this.originalEvent;\n this.isPropagationStopped = returnTrue;\n if (e && !this.isSimulated) {\n e.stopPropagation();\n }\n },\n stopImmediatePropagation: function () {\n var e = this.originalEvent;\n this.isImmediatePropagationStopped = returnTrue;\n if (e && !this.isSimulated) {\n e.stopImmediatePropagation();\n }\n this.stopPropagation();\n }\n };\n\n // Includes all common event props including KeyEvent and MouseEvent specific props\n jQuery.each({\n altKey: true,\n bubbles: true,\n cancelable: true,\n changedTouches: true,\n ctrlKey: true,\n detail: true,\n eventPhase: true,\n metaKey: true,\n pageX: true,\n pageY: true,\n shiftKey: true,\n view: true,\n \"char\": true,\n code: true,\n charCode: true,\n key: true,\n keyCode: true,\n button: true,\n buttons: true,\n clientX: true,\n clientY: true,\n offsetX: true,\n offsetY: true,\n pointerId: true,\n pointerType: true,\n screenX: true,\n screenY: true,\n targetTouches: true,\n toElement: true,\n touches: true,\n which: true\n }, jQuery.event.addProp);\n jQuery.each({\n focus: \"focusin\",\n blur: \"focusout\"\n }, function (type, delegateType) {\n function focusMappedHandler(nativeEvent) {\n if (document.documentMode) {\n // Support: IE 11+\n // Attach a single focusin/focusout handler on the document while someone wants\n // focus/blur. This is because the former are synchronous in IE while the latter\n // are async. In other browsers, all those handlers are invoked synchronously.\n\n // `handle` from private data would already wrap the event, but we need\n // to change the `type` here.\n var handle = dataPriv.get(this, \"handle\"),\n event = jQuery.event.fix(nativeEvent);\n event.type = nativeEvent.type === \"focusin\" ? \"focus\" : \"blur\";\n event.isSimulated = true;\n\n // First, handle focusin/focusout\n handle(nativeEvent);\n\n // ...then, handle focus/blur\n //\n // focus/blur don't bubble while focusin/focusout do; simulate the former by only\n // invoking the handler at the lower level.\n if (event.target === event.currentTarget) {\n // The setup part calls `leverageNative`, which, in turn, calls\n // `jQuery.event.add`, so event handle will already have been set\n // by this point.\n handle(event);\n }\n } else {\n // For non-IE browsers, attach a single capturing handler on the document\n // while someone wants focusin/focusout.\n jQuery.event.simulate(delegateType, nativeEvent.target, jQuery.event.fix(nativeEvent));\n }\n }\n jQuery.event.special[type] = {\n // Utilize native event if possible so blur/focus sequence is correct\n setup: function () {\n var attaches;\n\n // Claim the first handler\n // dataPriv.set( this, \"focus\", ... )\n // dataPriv.set( this, \"blur\", ... )\n leverageNative(this, type, true);\n if (document.documentMode) {\n // Support: IE 9 - 11+\n // We use the same native handler for focusin & focus (and focusout & blur)\n // so we need to coordinate setup & teardown parts between those events.\n // Use `delegateType` as the key as `type` is already used by `leverageNative`.\n attaches = dataPriv.get(this, delegateType);\n if (!attaches) {\n this.addEventListener(delegateType, focusMappedHandler);\n }\n dataPriv.set(this, delegateType, (attaches || 0) + 1);\n } else {\n // Return false to allow normal processing in the caller\n return false;\n }\n },\n trigger: function () {\n // Force setup before trigger\n leverageNative(this, type);\n\n // Return non-false to allow normal event-path propagation\n return true;\n },\n teardown: function () {\n var attaches;\n if (document.documentMode) {\n attaches = dataPriv.get(this, delegateType) - 1;\n if (!attaches) {\n this.removeEventListener(delegateType, focusMappedHandler);\n dataPriv.remove(this, delegateType);\n } else {\n dataPriv.set(this, delegateType, attaches);\n }\n } else {\n // Return false to indicate standard teardown should be applied\n return false;\n }\n },\n // Suppress native focus or blur if we're currently inside\n // a leveraged native-event stack\n _default: function (event) {\n return dataPriv.get(event.target, type);\n },\n delegateType: delegateType\n };\n\n // Support: Firefox <=44\n // Firefox doesn't have focus(in | out) events\n // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n //\n // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1\n // focus(in | out) events fire after focus & blur events,\n // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857\n //\n // Support: IE 9 - 11+\n // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,\n // attach a single handler for both events in IE.\n jQuery.event.special[delegateType] = {\n setup: function () {\n // Handle: regular nodes (via `this.ownerDocument`), window\n // (via `this.document`) & document (via `this`).\n var doc = this.ownerDocument || this.document || this,\n dataHolder = document.documentMode ? this : doc,\n attaches = dataPriv.get(dataHolder, delegateType);\n\n // Support: IE 9 - 11+\n // We use the same native handler for focusin & focus (and focusout & blur)\n // so we need to coordinate setup & teardown parts between those events.\n // Use `delegateType` as the key as `type` is already used by `leverageNative`.\n if (!attaches) {\n if (document.documentMode) {\n this.addEventListener(delegateType, focusMappedHandler);\n } else {\n doc.addEventListener(type, focusMappedHandler, true);\n }\n }\n dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1);\n },\n teardown: function () {\n var doc = this.ownerDocument || this.document || this,\n dataHolder = document.documentMode ? this : doc,\n attaches = dataPriv.get(dataHolder, delegateType) - 1;\n if (!attaches) {\n if (document.documentMode) {\n this.removeEventListener(delegateType, focusMappedHandler);\n } else {\n doc.removeEventListener(type, focusMappedHandler, true);\n }\n dataPriv.remove(dataHolder, delegateType);\n } else {\n dataPriv.set(dataHolder, delegateType, attaches);\n }\n }\n };\n });\n\n // Create mouseenter/leave events using mouseover/out and event-time checks\n // so that event delegation works in jQuery.\n // Do the same for pointerenter/pointerleave and pointerover/pointerout\n //\n // Support: Safari 7 only\n // Safari sends mouseenter too often; see:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=470258\n // for the description of the bug (it existed in older Chrome versions as well).\n jQuery.each({\n mouseenter: \"mouseover\",\n mouseleave: \"mouseout\",\n pointerenter: \"pointerover\",\n pointerleave: \"pointerout\"\n }, function (orig, fix) {\n jQuery.event.special[orig] = {\n delegateType: fix,\n bindType: fix,\n handle: function (event) {\n var ret,\n target = this,\n related = event.relatedTarget,\n handleObj = event.handleObj;\n\n // For mouseenter/leave call the handler if related is outside the target.\n // NB: No relatedTarget if the mouse left/entered the browser window\n if (!related || related !== target && !jQuery.contains(target, related)) {\n event.type = handleObj.origType;\n ret = handleObj.handler.apply(this, arguments);\n event.type = fix;\n }\n return ret;\n }\n };\n });\n jQuery.fn.extend({\n on: function (types, selector, data, fn) {\n return on(this, types, selector, data, fn);\n },\n one: function (types, selector, data, fn) {\n return on(this, types, selector, data, fn, 1);\n },\n off: function (types, selector, fn) {\n var handleObj, type;\n if (types && types.preventDefault && types.handleObj) {\n // ( event ) dispatched jQuery.Event\n handleObj = types.handleObj;\n jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + \".\" + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);\n return this;\n }\n if (typeof types === \"object\") {\n // ( types-object [, selector] )\n for (type in types) {\n this.off(type, selector, types[type]);\n }\n return this;\n }\n if (selector === false || typeof selector === \"function\") {\n // ( types [, fn] )\n fn = selector;\n selector = undefined;\n }\n if (fn === false) {\n fn = returnFalse;\n }\n return this.each(function () {\n jQuery.event.remove(this, types, fn, selector);\n });\n }\n });\n var\n // Support: IE <=10 - 11, Edge 12 - 13 only\n // In IE/Edge using regex groups here causes severe slowdowns.\n // See https://connect.microsoft.com/IE/feedback/details/1736512/\n rnoInnerhtml = /\\s*$/g;\n\n // Prefer a tbody over its parent table for containing new rows\n function manipulationTarget(elem, content) {\n if (nodeName(elem, \"table\") && nodeName(content.nodeType !== 11 ? content : content.firstChild, \"tr\")) {\n return jQuery(elem).children(\"tbody\")[0] || elem;\n }\n return elem;\n }\n\n // Replace/restore the type attribute of script elements for safe DOM manipulation\n function disableScript(elem) {\n elem.type = (elem.getAttribute(\"type\") !== null) + \"/\" + elem.type;\n return elem;\n }\n function restoreScript(elem) {\n if ((elem.type || \"\").slice(0, 5) === \"true/\") {\n elem.type = elem.type.slice(5);\n } else {\n elem.removeAttribute(\"type\");\n }\n return elem;\n }\n function cloneCopyEvent(src, dest) {\n var i, l, type, pdataOld, udataOld, udataCur, events;\n if (dest.nodeType !== 1) {\n return;\n }\n\n // 1. Copy private data: events, handlers, etc.\n if (dataPriv.hasData(src)) {\n pdataOld = dataPriv.get(src);\n events = pdataOld.events;\n if (events) {\n dataPriv.remove(dest, \"handle events\");\n for (type in events) {\n for (i = 0, l = events[type].length; i < l; i++) {\n jQuery.event.add(dest, type, events[type][i]);\n }\n }\n }\n }\n\n // 2. Copy user data\n if (dataUser.hasData(src)) {\n udataOld = dataUser.access(src);\n udataCur = jQuery.extend({}, udataOld);\n dataUser.set(dest, udataCur);\n }\n }\n\n // Fix IE bugs, see support tests\n function fixInput(src, dest) {\n var nodeName = dest.nodeName.toLowerCase();\n\n // Fails to persist the checked state of a cloned checkbox or radio button.\n if (nodeName === \"input\" && rcheckableType.test(src.type)) {\n dest.checked = src.checked;\n\n // Fails to return the selected option to the default selected state when cloning options\n } else if (nodeName === \"input\" || nodeName === \"textarea\") {\n dest.defaultValue = src.defaultValue;\n }\n }\n function domManip(collection, args, callback, ignored) {\n // Flatten any nested arrays\n args = flat(args);\n var fragment,\n first,\n scripts,\n hasScripts,\n node,\n doc,\n i = 0,\n l = collection.length,\n iNoClone = l - 1,\n value = args[0],\n valueIsFunction = isFunction(value);\n\n // We can't cloneNode fragments that contain checked, in WebKit\n if (valueIsFunction || l > 1 && typeof value === \"string\" && !support.checkClone && rchecked.test(value)) {\n return collection.each(function (index) {\n var self = collection.eq(index);\n if (valueIsFunction) {\n args[0] = value.call(this, index, self.html());\n }\n domManip(self, args, callback, ignored);\n });\n }\n if (l) {\n fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);\n first = fragment.firstChild;\n if (fragment.childNodes.length === 1) {\n fragment = first;\n }\n\n // Require either new content or an interest in ignored elements to invoke the callback\n if (first || ignored) {\n scripts = jQuery.map(getAll(fragment, \"script\"), disableScript);\n hasScripts = scripts.length;\n\n // Use the original fragment for the last item\n // instead of the first because it can end up\n // being emptied incorrectly in certain situations (trac-8070).\n for (; i < l; i++) {\n node = fragment;\n if (i !== iNoClone) {\n node = jQuery.clone(node, true, true);\n\n // Keep references to cloned scripts for later restoration\n if (hasScripts) {\n // Support: Android <=4.0 only, PhantomJS 1 only\n // push.apply(_, arraylike) throws on ancient WebKit\n jQuery.merge(scripts, getAll(node, \"script\"));\n }\n }\n callback.call(collection[i], node, i);\n }\n if (hasScripts) {\n doc = scripts[scripts.length - 1].ownerDocument;\n\n // Re-enable scripts\n jQuery.map(scripts, restoreScript);\n\n // Evaluate executable scripts on first document insertion\n for (i = 0; i < hasScripts; i++) {\n node = scripts[i];\n if (rscriptType.test(node.type || \"\") && !dataPriv.access(node, \"globalEval\") && jQuery.contains(doc, node)) {\n if (node.src && (node.type || \"\").toLowerCase() !== \"module\") {\n // Optional AJAX dependency, but won't run scripts if not present\n if (jQuery._evalUrl && !node.noModule) {\n jQuery._evalUrl(node.src, {\n nonce: node.nonce || node.getAttribute(\"nonce\")\n }, doc);\n }\n } else {\n // Unwrap a CDATA section containing script contents. This shouldn't be\n // needed as in XML documents they're already not visible when\n // inspecting element contents and in HTML documents they have no\n // meaning but we're preserving that logic for backwards compatibility.\n // This will be removed completely in 4.0. See gh-4904.\n DOMEval(node.textContent.replace(rcleanScript, \"\"), node, doc);\n }\n }\n }\n }\n }\n }\n return collection;\n }\n function remove(elem, selector, keepData) {\n var node,\n nodes = selector ? jQuery.filter(selector, elem) : elem,\n i = 0;\n for (; (node = nodes[i]) != null; i++) {\n if (!keepData && node.nodeType === 1) {\n jQuery.cleanData(getAll(node));\n }\n if (node.parentNode) {\n if (keepData && isAttached(node)) {\n setGlobalEval(getAll(node, \"script\"));\n }\n node.parentNode.removeChild(node);\n }\n }\n return elem;\n }\n jQuery.extend({\n htmlPrefilter: function (html) {\n return html;\n },\n clone: function (elem, dataAndEvents, deepDataAndEvents) {\n var i,\n l,\n srcElements,\n destElements,\n clone = elem.cloneNode(true),\n inPage = isAttached(elem);\n\n // Fix IE cloning issues\n if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {\n // We eschew jQuery#find here for performance reasons:\n // https://jsperf.com/getall-vs-sizzle/2\n destElements = getAll(clone);\n srcElements = getAll(elem);\n for (i = 0, l = srcElements.length; i < l; i++) {\n fixInput(srcElements[i], destElements[i]);\n }\n }\n\n // Copy the events from the original to the clone\n if (dataAndEvents) {\n if (deepDataAndEvents) {\n srcElements = srcElements || getAll(elem);\n destElements = destElements || getAll(clone);\n for (i = 0, l = srcElements.length; i < l; i++) {\n cloneCopyEvent(srcElements[i], destElements[i]);\n }\n } else {\n cloneCopyEvent(elem, clone);\n }\n }\n\n // Preserve script evaluation history\n destElements = getAll(clone, \"script\");\n if (destElements.length > 0) {\n setGlobalEval(destElements, !inPage && getAll(elem, \"script\"));\n }\n\n // Return the cloned set\n return clone;\n },\n cleanData: function (elems) {\n var data,\n elem,\n type,\n special = jQuery.event.special,\n i = 0;\n for (; (elem = elems[i]) !== undefined; i++) {\n if (acceptData(elem)) {\n if (data = elem[dataPriv.expando]) {\n if (data.events) {\n for (type in data.events) {\n if (special[type]) {\n jQuery.event.remove(elem, type);\n\n // This is a shortcut to avoid jQuery.event.remove's overhead\n } else {\n jQuery.removeEvent(elem, type, data.handle);\n }\n }\n }\n\n // Support: Chrome <=35 - 45+\n // Assign undefined instead of using delete, see Data#remove\n elem[dataPriv.expando] = undefined;\n }\n if (elem[dataUser.expando]) {\n // Support: Chrome <=35 - 45+\n // Assign undefined instead of using delete, see Data#remove\n elem[dataUser.expando] = undefined;\n }\n }\n }\n }\n });\n jQuery.fn.extend({\n detach: function (selector) {\n return remove(this, selector, true);\n },\n remove: function (selector) {\n return remove(this, selector);\n },\n text: function (value) {\n return access(this, function (value) {\n return value === undefined ? jQuery.text(this) : this.empty().each(function () {\n if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n this.textContent = value;\n }\n });\n }, null, value, arguments.length);\n },\n append: function () {\n return domManip(this, arguments, function (elem) {\n if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n var target = manipulationTarget(this, elem);\n target.appendChild(elem);\n }\n });\n },\n prepend: function () {\n return domManip(this, arguments, function (elem) {\n if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n var target = manipulationTarget(this, elem);\n target.insertBefore(elem, target.firstChild);\n }\n });\n },\n before: function () {\n return domManip(this, arguments, function (elem) {\n if (this.parentNode) {\n this.parentNode.insertBefore(elem, this);\n }\n });\n },\n after: function () {\n return domManip(this, arguments, function (elem) {\n if (this.parentNode) {\n this.parentNode.insertBefore(elem, this.nextSibling);\n }\n });\n },\n empty: function () {\n var elem,\n i = 0;\n for (; (elem = this[i]) != null; i++) {\n if (elem.nodeType === 1) {\n // Prevent memory leaks\n jQuery.cleanData(getAll(elem, false));\n\n // Remove any remaining nodes\n elem.textContent = \"\";\n }\n }\n return this;\n },\n clone: function (dataAndEvents, deepDataAndEvents) {\n dataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n return this.map(function () {\n return jQuery.clone(this, dataAndEvents, deepDataAndEvents);\n });\n },\n html: function (value) {\n return access(this, function (value) {\n var elem = this[0] || {},\n i = 0,\n l = this.length;\n if (value === undefined && elem.nodeType === 1) {\n return elem.innerHTML;\n }\n\n // See if we can take a shortcut and just use innerHTML\n if (typeof value === \"string\" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || [\"\", \"\"])[1].toLowerCase()]) {\n value = jQuery.htmlPrefilter(value);\n try {\n for (; i < l; i++) {\n elem = this[i] || {};\n\n // Remove element nodes and prevent memory leaks\n if (elem.nodeType === 1) {\n jQuery.cleanData(getAll(elem, false));\n elem.innerHTML = value;\n }\n }\n elem = 0;\n\n // If using innerHTML throws an exception, use the fallback method\n } catch (e) {}\n }\n if (elem) {\n this.empty().append(value);\n }\n }, null, value, arguments.length);\n },\n replaceWith: function () {\n var ignored = [];\n\n // Make the changes, replacing each non-ignored context element with the new content\n return domManip(this, arguments, function (elem) {\n var parent = this.parentNode;\n if (jQuery.inArray(this, ignored) < 0) {\n jQuery.cleanData(getAll(this));\n if (parent) {\n parent.replaceChild(elem, this);\n }\n }\n\n // Force callback invocation\n }, ignored);\n }\n });\n jQuery.each({\n appendTo: \"append\",\n prependTo: \"prepend\",\n insertBefore: \"before\",\n insertAfter: \"after\",\n replaceAll: \"replaceWith\"\n }, function (name, original) {\n jQuery.fn[name] = function (selector) {\n var elems,\n ret = [],\n insert = jQuery(selector),\n last = insert.length - 1,\n i = 0;\n for (; i <= last; i++) {\n elems = i === last ? this : this.clone(true);\n jQuery(insert[i])[original](elems);\n\n // Support: Android <=4.0 only, PhantomJS 1 only\n // .get() because push.apply(_, arraylike) throws on ancient WebKit\n push.apply(ret, elems.get());\n }\n return this.pushStack(ret);\n };\n });\n var rnumnonpx = new RegExp(\"^(\" + pnum + \")(?!px)[a-z%]+$\", \"i\");\n var rcustomProp = /^--/;\n var getStyles = function (elem) {\n // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)\n // IE throws on elements created in popups\n // FF meanwhile throws on frame elements through \"defaultView.getComputedStyle\"\n var view = elem.ownerDocument.defaultView;\n if (!view || !view.opener) {\n view = window;\n }\n return view.getComputedStyle(elem);\n };\n var swap = function (elem, options, callback) {\n var ret,\n name,\n old = {};\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n old[name] = elem.style[name];\n elem.style[name] = options[name];\n }\n ret = callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n elem.style[name] = old[name];\n }\n return ret;\n };\n var rboxStyle = new RegExp(cssExpand.join(\"|\"), \"i\");\n (function () {\n // Executing both pixelPosition & boxSizingReliable tests require only one layout\n // so they're executed at the same time to save the second computation.\n function computeStyleTests() {\n // This is a singleton, we need to execute it only once\n if (!div) {\n return;\n }\n container.style.cssText = \"position:absolute;left:-11111px;width:60px;\" + \"margin-top:1px;padding:0;border:0\";\n div.style.cssText = \"position:relative;display:block;box-sizing:border-box;overflow:scroll;\" + \"margin:auto;border:1px;padding:1px;\" + \"width:60%;top:1%\";\n documentElement.appendChild(container).appendChild(div);\n var divStyle = window.getComputedStyle(div);\n pixelPositionVal = divStyle.top !== \"1%\";\n\n // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44\n reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;\n\n // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3\n // Some styles come back with percentage values, even though they shouldn't\n div.style.right = \"60%\";\n pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;\n\n // Support: IE 9 - 11 only\n // Detect misreporting of content dimensions for box-sizing:border-box elements\n boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;\n\n // Support: IE 9 only\n // Detect overflow:scroll screwiness (gh-3699)\n // Support: Chrome <=64\n // Don't get tricked when zoom affects offsetWidth (gh-4029)\n div.style.position = \"absolute\";\n scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;\n documentElement.removeChild(container);\n\n // Nullify the div so it wouldn't be stored in the memory and\n // it will also be a sign that checks already performed\n div = null;\n }\n function roundPixelMeasures(measure) {\n return Math.round(parseFloat(measure));\n }\n var pixelPositionVal,\n boxSizingReliableVal,\n scrollboxSizeVal,\n pixelBoxStylesVal,\n reliableTrDimensionsVal,\n reliableMarginLeftVal,\n container = document.createElement(\"div\"),\n div = document.createElement(\"div\");\n\n // Finish early in limited (non-browser) environments\n if (!div.style) {\n return;\n }\n\n // Support: IE <=9 - 11 only\n // Style of cloned element affects source element cloned (trac-8908)\n div.style.backgroundClip = \"content-box\";\n div.cloneNode(true).style.backgroundClip = \"\";\n support.clearCloneStyle = div.style.backgroundClip === \"content-box\";\n jQuery.extend(support, {\n boxSizingReliable: function () {\n computeStyleTests();\n return boxSizingReliableVal;\n },\n pixelBoxStyles: function () {\n computeStyleTests();\n return pixelBoxStylesVal;\n },\n pixelPosition: function () {\n computeStyleTests();\n return pixelPositionVal;\n },\n reliableMarginLeft: function () {\n computeStyleTests();\n return reliableMarginLeftVal;\n },\n scrollboxSize: function () {\n computeStyleTests();\n return scrollboxSizeVal;\n },\n // Support: IE 9 - 11+, Edge 15 - 18+\n // IE/Edge misreport `getComputedStyle` of table rows with width/height\n // set in CSS while `offset*` properties report correct values.\n // Behavior in IE 9 is more subtle than in newer versions & it passes\n // some versions of this test; make sure not to make it pass there!\n //\n // Support: Firefox 70+\n // Only Firefox includes border widths\n // in computed dimensions. (gh-4529)\n reliableTrDimensions: function () {\n var table, tr, trChild, trStyle;\n if (reliableTrDimensionsVal == null) {\n table = document.createElement(\"table\");\n tr = document.createElement(\"tr\");\n trChild = document.createElement(\"div\");\n table.style.cssText = \"position:absolute;left:-11111px;border-collapse:separate\";\n tr.style.cssText = \"box-sizing:content-box;border:1px solid\";\n\n // Support: Chrome 86+\n // Height set through cssText does not get applied.\n // Computed height then comes back as 0.\n tr.style.height = \"1px\";\n trChild.style.height = \"9px\";\n\n // Support: Android 8 Chrome 86+\n // In our bodyBackground.html iframe,\n // display for all div elements is set to \"inline\",\n // which causes a problem only in Android 8 Chrome 86.\n // Ensuring the div is `display: block`\n // gets around this issue.\n trChild.style.display = \"block\";\n documentElement.appendChild(table).appendChild(tr).appendChild(trChild);\n trStyle = window.getComputedStyle(tr);\n reliableTrDimensionsVal = parseInt(trStyle.height, 10) + parseInt(trStyle.borderTopWidth, 10) + parseInt(trStyle.borderBottomWidth, 10) === tr.offsetHeight;\n documentElement.removeChild(table);\n }\n return reliableTrDimensionsVal;\n }\n });\n })();\n function curCSS(elem, name, computed) {\n var width,\n minWidth,\n maxWidth,\n ret,\n isCustomProp = rcustomProp.test(name),\n // Support: Firefox 51+\n // Retrieving style before computed somehow\n // fixes an issue with getting wrong values\n // on detached elements\n style = elem.style;\n computed = computed || getStyles(elem);\n\n // getPropertyValue is needed for:\n // .css('filter') (IE 9 only, trac-12537)\n // .css('--customProperty) (gh-3144)\n if (computed) {\n // Support: IE <=9 - 11+\n // IE only supports `\"float\"` in `getPropertyValue`; in computed styles\n // it's only available as `\"cssFloat\"`. We no longer modify properties\n // sent to `.css()` apart from camelCasing, so we need to check both.\n // Normally, this would create difference in behavior: if\n // `getPropertyValue` returns an empty string, the value returned\n // by `.css()` would be `undefined`. This is usually the case for\n // disconnected elements. However, in IE even disconnected elements\n // with no styles return `\"none\"` for `getPropertyValue( \"float\" )`\n ret = computed.getPropertyValue(name) || computed[name];\n if (isCustomProp && ret) {\n // Support: Firefox 105+, Chrome <=105+\n // Spec requires trimming whitespace for custom properties (gh-4926).\n // Firefox only trims leading whitespace. Chrome just collapses\n // both leading & trailing whitespace to a single space.\n //\n // Fall back to `undefined` if empty string returned.\n // This collapses a missing definition with property defined\n // and set to an empty string but there's no standard API\n // allowing us to differentiate them without a performance penalty\n // and returning `undefined` aligns with older jQuery.\n //\n // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED\n // as whitespace while CSS does not, but this is not a problem\n // because CSS preprocessing replaces them with U+000A LINE FEED\n // (which *is* CSS whitespace)\n // https://www.w3.org/TR/css-syntax-3/#input-preprocessing\n ret = ret.replace(rtrimCSS, \"$1\") || undefined;\n }\n if (ret === \"\" && !isAttached(elem)) {\n ret = jQuery.style(elem, name);\n }\n\n // A tribute to the \"awesome hack by Dean Edwards\"\n // Android Browser returns percentage for some values,\n // but width seems to be reliably pixels.\n // This is against the CSSOM draft spec:\n // https://drafts.csswg.org/cssom/#resolved-values\n if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {\n // Remember the original values\n width = style.width;\n minWidth = style.minWidth;\n maxWidth = style.maxWidth;\n\n // Put in the new values to get a computed value out\n style.minWidth = style.maxWidth = style.width = ret;\n ret = computed.width;\n\n // Revert the changed values\n style.width = width;\n style.minWidth = minWidth;\n style.maxWidth = maxWidth;\n }\n }\n return ret !== undefined ?\n // Support: IE <=9 - 11 only\n // IE returns zIndex value as an integer.\n ret + \"\" : ret;\n }\n function addGetHookIf(conditionFn, hookFn) {\n // Define the hook, we'll check on the first run if it's really needed.\n return {\n get: function () {\n if (conditionFn()) {\n // Hook not needed (or it's not possible to use it due\n // to missing dependency), remove it.\n delete this.get;\n return;\n }\n\n // Hook needed; redefine it so that the support test is not executed again.\n return (this.get = hookFn).apply(this, arguments);\n }\n };\n }\n var cssPrefixes = [\"Webkit\", \"Moz\", \"ms\"],\n emptyStyle = document.createElement(\"div\").style,\n vendorProps = {};\n\n // Return a vendor-prefixed property or undefined\n function vendorPropName(name) {\n // Check for vendor prefixed names\n var capName = name[0].toUpperCase() + name.slice(1),\n i = cssPrefixes.length;\n while (i--) {\n name = cssPrefixes[i] + capName;\n if (name in emptyStyle) {\n return name;\n }\n }\n }\n\n // Return a potentially-mapped jQuery.cssProps or vendor prefixed property\n function finalPropName(name) {\n var final = jQuery.cssProps[name] || vendorProps[name];\n if (final) {\n return final;\n }\n if (name in emptyStyle) {\n return name;\n }\n return vendorProps[name] = vendorPropName(name) || name;\n }\n var\n // Swappable if display is none or starts with table\n // except \"table\", \"table-cell\", or \"table-caption\"\n // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n rdisplayswap = /^(none|table(?!-c[ea]).+)/,\n cssShow = {\n position: \"absolute\",\n visibility: \"hidden\",\n display: \"block\"\n },\n cssNormalTransform = {\n letterSpacing: \"0\",\n fontWeight: \"400\"\n };\n function setPositiveNumber(_elem, value, subtract) {\n // Any relative (+/-) values have already been\n // normalized at this point\n var matches = rcssNum.exec(value);\n return matches ?\n // Guard against undefined \"subtract\", e.g., when used as in cssHooks\n Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || \"px\") : value;\n }\n function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {\n var i = dimension === \"width\" ? 1 : 0,\n extra = 0,\n delta = 0,\n marginDelta = 0;\n\n // Adjustment may not be necessary\n if (box === (isBorderBox ? \"border\" : \"content\")) {\n return 0;\n }\n for (; i < 4; i += 2) {\n // Both box models exclude margin\n // Count margin delta separately to only add it after scroll gutter adjustment.\n // This is needed to make negative margins work with `outerHeight( true )` (gh-3982).\n if (box === \"margin\") {\n marginDelta += jQuery.css(elem, box + cssExpand[i], true, styles);\n }\n\n // If we get here with a content-box, we're seeking \"padding\" or \"border\" or \"margin\"\n if (!isBorderBox) {\n // Add padding\n delta += jQuery.css(elem, \"padding\" + cssExpand[i], true, styles);\n\n // For \"border\" or \"margin\", add border\n if (box !== \"padding\") {\n delta += jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n\n // But still keep track of it otherwise\n } else {\n extra += jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n }\n\n // If we get here with a border-box (content + padding + border), we're seeking \"content\" or\n // \"padding\" or \"margin\"\n } else {\n // For \"content\", subtract padding\n if (box === \"content\") {\n delta -= jQuery.css(elem, \"padding\" + cssExpand[i], true, styles);\n }\n\n // For \"content\" or \"padding\", subtract border\n if (box !== \"margin\") {\n delta -= jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n }\n }\n }\n\n // Account for positive content-box scroll gutter when requested by providing computedVal\n if (!isBorderBox && computedVal >= 0) {\n // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border\n // Assuming integer scroll gutter, subtract the rest and round down\n delta += Math.max(0, Math.ceil(elem[\"offset\" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5\n\n // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter\n // Use an explicit zero to avoid NaN (gh-3964)\n )) || 0;\n }\n return delta + marginDelta;\n }\n function getWidthOrHeight(elem, dimension, extra) {\n // Start with computed style\n var styles = getStyles(elem),\n // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).\n // Fake content-box until we know it's needed to know the true value.\n boxSizingNeeded = !support.boxSizingReliable() || extra,\n isBorderBox = boxSizingNeeded && jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\",\n valueIsBorderBox = isBorderBox,\n val = curCSS(elem, dimension, styles),\n offsetProp = \"offset\" + dimension[0].toUpperCase() + dimension.slice(1);\n\n // Support: Firefox <=54\n // Return a confounding non-pixel value or feign ignorance, as appropriate.\n if (rnumnonpx.test(val)) {\n if (!extra) {\n return val;\n }\n val = \"auto\";\n }\n\n // Support: IE 9 - 11 only\n // Use offsetWidth/offsetHeight for when box sizing is unreliable.\n // In those cases, the computed value can be trusted to be border-box.\n if ((!support.boxSizingReliable() && isBorderBox ||\n // Support: IE 10 - 11+, Edge 15 - 18+\n // IE/Edge misreport `getComputedStyle` of table rows with width/height\n // set in CSS while `offset*` properties report correct values.\n // Interestingly, in some cases IE 9 doesn't suffer from this issue.\n !support.reliableTrDimensions() && nodeName(elem, \"tr\") ||\n // Fall back to offsetWidth/offsetHeight when value is \"auto\"\n // This happens for inline elements with no explicit setting (gh-3571)\n val === \"auto\" ||\n // Support: Android <=4.1 - 4.3 only\n // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)\n !parseFloat(val) && jQuery.css(elem, \"display\", false, styles) === \"inline\") &&\n // Make sure the element is visible & connected\n elem.getClientRects().length) {\n isBorderBox = jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\";\n\n // Where available, offsetWidth/offsetHeight approximate border box dimensions.\n // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the\n // retrieved value as a content box dimension.\n valueIsBorderBox = offsetProp in elem;\n if (valueIsBorderBox) {\n val = elem[offsetProp];\n }\n }\n\n // Normalize \"\" and auto\n val = parseFloat(val) || 0;\n\n // Adjust for the element's box model\n return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? \"border\" : \"content\"), valueIsBorderBox, styles,\n // Provide the current computed size to request scroll gutter calculation (gh-3589)\n val) + \"px\";\n }\n jQuery.extend({\n // Add in style property hooks for overriding the default\n // behavior of getting and setting a style property\n cssHooks: {\n opacity: {\n get: function (elem, computed) {\n if (computed) {\n // We should always get a number back from opacity\n var ret = curCSS(elem, \"opacity\");\n return ret === \"\" ? \"1\" : ret;\n }\n }\n }\n },\n // Don't automatically add \"px\" to these possibly-unitless properties\n cssNumber: {\n animationIterationCount: true,\n aspectRatio: true,\n borderImageSlice: true,\n columnCount: true,\n flexGrow: true,\n flexShrink: true,\n fontWeight: true,\n gridArea: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnStart: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowStart: true,\n lineHeight: true,\n opacity: true,\n order: true,\n orphans: true,\n scale: true,\n widows: true,\n zIndex: true,\n zoom: true,\n // SVG-related\n fillOpacity: true,\n floodOpacity: true,\n stopOpacity: true,\n strokeMiterlimit: true,\n strokeOpacity: true\n },\n // Add in properties whose names you wish to fix before\n // setting or getting the value\n cssProps: {},\n // Get and set the style property on a DOM Node\n style: function (elem, name, value, extra) {\n // Don't set styles on text and comment nodes\n if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {\n return;\n }\n\n // Make sure that we're working with the right name\n var ret,\n type,\n hooks,\n origName = camelCase(name),\n isCustomProp = rcustomProp.test(name),\n style = elem.style;\n\n // Make sure that we're working with the right name. We don't\n // want to query the value if it is a CSS custom property\n // since they are user-defined.\n if (!isCustomProp) {\n name = finalPropName(origName);\n }\n\n // Gets hook for the prefixed version, then unprefixed version\n hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];\n\n // Check if we're setting a value\n if (value !== undefined) {\n type = typeof value;\n\n // Convert \"+=\" or \"-=\" to relative numbers (trac-7345)\n if (type === \"string\" && (ret = rcssNum.exec(value)) && ret[1]) {\n value = adjustCSS(elem, name, ret);\n\n // Fixes bug trac-9237\n type = \"number\";\n }\n\n // Make sure that null and NaN values aren't set (trac-7116)\n if (value == null || value !== value) {\n return;\n }\n\n // If a number was passed in, add the unit (except for certain CSS properties)\n // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append\n // \"px\" to a few hardcoded values.\n if (type === \"number\" && !isCustomProp) {\n value += ret && ret[3] || (jQuery.cssNumber[origName] ? \"\" : \"px\");\n }\n\n // background-* props affect original clone's values\n if (!support.clearCloneStyle && value === \"\" && name.indexOf(\"background\") === 0) {\n style[name] = \"inherit\";\n }\n\n // If a hook was provided, use that value, otherwise just set the specified value\n if (!hooks || !(\"set\" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {\n if (isCustomProp) {\n style.setProperty(name, value);\n } else {\n style[name] = value;\n }\n }\n } else {\n // If a hook was provided get the non-computed value from there\n if (hooks && \"get\" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {\n return ret;\n }\n\n // Otherwise just get the value from the style object\n return style[name];\n }\n },\n css: function (elem, name, extra, styles) {\n var val,\n num,\n hooks,\n origName = camelCase(name),\n isCustomProp = rcustomProp.test(name);\n\n // Make sure that we're working with the right name. We don't\n // want to modify the value if it is a CSS custom property\n // since they are user-defined.\n if (!isCustomProp) {\n name = finalPropName(origName);\n }\n\n // Try prefixed name followed by the unprefixed name\n hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];\n\n // If a hook was provided get the computed value from there\n if (hooks && \"get\" in hooks) {\n val = hooks.get(elem, true, extra);\n }\n\n // Otherwise, if a way to get the computed value exists, use that\n if (val === undefined) {\n val = curCSS(elem, name, styles);\n }\n\n // Convert \"normal\" to computed value\n if (val === \"normal\" && name in cssNormalTransform) {\n val = cssNormalTransform[name];\n }\n\n // Make numeric if forced or a qualifier was provided and val looks numeric\n if (extra === \"\" || extra) {\n num = parseFloat(val);\n return extra === true || isFinite(num) ? num || 0 : val;\n }\n return val;\n }\n });\n jQuery.each([\"height\", \"width\"], function (_i, dimension) {\n jQuery.cssHooks[dimension] = {\n get: function (elem, computed, extra) {\n if (computed) {\n // Certain elements can have dimension info if we invisibly show them\n // but it must have a current display style that would benefit\n return rdisplayswap.test(jQuery.css(elem, \"display\")) && (\n // Support: Safari 8+\n // Table columns in Safari have non-zero offsetWidth & zero\n // getBoundingClientRect().width unless display is changed.\n // Support: IE <=11 only\n // Running getBoundingClientRect on a disconnected node\n // in IE throws an error.\n !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {\n return getWidthOrHeight(elem, dimension, extra);\n }) : getWidthOrHeight(elem, dimension, extra);\n }\n },\n set: function (elem, value, extra) {\n var matches,\n styles = getStyles(elem),\n // Only read styles.position if the test has a chance to fail\n // to avoid forcing a reflow.\n scrollboxSizeBuggy = !support.scrollboxSize() && styles.position === \"absolute\",\n // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)\n boxSizingNeeded = scrollboxSizeBuggy || extra,\n isBorderBox = boxSizingNeeded && jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\",\n subtract = extra ? boxModelAdjustment(elem, dimension, extra, isBorderBox, styles) : 0;\n\n // Account for unreliable border-box dimensions by comparing offset* to computed and\n // faking a content-box to get border and padding (gh-3699)\n if (isBorderBox && scrollboxSizeBuggy) {\n subtract -= Math.ceil(elem[\"offset\" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, \"border\", false, styles) - 0.5);\n }\n\n // Convert to pixels if value adjustment is needed\n if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || \"px\") !== \"px\") {\n elem.style[dimension] = value;\n value = jQuery.css(elem, dimension);\n }\n return setPositiveNumber(elem, value, subtract);\n }\n };\n });\n jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {\n if (computed) {\n return (parseFloat(curCSS(elem, \"marginLeft\")) || elem.getBoundingClientRect().left - swap(elem, {\n marginLeft: 0\n }, function () {\n return elem.getBoundingClientRect().left;\n })) + \"px\";\n }\n });\n\n // These hooks are used by animate to expand properties\n jQuery.each({\n margin: \"\",\n padding: \"\",\n border: \"Width\"\n }, function (prefix, suffix) {\n jQuery.cssHooks[prefix + suffix] = {\n expand: function (value) {\n var i = 0,\n expanded = {},\n // Assumes a single number if not a string\n parts = typeof value === \"string\" ? value.split(\" \") : [value];\n for (; i < 4; i++) {\n expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];\n }\n return expanded;\n }\n };\n if (prefix !== \"margin\") {\n jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;\n }\n });\n jQuery.fn.extend({\n css: function (name, value) {\n return access(this, function (elem, name, value) {\n var styles,\n len,\n map = {},\n i = 0;\n if (Array.isArray(name)) {\n styles = getStyles(elem);\n len = name.length;\n for (; i < len; i++) {\n map[name[i]] = jQuery.css(elem, name[i], false, styles);\n }\n return map;\n }\n return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);\n }, name, value, arguments.length > 1);\n }\n });\n function Tween(elem, options, prop, end, easing) {\n return new Tween.prototype.init(elem, options, prop, end, easing);\n }\n jQuery.Tween = Tween;\n Tween.prototype = {\n constructor: Tween,\n init: function (elem, options, prop, end, easing, unit) {\n this.elem = elem;\n this.prop = prop;\n this.easing = easing || jQuery.easing._default;\n this.options = options;\n this.start = this.now = this.cur();\n this.end = end;\n this.unit = unit || (jQuery.cssNumber[prop] ? \"\" : \"px\");\n },\n cur: function () {\n var hooks = Tween.propHooks[this.prop];\n return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);\n },\n run: function (percent) {\n var eased,\n hooks = Tween.propHooks[this.prop];\n if (this.options.duration) {\n this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);\n } else {\n this.pos = eased = percent;\n }\n this.now = (this.end - this.start) * eased + this.start;\n if (this.options.step) {\n this.options.step.call(this.elem, this.now, this);\n }\n if (hooks && hooks.set) {\n hooks.set(this);\n } else {\n Tween.propHooks._default.set(this);\n }\n return this;\n }\n };\n Tween.prototype.init.prototype = Tween.prototype;\n Tween.propHooks = {\n _default: {\n get: function (tween) {\n var result;\n\n // Use a property on the element directly when it is not a DOM element,\n // or when there is no matching style property that exists.\n if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {\n return tween.elem[tween.prop];\n }\n\n // Passing an empty string as a 3rd parameter to .css will automatically\n // attempt a parseFloat and fallback to a string if the parse fails.\n // Simple values such as \"10px\" are parsed to Float;\n // complex values such as \"rotate(1rad)\" are returned as-is.\n result = jQuery.css(tween.elem, tween.prop, \"\");\n\n // Empty strings, null, undefined and \"auto\" are converted to 0.\n return !result || result === \"auto\" ? 0 : result;\n },\n set: function (tween) {\n // Use step hook for back compat.\n // Use cssHook if its there.\n // Use .style if available and use plain properties where available.\n if (jQuery.fx.step[tween.prop]) {\n jQuery.fx.step[tween.prop](tween);\n } else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) {\n jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);\n } else {\n tween.elem[tween.prop] = tween.now;\n }\n }\n }\n };\n\n // Support: IE <=9 only\n // Panic based approach to setting things on disconnected nodes\n Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n set: function (tween) {\n if (tween.elem.nodeType && tween.elem.parentNode) {\n tween.elem[tween.prop] = tween.now;\n }\n }\n };\n jQuery.easing = {\n linear: function (p) {\n return p;\n },\n swing: function (p) {\n return 0.5 - Math.cos(p * Math.PI) / 2;\n },\n _default: \"swing\"\n };\n jQuery.fx = Tween.prototype.init;\n\n // Back compat <1.8 extension point\n jQuery.fx.step = {};\n var fxNow,\n inProgress,\n rfxtypes = /^(?:toggle|show|hide)$/,\n rrun = /queueHooks$/;\n function schedule() {\n if (inProgress) {\n if (document.hidden === false && window.requestAnimationFrame) {\n window.requestAnimationFrame(schedule);\n } else {\n window.setTimeout(schedule, jQuery.fx.interval);\n }\n jQuery.fx.tick();\n }\n }\n\n // Animations created synchronously will run synchronously\n function createFxNow() {\n window.setTimeout(function () {\n fxNow = undefined;\n });\n return fxNow = Date.now();\n }\n\n // Generate parameters to create a standard animation\n function genFx(type, includeWidth) {\n var which,\n i = 0,\n attrs = {\n height: type\n };\n\n // If we include width, step value is 1 to do all cssExpand values,\n // otherwise step value is 2 to skip over Left and Right\n includeWidth = includeWidth ? 1 : 0;\n for (; i < 4; i += 2 - includeWidth) {\n which = cssExpand[i];\n attrs[\"margin\" + which] = attrs[\"padding\" + which] = type;\n }\n if (includeWidth) {\n attrs.opacity = attrs.width = type;\n }\n return attrs;\n }\n function createTween(value, prop, animation) {\n var tween,\n collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners[\"*\"]),\n index = 0,\n length = collection.length;\n for (; index < length; index++) {\n if (tween = collection[index].call(animation, prop, value)) {\n // We're done with this property\n return tween;\n }\n }\n }\n function defaultPrefilter(elem, props, opts) {\n var prop,\n value,\n toggle,\n hooks,\n oldfire,\n propTween,\n restoreDisplay,\n display,\n isBox = \"width\" in props || \"height\" in props,\n anim = this,\n orig = {},\n style = elem.style,\n hidden = elem.nodeType && isHiddenWithinTree(elem),\n dataShow = dataPriv.get(elem, \"fxshow\");\n\n // Queue-skipping animations hijack the fx hooks\n if (!opts.queue) {\n hooks = jQuery._queueHooks(elem, \"fx\");\n if (hooks.unqueued == null) {\n hooks.unqueued = 0;\n oldfire = hooks.empty.fire;\n hooks.empty.fire = function () {\n if (!hooks.unqueued) {\n oldfire();\n }\n };\n }\n hooks.unqueued++;\n anim.always(function () {\n // Ensure the complete handler is called before this completes\n anim.always(function () {\n hooks.unqueued--;\n if (!jQuery.queue(elem, \"fx\").length) {\n hooks.empty.fire();\n }\n });\n });\n }\n\n // Detect show/hide animations\n for (prop in props) {\n value = props[prop];\n if (rfxtypes.test(value)) {\n delete props[prop];\n toggle = toggle || value === \"toggle\";\n if (value === (hidden ? \"hide\" : \"show\")) {\n // Pretend to be hidden if this is a \"show\" and\n // there is still data from a stopped show/hide\n if (value === \"show\" && dataShow && dataShow[prop] !== undefined) {\n hidden = true;\n\n // Ignore all other no-op show/hide data\n } else {\n continue;\n }\n }\n orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);\n }\n }\n\n // Bail out if this is a no-op like .hide().hide()\n propTween = !jQuery.isEmptyObject(props);\n if (!propTween && jQuery.isEmptyObject(orig)) {\n return;\n }\n\n // Restrict \"overflow\" and \"display\" styles during box animations\n if (isBox && elem.nodeType === 1) {\n // Support: IE <=9 - 11, Edge 12 - 15\n // Record all 3 overflow attributes because IE does not infer the shorthand\n // from identically-valued overflowX and overflowY and Edge just mirrors\n // the overflowX value there.\n opts.overflow = [style.overflow, style.overflowX, style.overflowY];\n\n // Identify a display type, preferring old show/hide data over the CSS cascade\n restoreDisplay = dataShow && dataShow.display;\n if (restoreDisplay == null) {\n restoreDisplay = dataPriv.get(elem, \"display\");\n }\n display = jQuery.css(elem, \"display\");\n if (display === \"none\") {\n if (restoreDisplay) {\n display = restoreDisplay;\n } else {\n // Get nonempty value(s) by temporarily forcing visibility\n showHide([elem], true);\n restoreDisplay = elem.style.display || restoreDisplay;\n display = jQuery.css(elem, \"display\");\n showHide([elem]);\n }\n }\n\n // Animate inline elements as inline-block\n if (display === \"inline\" || display === \"inline-block\" && restoreDisplay != null) {\n if (jQuery.css(elem, \"float\") === \"none\") {\n // Restore the original display value at the end of pure show/hide animations\n if (!propTween) {\n anim.done(function () {\n style.display = restoreDisplay;\n });\n if (restoreDisplay == null) {\n display = style.display;\n restoreDisplay = display === \"none\" ? \"\" : display;\n }\n }\n style.display = \"inline-block\";\n }\n }\n }\n if (opts.overflow) {\n style.overflow = \"hidden\";\n anim.always(function () {\n style.overflow = opts.overflow[0];\n style.overflowX = opts.overflow[1];\n style.overflowY = opts.overflow[2];\n });\n }\n\n // Implement show/hide animations\n propTween = false;\n for (prop in orig) {\n // General show/hide setup for this element animation\n if (!propTween) {\n if (dataShow) {\n if (\"hidden\" in dataShow) {\n hidden = dataShow.hidden;\n }\n } else {\n dataShow = dataPriv.access(elem, \"fxshow\", {\n display: restoreDisplay\n });\n }\n\n // Store hidden/visible for toggle so `.stop().toggle()` \"reverses\"\n if (toggle) {\n dataShow.hidden = !hidden;\n }\n\n // Show elements before animating them\n if (hidden) {\n showHide([elem], true);\n }\n\n /* eslint-disable no-loop-func */\n\n anim.done(function () {\n /* eslint-enable no-loop-func */\n\n // The final step of a \"hide\" animation is actually hiding the element\n if (!hidden) {\n showHide([elem]);\n }\n dataPriv.remove(elem, \"fxshow\");\n for (prop in orig) {\n jQuery.style(elem, prop, orig[prop]);\n }\n });\n }\n\n // Per-property setup\n propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);\n if (!(prop in dataShow)) {\n dataShow[prop] = propTween.start;\n if (hidden) {\n propTween.end = propTween.start;\n propTween.start = 0;\n }\n }\n }\n }\n function propFilter(props, specialEasing) {\n var index, name, easing, value, hooks;\n\n // camelCase, specialEasing and expand cssHook pass\n for (index in props) {\n name = camelCase(index);\n easing = specialEasing[name];\n value = props[index];\n if (Array.isArray(value)) {\n easing = value[1];\n value = props[index] = value[0];\n }\n if (index !== name) {\n props[name] = value;\n delete props[index];\n }\n hooks = jQuery.cssHooks[name];\n if (hooks && \"expand\" in hooks) {\n value = hooks.expand(value);\n delete props[name];\n\n // Not quite $.extend, this won't overwrite existing keys.\n // Reusing 'index' because we have the correct \"name\"\n for (index in value) {\n if (!(index in props)) {\n props[index] = value[index];\n specialEasing[index] = easing;\n }\n }\n } else {\n specialEasing[name] = easing;\n }\n }\n }\n function Animation(elem, properties, options) {\n var result,\n stopped,\n index = 0,\n length = Animation.prefilters.length,\n deferred = jQuery.Deferred().always(function () {\n // Don't match elem in the :animated selector\n delete tick.elem;\n }),\n tick = function () {\n if (stopped) {\n return false;\n }\n var currentTime = fxNow || createFxNow(),\n remaining = Math.max(0, animation.startTime + animation.duration - currentTime),\n // Support: Android 2.3 only\n // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497)\n temp = remaining / animation.duration || 0,\n percent = 1 - temp,\n index = 0,\n length = animation.tweens.length;\n for (; index < length; index++) {\n animation.tweens[index].run(percent);\n }\n deferred.notifyWith(elem, [animation, percent, remaining]);\n\n // If there's more to do, yield\n if (percent < 1 && length) {\n return remaining;\n }\n\n // If this was an empty animation, synthesize a final progress notification\n if (!length) {\n deferred.notifyWith(elem, [animation, 1, 0]);\n }\n\n // Resolve the animation and report its conclusion\n deferred.resolveWith(elem, [animation]);\n return false;\n },\n animation = deferred.promise({\n elem: elem,\n props: jQuery.extend({}, properties),\n opts: jQuery.extend(true, {\n specialEasing: {},\n easing: jQuery.easing._default\n }, options),\n originalProperties: properties,\n originalOptions: options,\n startTime: fxNow || createFxNow(),\n duration: options.duration,\n tweens: [],\n createTween: function (prop, end) {\n var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);\n animation.tweens.push(tween);\n return tween;\n },\n stop: function (gotoEnd) {\n var index = 0,\n // If we are going to the end, we want to run all the tweens\n // otherwise we skip this part\n length = gotoEnd ? animation.tweens.length : 0;\n if (stopped) {\n return this;\n }\n stopped = true;\n for (; index < length; index++) {\n animation.tweens[index].run(1);\n }\n\n // Resolve when we played the last frame; otherwise, reject\n if (gotoEnd) {\n deferred.notifyWith(elem, [animation, 1, 0]);\n deferred.resolveWith(elem, [animation, gotoEnd]);\n } else {\n deferred.rejectWith(elem, [animation, gotoEnd]);\n }\n return this;\n }\n }),\n props = animation.props;\n propFilter(props, animation.opts.specialEasing);\n for (; index < length; index++) {\n result = Animation.prefilters[index].call(animation, elem, props, animation.opts);\n if (result) {\n if (isFunction(result.stop)) {\n jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);\n }\n return result;\n }\n }\n jQuery.map(props, createTween, animation);\n if (isFunction(animation.opts.start)) {\n animation.opts.start.call(elem, animation);\n }\n\n // Attach callbacks from options\n animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);\n jQuery.fx.timer(jQuery.extend(tick, {\n elem: elem,\n anim: animation,\n queue: animation.opts.queue\n }));\n return animation;\n }\n jQuery.Animation = jQuery.extend(Animation, {\n tweeners: {\n \"*\": [function (prop, value) {\n var tween = this.createTween(prop, value);\n adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);\n return tween;\n }]\n },\n tweener: function (props, callback) {\n if (isFunction(props)) {\n callback = props;\n props = [\"*\"];\n } else {\n props = props.match(rnothtmlwhite);\n }\n var prop,\n index = 0,\n length = props.length;\n for (; index < length; index++) {\n prop = props[index];\n Animation.tweeners[prop] = Animation.tweeners[prop] || [];\n Animation.tweeners[prop].unshift(callback);\n }\n },\n prefilters: [defaultPrefilter],\n prefilter: function (callback, prepend) {\n if (prepend) {\n Animation.prefilters.unshift(callback);\n } else {\n Animation.prefilters.push(callback);\n }\n }\n });\n jQuery.speed = function (speed, easing, fn) {\n var opt = speed && typeof speed === \"object\" ? jQuery.extend({}, speed) : {\n complete: fn || !fn && easing || isFunction(speed) && speed,\n duration: speed,\n easing: fn && easing || easing && !isFunction(easing) && easing\n };\n\n // Go to the end state if fx are off\n if (jQuery.fx.off) {\n opt.duration = 0;\n } else {\n if (typeof opt.duration !== \"number\") {\n if (opt.duration in jQuery.fx.speeds) {\n opt.duration = jQuery.fx.speeds[opt.duration];\n } else {\n opt.duration = jQuery.fx.speeds._default;\n }\n }\n }\n\n // Normalize opt.queue - true/undefined/null -> \"fx\"\n if (opt.queue == null || opt.queue === true) {\n opt.queue = \"fx\";\n }\n\n // Queueing\n opt.old = opt.complete;\n opt.complete = function () {\n if (isFunction(opt.old)) {\n opt.old.call(this);\n }\n if (opt.queue) {\n jQuery.dequeue(this, opt.queue);\n }\n };\n return opt;\n };\n jQuery.fn.extend({\n fadeTo: function (speed, to, easing, callback) {\n // Show any hidden elements after setting opacity to 0\n return this.filter(isHiddenWithinTree).css(\"opacity\", 0).show()\n\n // Animate to the value specified\n .end().animate({\n opacity: to\n }, speed, easing, callback);\n },\n animate: function (prop, speed, easing, callback) {\n var empty = jQuery.isEmptyObject(prop),\n optall = jQuery.speed(speed, easing, callback),\n doAnimation = function () {\n // Operate on a copy of prop so per-property easing won't be lost\n var anim = Animation(this, jQuery.extend({}, prop), optall);\n\n // Empty animations, or finishing resolves immediately\n if (empty || dataPriv.get(this, \"finish\")) {\n anim.stop(true);\n }\n };\n doAnimation.finish = doAnimation;\n return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);\n },\n stop: function (type, clearQueue, gotoEnd) {\n var stopQueue = function (hooks) {\n var stop = hooks.stop;\n delete hooks.stop;\n stop(gotoEnd);\n };\n if (typeof type !== \"string\") {\n gotoEnd = clearQueue;\n clearQueue = type;\n type = undefined;\n }\n if (clearQueue) {\n this.queue(type || \"fx\", []);\n }\n return this.each(function () {\n var dequeue = true,\n index = type != null && type + \"queueHooks\",\n timers = jQuery.timers,\n data = dataPriv.get(this);\n if (index) {\n if (data[index] && data[index].stop) {\n stopQueue(data[index]);\n }\n } else {\n for (index in data) {\n if (data[index] && data[index].stop && rrun.test(index)) {\n stopQueue(data[index]);\n }\n }\n }\n for (index = timers.length; index--;) {\n if (timers[index].elem === this && (type == null || timers[index].queue === type)) {\n timers[index].anim.stop(gotoEnd);\n dequeue = false;\n timers.splice(index, 1);\n }\n }\n\n // Start the next in the queue if the last step wasn't forced.\n // Timers currently will call their complete callbacks, which\n // will dequeue but only if they were gotoEnd.\n if (dequeue || !gotoEnd) {\n jQuery.dequeue(this, type);\n }\n });\n },\n finish: function (type) {\n if (type !== false) {\n type = type || \"fx\";\n }\n return this.each(function () {\n var index,\n data = dataPriv.get(this),\n queue = data[type + \"queue\"],\n hooks = data[type + \"queueHooks\"],\n timers = jQuery.timers,\n length = queue ? queue.length : 0;\n\n // Enable finishing flag on private data\n data.finish = true;\n\n // Empty the queue first\n jQuery.queue(this, type, []);\n if (hooks && hooks.stop) {\n hooks.stop.call(this, true);\n }\n\n // Look for any active animations, and finish them\n for (index = timers.length; index--;) {\n if (timers[index].elem === this && timers[index].queue === type) {\n timers[index].anim.stop(true);\n timers.splice(index, 1);\n }\n }\n\n // Look for any animations in the old queue and finish them\n for (index = 0; index < length; index++) {\n if (queue[index] && queue[index].finish) {\n queue[index].finish.call(this);\n }\n }\n\n // Turn off finishing flag\n delete data.finish;\n });\n }\n });\n jQuery.each([\"toggle\", \"show\", \"hide\"], function (_i, name) {\n var cssFn = jQuery.fn[name];\n jQuery.fn[name] = function (speed, easing, callback) {\n return speed == null || typeof speed === \"boolean\" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);\n };\n });\n\n // Generate shortcuts for custom animations\n jQuery.each({\n slideDown: genFx(\"show\"),\n slideUp: genFx(\"hide\"),\n slideToggle: genFx(\"toggle\"),\n fadeIn: {\n opacity: \"show\"\n },\n fadeOut: {\n opacity: \"hide\"\n },\n fadeToggle: {\n opacity: \"toggle\"\n }\n }, function (name, props) {\n jQuery.fn[name] = function (speed, easing, callback) {\n return this.animate(props, speed, easing, callback);\n };\n });\n jQuery.timers = [];\n jQuery.fx.tick = function () {\n var timer,\n i = 0,\n timers = jQuery.timers;\n fxNow = Date.now();\n for (; i < timers.length; i++) {\n timer = timers[i];\n\n // Run the timer and safely remove it when done (allowing for external removal)\n if (!timer() && timers[i] === timer) {\n timers.splice(i--, 1);\n }\n }\n if (!timers.length) {\n jQuery.fx.stop();\n }\n fxNow = undefined;\n };\n jQuery.fx.timer = function (timer) {\n jQuery.timers.push(timer);\n jQuery.fx.start();\n };\n jQuery.fx.interval = 13;\n jQuery.fx.start = function () {\n if (inProgress) {\n return;\n }\n inProgress = true;\n schedule();\n };\n jQuery.fx.stop = function () {\n inProgress = null;\n };\n jQuery.fx.speeds = {\n slow: 600,\n fast: 200,\n // Default speed\n _default: 400\n };\n\n // Based off of the plugin by Clint Helfers, with permission.\n jQuery.fn.delay = function (time, type) {\n time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;\n type = type || \"fx\";\n return this.queue(type, function (next, hooks) {\n var timeout = window.setTimeout(next, time);\n hooks.stop = function () {\n window.clearTimeout(timeout);\n };\n });\n };\n (function () {\n var input = document.createElement(\"input\"),\n select = document.createElement(\"select\"),\n opt = select.appendChild(document.createElement(\"option\"));\n input.type = \"checkbox\";\n\n // Support: Android <=4.3 only\n // Default value for a checkbox should be \"on\"\n support.checkOn = input.value !== \"\";\n\n // Support: IE <=11 only\n // Must access selectedIndex to make default options select\n support.optSelected = opt.selected;\n\n // Support: IE <=11 only\n // An input loses its value after becoming a radio\n input = document.createElement(\"input\");\n input.value = \"t\";\n input.type = \"radio\";\n support.radioValue = input.value === \"t\";\n })();\n var boolHook,\n attrHandle = jQuery.expr.attrHandle;\n jQuery.fn.extend({\n attr: function (name, value) {\n return access(this, jQuery.attr, name, value, arguments.length > 1);\n },\n removeAttr: function (name) {\n return this.each(function () {\n jQuery.removeAttr(this, name);\n });\n }\n });\n jQuery.extend({\n attr: function (elem, name, value) {\n var ret,\n hooks,\n nType = elem.nodeType;\n\n // Don't get/set attributes on text, comment and attribute nodes\n if (nType === 3 || nType === 8 || nType === 2) {\n return;\n }\n\n // Fallback to prop when attributes are not supported\n if (typeof elem.getAttribute === \"undefined\") {\n return jQuery.prop(elem, name, value);\n }\n\n // Attribute hooks are determined by the lowercase version\n // Grab necessary hook if one is defined\n if (nType !== 1 || !jQuery.isXMLDoc(elem)) {\n hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);\n }\n if (value !== undefined) {\n if (value === null) {\n jQuery.removeAttr(elem, name);\n return;\n }\n if (hooks && \"set\" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {\n return ret;\n }\n elem.setAttribute(name, value + \"\");\n return value;\n }\n if (hooks && \"get\" in hooks && (ret = hooks.get(elem, name)) !== null) {\n return ret;\n }\n ret = jQuery.find.attr(elem, name);\n\n // Non-existent attributes return null, we normalize to undefined\n return ret == null ? undefined : ret;\n },\n attrHooks: {\n type: {\n set: function (elem, value) {\n if (!support.radioValue && value === \"radio\" && nodeName(elem, \"input\")) {\n var val = elem.value;\n elem.setAttribute(\"type\", value);\n if (val) {\n elem.value = val;\n }\n return value;\n }\n }\n }\n },\n removeAttr: function (elem, value) {\n var name,\n i = 0,\n // Attribute names can contain non-HTML whitespace characters\n // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n attrNames = value && value.match(rnothtmlwhite);\n if (attrNames && elem.nodeType === 1) {\n while (name = attrNames[i++]) {\n elem.removeAttribute(name);\n }\n }\n }\n });\n\n // Hooks for boolean attributes\n boolHook = {\n set: function (elem, value, name) {\n if (value === false) {\n // Remove boolean attributes when set to false\n jQuery.removeAttr(elem, name);\n } else {\n elem.setAttribute(name, name);\n }\n return name;\n }\n };\n jQuery.each(jQuery.expr.match.bool.source.match(/\\w+/g), function (_i, name) {\n var getter = attrHandle[name] || jQuery.find.attr;\n attrHandle[name] = function (elem, name, isXML) {\n var ret,\n handle,\n lowercaseName = name.toLowerCase();\n if (!isXML) {\n // Avoid an infinite loop by temporarily removing this function from the getter\n handle = attrHandle[lowercaseName];\n attrHandle[lowercaseName] = ret;\n ret = getter(elem, name, isXML) != null ? lowercaseName : null;\n attrHandle[lowercaseName] = handle;\n }\n return ret;\n };\n });\n var rfocusable = /^(?:input|select|textarea|button)$/i,\n rclickable = /^(?:a|area)$/i;\n jQuery.fn.extend({\n prop: function (name, value) {\n return access(this, jQuery.prop, name, value, arguments.length > 1);\n },\n removeProp: function (name) {\n return this.each(function () {\n delete this[jQuery.propFix[name] || name];\n });\n }\n });\n jQuery.extend({\n prop: function (elem, name, value) {\n var ret,\n hooks,\n nType = elem.nodeType;\n\n // Don't get/set properties on text, comment and attribute nodes\n if (nType === 3 || nType === 8 || nType === 2) {\n return;\n }\n if (nType !== 1 || !jQuery.isXMLDoc(elem)) {\n // Fix name and attach hooks\n name = jQuery.propFix[name] || name;\n hooks = jQuery.propHooks[name];\n }\n if (value !== undefined) {\n if (hooks && \"set\" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {\n return ret;\n }\n return elem[name] = value;\n }\n if (hooks && \"get\" in hooks && (ret = hooks.get(elem, name)) !== null) {\n return ret;\n }\n return elem[name];\n },\n propHooks: {\n tabIndex: {\n get: function (elem) {\n // Support: IE <=9 - 11 only\n // elem.tabIndex doesn't always return the\n // correct value when it hasn't been explicitly set\n // Use proper attribute retrieval (trac-12072)\n var tabindex = jQuery.find.attr(elem, \"tabindex\");\n if (tabindex) {\n return parseInt(tabindex, 10);\n }\n if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {\n return 0;\n }\n return -1;\n }\n }\n },\n propFix: {\n \"for\": \"htmlFor\",\n \"class\": \"className\"\n }\n });\n\n // Support: IE <=11 only\n // Accessing the selectedIndex property\n // forces the browser to respect setting selected\n // on the option\n // The getter ensures a default option is selected\n // when in an optgroup\n // eslint rule \"no-unused-expressions\" is disabled for this code\n // since it considers such accessions noop\n if (!support.optSelected) {\n jQuery.propHooks.selected = {\n get: function (elem) {\n /* eslint no-unused-expressions: \"off\" */\n\n var parent = elem.parentNode;\n if (parent && parent.parentNode) {\n parent.parentNode.selectedIndex;\n }\n return null;\n },\n set: function (elem) {\n /* eslint no-unused-expressions: \"off\" */\n\n var parent = elem.parentNode;\n if (parent) {\n parent.selectedIndex;\n if (parent.parentNode) {\n parent.parentNode.selectedIndex;\n }\n }\n }\n };\n }\n jQuery.each([\"tabIndex\", \"readOnly\", \"maxLength\", \"cellSpacing\", \"cellPadding\", \"rowSpan\", \"colSpan\", \"useMap\", \"frameBorder\", \"contentEditable\"], function () {\n jQuery.propFix[this.toLowerCase()] = this;\n });\n\n // Strip and collapse whitespace according to HTML spec\n // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace\n function stripAndCollapse(value) {\n var tokens = value.match(rnothtmlwhite) || [];\n return tokens.join(\" \");\n }\n function getClass(elem) {\n return elem.getAttribute && elem.getAttribute(\"class\") || \"\";\n }\n function classesToArray(value) {\n if (Array.isArray(value)) {\n return value;\n }\n if (typeof value === \"string\") {\n return value.match(rnothtmlwhite) || [];\n }\n return [];\n }\n jQuery.fn.extend({\n addClass: function (value) {\n var classNames, cur, curValue, className, i, finalValue;\n if (isFunction(value)) {\n return this.each(function (j) {\n jQuery(this).addClass(value.call(this, j, getClass(this)));\n });\n }\n classNames = classesToArray(value);\n if (classNames.length) {\n return this.each(function () {\n curValue = getClass(this);\n cur = this.nodeType === 1 && \" \" + stripAndCollapse(curValue) + \" \";\n if (cur) {\n for (i = 0; i < classNames.length; i++) {\n className = classNames[i];\n if (cur.indexOf(\" \" + className + \" \") < 0) {\n cur += className + \" \";\n }\n }\n\n // Only assign if different to avoid unneeded rendering.\n finalValue = stripAndCollapse(cur);\n if (curValue !== finalValue) {\n this.setAttribute(\"class\", finalValue);\n }\n }\n });\n }\n return this;\n },\n removeClass: function (value) {\n var classNames, cur, curValue, className, i, finalValue;\n if (isFunction(value)) {\n return this.each(function (j) {\n jQuery(this).removeClass(value.call(this, j, getClass(this)));\n });\n }\n if (!arguments.length) {\n return this.attr(\"class\", \"\");\n }\n classNames = classesToArray(value);\n if (classNames.length) {\n return this.each(function () {\n curValue = getClass(this);\n\n // This expression is here for better compressibility (see addClass)\n cur = this.nodeType === 1 && \" \" + stripAndCollapse(curValue) + \" \";\n if (cur) {\n for (i = 0; i < classNames.length; i++) {\n className = classNames[i];\n\n // Remove *all* instances\n while (cur.indexOf(\" \" + className + \" \") > -1) {\n cur = cur.replace(\" \" + className + \" \", \" \");\n }\n }\n\n // Only assign if different to avoid unneeded rendering.\n finalValue = stripAndCollapse(cur);\n if (curValue !== finalValue) {\n this.setAttribute(\"class\", finalValue);\n }\n }\n });\n }\n return this;\n },\n toggleClass: function (value, stateVal) {\n var classNames,\n className,\n i,\n self,\n type = typeof value,\n isValidValue = type === \"string\" || Array.isArray(value);\n if (isFunction(value)) {\n return this.each(function (i) {\n jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);\n });\n }\n if (typeof stateVal === \"boolean\" && isValidValue) {\n return stateVal ? this.addClass(value) : this.removeClass(value);\n }\n classNames = classesToArray(value);\n return this.each(function () {\n if (isValidValue) {\n // Toggle individual class names\n self = jQuery(this);\n for (i = 0; i < classNames.length; i++) {\n className = classNames[i];\n\n // Check each className given, space separated list\n if (self.hasClass(className)) {\n self.removeClass(className);\n } else {\n self.addClass(className);\n }\n }\n\n // Toggle whole class name\n } else if (value === undefined || type === \"boolean\") {\n className = getClass(this);\n if (className) {\n // Store className if set\n dataPriv.set(this, \"__className__\", className);\n }\n\n // If the element has a class name or if we're passed `false`,\n // then remove the whole classname (if there was one, the above saved it).\n // Otherwise bring back whatever was previously saved (if anything),\n // falling back to the empty string if nothing was stored.\n if (this.setAttribute) {\n this.setAttribute(\"class\", className || value === false ? \"\" : dataPriv.get(this, \"__className__\") || \"\");\n }\n }\n });\n },\n hasClass: function (selector) {\n var className,\n elem,\n i = 0;\n className = \" \" + selector + \" \";\n while (elem = this[i++]) {\n if (elem.nodeType === 1 && (\" \" + stripAndCollapse(getClass(elem)) + \" \").indexOf(className) > -1) {\n return true;\n }\n }\n return false;\n }\n });\n var rreturn = /\\r/g;\n jQuery.fn.extend({\n val: function (value) {\n var hooks,\n ret,\n valueIsFunction,\n elem = this[0];\n if (!arguments.length) {\n if (elem) {\n hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];\n if (hooks && \"get\" in hooks && (ret = hooks.get(elem, \"value\")) !== undefined) {\n return ret;\n }\n ret = elem.value;\n\n // Handle most common string cases\n if (typeof ret === \"string\") {\n return ret.replace(rreturn, \"\");\n }\n\n // Handle cases where value is null/undef or number\n return ret == null ? \"\" : ret;\n }\n return;\n }\n valueIsFunction = isFunction(value);\n return this.each(function (i) {\n var val;\n if (this.nodeType !== 1) {\n return;\n }\n if (valueIsFunction) {\n val = value.call(this, i, jQuery(this).val());\n } else {\n val = value;\n }\n\n // Treat null/undefined as \"\"; convert numbers to string\n if (val == null) {\n val = \"\";\n } else if (typeof val === \"number\") {\n val += \"\";\n } else if (Array.isArray(val)) {\n val = jQuery.map(val, function (value) {\n return value == null ? \"\" : value + \"\";\n });\n }\n hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];\n\n // If set returns undefined, fall back to normal setting\n if (!hooks || !(\"set\" in hooks) || hooks.set(this, val, \"value\") === undefined) {\n this.value = val;\n }\n });\n }\n });\n jQuery.extend({\n valHooks: {\n option: {\n get: function (elem) {\n var val = jQuery.find.attr(elem, \"value\");\n return val != null ? val :\n // Support: IE <=10 - 11 only\n // option.text throws exceptions (trac-14686, trac-14858)\n // Strip and collapse whitespace\n // https://html.spec.whatwg.org/#strip-and-collapse-whitespace\n stripAndCollapse(jQuery.text(elem));\n }\n },\n select: {\n get: function (elem) {\n var value,\n option,\n i,\n options = elem.options,\n index = elem.selectedIndex,\n one = elem.type === \"select-one\",\n values = one ? null : [],\n max = one ? index + 1 : options.length;\n if (index < 0) {\n i = max;\n } else {\n i = one ? index : 0;\n }\n\n // Loop through all the selected options\n for (; i < max; i++) {\n option = options[i];\n\n // Support: IE <=9 only\n // IE8-9 doesn't update selected after form reset (trac-2551)\n if ((option.selected || i === index) &&\n // Don't return options that are disabled or in a disabled optgroup\n !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, \"optgroup\"))) {\n // Get the specific value for the option\n value = jQuery(option).val();\n\n // We don't need an array for one selects\n if (one) {\n return value;\n }\n\n // Multi-Selects return an array\n values.push(value);\n }\n }\n return values;\n },\n set: function (elem, value) {\n var optionSet,\n option,\n options = elem.options,\n values = jQuery.makeArray(value),\n i = options.length;\n while (i--) {\n option = options[i];\n\n /* eslint-disable no-cond-assign */\n\n if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {\n optionSet = true;\n }\n\n /* eslint-enable no-cond-assign */\n }\n\n // Force browsers to behave consistently when non-matching value is set\n if (!optionSet) {\n elem.selectedIndex = -1;\n }\n return values;\n }\n }\n }\n });\n\n // Radios and checkboxes getter/setter\n jQuery.each([\"radio\", \"checkbox\"], function () {\n jQuery.valHooks[this] = {\n set: function (elem, value) {\n if (Array.isArray(value)) {\n return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;\n }\n }\n };\n if (!support.checkOn) {\n jQuery.valHooks[this].get = function (elem) {\n return elem.getAttribute(\"value\") === null ? \"on\" : elem.value;\n };\n }\n });\n\n // Return jQuery for attributes-only inclusion\n var location = window.location;\n var nonce = {\n guid: Date.now()\n };\n var rquery = /\\?/;\n\n // Cross-browser xml parsing\n jQuery.parseXML = function (data) {\n var xml, parserErrorElem;\n if (!data || typeof data !== \"string\") {\n return null;\n }\n\n // Support: IE 9 - 11 only\n // IE throws on parseFromString with invalid input.\n try {\n xml = new window.DOMParser().parseFromString(data, \"text/xml\");\n } catch (e) {}\n parserErrorElem = xml && xml.getElementsByTagName(\"parsererror\")[0];\n if (!xml || parserErrorElem) {\n jQuery.error(\"Invalid XML: \" + (parserErrorElem ? jQuery.map(parserErrorElem.childNodes, function (el) {\n return el.textContent;\n }).join(\"\\n\") : data));\n }\n return xml;\n };\n var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,\n stopPropagationCallback = function (e) {\n e.stopPropagation();\n };\n jQuery.extend(jQuery.event, {\n trigger: function (event, data, elem, onlyHandlers) {\n var i,\n cur,\n tmp,\n bubbleType,\n ontype,\n handle,\n special,\n lastElement,\n eventPath = [elem || document],\n type = hasOwn.call(event, \"type\") ? event.type : event,\n namespaces = hasOwn.call(event, \"namespace\") ? event.namespace.split(\".\") : [];\n cur = lastElement = tmp = elem = elem || document;\n\n // Don't do events on text and comment nodes\n if (elem.nodeType === 3 || elem.nodeType === 8) {\n return;\n }\n\n // focus/blur morphs to focusin/out; ensure we're not firing them right now\n if (rfocusMorph.test(type + jQuery.event.triggered)) {\n return;\n }\n if (type.indexOf(\".\") > -1) {\n // Namespaced trigger; create a regexp to match event type in handle()\n namespaces = type.split(\".\");\n type = namespaces.shift();\n namespaces.sort();\n }\n ontype = type.indexOf(\":\") < 0 && \"on\" + type;\n\n // Caller can pass in a jQuery.Event object, Object, or just an event type string\n event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === \"object\" && event);\n\n // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n event.isTrigger = onlyHandlers ? 2 : 3;\n event.namespace = namespaces.join(\".\");\n event.rnamespace = event.namespace ? new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\") : null;\n\n // Clean up the event in case it is being reused\n event.result = undefined;\n if (!event.target) {\n event.target = elem;\n }\n\n // Clone any incoming data and prepend the event, creating the handler arg list\n data = data == null ? [event] : jQuery.makeArray(data, [event]);\n\n // Allow special events to draw outside the lines\n special = jQuery.event.special[type] || {};\n if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {\n return;\n }\n\n // Determine event propagation path in advance, per W3C events spec (trac-9951)\n // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)\n if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {\n bubbleType = special.delegateType || type;\n if (!rfocusMorph.test(bubbleType + type)) {\n cur = cur.parentNode;\n }\n for (; cur; cur = cur.parentNode) {\n eventPath.push(cur);\n tmp = cur;\n }\n\n // Only add window if we got to document (e.g., not plain obj or detached DOM)\n if (tmp === (elem.ownerDocument || document)) {\n eventPath.push(tmp.defaultView || tmp.parentWindow || window);\n }\n }\n\n // Fire handlers on the event path\n i = 0;\n while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {\n lastElement = cur;\n event.type = i > 1 ? bubbleType : special.bindType || type;\n\n // jQuery handler\n handle = (dataPriv.get(cur, \"events\") || Object.create(null))[event.type] && dataPriv.get(cur, \"handle\");\n if (handle) {\n handle.apply(cur, data);\n }\n\n // Native handler\n handle = ontype && cur[ontype];\n if (handle && handle.apply && acceptData(cur)) {\n event.result = handle.apply(cur, data);\n if (event.result === false) {\n event.preventDefault();\n }\n }\n }\n event.type = type;\n\n // If nobody prevented the default action, do it now\n if (!onlyHandlers && !event.isDefaultPrevented()) {\n if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {\n // Call a native DOM method on the target with the same name as the event.\n // Don't do default actions on window, that's where global variables be (trac-6170)\n if (ontype && isFunction(elem[type]) && !isWindow(elem)) {\n // Don't re-trigger an onFOO event when we call its FOO() method\n tmp = elem[ontype];\n if (tmp) {\n elem[ontype] = null;\n }\n\n // Prevent re-triggering of the same event, since we already bubbled it above\n jQuery.event.triggered = type;\n if (event.isPropagationStopped()) {\n lastElement.addEventListener(type, stopPropagationCallback);\n }\n elem[type]();\n if (event.isPropagationStopped()) {\n lastElement.removeEventListener(type, stopPropagationCallback);\n }\n jQuery.event.triggered = undefined;\n if (tmp) {\n elem[ontype] = tmp;\n }\n }\n }\n }\n return event.result;\n },\n // Piggyback on a donor event to simulate a different one\n // Used only for `focus(in | out)` events\n simulate: function (type, elem, event) {\n var e = jQuery.extend(new jQuery.Event(), event, {\n type: type,\n isSimulated: true\n });\n jQuery.event.trigger(e, null, elem);\n }\n });\n jQuery.fn.extend({\n trigger: function (type, data) {\n return this.each(function () {\n jQuery.event.trigger(type, data, this);\n });\n },\n triggerHandler: function (type, data) {\n var elem = this[0];\n if (elem) {\n return jQuery.event.trigger(type, data, elem, true);\n }\n }\n });\n var rbracket = /\\[\\]$/,\n rCRLF = /\\r?\\n/g,\n rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,\n rsubmittable = /^(?:input|select|textarea|keygen)/i;\n function buildParams(prefix, obj, traditional, add) {\n var name;\n if (Array.isArray(obj)) {\n // Serialize array item.\n jQuery.each(obj, function (i, v) {\n if (traditional || rbracket.test(prefix)) {\n // Treat each array item as a scalar.\n add(prefix, v);\n } else {\n // Item is non-scalar (array or object), encode its numeric index.\n buildParams(prefix + \"[\" + (typeof v === \"object\" && v != null ? i : \"\") + \"]\", v, traditional, add);\n }\n });\n } else if (!traditional && toType(obj) === \"object\") {\n // Serialize object item.\n for (name in obj) {\n buildParams(prefix + \"[\" + name + \"]\", obj[name], traditional, add);\n }\n } else {\n // Serialize scalar item.\n add(prefix, obj);\n }\n }\n\n // Serialize an array of form elements or a set of\n // key/values into a query string\n jQuery.param = function (a, traditional) {\n var prefix,\n s = [],\n add = function (key, valueOrFunction) {\n // If value is a function, invoke it and use its return value\n var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;\n s[s.length] = encodeURIComponent(key) + \"=\" + encodeURIComponent(value == null ? \"\" : value);\n };\n if (a == null) {\n return \"\";\n }\n\n // If an array was passed in, assume that it is an array of form elements.\n if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {\n // Serialize the form elements\n jQuery.each(a, function () {\n add(this.name, this.value);\n });\n } else {\n // If traditional, encode the \"old\" way (the way 1.3.2 or older\n // did it), otherwise encode params recursively.\n for (prefix in a) {\n buildParams(prefix, a[prefix], traditional, add);\n }\n }\n\n // Return the resulting serialization\n return s.join(\"&\");\n };\n jQuery.fn.extend({\n serialize: function () {\n return jQuery.param(this.serializeArray());\n },\n serializeArray: function () {\n return this.map(function () {\n // Can add propHook for \"elements\" to filter or add form elements\n var elements = jQuery.prop(this, \"elements\");\n return elements ? jQuery.makeArray(elements) : this;\n }).filter(function () {\n var type = this.type;\n\n // Use .is( \":disabled\" ) so that fieldset[disabled] works\n return this.name && !jQuery(this).is(\":disabled\") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));\n }).map(function (_i, elem) {\n var val = jQuery(this).val();\n if (val == null) {\n return null;\n }\n if (Array.isArray(val)) {\n return jQuery.map(val, function (val) {\n return {\n name: elem.name,\n value: val.replace(rCRLF, \"\\r\\n\")\n };\n });\n }\n return {\n name: elem.name,\n value: val.replace(rCRLF, \"\\r\\n\")\n };\n }).get();\n }\n });\n var r20 = /%20/g,\n rhash = /#.*$/,\n rantiCache = /([?&])_=[^&]*/,\n rheaders = /^(.*?):[ \\t]*([^\\r\\n]*)$/mg,\n // trac-7653, trac-8125, trac-8152: local protocol detection\n rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,\n rnoContent = /^(?:GET|HEAD)$/,\n rprotocol = /^\\/\\//,\n /* Prefilters\n * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n * 2) These are called:\n * - BEFORE asking for a transport\n * - AFTER param serialization (s.data is a string if s.processData is true)\n * 3) key is the dataType\n * 4) the catchall symbol \"*\" can be used\n * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n */\n prefilters = {},\n /* Transports bindings\n * 1) key is the dataType\n * 2) the catchall symbol \"*\" can be used\n * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n */\n transports = {},\n // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression\n allTypes = \"*/\".concat(\"*\"),\n // Anchor tag for parsing the document origin\n originAnchor = document.createElement(\"a\");\n originAnchor.href = location.href;\n\n // Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\n function addToPrefiltersOrTransports(structure) {\n // dataTypeExpression is optional and defaults to \"*\"\n return function (dataTypeExpression, func) {\n if (typeof dataTypeExpression !== \"string\") {\n func = dataTypeExpression;\n dataTypeExpression = \"*\";\n }\n var dataType,\n i = 0,\n dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];\n if (isFunction(func)) {\n // For each dataType in the dataTypeExpression\n while (dataType = dataTypes[i++]) {\n // Prepend if requested\n if (dataType[0] === \"+\") {\n dataType = dataType.slice(1) || \"*\";\n (structure[dataType] = structure[dataType] || []).unshift(func);\n\n // Otherwise append\n } else {\n (structure[dataType] = structure[dataType] || []).push(func);\n }\n }\n }\n };\n }\n\n // Base inspection function for prefilters and transports\n function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {\n var inspected = {},\n seekingTransport = structure === transports;\n function inspect(dataType) {\n var selected;\n inspected[dataType] = true;\n jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {\n var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);\n if (typeof dataTypeOrTransport === \"string\" && !seekingTransport && !inspected[dataTypeOrTransport]) {\n options.dataTypes.unshift(dataTypeOrTransport);\n inspect(dataTypeOrTransport);\n return false;\n } else if (seekingTransport) {\n return !(selected = dataTypeOrTransport);\n }\n });\n return selected;\n }\n return inspect(options.dataTypes[0]) || !inspected[\"*\"] && inspect(\"*\");\n }\n\n // A special extend for ajax options\n // that takes \"flat\" options (not to be deep extended)\n // Fixes trac-9887\n function ajaxExtend(target, src) {\n var key,\n deep,\n flatOptions = jQuery.ajaxSettings.flatOptions || {};\n for (key in src) {\n if (src[key] !== undefined) {\n (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];\n }\n }\n if (deep) {\n jQuery.extend(true, target, deep);\n }\n return target;\n }\n\n /* Handles responses to an ajax request:\n * - finds the right dataType (mediates between content-type and expected dataType)\n * - returns the corresponding response\n */\n function ajaxHandleResponses(s, jqXHR, responses) {\n var ct,\n type,\n finalDataType,\n firstDataType,\n contents = s.contents,\n dataTypes = s.dataTypes;\n\n // Remove auto dataType and get content-type in the process\n while (dataTypes[0] === \"*\") {\n dataTypes.shift();\n if (ct === undefined) {\n ct = s.mimeType || jqXHR.getResponseHeader(\"Content-Type\");\n }\n }\n\n // Check if we're dealing with a known content-type\n if (ct) {\n for (type in contents) {\n if (contents[type] && contents[type].test(ct)) {\n dataTypes.unshift(type);\n break;\n }\n }\n }\n\n // Check to see if we have a response for the expected dataType\n if (dataTypes[0] in responses) {\n finalDataType = dataTypes[0];\n } else {\n // Try convertible dataTypes\n for (type in responses) {\n if (!dataTypes[0] || s.converters[type + \" \" + dataTypes[0]]) {\n finalDataType = type;\n break;\n }\n if (!firstDataType) {\n firstDataType = type;\n }\n }\n\n // Or just use first one\n finalDataType = finalDataType || firstDataType;\n }\n\n // If we found a dataType\n // We add the dataType to the list if needed\n // and return the corresponding response\n if (finalDataType) {\n if (finalDataType !== dataTypes[0]) {\n dataTypes.unshift(finalDataType);\n }\n return responses[finalDataType];\n }\n }\n\n /* Chain conversions given the request and the original response\n * Also sets the responseXXX fields on the jqXHR instance\n */\n function ajaxConvert(s, response, jqXHR, isSuccess) {\n var conv2,\n current,\n conv,\n tmp,\n prev,\n converters = {},\n // Work with a copy of dataTypes in case we need to modify it for conversion\n dataTypes = s.dataTypes.slice();\n\n // Create converters map with lowercased keys\n if (dataTypes[1]) {\n for (conv in s.converters) {\n converters[conv.toLowerCase()] = s.converters[conv];\n }\n }\n current = dataTypes.shift();\n\n // Convert to each sequential dataType\n while (current) {\n if (s.responseFields[current]) {\n jqXHR[s.responseFields[current]] = response;\n }\n\n // Apply the dataFilter if provided\n if (!prev && isSuccess && s.dataFilter) {\n response = s.dataFilter(response, s.dataType);\n }\n prev = current;\n current = dataTypes.shift();\n if (current) {\n // There's only work to do if current dataType is non-auto\n if (current === \"*\") {\n current = prev;\n\n // Convert response if prev dataType is non-auto and differs from current\n } else if (prev !== \"*\" && prev !== current) {\n // Seek a direct converter\n conv = converters[prev + \" \" + current] || converters[\"* \" + current];\n\n // If none found, seek a pair\n if (!conv) {\n for (conv2 in converters) {\n // If conv2 outputs current\n tmp = conv2.split(\" \");\n if (tmp[1] === current) {\n // If prev can be converted to accepted input\n conv = converters[prev + \" \" + tmp[0]] || converters[\"* \" + tmp[0]];\n if (conv) {\n // Condense equivalence converters\n if (conv === true) {\n conv = converters[conv2];\n\n // Otherwise, insert the intermediate dataType\n } else if (converters[conv2] !== true) {\n current = tmp[0];\n dataTypes.unshift(tmp[1]);\n }\n break;\n }\n }\n }\n }\n\n // Apply converter (if not an equivalence)\n if (conv !== true) {\n // Unless errors are allowed to bubble, catch and return them\n if (conv && s.throws) {\n response = conv(response);\n } else {\n try {\n response = conv(response);\n } catch (e) {\n return {\n state: \"parsererror\",\n error: conv ? e : \"No conversion from \" + prev + \" to \" + current\n };\n }\n }\n }\n }\n }\n }\n return {\n state: \"success\",\n data: response\n };\n }\n jQuery.extend({\n // Counter for holding the number of active queries\n active: 0,\n // Last-Modified header cache for next request\n lastModified: {},\n etag: {},\n ajaxSettings: {\n url: location.href,\n type: \"GET\",\n isLocal: rlocalProtocol.test(location.protocol),\n global: true,\n processData: true,\n async: true,\n contentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\n /*\n timeout: 0,\n data: null,\n dataType: null,\n username: null,\n password: null,\n cache: null,\n throws: false,\n traditional: false,\n headers: {},\n */\n\n accepts: {\n \"*\": allTypes,\n text: \"text/plain\",\n html: \"text/html\",\n xml: \"application/xml, text/xml\",\n json: \"application/json, text/javascript\"\n },\n contents: {\n xml: /\\bxml\\b/,\n html: /\\bhtml/,\n json: /\\bjson\\b/\n },\n responseFields: {\n xml: \"responseXML\",\n text: \"responseText\",\n json: \"responseJSON\"\n },\n // Data converters\n // Keys separate source (or catchall \"*\") and destination types with a single space\n converters: {\n // Convert anything to text\n \"* text\": String,\n // Text to html (true = no transformation)\n \"text html\": true,\n // Evaluate text as a json expression\n \"text json\": JSON.parse,\n // Parse text as xml\n \"text xml\": jQuery.parseXML\n },\n // For options that shouldn't be deep extended:\n // you can add your own custom options here if\n // and when you create one that shouldn't be\n // deep extended (see ajaxExtend)\n flatOptions: {\n url: true,\n context: true\n }\n },\n // Creates a full fledged settings object into target\n // with both ajaxSettings and settings fields.\n // If target is omitted, writes into ajaxSettings.\n ajaxSetup: function (target, settings) {\n return settings ?\n // Building a settings object\n ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :\n // Extending ajaxSettings\n ajaxExtend(jQuery.ajaxSettings, target);\n },\n ajaxPrefilter: addToPrefiltersOrTransports(prefilters),\n ajaxTransport: addToPrefiltersOrTransports(transports),\n // Main method\n ajax: function (url, options) {\n // If url is an object, simulate pre-1.5 signature\n if (typeof url === \"object\") {\n options = url;\n url = undefined;\n }\n\n // Force options to be an object\n options = options || {};\n var transport,\n // URL without anti-cache param\n cacheURL,\n // Response headers\n responseHeadersString,\n responseHeaders,\n // timeout handle\n timeoutTimer,\n // Url cleanup var\n urlAnchor,\n // Request state (becomes false upon send and true upon completion)\n completed,\n // To know if global events are to be dispatched\n fireGlobals,\n // Loop variable\n i,\n // uncached part of the url\n uncached,\n // Create the final options object\n s = jQuery.ajaxSetup({}, options),\n // Callbacks context\n callbackContext = s.context || s,\n // Context for global events is callbackContext if it is a DOM node or jQuery collection\n globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,\n // Deferreds\n deferred = jQuery.Deferred(),\n completeDeferred = jQuery.Callbacks(\"once memory\"),\n // Status-dependent callbacks\n statusCode = s.statusCode || {},\n // Headers (they are sent all at once)\n requestHeaders = {},\n requestHeadersNames = {},\n // Default abort message\n strAbort = \"canceled\",\n // Fake xhr\n jqXHR = {\n readyState: 0,\n // Builds headers hashtable if needed\n getResponseHeader: function (key) {\n var match;\n if (completed) {\n if (!responseHeaders) {\n responseHeaders = {};\n while (match = rheaders.exec(responseHeadersString)) {\n responseHeaders[match[1].toLowerCase() + \" \"] = (responseHeaders[match[1].toLowerCase() + \" \"] || []).concat(match[2]);\n }\n }\n match = responseHeaders[key.toLowerCase() + \" \"];\n }\n return match == null ? null : match.join(\", \");\n },\n // Raw string\n getAllResponseHeaders: function () {\n return completed ? responseHeadersString : null;\n },\n // Caches the header\n setRequestHeader: function (name, value) {\n if (completed == null) {\n name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;\n requestHeaders[name] = value;\n }\n return this;\n },\n // Overrides response content-type header\n overrideMimeType: function (type) {\n if (completed == null) {\n s.mimeType = type;\n }\n return this;\n },\n // Status-dependent callbacks\n statusCode: function (map) {\n var code;\n if (map) {\n if (completed) {\n // Execute the appropriate callbacks\n jqXHR.always(map[jqXHR.status]);\n } else {\n // Lazy-add the new callbacks in a way that preserves old ones\n for (code in map) {\n statusCode[code] = [statusCode[code], map[code]];\n }\n }\n }\n return this;\n },\n // Cancel the request\n abort: function (statusText) {\n var finalText = statusText || strAbort;\n if (transport) {\n transport.abort(finalText);\n }\n done(0, finalText);\n return this;\n }\n };\n\n // Attach deferreds\n deferred.promise(jqXHR);\n\n // Add protocol if not provided (prefilters might expect it)\n // Handle falsy url in the settings object (trac-10093: consistency with old signature)\n // We also use the url parameter if available\n s.url = ((url || s.url || location.href) + \"\").replace(rprotocol, location.protocol + \"//\");\n\n // Alias method option to type as per ticket trac-12004\n s.type = options.method || options.type || s.method || s.type;\n\n // Extract dataTypes list\n s.dataTypes = (s.dataType || \"*\").toLowerCase().match(rnothtmlwhite) || [\"\"];\n\n // A cross-domain request is in order when the origin doesn't match the current origin.\n if (s.crossDomain == null) {\n urlAnchor = document.createElement(\"a\");\n\n // Support: IE <=8 - 11, Edge 12 - 15\n // IE throws exception on accessing the href property if url is malformed,\n // e.g. http://example.com:80x/\n try {\n urlAnchor.href = s.url;\n\n // Support: IE <=8 - 11 only\n // Anchor's host property isn't correctly set when s.url is relative\n urlAnchor.href = urlAnchor.href;\n s.crossDomain = originAnchor.protocol + \"//\" + originAnchor.host !== urlAnchor.protocol + \"//\" + urlAnchor.host;\n } catch (e) {\n // If there is an error parsing the URL, assume it is crossDomain,\n // it can be rejected by the transport if it is invalid\n s.crossDomain = true;\n }\n }\n\n // Convert data if not already a string\n if (s.data && s.processData && typeof s.data !== \"string\") {\n s.data = jQuery.param(s.data, s.traditional);\n }\n\n // Apply prefilters\n inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);\n\n // If request was aborted inside a prefilter, stop there\n if (completed) {\n return jqXHR;\n }\n\n // We can fire global events as of now if asked to\n // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118)\n fireGlobals = jQuery.event && s.global;\n\n // Watch for a new set of requests\n if (fireGlobals && jQuery.active++ === 0) {\n jQuery.event.trigger(\"ajaxStart\");\n }\n\n // Uppercase the type\n s.type = s.type.toUpperCase();\n\n // Determine if request has content\n s.hasContent = !rnoContent.test(s.type);\n\n // Save the URL in case we're toying with the If-Modified-Since\n // and/or If-None-Match header later on\n // Remove hash to simplify url manipulation\n cacheURL = s.url.replace(rhash, \"\");\n\n // More options handling for requests with no content\n if (!s.hasContent) {\n // Remember the hash so we can put it back\n uncached = s.url.slice(cacheURL.length);\n\n // If data is available and should be processed, append data to url\n if (s.data && (s.processData || typeof s.data === \"string\")) {\n cacheURL += (rquery.test(cacheURL) ? \"&\" : \"?\") + s.data;\n\n // trac-9682: remove data so that it's not used in an eventual retry\n delete s.data;\n }\n\n // Add or update anti-cache param if needed\n if (s.cache === false) {\n cacheURL = cacheURL.replace(rantiCache, \"$1\");\n uncached = (rquery.test(cacheURL) ? \"&\" : \"?\") + \"_=\" + nonce.guid++ + uncached;\n }\n\n // Put hash and anti-cache on the URL that will be requested (gh-1732)\n s.url = cacheURL + uncached;\n\n // Change '%20' to '+' if this is encoded form body content (gh-2658)\n } else if (s.data && s.processData && (s.contentType || \"\").indexOf(\"application/x-www-form-urlencoded\") === 0) {\n s.data = s.data.replace(r20, \"+\");\n }\n\n // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n if (s.ifModified) {\n if (jQuery.lastModified[cacheURL]) {\n jqXHR.setRequestHeader(\"If-Modified-Since\", jQuery.lastModified[cacheURL]);\n }\n if (jQuery.etag[cacheURL]) {\n jqXHR.setRequestHeader(\"If-None-Match\", jQuery.etag[cacheURL]);\n }\n }\n\n // Set the correct header, if data is being sent\n if (s.data && s.hasContent && s.contentType !== false || options.contentType) {\n jqXHR.setRequestHeader(\"Content-Type\", s.contentType);\n }\n\n // Set the Accepts header for the server, depending on the dataType\n jqXHR.setRequestHeader(\"Accept\", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\") : s.accepts[\"*\"]);\n\n // Check for headers option\n for (i in s.headers) {\n jqXHR.setRequestHeader(i, s.headers[i]);\n }\n\n // Allow custom headers/mimetypes and early abort\n if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {\n // Abort if not done already and return\n return jqXHR.abort();\n }\n\n // Aborting is no longer a cancellation\n strAbort = \"abort\";\n\n // Install callbacks on deferreds\n completeDeferred.add(s.complete);\n jqXHR.done(s.success);\n jqXHR.fail(s.error);\n\n // Get transport\n transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);\n\n // If no transport, we auto-abort\n if (!transport) {\n done(-1, \"No Transport\");\n } else {\n jqXHR.readyState = 1;\n\n // Send global event\n if (fireGlobals) {\n globalEventContext.trigger(\"ajaxSend\", [jqXHR, s]);\n }\n\n // If request was aborted inside ajaxSend, stop there\n if (completed) {\n return jqXHR;\n }\n\n // Timeout\n if (s.async && s.timeout > 0) {\n timeoutTimer = window.setTimeout(function () {\n jqXHR.abort(\"timeout\");\n }, s.timeout);\n }\n try {\n completed = false;\n transport.send(requestHeaders, done);\n } catch (e) {\n // Rethrow post-completion exceptions\n if (completed) {\n throw e;\n }\n\n // Propagate others as results\n done(-1, e);\n }\n }\n\n // Callback for when everything is done\n function done(status, nativeStatusText, responses, headers) {\n var isSuccess,\n success,\n error,\n response,\n modified,\n statusText = nativeStatusText;\n\n // Ignore repeat invocations\n if (completed) {\n return;\n }\n completed = true;\n\n // Clear timeout if it exists\n if (timeoutTimer) {\n window.clearTimeout(timeoutTimer);\n }\n\n // Dereference transport for early garbage collection\n // (no matter how long the jqXHR object will be used)\n transport = undefined;\n\n // Cache response headers\n responseHeadersString = headers || \"\";\n\n // Set readyState\n jqXHR.readyState = status > 0 ? 4 : 0;\n\n // Determine if successful\n isSuccess = status >= 200 && status < 300 || status === 304;\n\n // Get response data\n if (responses) {\n response = ajaxHandleResponses(s, jqXHR, responses);\n }\n\n // Use a noop converter for missing script but not if jsonp\n if (!isSuccess && jQuery.inArray(\"script\", s.dataTypes) > -1 && jQuery.inArray(\"json\", s.dataTypes) < 0) {\n s.converters[\"text script\"] = function () {};\n }\n\n // Convert no matter what (that way responseXXX fields are always set)\n response = ajaxConvert(s, response, jqXHR, isSuccess);\n\n // If successful, handle type chaining\n if (isSuccess) {\n // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n if (s.ifModified) {\n modified = jqXHR.getResponseHeader(\"Last-Modified\");\n if (modified) {\n jQuery.lastModified[cacheURL] = modified;\n }\n modified = jqXHR.getResponseHeader(\"etag\");\n if (modified) {\n jQuery.etag[cacheURL] = modified;\n }\n }\n\n // if no content\n if (status === 204 || s.type === \"HEAD\") {\n statusText = \"nocontent\";\n\n // if not modified\n } else if (status === 304) {\n statusText = \"notmodified\";\n\n // If we have data, let's convert it\n } else {\n statusText = response.state;\n success = response.data;\n error = response.error;\n isSuccess = !error;\n }\n } else {\n // Extract error from statusText and normalize for non-aborts\n error = statusText;\n if (status || !statusText) {\n statusText = \"error\";\n if (status < 0) {\n status = 0;\n }\n }\n }\n\n // Set data for the fake xhr object\n jqXHR.status = status;\n jqXHR.statusText = (nativeStatusText || statusText) + \"\";\n\n // Success/Error\n if (isSuccess) {\n deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);\n } else {\n deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);\n }\n\n // Status-dependent callbacks\n jqXHR.statusCode(statusCode);\n statusCode = undefined;\n if (fireGlobals) {\n globalEventContext.trigger(isSuccess ? \"ajaxSuccess\" : \"ajaxError\", [jqXHR, s, isSuccess ? success : error]);\n }\n\n // Complete\n completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);\n if (fireGlobals) {\n globalEventContext.trigger(\"ajaxComplete\", [jqXHR, s]);\n\n // Handle the global AJAX counter\n if (! --jQuery.active) {\n jQuery.event.trigger(\"ajaxStop\");\n }\n }\n }\n return jqXHR;\n },\n getJSON: function (url, data, callback) {\n return jQuery.get(url, data, callback, \"json\");\n },\n getScript: function (url, callback) {\n return jQuery.get(url, undefined, callback, \"script\");\n }\n });\n jQuery.each([\"get\", \"post\"], function (_i, method) {\n jQuery[method] = function (url, data, callback, type) {\n // Shift arguments if data argument was omitted\n if (isFunction(data)) {\n type = type || callback;\n callback = data;\n data = undefined;\n }\n\n // The url can be an options object (which then must have .url)\n return jQuery.ajax(jQuery.extend({\n url: url,\n type: method,\n dataType: type,\n data: data,\n success: callback\n }, jQuery.isPlainObject(url) && url));\n };\n });\n jQuery.ajaxPrefilter(function (s) {\n var i;\n for (i in s.headers) {\n if (i.toLowerCase() === \"content-type\") {\n s.contentType = s.headers[i] || \"\";\n }\n }\n });\n jQuery._evalUrl = function (url, options, doc) {\n return jQuery.ajax({\n url: url,\n // Make this explicit, since user can override this through ajaxSetup (trac-11264)\n type: \"GET\",\n dataType: \"script\",\n cache: true,\n async: false,\n global: false,\n // Only evaluate the response if it is successful (gh-4126)\n // dataFilter is not invoked for failure responses, so using it instead\n // of the default converter is kludgy but it works.\n converters: {\n \"text script\": function () {}\n },\n dataFilter: function (response) {\n jQuery.globalEval(response, options, doc);\n }\n });\n };\n jQuery.fn.extend({\n wrapAll: function (html) {\n var wrap;\n if (this[0]) {\n if (isFunction(html)) {\n html = html.call(this[0]);\n }\n\n // The elements to wrap the target around\n wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);\n if (this[0].parentNode) {\n wrap.insertBefore(this[0]);\n }\n wrap.map(function () {\n var elem = this;\n while (elem.firstElementChild) {\n elem = elem.firstElementChild;\n }\n return elem;\n }).append(this);\n }\n return this;\n },\n wrapInner: function (html) {\n if (isFunction(html)) {\n return this.each(function (i) {\n jQuery(this).wrapInner(html.call(this, i));\n });\n }\n return this.each(function () {\n var self = jQuery(this),\n contents = self.contents();\n if (contents.length) {\n contents.wrapAll(html);\n } else {\n self.append(html);\n }\n });\n },\n wrap: function (html) {\n var htmlIsFunction = isFunction(html);\n return this.each(function (i) {\n jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);\n });\n },\n unwrap: function (selector) {\n this.parent(selector).not(\"body\").each(function () {\n jQuery(this).replaceWith(this.childNodes);\n });\n return this;\n }\n });\n jQuery.expr.pseudos.hidden = function (elem) {\n return !jQuery.expr.pseudos.visible(elem);\n };\n jQuery.expr.pseudos.visible = function (elem) {\n return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);\n };\n jQuery.ajaxSettings.xhr = function () {\n try {\n return new window.XMLHttpRequest();\n } catch (e) {}\n };\n var xhrSuccessStatus = {\n // File protocol always yields status code 0, assume 200\n 0: 200,\n // Support: IE <=9 only\n // trac-1450: sometimes IE returns 1223 when it should be 204\n 1223: 204\n },\n xhrSupported = jQuery.ajaxSettings.xhr();\n support.cors = !!xhrSupported && \"withCredentials\" in xhrSupported;\n support.ajax = xhrSupported = !!xhrSupported;\n jQuery.ajaxTransport(function (options) {\n var callback, errorCallback;\n\n // Cross domain only allowed if supported through XMLHttpRequest\n if (support.cors || xhrSupported && !options.crossDomain) {\n return {\n send: function (headers, complete) {\n var i,\n xhr = options.xhr();\n xhr.open(options.type, options.url, options.async, options.username, options.password);\n\n // Apply custom fields if provided\n if (options.xhrFields) {\n for (i in options.xhrFields) {\n xhr[i] = options.xhrFields[i];\n }\n }\n\n // Override mime type if needed\n if (options.mimeType && xhr.overrideMimeType) {\n xhr.overrideMimeType(options.mimeType);\n }\n\n // X-Requested-With header\n // For cross-domain requests, seeing as conditions for a preflight are\n // akin to a jigsaw puzzle, we simply never set it to be sure.\n // (it can always be set on a per-request basis or even using ajaxSetup)\n // For same-domain requests, won't change header if already provided.\n if (!options.crossDomain && !headers[\"X-Requested-With\"]) {\n headers[\"X-Requested-With\"] = \"XMLHttpRequest\";\n }\n\n // Set headers\n for (i in headers) {\n xhr.setRequestHeader(i, headers[i]);\n }\n\n // Callback\n callback = function (type) {\n return function () {\n if (callback) {\n callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;\n if (type === \"abort\") {\n xhr.abort();\n } else if (type === \"error\") {\n // Support: IE <=9 only\n // On a manual native abort, IE9 throws\n // errors on any property access that is not readyState\n if (typeof xhr.status !== \"number\") {\n complete(0, \"error\");\n } else {\n complete(\n // File: protocol always yields status 0; see trac-8605, trac-14207\n xhr.status, xhr.statusText);\n }\n } else {\n complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,\n // Support: IE <=9 only\n // IE9 has no XHR2 but throws on binary (trac-11426)\n // For XHR2 non-text, let the caller handle it (gh-2498)\n (xhr.responseType || \"text\") !== \"text\" || typeof xhr.responseText !== \"string\" ? {\n binary: xhr.response\n } : {\n text: xhr.responseText\n }, xhr.getAllResponseHeaders());\n }\n }\n };\n };\n\n // Listen to events\n xhr.onload = callback();\n errorCallback = xhr.onerror = xhr.ontimeout = callback(\"error\");\n\n // Support: IE 9 only\n // Use onreadystatechange to replace onabort\n // to handle uncaught aborts\n if (xhr.onabort !== undefined) {\n xhr.onabort = errorCallback;\n } else {\n xhr.onreadystatechange = function () {\n // Check readyState before timeout as it changes\n if (xhr.readyState === 4) {\n // Allow onerror to be called first,\n // but that will not handle a native abort\n // Also, save errorCallback to a variable\n // as xhr.onerror cannot be accessed\n window.setTimeout(function () {\n if (callback) {\n errorCallback();\n }\n });\n }\n };\n }\n\n // Create the abort callback\n callback = callback(\"abort\");\n try {\n // Do send the request (this may raise an exception)\n xhr.send(options.hasContent && options.data || null);\n } catch (e) {\n // trac-14683: Only rethrow if this hasn't been notified as an error yet\n if (callback) {\n throw e;\n }\n }\n },\n abort: function () {\n if (callback) {\n callback();\n }\n }\n };\n }\n });\n\n // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)\n jQuery.ajaxPrefilter(function (s) {\n if (s.crossDomain) {\n s.contents.script = false;\n }\n });\n\n // Install script dataType\n jQuery.ajaxSetup({\n accepts: {\n script: \"text/javascript, application/javascript, \" + \"application/ecmascript, application/x-ecmascript\"\n },\n contents: {\n script: /\\b(?:java|ecma)script\\b/\n },\n converters: {\n \"text script\": function (text) {\n jQuery.globalEval(text);\n return text;\n }\n }\n });\n\n // Handle cache's special case and crossDomain\n jQuery.ajaxPrefilter(\"script\", function (s) {\n if (s.cache === undefined) {\n s.cache = false;\n }\n if (s.crossDomain) {\n s.type = \"GET\";\n }\n });\n\n // Bind script tag hack transport\n jQuery.ajaxTransport(\"script\", function (s) {\n // This transport only deals with cross domain or forced-by-attrs requests\n if (s.crossDomain || s.scriptAttrs) {\n var script, callback;\n return {\n send: function (_, complete) {\n script = jQuery(\"