{"version":3,"file":"js/application-ceb15bf623d932bab84e.js","sources":["webpack:///webpack/bootstrap","webpack:///./app/webpacker/channels sync _channel\\.js$","webpack:///./app/webpacker/channels/index.js","webpack:///./app/webpacker/controllers sync _controller\\.js$","webpack:///./app/webpacker/controllers/application_controller.js","webpack:///./app/webpacker/controllers/cart_controller.js","webpack:///./app/webpacker/controllers/contact_controller.js","webpack:///./app/webpacker/controllers/customers_controller.js","webpack:///./app/webpacker/controllers/index.js","webpack:///./app/webpacker/controllers/items_controller.js","webpack:///./app/webpacker/images sync ^\\.\\/.*$","webpack:///./app/webpacker/images/apple-touch-icon-114x114.png","webpack:///./app/webpacker/images/apple-touch-icon-120x120.png","webpack:///./app/webpacker/images/apple-touch-icon-144x144.png","webpack:///./app/webpacker/images/apple-touch-icon-152x152.png","webpack:///./app/webpacker/images/apple-touch-icon-180x180.png","webpack:///./app/webpacker/images/apple-touch-icon-57x57.png","webpack:///./app/webpacker/images/apple-touch-icon-72x72.png","webpack:///./app/webpacker/images/apple-touch-icon-76x76.png","webpack:///./app/webpacker/images/apple-touch-icon.png","webpack:///./app/webpacker/images/favicon.ico","webpack:///./app/webpacker/images/favicon.png","webpack:///./app/webpacker/images/header-logo.png","webpack:///./app/webpacker/images/header-logo.webp","webpack:///./app/webpacker/images/item-placeholder.jpg","webpack:///./app/webpacker/images/navbar-logo.png","webpack:///./app/webpacker/images/navbar-logo.webp","webpack:///./app/webpacker/images/prando-shop.jpg","webpack:///./app/webpacker/images/social_preview.jpg","webpack:///./app/webpacker/images/social_preview_default.jpg","webpack:///./app/webpacker/images/start_footer.webp","webpack:///./app/webpacker/images/start_footer_default.webp","webpack:///./app/webpacker/images/start_header.webp","webpack:///./app/webpacker/images/start_header_default.webp","webpack:///./app/webpacker/images/static-1.jpg","webpack:///./app/webpacker/locales sync ^\\.\\/.*\\.json$","webpack:///./app/webpacker/packs/application.js","webpack:///./app/webpacker/src/javascripts/i18n.js.erb","webpack:///./app/webpacker/src/javascripts/main.js.erb","webpack:///./app/webpacker/src/javascripts/modal.js","webpack:///./node_modules/@rails/activestorage/app/assets/javascripts/activestorage.esm.js","webpack:///./node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js","webpack:///./node_modules/@stimulus/core/dist/action.js","webpack:///./node_modules/@stimulus/core/dist/action_descriptor.js","webpack:///./node_modules/@stimulus/core/dist/application.js","webpack:///./node_modules/@stimulus/core/dist/binding.js","webpack:///./node_modules/@stimulus/core/dist/binding_observer.js","webpack:///./node_modules/@stimulus/core/dist/blessing.js","webpack:///./node_modules/@stimulus/core/dist/class_map.js","webpack:///./node_modules/@stimulus/core/dist/class_properties.js","webpack:///./node_modules/@stimulus/core/dist/context.js","webpack:///./node_modules/@stimulus/core/dist/controller.js","webpack:///./node_modules/@stimulus/core/dist/data_map.js","webpack:///./node_modules/@stimulus/core/dist/definition.js","webpack:///./node_modules/@stimulus/core/dist/dispatcher.js","webpack:///./node_modules/@stimulus/core/dist/event_listener.js","webpack:///./node_modules/@stimulus/core/dist/guide.js","webpack:///./node_modules/@stimulus/core/dist/index.js","webpack:///./node_modules/@stimulus/core/dist/inheritable_statics.js","webpack:///./node_modules/@stimulus/core/dist/module.js","webpack:///./node_modules/@stimulus/core/dist/router.js","webpack:///./node_modules/@stimulus/core/dist/schema.js","webpack:///./node_modules/@stimulus/core/dist/scope.js","webpack:///./node_modules/@stimulus/core/dist/scope_observer.js","webpack:///./node_modules/@stimulus/core/dist/selectors.js","webpack:///./node_modules/@stimulus/core/dist/string_helpers.js","webpack:///./node_modules/@stimulus/core/dist/target_properties.js","webpack:///./node_modules/@stimulus/core/dist/target_set.js","webpack:///./node_modules/@stimulus/core/dist/value_observer.js","webpack:///./node_modules/@stimulus/core/dist/value_properties.js","webpack:///./node_modules/@stimulus/multimap/dist/index.js","webpack:///./node_modules/@stimulus/multimap/dist/indexed_multimap.js","webpack:///./node_modules/@stimulus/multimap/dist/multimap.js","webpack:///./node_modules/@stimulus/multimap/dist/set_operations.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/attribute_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/element_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/index.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/string_map_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/token_list_observer.js","webpack:///./node_modules/@stimulus/mutation-observers/dist/value_list_observer.js","webpack:///./node_modules/@stimulus/webpack-helpers/dist/index.js","webpack:///./node_modules/bulma-carousel/dist/js/bulma-carousel.min.js","webpack:///./node_modules/diacritics/index.js","webpack:///./node_modules/i18n-iso-countries/index.js","webpack:///./node_modules/i18n-js/app/assets/javascripts/i18n.js","webpack:///./node_modules/pinch-zoom-js/src/pinch-zoom.js","webpack:///./node_modules/stimulus/index.js","webpack:///./node_modules/stimulus/webpack-helpers.js","webpack:///./node_modules/tinygesture/dist/TinyGesture.js","webpack:///./node_modules/turbolinks/dist/turbolinks.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-test/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./app/webpacker/packs/application.js\");\n","function webpackEmptyContext(req) {\n\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\te.code = 'MODULE_NOT_FOUND';\n\tthrow e;\n}\nwebpackEmptyContext.keys = function() { return []; };\nwebpackEmptyContext.resolve = webpackEmptyContext;\nmodule.exports = webpackEmptyContext;\nwebpackEmptyContext.id = \"./app/webpacker/channels sync recursive _channel\\\\.js$\";","// Load all the channels within this directory and all subdirectories.\n// Channel files must be named *_channel.js.\n\nconst channels = require.context('.', true, /_channel\\.js$/)\nchannels.keys().forEach(channels)\n","var map = {\n\t\"./application_controller.js\": \"./app/webpacker/controllers/application_controller.js\",\n\t\"./cart_controller.js\": \"./app/webpacker/controllers/cart_controller.js\",\n\t\"./contact_controller.js\": \"./app/webpacker/controllers/contact_controller.js\",\n\t\"./customers_controller.js\": \"./app/webpacker/controllers/customers_controller.js\",\n\t\"./items_controller.js\": \"./app/webpacker/controllers/items_controller.js\"\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/webpacker/controllers sync recursive _controller\\\\.js$\";","import { Controller } from \"stimulus\"\n\nexport default class extends Controller {\n\n static targets = [ \"header\", \"headerImages\", \"footer\" ]\n\n initialize() {\n this.country = this.element.getAttribute(\"data-country\");\n if(!this.country) {\n this.country = document.querySelector(\"meta[name='country']\").getAttribute('content');\n }\n }\n\n connect() {\n let applController = this;\n var observer = new IntersectionObserver(function(entries) {\n \t// isIntersecting is true when element and viewport are overlapping\n \t// isIntersecting is false when element and viewport don't overlap\n \tif(entries[0].isIntersecting === true) {\n applController.offsetHero = window.scrollY;\n }\n }, { threshold: [0] });\n\n var ctrl = this;\n if(this.hasFooterTarget) {\n observer.observe(this.footerTarget);\n }\n\n window.onVisible = function(element, callback) {\n new IntersectionObserver((entries, observer) => {\n entries.forEach(entry => {\n if(entry.intersectionRatio > 0) {\n callback(element);\n observer.disconnect();\n }\n });\n }).observe(element);\n }\n\n document.querySelectorAll(\".opacity-0\").forEach((fig, i) => {\n onVisible(fig, () => {\n fig.classList.add('fade-in');\n fig.classList.remove('opacity-0');\n });\n });\n\n this.carousel = bulmaCarousel.attach('#carousel-header', {\n slidesToScroll: 1,\n slidesToShow: 1,\n loop: true,\n navigation: false,\n navigationKeys: false,\n autoplay: true,\n autoplaySpeed: 8000,\n effect: 'fade',\n duration: 2000\n\t\t});\n }\n\n onScroll() {\n this.y = window.scrollY/2;\n if(this.hasHeaderTarget) {\n this.headerTarget.style.backgroundPosition = `center ${0-this.y}px`\n }\n if(this.hasFooterTarget) {\n if(this.offsetHero && (this.offsetHero-this.y) < this.footerTarget.clientHeight) {\n this.footerTarget.style.backgroundPosition = `center ${this.offsetHero-this.y}px`\n }\n }\n }\n\n search() {\n let div = document.createElement(\"div\");\n div.classList.add('modal', 'p-3');\n div.setAttribute(\"id\", \"search\");\n\n div.innerHTML = `\n
application#hideSearch keydown.esc->application#hideSearch\">
\n
\n
\n
\n \n
\n

\n \n

\n
\n \n
\n
\n
\n
\n
\n `\n document.querySelector('body').appendChild(div)\n div.classList.add('is-active')\n div.querySelector(\"input#search\").focus()\n }\n\n hideSearch() {\n let modal = document.querySelector(\"div.modal#search\");\n modal.classList.remove('is-active');\n modal.remove()\n }\n\n}\n","import { Controller } from \"stimulus\"\nimport * as Modal from \"../src/javascripts/modal.js\"\n\nexport default class extends Controller {\n\n static targets = [ \"overlay\", \"cartMenuWrapper\", \"vat\", \"companyData\", \"privateData\", \"invoice_direction\", \"invoiceDirectionToggle\", \"invoice_direction_header\", \"shipping_address\", \"checkout_payment\", \"navbarCartItemsCounter\", \"navbarMobileCartItemsCounter\", \"cartMenuItems\", \"cartMenuCheckoutButton\", \"cartMenuSummary\", \"cartMenuTotal\", \"checkoutCartItems\", \"checkoutSummaryCartItems\", \"checkoutShipping\", \"checkoutPayment\", \"checkoutConfirmation\", \"checkoutCartNextButton\", \"checkoutCartFinishButton\", \"checkoutCartItemsCount\", \"checkoutShippingCost\", \"checkoutTotal\", \"checkoutVat\", \"checkoutItems\", \"vouchercode\", \"checkoutCharges\", \"checkoutChargesSummary\", \"signinModal\", \"itemPrice\"]\n\n static values = {\n currencyFormat: String,\n currencyAbbr: String\n }\n\n initialize() {\n if(this.element.getAttribute(\"data-checkout-step\")) {\n this.currentStep = parseInt(this.element.getAttribute(\"data-checkout-step\"));\n } else {\n this.currentStep = 1;\n }\n\n this.locale = this.element.getAttribute(\"data-locale\");\n this.country = this.element.getAttribute(\"data-country\");\n if(!this.locale) {\n this.locale = document.querySelector(\"meta[name='locale']\").getAttribute('content');\n }\n if(!this.country) {\n this.country = document.querySelector(\"meta[name='country']\").getAttribute('content');\n }\n\n this.currency = document.querySelector(\"meta[name='currency']\").getAttribute('content');\n }\n\n connect() {\n this.steps = 4;\n if(location.href.endsWith('checkout')) {\n if (typeof gtag === \"function\") {\n let total = document.querySelector(\"input#checkout_total_with_vat\").value;\n let currency = document.querySelector(\"input#checkout_currency\").value;\n gtag('event', 'begin_checkout', {currency: currency, value: total});\n }\n }\n }\n\n currenciesFormat(value, currency) {\n if(this.currencyFormatValue == '%u %n') {\n return `${this.currencyAbbrValue} ${value}`\n } else {\n return `${value} ${this.currencyAbbrValue}`\n }\n }\n\n removeTags(str) {\n if((str===null) || (str===''))\n return '';\n else\n str = str.toString();\n return str.replace( /(<([^>]+)>)/ig, '');\n }\n\n mainImage() {\n let parent = event.target.parentNode;\n if(parent.dataset.mainImg) {\n event.target.src = parent.dataset.mainImg;\n parent.removeAttribute('data-main-img');\n }\n }\n\n altImage() {\n let parent = event.target.parentNode;\n if(parent.dataset.altImg) {\n parent.setAttribute('data-main-img', event.target.src);\n event.target.src = parent.dataset.altImg;\n }\n }\n\n toggleCart() {\n this.cartMenuWrapperTarget.classList.toggle('active');\n this.overlayTarget.classList.toggle('active');\n\n if(this.cartMenuWrapperTarget.classList.contains(\"active\")) {\n if (typeof gtag === \"function\") {\n gtag('event', 'view_cart', {});\n }\n }\n }\n\n toggleMobileMenu() {\n document.querySelector(\"#navbarMain\").classList.toggle('is-active');\n }\n\n addToCart() {\n let that = this;\n let cartController = this;\n let uuid = event.target.dataset.uuid;\n let quantity = event.target.dataset.quantity;\n let product_number = event.target.dataset.product_number;\n let item = I18n.t('item.item');\n let inp;\n if(document.querySelector(\"h1.title\")) {\n item = document.querySelector(\"h1.title\").textContent;\n }\n if(!quantity) {\n let div = event.target.parentNode.parentNode.parentNode;\n inp = div.querySelector(\"input#item_quantity\");\n if(inp) {\n quantity = inp.value;\n }\n }\n\n if(!quantity || !uuid) {\n event.stopPropagation();\n return\n }\n\n let json = {\n uuid: uuid,\n quantity: quantity\n }\n\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/cart/add`,\n type: \"post\",\n data: JSON.stringify(json),\n contentType: false,\n processData: false,\n success: function(data) {\n that.updateCart(data);\n let box = document.createElement(\"div\")\n box.setAttribute(\"class\", \"box has-background-primary has-text-white\")\n box.textContent = I18n.t('cart.messages.added_to_cart', {item: item})\n box.style.position = \"absolute\";\n box.style.top = \"40vh\";\n box.style.left = \"50%\";\n box.style.transform = \"translate(-50%, -50%)\"\n box.style.width = \"600px\";\n box.style.maxWidth = \"90vw\";\n document.querySelector(\"div.container\").appendChild(box);\n main.fadeOut(box, 2000);\n\n inp.value = inp.getAttribute(\"min\");\n\n if (typeof gtag === \"function\") {\n let currency = document.querySelector('meta[name=\"currency\"]').content;\n let price = 0;\n let p = that.itemPriceTarget;\n if(p) {\n price = p.dataset.price\n }\n\n gtag('event', 'add_to_cart', {currency: currency, value: price*quantity, items: [{'product' : product_number, 'quantity' : quantity}]});\n }\n },\n error: function(data) {\n }\n });\n event.stopPropagation();\n }\n\n removeFromCart() {\n let cartController = this;\n let uuid = event.target.dataset.uuid;\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/cart/${uuid}/remove`,\n type: \"delete\",\n data: \"\",\n success: function(data) {\n cartController.navbarCartItemsCounterTarget.textContent = data.count;\n cartController.navbarMobileCartItemsCounterTarget.textContent = data.count;\n if(data.count == 0) {\n cartController.navbarCartItemsCounterTarget.classList.add('is-hidden');\n cartController.navbarMobileCartItemsCounterTarget.classList.add('is-hidden');\n }\n\n let item = cartController.cartMenuItemsTarget.querySelector(`[data-uuid=\"${uuid}\"]`);\n if(item) {\n item.remove();\n }\n\n if(cartController.hasCheckoutCartItemsTarget) {\n item = cartController.checkoutCartItemsTarget.querySelector(`[data-uuid=\"${uuid}\"]`);\n if(item) {\n item.remove();\n }\n }\n\n cartController.updateCart(data);\n },\n error: function(data) {}\n });\n event.stopPropagation();\n }\n\n decreaseQuantity() {\n let cartController = this;\n let uuid = event.target.dataset.uuid;\n let quantity = parseFloat(event.target.dataset.quantity);\n let step = 1;\n if(event.target.dataset.step && event.target.dataset.step != '') {\n step = parseFloat(event.target.dataset.step);\n if(step == 0) {\n step = 1;\n }\n }\n if(quantity > 0) {\n quantity -= step;\n }\n\n if(quantity == 0) {\n let item = this.checkoutCartItemsTarget.querySelector(`[data-uuid=\"${uuid}\"]`);\n if(item) {\n item.remove();\n }\n }\n\n let json = {\n uuid: uuid,\n quantity: quantity\n }\n\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/cart/update`,\n type: \"POST\",\n data: JSON.stringify(json),\n contentType: false,\n processData: false,\n success: function(data) {\n cartController.updateCart(data);\n },\n error: function(data) {}\n });\n }\n\n increaseQuantity() {\n let cartController = this;\n let uuid = event.target.dataset.uuid;\n let quantity = parseFloat(event.target.dataset.quantity);\n\n let step = 1;\n if(event.target.dataset.step && event.target.dataset.step != '') {\n step = parseFloat(event.target.dataset.step);\n if(step == 0) {\n step = 1;\n }\n }\n if(quantity > 0) {\n quantity += step;\n }\n\n let json = {\n uuid: uuid,\n quantity: quantity\n }\n\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/cart/update`,\n type: \"POST\",\n data: JSON.stringify(json),\n contentType: false,\n processData: false,\n success: function(data) {\n cartController.updateCart(data);\n },\n error: function(data) {}\n });\n }\n\n updateCart(data) {\n this.navbarCartItemsCounterTarget.textContent = data.count;\n this.navbarMobileCartItemsCounterTarget.textContent = data.count;\n if(data.count == 0) {\n this.navbarCartItemsCounterTarget.classList.add('is-hidden');\n this.navbarMobileCartItemsCounterTarget.classList.add('is-hidden');\n this.cartMenuCheckoutButtonTarget.classList.add('is-hidden');\n\n this.cartMenuItemsTarget.innerHTML = `\n
  • \n

    \n ${I18n.t('cart.is_empty')}\n

    \n
  • \n `\n\n if(this.hasCheckoutCartNextButtonTarget) {\n this.checkoutCartNextButtonTarget.disabled = true;\n }\n if(this.hasCheckoutCartItemsTarget) {\n this.checkoutCartItemsTarget.innerHTML = `\n

    \n ${I18n.t('cart.is_empty')}\n

    \n `\n }\n } else {\n this.navbarCartItemsCounterTarget.classList.remove('is-hidden');\n this.navbarMobileCartItemsCounterTarget.classList.remove('is-hidden');\n this.cartMenuCheckoutButtonTarget.classList.remove('is-hidden');\n\n let div = this.cartMenuItemsTarget.querySelector(\"li.cart-empty\");\n if(div) {\n div.remove();\n }\n }\n\n if(data.vouchers && data.vouchers.length == 0) {\n if(document.querySelector('.vouchers')) {\n location.reload();\n }\n }\n\n if(this.hasCartMenuTotalTarget) {\n this.cartMenuTotalTarget.innerHTML = this.currenciesFormat(data.total_with_vat.toFixed(2), this.currency);\n }\n\n if(this.hasCheckoutCartItemsCountTarget) {\n this.checkoutCartItemsCountTarget.textContent = data.count;\n }\n if(this.hasCheckoutTotalTarget) {\n this.checkoutTotalTargets.forEach((div, i) => {\n div.innerHTML = this.currenciesFormat(data.total_with_vat.toFixed(2), this.currency);\n });\n }\n if(this.hasCheckoutItemsTarget) {\n this.checkoutItemsTarget.innerHTML = this.currenciesFormat(data.total_items.toFixed(2), this.currency);\n }\n if(this.hasCheckoutVatTarget) {\n this.checkoutVatTarget.innerHTML = this.currenciesFormat(data.vat.toFixed(2), this.currency);\n }\n if(this.hasCheckoutShippingCostTarget) {\n this.checkoutShippingCostTargets.forEach((target, i) => {\n target.innerHTML = this.currenciesFormat(data.shipping.toFixed(2), this.currency);\n });\n }\n if(this.hasCheckoutChargesTarget) {\n if(data.charges) {\n this.checkoutChargesTarget.cells[0].innerHTML = `\n ${I18n.t('checkout.charges')}\n \n ${data.charges.description}\n \n `\n\n this.checkoutChargesTarget.cells[1].textContent = this.currenciesFormat(data.charges.charges.toFixed(2), this.currency);\n\n let strong = this.checkoutChargesSummaryTarget.querySelector('strong');\n strong.innerHTML = `\n ${data.charges.description}\n \n ${this.currenciesFormat(data.charges.charges.toFixed(2), this.currency)}\n \n `\n this.checkoutChargesSummaryTarget.classList.remove('is-hidden');\n } else {\n this.checkoutChargesTarget.cells[1].textContent = '';\n this.checkoutChargesSummaryTarget.classList.add('is-hidden');\n }\n }\n\n let div;\n data.items.forEach((item, i) => {\n div = this.cartMenuItemsTarget.querySelector(`li[data-uuid=\"${item.uuid}\"]`);\n if(div) {\n let sml = div.querySelector('small');\n if(sml) {\n sml.innerHTML = `${I18n.t('cart.quantity')}: ${item.quantity}`;\n }\n sml = div.querySelector('small.pos-total');\n if(sml) {\n sml.innerHTML = this.currenciesFormat(item.total.toFixed(2), this.currency);\n }\n } else {\n let details = [];\n let span = '';\n if(item.color) {\n details.push(`${I18n.t('item.color')}: ${item.color}`);\n }\n if(item.size) {\n details.push(`${I18n.t('item.size')}: ${item.size}`);\n }\n if(details.length > 0) {\n span = `${details.join(', ')}
    `;\n }\n\n let cartItem = document.createElement('li');\n cartItem.classList.add('mb-3');\n cartItem.setAttribute(\"data-uuid\", item.uuid);\n cartItem.innerHTML = `\n
    \n
    \n

    \n \"${item.name}\"\n

    \n
    \n
    \n
    \n

    \n ${item.name}\n \n \n \n \n
    \n ${span}\n ${I18n.t('cart.quantity')}: ${item.quantity}\n \n ${this.currenciesFormat(item.total.toFixed(2), this.currency)}\n \n

    \n
    \n
    \n
    \n `\n this.cartMenuItemsTarget.appendChild(cartItem);\n }\n\n if(this.hasCheckoutCartItemsTarget) {\n div = this.checkoutCartItemsTarget.querySelector(`[data-uuid=\"${item.uuid}\"]`);\n let inp = div.querySelector('input');\n inp.value = item.quantity;\n\n div.querySelector('button.decrease').setAttribute(\"data-quantity\", item.quantity);\n div.querySelector('button.increase').setAttribute(\"data-quantity\", item.quantity);\n\n let div_total = div.querySelectorAll(\"div.price-total\");\n div_total.forEach((dt, i) => {\n dt.textContent = this.currenciesFormat(item.total.toFixed(2), this.currency);\n });\n\n div = this.checkoutSummaryCartItemsTarget.querySelector(`[data-uuid=\"${item.uuid}\"]`);\n\n let sum_total = div.querySelector(\"span.is-pulled-right\");\n if(sum_total) {\n sum_total.textContent = this.currenciesFormat(item.total.toFixed(2), this.currency);\n }\n let sum_quantity = div.querySelector(\"span.quantity\");\n if(sum_quantity) {\n sum_quantity.textContent = inp.value;\n }\n }\n });\n }\n\n nextStep() {\n if(this.currentStep == this.steps) {\n return;\n } else {\n\n if(this.currentStep == 2) {\n let customer = document.querySelector(\"#data_customer_company\");\n\n let firstname = document.querySelector(\"#checkout_firstname\");\n let lastname = document.querySelector(\"#checkout_lastname\");\n let email = document.querySelector(\"#checkout_email\");\n let email_helper = document.querySelector(\".help.email\");\n let phone = document.querySelector(\"#checkout_phone\");\n let cem = document.querySelector(\"#data_cem\");\n let cem_helper = document.querySelector(\".help.cem\");\n\n let name = document.querySelector(\"#checkout_name\");\n let street = document.querySelector(\"#checkout_street\");\n let zip = document.querySelector(\"#checkout_zip\");\n let location = document.querySelector(\"#checkout_location\");\n let country = document.querySelector(\"#checkout_country\");\n\n let error = false;\n if(firstname.value.trim() == '') {\n firstname.classList.add('is-danger');\n error = true;\n } else {\n firstname.classList.remove('is-danger');\n }\n if(lastname.value.trim() == '') {\n lastname.classList.add('is-danger');\n error = true;\n } else {\n lastname.classList.remove('is-danger');\n }\n if(email.value.trim() == '' || !this.validateEmail(email.value.trim())) {\n email.classList.add('is-danger');\n email_helper.classList.remove(\"is-hidden\");\n error = true;\n } else {\n email.classList.remove('is-danger');\n email_helper.classList.add(\"is-hidden\");\n }\n\n if(phone.getAttribute('required')) {\n if(phone.value.trim() == '' || phone.value.length < 6) {\n phone.classList.add('is-danger');\n error = true;\n } else {\n phone.classList.remove('is-danger');\n }\n }\n\n if(cem) {\n if(cem.value.trim() != '' && !this.validateEmail(email.value.trim())) {\n cem.classList.add('is-danger');\n cem_helper.classList.remove(\"is-hidden\");\n error = true;\n } else {\n cem.classList.remove('is-danger');\n cem_helper.classList.add(\"is-hidden\");\n }\n }\n\n if(name.value.trim() == '') {\n name.value = `${firstname.value.trim()} ${lastname.value.trim()}`.trim()\n }\n if(street.value.trim() == '') {\n street.classList.add('is-danger');\n error = true;\n } else {\n street.classList.remove('is-danger');\n }\n if(zip.value.trim() == '') {\n zip.classList.add('is-danger');\n error = true;\n } else {\n zip.classList.remove('is-danger');\n }\n if(location.value.trim() == '') {\n location.classList.add('is-danger');\n error = true;\n } else {\n location.classList.remove('is-danger');\n }\n if(country.value.trim() == '') {\n country.parentNode.classList.add('is-danger');\n error = true;\n } else {\n country.parentNode.classList.remove('is-danger');\n }\n\n if(email.value.trim() == '' || !this.validateEmail(email.value.trim())) {\n email.classList.add('is-danger');\n email_helper.classList.remove(\"is-hidden\");\n error = true;\n } else {\n email.classList.remove('is-danger');\n email_helper.classList.add(\"is-hidden\");\n }\n\n /*\n if(customer.checked) {\n let taxid = document.querySelector(\"#data_taxid\");\n if(taxid.value.trim() == '') {\n taxid.classList.add('is-danger');\n error = true;\n } else {\n taxid.classList.remove('is-danger');\n }\n\n let fiscal_code = document.querySelector(\"#data_fiscal_code\");\n if(fiscal_code.value.trim() == '') {\n if(taxid.value.trim() != '') {\n fiscal_code.value = taxid.value;\n } else {\n fiscal_code.classList.add('is-danger');\n error = true;\n }\n } else {\n fiscal_code.classList.remove('is-danger');\n }\n }\n */\n\n if(this.invoiceDirectionToggleTarget.checked) {\n let invoice_name = document.querySelector(\"#invoice_name\");\n let invoice_street = document.querySelector(\"#invoice_street\");\n let invoice_zip = document.querySelector(\"#invoice_zip\");\n let invoice_location = document.querySelector(\"#invoice_location\");\n\n if(invoice_name.value.trim() == '') {\n invoice_name.classList.add('is-danger');\n error = true;\n } else {\n invoice_name.classList.remove('is-danger');\n }\n if(invoice_street.value.trim() == '') {\n invoice_street.classList.add('is-danger');\n error = true;\n } else {\n invoice_street.classList.remove('is-danger');\n }\n if(invoice_zip.value.trim() == '') {\n invoice_zip.classList.add('is-danger');\n error = true;\n } else {\n invoice_zip.classList.remove('is-danger');\n }\n if(invoice_location.value.trim() == '') {\n invoice_location.classList.add('is-danger');\n error = true;\n } else {\n invoice_location.classList.remove('is-danger');\n }\n }\n\n if(error) {\n return;\n }\n }\n\n this.currentStep++;\n\n if(this.currentStep > 1) {\n let btnBack = document.querySelector('#btn-back');\n btnBack.classList.remove('is-static');\n }\n\n this.refreshView();\n }\n }\n\n validateEmail(email) {\n const re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return re.test(String(email).toLowerCase());\n }\n\n previousStep() {\n if(this.currentStep == 1) {\n return;\n }\n\n this.currentStep--;\n\n let currentState = document.querySelector(\".steps\").children[this.currentStep-1];\n currentState.classList.add('is-active');\n\n this.refreshView();\n }\n\n refreshView() {\n let steps = document.querySelector(\".steps\").children;\n for(var i = 0; i${company}
    `;\n }\n address.innerHTML += `${firstname} ${lastname}`;\n address.innerHTML += '
    ';\n address.innerHTML += email;\n address.innerHTML += '

    ';\n address.innerHTML += ''+name+'
    ';\n address.innerHTML += street+'
    '+zip+' '+location;\n if(state && state != '') {\n address.innerHTML += '
    '+state;\n }\n if(country && country != '') {\n address.innerHTML += '
    '+countries.getName(country, this.locale);\n }\n\n if(this.invoiceDirectionToggleTarget.checked) {\n let invoice_address = document.querySelector(\"#invoice_address\");\n let invoice_name = this.removeTags(document.querySelector(\"#invoice_name\").value);\n let invoice_street = this.removeTags(document.querySelector(\"#invoice_street\").value);\n let invoice_zip = this.removeTags(document.querySelector(\"#invoice_zip\").value);\n let invoice_location = this.removeTags(document.querySelector(\"#invoice_location\").value);\n let invoice_state = this.removeTags(document.querySelector(\"#invoice_state\").value);\n let invoice_country = this.removeTags(document.querySelector(\"#invoice_country\").value);\n\n invoice_address.innerHTML = '';\n invoice_address.innerHTML += ''+invoice_name+'
    ';\n invoice_address.innerHTML += invoice_street+'
    '+invoice_zip+' '+invoice_location;\n if(invoice_state && invoice_state != '') {\n invoice_address.innerHTML += '
    '+invoice_state;\n }\n if(invoice_country && invoice_country != '') {\n invoice_address.innerHTML += '
    '+countries.getName(invoice_country, this.locale);\n }\n\n invoice_address.classList.remove(\"is-hidden\");\n this.invoice_direction_headerTarget.classList.remove(\"is-hidden\");\n } else {\n invoice_address.classList.add(\"is-hidden\");\n this.invoice_direction_headerTarget.classList.add(\"is-hidden\");\n }\n\n switch(this.currentStep) {\n case 1:\n this.checkoutCartItemsTarget.classList.remove('is-hidden');\n break;\n case 2:\n this.checkoutShippingTarget.classList.remove('is-hidden');\n break;\n case 3:\n this.checkoutPaymentTarget.classList.remove('is-hidden');\n break;\n case 4:\n this.checkoutConfirmationTarget.classList.remove('is-hidden');\n break;\n }\n }\n\n setAddress() {\n let addr = event.target.dataset.address;\n\n let name = event.target.dataset.name;\n let street = event.target.dataset.street;\n let zip = event.target.dataset.zip;\n let location = event.target.dataset.location;\n let state = event.target.dataset.state;\n let country = event.target.dataset.country;\n\n document.querySelector(\"#checkout_name\").value = name;\n document.querySelector(\"#checkout_street\").value = street;\n document.querySelector(\"#checkout_zip\").value = zip;\n document.querySelector(\"#checkout_location\").value = location;\n document.querySelector(\"#checkout_state\").value = state;\n document.querySelector(\"#checkout_country\").value = country;\n\n document.querySelector(\"#checkout_country\").dispatchEvent(new Event('change'));\n }\n\n setInvoiceAddress() {\n let addr = event.target.dataset.address;\n\n let name = event.target.dataset.name;\n let street = event.target.dataset.street;\n let zip = event.target.dataset.zip;\n let location = event.target.dataset.location;\n let state = event.target.dataset.state;\n let country = event.target.dataset.country;\n\n document.querySelector(\"#invoice_name\").value = name;\n document.querySelector(\"#invoice_street\").value = street;\n document.querySelector(\"#invoice_zip\").value = zip;\n document.querySelector(\"#invoice_location\").value = location;\n document.querySelector(\"#invoice_state\").value = state;\n document.querySelector(\"#invoice_country\").value = country;\n }\n\n toggleTermCheck() {\n var btn = document.querySelector('#btn-confirm');\n if(event.target.checked) {\n btn.removeAttribute('disabled', 'true');\n } else {\n btn.setAttribute('disabled', 'true');\n }\n }\n\n toggleFinishButton() {\n var btn = document.querySelector('#btn-confirm');\n var btnBack = document.querySelector('#btn-back');\n var icon = btn.querySelector(\"svg\");\n if(btn.classList.contains('is-static')) {\n btn.classList.remove('is-warning');\n btn.classList.add('is-primary');\n btn.classList.add('is-static');\n btnBack.classList.remove('is-static');\n\n icon.classList.remove(\"fa-spinner\",\"fa-pulse\");\n icon.classList.add(\"fa-check\");\n } else {\n btn.classList.add('is-static');\n btnBack.classList.add('is-static');\n btn.classList.remove('is-primary');\n btn.classList.add('is-warning');\n\n icon.classList.remove(\"fa-check\");\n icon.classList.add(\"fa-spinner\",\"fa-pulse\");\n\n let radio = document.querySelector('[name=\"checkout[payment_method]\"]:checked')\n if(radio.value != 'advance') {\n var busy = document.querySelector(\".modal\");\n\n let sumup;\n try {\n sumup = SumUpCard;\n } catch {\n\n }\n\n if(sumup && radio.value != 'paypal') {\n busy.querySelector(\".modal-content\").classList.add(\"card\")\n busy.querySelector(\".modal-content\").innerHTML = `\n
    \n
    \n
    \n
    \n
    \n \n ${I18n.t(\"checkout.cancel\")}\n \n
    \n `;\n }\n busy.classList.add('is-active');\n }\n }\n }\n\n checkQuantities() {\n event.stopPropagation();\n\n if(event.target.dataset.step) {\n let that = this;\n let uuid = event.target.dataset.uuid;\n let quantity = parseFloat(event.target.value);\n let step = parseFloat(event.target.dataset.step);\n try {\n let d = Math.ceil(quantity / step);\n quantity = d * step;\n event.target.value = quantity\n\n if(uuid != '' && quantity != '') {\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/cart/update`,\n type: \"POST\",\n data: `uuid=${uuid}&quantity=${quantity}`,\n success: function(data) {\n that.updateCart(data);\n },\n error: function(data) {}\n });\n }\n } catch {\n\n }\n }\n }\n\n updateQuantity() {\n event.stopPropagation();\n\n let that = this;\n var uuid = event.target.dataset.uuid;\n var quantity = event.target.value;\n\n if(uuid != '' && quantity != '') {\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/cart/update`,\n type: \"POST\",\n data: `uuid=${uuid}&quantity=${quantity}`,\n success: function(data) {\n that.updateCart(data);\n },\n error: function(data) {}\n });\n }\n }\n\n toggleCustomerType() {\n if(event.target.value) {\n if(event.target.value == 'company') {\n this.privateDataTarget.classList.add('is-hidden');\n this.companyDataTarget.classList.remove('is-hidden');\n } else {\n this.companyDataTarget.classList.add('is-hidden');\n this.privateDataTarget.classList.remove('is-hidden');\n }\n }\n }\n\n toggleInvoiceDirection() {\n if(event.target.type) {\n if(event.target.checked) {\n this.invoice_directionTarget.classList.remove('is-hidden');\n } else {\n this.invoice_directionTarget.classList.add('is-hidden');\n }\n }\n }\n\n setPaymentMethod() {\n let that = this;\n let radio = event.target;\n\n\n switch (radio.value) {\n case \"twint\":\n this.checkout_paymentTarget.innerHTML = `\n
    \n \n ${I18n.t('checkout.twint')}\n
    \n `;\n break;\n case \"postfinance\":\n this.checkout_paymentTarget.innerHTML = `\n
    \n \n ${I18n.t('checkout.postfinance')}\n
    \n `;\n break;\n default:\n var span = radio.parentNode.querySelector('span');\n this.checkout_paymentTarget.innerHTML = span.innerHTML;\n }\n\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/checkout/payment/set/${radio.value}`,\n type: \"POST\",\n data: null,\n success: function(data) {\n if(radio.dataset.chargesType && radio.dataset.chargesAmount) {\n that.applyCharges(radio.dataset.chargesAmount, radio.dataset.chargesType, radio.dataset.chargesDescription)\n } else {\n that.removeCharges()\n }\n },\n error: function(data) {}\n });\n }\n\n switchCountry() {\n let country = event.target.dataset.country;\n let locale = I18n.locale;\n if(event.target.dataset.locale) {\n locale = event.target.dataset.locale;\n }\n let title = I18n.t('cart.messages.country_change');\n let content = I18n.t('cart.messages.country_clear_cart', {country: I18n.t(`countries.${country}`)});\n\n let modal = Modal.createModal(title, content, [{label: I18n.t('btn.cancel'), event: 'cancel', classes: ''}, {label: I18n.t('btn.accept'), event: 'success', classes: 'is-success'}]);\n modal.openModal();\n\n modal.addEventListener('success', () => {\n Rails.ajax({\n url: `/country/${country}/${locale}`,\n type: \"POST\",\n data: null,\n success: function(data) {\n },\n error: function(data) {}\n });\n })\n }\n\n addVoucher() {\n let that = this;\n if(this.vouchercodeTarget.value != '') {\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/cart/voucher`,\n type: \"POST\",\n data: `code=${this.vouchercodeTarget.value}`,\n success: function(data) {\n location.reload();\n },\n error: function(data) {\n\n switch(data.error) {\n case 'purchase':\n var alert = document.querySelector(\".notification.voucher\");\n alert.innerHTML = ` ${I18n.t('voucher.error.purchase', {purchase: `${data.value} ${that.currency}`})}`;\n alert.classList.remove('is-hidden');\n main.fadeOut(alert, 8000);\n break\n default:\n var alert = document.querySelector(\".notification.voucher\");\n alert.innerHTML = ` ${I18n.t('voucher.error.invalid')}`;\n alert.classList.remove('is-hidden');\n main.fadeOut(alert, 8000);\n break\n }\n }\n });\n }\n }\n\n removeVoucher() {\n if(event.target.dataset.code && event.target.dataset.uuid) {\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/cart/voucher`,\n type: \"DELETE\",\n data: `code=${event.target.dataset.code}&uuid=${event.target.dataset.uuid}`,\n success: function(data) {\n location.reload();\n },\n error: function(data) {\n location.reload();\n }\n });\n }\n }\n\n applyCharges(amount, type, description) {\n let that = this;\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/checkout/charges`,\n type: \"POST\",\n data: JSON.stringify({type: type, amount: amount, description: description}),\n contentType: false,\n processData: false,\n success: function(data) {\n that.updateCart(data);\n that.checkoutChargesTarget.classList.remove('is-hidden');\n },\n error: function(data) {\n }\n });\n }\n\n removeCharges() {\n let that = this;\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/checkout/charges`,\n type: \"DELETE\",\n data: null,\n success: function(data) {\n that.checkoutChargesTarget.classList.add('is-hidden');\n that.updateCart(data);\n },\n error: function(data) {\n }\n });\n }\n\n setShippingCountry() {\n let that = this;\n Rails.ajax({\n url: `/${this.country.toLowerCase()}-${this.locale}/cart/shipping_country`,\n type: \"POST\",\n data: `shipping_country=${event.target.value}`,\n success: function(data) {\n that.updateCart(data);\n },\n error: function(data) {}\n });\n }\n\n signin() {\n this.signinModalTarget.classList.add(\"is-active\");\n\n this.signinModalTarget.classList.remove(\"is-hidden\");\n setTimeout(() => {\n this.signinModalTarget.querySelector(\"#customer_email\").focus();\n }, 250)\n }\n\n closeSignin() {\n this.signinModalTarget.classList.remove(\"is-active\")\n this.signinModalTarget.querySelectorAll(\"input\").forEach((inp, i) => {\n inp.value = \"\"\n });\n }\n}\n","import { Controller } from \"stimulus\"\n\nexport default class extends Controller {\n\n static targets = [ \"email\", \"phone\" ]\n\n initialize() {\n\n }\n\n connect() {\n window.onSubmit = function(token) {\n let form = document.getElementById(\"contact-form\");\n Rails.fire(form, 'submit');\n }\n }\n\n checkContactForm() {\n if(this.validateEmail(this.emailTarget.value)) {\n this.phoneTarget.required = \"\";\n } else {\n this.phoneTarget.required = true;\n }\n if(this.phoneTarget.value.length > 4) {\n this.emailTarget.required = \"\";\n } else {\n this.emailTarget.required = true;\n }\n }\n\n validateEmail(mail) {\n if (/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/.test(mail))\n {\n return (true)\n }\n return (false)\n }\n}\n","import { Controller } from \"stimulus\"\nimport * as Modal from \"../src/javascripts/modal.js\"\n\nexport default class extends Controller {\n\n static targets = [\"companyData\", \"privateData\", \"password_current\", \"password_new\", \"password_confirm\", \"error_password_length\", \"error_password_match\"]\n\n initialize() {\n if(this.element.getAttribute(\"data-page\")) {\n this.page = this.element.getAttribute(\"data-page\");\n }\n\n this.locale = this.element.getAttribute(\"data-locale\");\n if(!this.locale) {\n this.locale = document.querySelector(\"meta[name='locale']\").getAttribute('content');\n }\n }\n\n connect() {\n if(window.location.pathname.includes('profile')) {\n //this.loadOrders();\n }\n }\n\n checkForm() {\n let error = false;\n\n let email1 = document.querySelector(\"#customer_email\");\n let email2 = document.querySelector(\"#customer_email_confirmation\");\n\n let password1 = document.querySelector(\"#customer_password\");\n let password2 = document.querySelector(\"#customer_password_confirmation\");\n\n if(email1 && email2) {\n if(email1.value != email2.value) {\n email1.classList.add('is-danger');\n email2.classList.add('is-danger');\n document.querySelector(\"#email-match\").classList.remove('is-hidden');\n error = true;\n } else {\n email1.classList.remove('is-danger');\n email2.classList.remove('is-danger');\n document.querySelector(\"#email-match\").classList.add('is-hidden');\n }\n }\n\n if(password1.value.trim() != password2.value.trim()) {\n password1.classList.add('is-danger');\n password2.classList.add('is-danger');\n document.querySelector(\"#password-match\").classList.remove('is-hidden');\n error = true;\n } else {\n password1.classList.remove('is-danger');\n password2.classList.remove('is-danger');\n document.querySelector(\"#password-match\").classList.add('is-hidden');\n }\n\n if(password1.value.trim().length < 6) {\n password1.classList.add('is-danger');\n password2.classList.add('is-danger');\n document.querySelector(\"#password-length\").classList.remove('is-hidden');\n error = true;\n } else {\n password1.classList.remove('is-danger');\n password2.classList.remove('is-danger');\n document.querySelector(\"#password-length\").classList.add('is-hidden');\n }\n\n if(error) {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n addAddress() {\n let box = document.querySelector(\"#editAddress\");\n box.classList.add('is-active');\n\n let street = box.querySelector('#address_street');\n street.focus();\n\n box.querySelector('.button.is-danger').classList.add('is-hidden');\n }\n\n editAddress() {\n let addressId = event.target.dataset.addressId;\n let address = event.target.dataset.address;\n let box = document.querySelector(\"#editAddress\");\n box.classList.add('is-active');\n\n let id = box.querySelector('input[name=\"id\"]');\n id.value = addressId;\n\n box.querySelector('.button.is-danger').classList.remove('is-hidden');\n\n let textarea = box.querySelector('textarea');\n\n let name = box.querySelector('#address_name');\n let street = box.querySelector('#address_street');\n let zip = box.querySelector('#address_zip');\n let location = box.querySelector('#address_location');\n let state = box.querySelector('#address_state');\n let country = box.querySelector('#address_country');\n\n name.value = event.target.dataset.name;\n street.value = event.target.dataset.street;\n zip.value = event.target.dataset.zip;\n location.value = event.target.dataset.location;\n if(state) {\n state.value = event.target.dataset.state;\n }\n country.value = event.target.dataset.country;\n\n street.focus();\n }\n\n deleteAddress() {\n var customersController = this;\n let box = document.querySelector(\"#editAddress\");\n let addressId = box.querySelector('input[name=\"id\"]').value;\n console.log(addressId);\n\n var xmlhttp = new XMLHttpRequest();\n xmlhttp.onreadystatechange = function(){\n if (xmlhttp.readyState == 4 && xmlhttp.status == 202) {\n let div = document.querySelector('#addresses');\n let addr = div.querySelector(`div[data-address-id='${addressId}']`);\n main.fadeOut(addr, 0);\n customersController.closeModal();\n }\n }\n xmlhttp.open(\"DELETE\", `/customers/address/${addressId}/delete`, true);\n //xmlhttp.setRequestHeader('X-CSRF-Token', document.querySelector('meta[name=\"csrf-token\"]').content);\n xmlhttp.send();\n }\n\n closeModal() {\n let modal = document.querySelector(\".modal\");\n\n let street = modal.querySelector('#address_street');\n let zip = modal.querySelector('#address_zip');\n let location = modal.querySelector('#address_location');\n let state = modal.querySelector('#address_state');\n let country = modal.querySelector('#address_country');\n\n street.value = '';\n zip.value = '';\n location.value = '';\n if(state) {\n state.value = '';\n }\n country.value = '';\n\n document.querySelector(\"#editAddress\").classList.remove('is-active');\n }\n\n loadOrders() {\n Rails.ajax({\n url: \"/en/orders\",\n type: \"get\",\n data: \"\",\n success: function(data) {\n var tbody = document.querySelector(\"#orders\");\n data.forEach( (order) => {\n\n let paid_icon = '';\n if(order['paid']) {\n paid_icon = '';\n } else if(order['state'] == '04_delivered' || order['state'] == '05_completed') {\n paid_icon = '';\n }\n\n let items = '';\n\n tbody.innerHTML += `\n ${order['orderref']}\n ${order['state_label']}\n ${paid_icon}\n ${items}\n ${order['total_with_vat']}\n `\n })\n },\n error: function(data) {}\n })\n }\n\n toggleCustomerType() {\n if(event.target.value) {\n if(event.target.value == 'company') {\n this.privateDataTarget.classList.add('is-hidden');\n this.companyDataTarget.classList.remove('is-hidden');\n } else {\n this.companyDataTarget.classList.add('is-hidden');\n this.privateDataTarget.classList.remove('is-hidden');\n }\n }\n }\n\n checkPassword() {\n if(this.password_newTarget.value != this.password_confirmTarget.value) {\n this.error_password_matchTargets.forEach((p) => {\n p.classList.remove('is-hidden');\n })\n } else {\n this.error_password_matchTargets.forEach((p) => {\n p.classList.add('is-hidden');\n })\n }\n\n if(this.password_newTarget.value.length < 6) {\n this.error_password_lengthTargets.forEach((p) => {\n p.classList.remove('is-hidden');\n })\n } else {\n this.error_password_lengthTargets.forEach((p) => {\n p.classList.add('is-hidden');\n })\n }\n }\n\n passwordForgotten() {\n let customersController = this;\n let title = I18n.t('customer.password_reset');\n let content = `\n ${I18n.t('customer.confirmations.password_reset')}\n
    \n
    \n \n
    \n
    \n `;\n\n let modal = Modal.createModal(title, content, [{label: I18n.t('btn.cancel'), event: 'cancel', classes: ''}, {label: I18n.t('btn.send'), event: 'success', classes: 'is-primary'}]);\n modal.openModal();\n\n modal.addEventListener('success', (event) => {\n let email = event.detail.email;\n if(email && email != '') {\n const formData = new FormData();\n formData.append(\"email\", email);\n\n Rails.ajax({\n url: `/${customersController.locale}/customers/password/reset`,\n type: \"POST\",\n data: formData,\n success: function(data) {\n let title = I18n.t('customer.password_reset');\n let content = I18n.t('customer.confirmations.password_reset_mail_sent');\n modal = Modal.createModal(title, content, [{label: I18n.t('btn.close'), event: 'success', classes: ''}]);\n modal.openModal();\n },\n error: function(data) {}\n });\n }\n })\n }\n}\n","// Load all the controllers within this directory and all subdirectories. \n// Controller files must be named *_controller.js.\n\nimport { Application } from \"stimulus\"\nimport { definitionsFromContext } from \"stimulus/webpack-helpers\"\n\nconst application = Application.start()\nconst context = require.context(\"controllers\", true, /_controller\\.js$/)\napplication.load(definitionsFromContext(context))\n","import { Controller } from \"stimulus\"\nimport PinchZoom from \"pinch-zoom-js\"\nimport Gesture from 'tinygesture';\n\nexport default class extends Controller {\n\n static targets = [ \"image\", \"productPicture\", \"productPictureDescription\", \"productPictureWrapper\", \"productPictureThumbnails\", \"image_left_icon\", \"image_zoom_icon\", \"image_right_icon\", \"inputUuid\", \"colorVariant\", \"sizeVariant\", \"buttonAddToCart\", \"price\", \"itemStock\", \"spanPriceWithVat\", \"tabs\", \"tabsContent\", \"bullets\", \"productVideoWrapper\" ]\n\n static values = {\n unitSteps: Number\n }\n\n initialize() {\n this.locale = this.element.getAttribute(\"data-locale\");\n if(!this.locale) {\n this.locale = document.querySelector(\"meta[name='locale']\").getAttribute('content');\n }\n\n this.currency = document.querySelector(\"meta[name='currency']\").getAttribute('content');\n }\n\n connect() {\n let li = this.tabsTarget.querySelector(\"li:not(.is-hidden)\");\n if(li) {\n li.classList.add('is-active');\n let tab = this.tabsContentTarget.querySelector(`div#${li.children[0].dataset.target}.tab-content`);\n if(tab) {\n tab.classList.remove('is-hidden');\n }\n }\n\n setTimeout( () => {\n let div = this.imageTarget.parentNode.parentNode;\n div.setAttribute(\"data-height\", div.offsetHeight);\n }, 500)\n\n const gesture = new Gesture(this.imageTarget, {\n diagonalSwipes: false\n });\n gesture.on('swiperight', (event) => {\n this.previewImageNavigation(\"right\");\n });\n gesture.on('swipeleft', (event) => {\n this.previewImageNavigation(\"left\");\n });\n\n if(this.unitStepsValue) {\n let inp = document.querySelector(\"input#item_quantity\");\n if(inp) {\n inp.value = this.unitStepsValue;\n inp.setAttribute(\"min\", this.unitStepsValue);\n inp.setAttribute(\"steps\", this.unitStepsValue);\n }\n }\n }\n\n imageNavigation() {\n let active = parseInt(this.productPictureThumbnailsTarget.dataset.active);\n let total = parseInt(this.productPictureThumbnailsTarget.dataset.thumbnails);\n let thumbnails = this.productPictureThumbnailsTarget.querySelectorAll('img');\n let keycode = event.keyCode;\n if(event.keyCode) {\n keycode = event.keyCode;\n } else {\n if(event.target.dataset.direction) {\n if(event.target.dataset.direction == 'left') {\n keycode = 37;\n } else {\n keycode = 39;\n }\n }\n }\n\n switch (keycode) {\n case 27:\n this.productPictureWrapperTarget.classList.add('is-hidden');\n\n let iframe = this.productPictureWrapperTarget.querySelector(\"iframe\");\n if(iframe) {\n iframe.remove();\n }\n let video = this.productPictureWrapperTarget.querySelector(\"video\");\n if(video) {\n video.remove();\n }\n\n break;\n case 39:\n //right\n this.pictureNavigation(\"left\")\n break;\n case 37:\n //left\n this.pictureNavigation(\"right\")\n break;\n }\n }\n\n pictureNavigation(direction) {\n let active = parseInt(this.productPictureThumbnailsTarget.dataset.active);\n let total = parseInt(this.productPictureThumbnailsTarget.dataset.thumbnails);\n let thumbnails = this.productPictureThumbnailsTarget.querySelectorAll('img');\n if(direction == \"left\") {\n thumbnails[active].classList.remove('active');\n if(active < total-1) {\n active++;\n } else {\n active = 0;\n }\n this.productPictureThumbnailsTarget.setAttribute(\"data-active\", active);\n thumbnails[active].classList.add('active');\n } else {\n thumbnails[active].classList.remove('active');\n if(active > 0) {\n active--;\n } else {\n active = total-1;\n }\n this.productPictureThumbnailsTarget.setAttribute(\"data-active\", active);\n thumbnails[active].classList.add('active');\n }\n\n let iframe = this.productPictureWrapperTarget.querySelector(\"iframe\");\n if(iframe) {\n iframe.remove();\n }\n let video = this.productPictureWrapperTarget.querySelector(\"video\");\n if(video) {\n video.remove();\n }\n\n this.productVideoWrapperTarget.style.display = \"block\"\n this.productVideoWrapperTarget.style.justifyContent = \"unset\"\n\n if(thumbnails[active].dataset.videoUrl || thumbnails[active].dataset.video) {\n this.productPictureTarget.classList.add('is-hidden');\n\n let div = this.productPictureTarget.parentNode;\n if(thumbnails[active].dataset.videoUrl) {\n let iframe = document.createElement('iframe');\n iframe.src = thumbnails[active].dataset.videoUrl;\n iframe.title = thumbnails[active].dataset.name;\n iframe.frameborder = \"0\"\n iframe.style.margin = \"auto\"\n iframe.style.width = \"100%\"\n iframe.style.height = \"60vh\";\n this.productPictureDescriptionTarget.textContent = thumbnails[active].alt;\n div.appendChild(iframe);\n } else {\n let video = document.createElement('video');\n video.controls = true;\n video.setAttribute('controlsList', 'nodownload')\n video.src = thumbnails[active].dataset.video;\n this.productPictureDescriptionTarget.textContent = thumbnails[active].alt;\n\n this.productVideoWrapperTarget.style.display = \"flex\"\n this.productVideoWrapperTarget.style.justifyContent = \"center\"\n div.appendChild(video);\n }\n } else {\n this.productPictureTarget.classList.remove('is-hidden');\n this.imageTarget.removeAttribute('data-video-url');\n\n this.productPictureTarget.src = thumbnails[active].dataset.image;\n this.productPictureDescriptionTarget.textContent = thumbnails[active].alt;\n }\n }\n\n previewNavigation() {\n if(event.detail > 1) {\n event.preventDefault();\n }\n\n if(event.target.dataset.direction) {\n if(event.target.dataset.direction == 'left') {\n this.previewImageNavigation(\"right\")\n } else {\n this.previewImageNavigation(\"left\")\n }\n }\n if(document.selection && document.selection.empty) {\n document.selection.empty();\n } else if(window.getSelection) {\n var sel = window.getSelection();\n sel.removeAllRanges();\n }\n }\n\n previewImageNavigation(direction) {\n let total = parseInt(this.productPictureThumbnailsTarget.dataset.thumbnails);\n let active = parseInt(this.productPictureThumbnailsTarget.dataset.active);\n let thumbnails = this.productPictureThumbnailsTarget.querySelectorAll('img');\n let bullets = this.bulletsTarget.querySelectorAll(\"div\");\n\n thumbnails[active].classList.remove('active');\n bullets[active].querySelector('svg').setAttribute(\"data-prefix\", 'far');\n\n if(direction == 'left') {\n if(active < total-1) {\n active++;\n } else {\n active = 0;\n }\n } else {\n if(active > 0) {\n active--;\n } else {\n active = total-1;\n }\n }\n\n this.productVideoWrapperTarget.style.display = \"block\"\n this.productVideoWrapperTarget.style.justifyContent = \"unset\"\n\n if(thumbnails[active].dataset.videoUrl || thumbnails[active].dataset.video) {\n this.productPictureTarget.classList.add('is-hidden');\n if(thumbnails[active].dataset.videoUrl) {\n this.imageTarget.setAttribute('data-video-url', thumbnails[active].dataset.videoUrl);\n } else {\n this.imageTarget.setAttribute('data-video', thumbnails[active].dataset.video);\n }\n let div = this.imageTarget.parentNode.parentNode;\n div.style.height = `${div.dataset.height}px`;\n\n this.image_zoom_iconTarget.innerHTML = `\n \n \n \n \n `\n } else {\n let iframe = this.productPictureWrapperTarget.querySelector(\"iframe\");\n if(iframe) {\n iframe.remove();\n }\n let video = this.productPictureWrapperTarget.querySelector(\"video\");\n if(video) {\n video.remove();\n }\n this.productPictureTarget.classList.remove('is-hidden');\n this.imageTarget.removeAttribute('data-video-url');\n\n this.image_zoom_iconTarget.innerHTML = `\n \n \n \n \n `\n }\n\n thumbnails[active].classList.add('active');\n this.productPictureThumbnailsTarget.setAttribute(\"data-active\", active);\n bullets[active].querySelector('svg').setAttribute(\"data-prefix\", 'fas');\n\n this.imageTarget.src = bullets[active].dataset.thumbnail;\n this.imageTarget.dataset.image = bullets[active].dataset.image;\n this.imageTarget.alt = bullets[active].dataset.title;\n }\n\n showImage() {\n let iframe = this.productPictureWrapperTarget.querySelector(\"iframe\");\n if(iframe) {\n iframe.remove();\n }\n let video = this.productPictureWrapperTarget.querySelector(\"video\");\n if(video) {\n video.remove();\n }\n\n this.productVideoWrapperTarget.style.display = \"block\"\n this.productVideoWrapperTarget.style.justifyContent = \"unset\"\n\n if(event.target.dataset.videoUrl || event.target.dataset.video) {\n this.productPictureTarget.classList.add('is-hidden');\n\n let div = this.productPictureTarget.parentNode;\n if(event.target.dataset.videoUrl) {\n let iframe = document.createElement('iframe');\n iframe.src = event.target.dataset.videoUrl;\n iframe.title = event.target.dataset.name;\n iframe.frameborder = \"0\"\n iframe.style.margin = \"auto\"\n iframe.style.width = \"100%\"\n iframe.style.height = \"60vh\";\n div.appendChild(iframe);\n } else {\n let video = document.createElement('video');\n video.controls = true;\n video.setAttribute('controlsList', 'nodownload')\n video.src = event.target.dataset.video;\n video.style.maxHeight = \"100%\";\n\n this.productVideoWrapperTarget.style.display = \"flex\"\n this.productVideoWrapperTarget.style.justifyContent = \"center\"\n div.appendChild(video);\n }\n } else {\n this.productPictureTarget.classList.remove('is-hidden');\n }\n this.productPictureTarget.src = event.target.dataset.image;\n this.productPictureDescriptionTarget.innerHTML = event.target.alt;\n this.productPictureWrapperTarget.classList.remove('is-hidden');\n this.productPictureWrapperTarget.focus();\n\n let pz = new PinchZoom(this.productPictureTarget, {\n draggableUnzoomed: false,\n minZoom: 1,\n });\n pz.enable()\n\n const gesture = new Gesture(this.productPictureTarget, {\n diagonalSwipes: false\n });\n gesture.on('swiperight', (event) => {\n this.pictureNavigation(\"right\");\n });\n gesture.on('swipeleft', (event) => {\n this.pictureNavigation(\"left\");\n });\n }\n\n hideImage() {\n this.productPictureWrapperTarget.classList.add('is-hidden');\n let iframe = this.productPictureWrapperTarget.querySelector(\"iframe\");\n if(iframe) {\n iframe.remove();\n }\n let video = this.productPictureWrapperTarget.querySelector(\"video\");\n if(video) {\n video.remove();\n }\n }\n\n switchImage() {\n let img = event.target;\n\n if(event.target.dataset.url || event.target.dataset.video) {\n this.productPictureTarget.classList.add('is-hidden');\n if(event.target.dataset.url) {\n this.imageTarget.setAttribute('data-video-url', event.target.dataset.url);\n } else {\n this.imageTarget.setAttribute('data-video', event.target.dataset.video);\n }\n\n let div = this.imageTarget.parentNode.parentNode;\n div.style.height = `${div.dataset.height}px`;\n\n this.image_zoom_iconTarget.innerHTML = `\n \n \n \n \n `\n } else {\n this.productPictureTarget.classList.remove('is-hidden');\n this.imageTarget.removeAttribute('data-video-url');\n this.imageTarget.removeAttribute('data-video');\n\n this.image_zoom_iconTarget.innerHTML = `\n \n \n \n \n `\n }\n\n if(this.productPictureWrapperTarget.classList.contains('is-hidden')) {\n event.target.parentNode.querySelectorAll('svg').forEach((svg, i) => {\n svg.setAttribute(\"data-prefix\", \"far\")\n });\n\n this.imageTarget.src = img.dataset.thumbnail;\n this.imageTarget.dataset.image = img.dataset.image;\n this.imageTarget.alt = img.dataset.title;\n\n event.target.querySelector('svg').setAttribute(\"data-prefix\", \"fas\");\n\n this.productPictureThumbnailsTarget.querySelectorAll(\"img\").forEach((img, i) => {\n if(i == event.target.dataset.index) {\n img.classList.add('active');\n } else {\n img.classList.remove('active');\n }\n });\n\n this.productPictureThumbnailsTarget.setAttribute(\"data-active\", event.target.dataset.index);\n } else {\n this.productPictureThumbnailsTarget.querySelectorAll(\"img\").forEach((img, i) => {\n img.classList.remove('active');\n });\n\n let iframe = this.productPictureWrapperTarget.querySelector(\"iframe\");\n if(iframe) {\n iframe.remove();\n }\n let video = this.productPictureWrapperTarget.querySelector(\"video\");\n if(video) {\n video.remove();\n }\n\n this.productVideoWrapperTarget.style.display = \"block\"\n this.productVideoWrapperTarget.style.justifyContent = \"unset\"\n\n if(event.target.dataset.videoUrl || event.target.dataset.video) {\n this.productPictureTarget.classList.add('is-hidden');\n\n let div = this.productPictureTarget.parentNode;\n if(event.target.dataset.videoUrl) {\n let iframe = document.createElement('iframe');\n iframe.src = event.target.dataset.videoUrl;\n iframe.title = event.target.dataset.name;\n iframe.frameborder = \"0\"\n iframe.style.margin = \"auto\"\n iframe.style.width = \"100%\"\n iframe.style.height = \"60vh\";\n div.appendChild(iframe);\n } else {\n let videoWrapper = document.createElement('div');\n let video = document.createElement('video');\n video.controls = true;\n video.setAttribute('controlsList', 'nodownload')\n video.src = event.target.dataset.video;\n video.style.maxHeight = \"100%\";\n\n this.productVideoWrapperTarget.style.display = \"flex\"\n this.productVideoWrapperTarget.style.justifyContent = \"center\"\n div.appendChild(video);\n }\n } else {\n this.productPictureTarget.classList.remove('is-hidden');\n this.imageTarget.removeAttribute('data-video-url');\n\n this.productPictureTarget.src = event.target.dataset.image;\n this.productPictureDescriptionTarget.textContent = event.target.alt;\n }\n event.target.classList.add('active');\n }\n }\n\n switchTab() {\n this.tabsTarget.querySelectorAll(\"a\").forEach((a, i) => {\n if(a.dataset.target == event.target.dataset.target) {\n a.parentNode.classList.add('is-active');\n } else {\n a.parentNode.classList.remove('is-active');\n }\n });\n\n this.tabsContentTarget.querySelectorAll(\"div.tab-content\").forEach((div, i) => {\n if(div.id == event.target.dataset.target) {\n div.classList.remove('is-hidden');\n } else {\n div.classList.add('is-hidden');\n }\n });\n }\n\n toggleImageZoomIcon() {\n this.image_left_iconTarget.classList.toggle('is-hidden');\n this.image_zoom_iconTarget.classList.toggle('is-hidden');\n this.image_right_iconTarget.classList.toggle('is-hidden');\n }\n\n setColor() {\n let uuid = event.target.dataset.uuid;\n\n this.colorVariantTargets.forEach((btn, i) => {\n if(btn.dataset.uuid == uuid) {\n btn.classList.add('has-background-secondary-dark');\n this.inputUuidTarget.value = uuid;\n } else {\n btn.classList.remove('has-background-secondary-dark');\n }\n });\n }\n\n setSize() {\n let itemsController = this;\n let uuid = event.target.dataset.uuid;\n\n Rails.ajax({\n url: `/${itemsController.locale}/item/${uuid}`,\n type: \"get\",\n data: \"\",\n success: function(data) {\n if(data.description_long && data.description_long != '') {\n let div = document.querySelector(\"#description_long\");\n div.innerHTML = data.description_long;\n div.classList.remove(\"is-hidden\");\n } else {\n div.classList.add(\"is-hidden\");\n }\n if(itemsController.hasPriceTarget) {\n if(data.price_with_vat) {\n if(data.price_with_discount) {\n let price_without_discount = data.price*(data.vat/100+1);\n itemsController.priceTarget.innerHTML = `\n \n \n ${price_without_discount.toFixed(2)} ${I18n.t(`currencies.abbr.${itemsController.currency}`)}\n \n
    \n \n ${data.price_with_vat.toFixed(2)} ${I18n.t(`currencies.abbr.${itemsController.currency}`)}\n `;\n } else {\n itemsController.priceTarget.textContent = `${data.price_with_vat.toFixed(2)} ${I18n.t(`currencies.abbr.${itemsController.currency}`)}`;\n }\n itemsController.spanPriceWithVatTarget.classList.remove('is-hidden');\n } else {\n itemsController.priceTarget.textContent = '';\n itemsController.spanPriceWithVatTarget.classList.add('is-hidden');\n }\n }\n if(data.with_stock) {\n let min = parseInt(itemsController.itemStockTarget.dataset.threshold);\n if(!min) {\n min = 0;\n }\n itemsController.itemStockTarget.classList.remove('has-text-success-dark', 'has-text-warning-dark', 'has-text-danger-dark');\n if(data.stock > min) {\n itemsController.itemStockTarget.classList.add('has-text-success-dark');\n itemsController.itemStockTarget.innerHTML = ` ${I18n.t('item.in_stock')}`\n itemsController.buttonAddToCartTarget.disabled = false;\n } else if(data.stock <= min && data.stock > 0) {\n itemsController.itemStockTarget.classList.add('has-text-warning-dark');\n itemsController.itemStockTarget.innerHTML = ` ${I18n.t('item.few_in_stock')}`\n itemsController.buttonAddToCartTarget.disabled = false;\n } else {\n itemsController.itemStockTarget.classList.add('has-text-danger-dark');\n itemsController.itemStockTarget.innerHTML = ` ${I18n.t('item.currently_not_available')}`\n itemsController.buttonAddToCartTarget.disabled = true;\n }\n itemsController.itemStockTarget.classList.remove('is-hidden');\n } else {\n itemsController.itemStockTarget.classList.add('is-hidden');\n }\n },\n error: function(data) {}\n })\n\n this.sizeVariantTargets.forEach((btn, i) => {\n if(btn.dataset.uuid == uuid) {\n btn.classList.add('has-background-secondary-dark');\n this.buttonAddToCartTarget.setAttribute(\"data-uuid\", uuid);\n } else {\n btn.classList.remove('has-background-secondary-dark');\n }\n });\n }\n\n checkQuantities() {\n if(this.unitStepsValue) {\n try {\n let d = Math.ceil(event.target.value / parseFloat(this.unitStepsValue));\n event.target.value = d * parseFloat(this.unitStepsValue);\n } catch {\n\n }\n }\n }\n}\n","var map = {\n\t\"./apple-touch-icon\": \"./app/webpacker/images/apple-touch-icon.png\",\n\t\"./apple-touch-icon-114x114\": \"./app/webpacker/images/apple-touch-icon-114x114.png\",\n\t\"./apple-touch-icon-114x114.png\": \"./app/webpacker/images/apple-touch-icon-114x114.png\",\n\t\"./apple-touch-icon-120x120\": \"./app/webpacker/images/apple-touch-icon-120x120.png\",\n\t\"./apple-touch-icon-120x120.png\": \"./app/webpacker/images/apple-touch-icon-120x120.png\",\n\t\"./apple-touch-icon-144x144\": \"./app/webpacker/images/apple-touch-icon-144x144.png\",\n\t\"./apple-touch-icon-144x144.png\": \"./app/webpacker/images/apple-touch-icon-144x144.png\",\n\t\"./apple-touch-icon-152x152\": \"./app/webpacker/images/apple-touch-icon-152x152.png\",\n\t\"./apple-touch-icon-152x152.png\": \"./app/webpacker/images/apple-touch-icon-152x152.png\",\n\t\"./apple-touch-icon-180x180\": \"./app/webpacker/images/apple-touch-icon-180x180.png\",\n\t\"./apple-touch-icon-180x180.png\": \"./app/webpacker/images/apple-touch-icon-180x180.png\",\n\t\"./apple-touch-icon-57x57\": \"./app/webpacker/images/apple-touch-icon-57x57.png\",\n\t\"./apple-touch-icon-57x57.png\": \"./app/webpacker/images/apple-touch-icon-57x57.png\",\n\t\"./apple-touch-icon-72x72\": \"./app/webpacker/images/apple-touch-icon-72x72.png\",\n\t\"./apple-touch-icon-72x72.png\": \"./app/webpacker/images/apple-touch-icon-72x72.png\",\n\t\"./apple-touch-icon-76x76\": \"./app/webpacker/images/apple-touch-icon-76x76.png\",\n\t\"./apple-touch-icon-76x76.png\": \"./app/webpacker/images/apple-touch-icon-76x76.png\",\n\t\"./apple-touch-icon.png\": \"./app/webpacker/images/apple-touch-icon.png\",\n\t\"./favicon\": \"./app/webpacker/images/favicon.png\",\n\t\"./favicon.ico\": \"./app/webpacker/images/favicon.ico\",\n\t\"./favicon.png\": \"./app/webpacker/images/favicon.png\",\n\t\"./header-logo\": \"./app/webpacker/images/header-logo.png\",\n\t\"./header-logo.png\": \"./app/webpacker/images/header-logo.png\",\n\t\"./header-logo.webp\": \"./app/webpacker/images/header-logo.webp\",\n\t\"./item-placeholder\": \"./app/webpacker/images/item-placeholder.jpg\",\n\t\"./item-placeholder.jpg\": \"./app/webpacker/images/item-placeholder.jpg\",\n\t\"./navbar-logo\": \"./app/webpacker/images/navbar-logo.png\",\n\t\"./navbar-logo.png\": \"./app/webpacker/images/navbar-logo.png\",\n\t\"./navbar-logo.webp\": \"./app/webpacker/images/navbar-logo.webp\",\n\t\"./prando-shop\": \"./app/webpacker/images/prando-shop.jpg\",\n\t\"./prando-shop.jpg\": \"./app/webpacker/images/prando-shop.jpg\",\n\t\"./social_preview\": \"./app/webpacker/images/social_preview.jpg\",\n\t\"./social_preview.jpg\": \"./app/webpacker/images/social_preview.jpg\",\n\t\"./social_preview_default\": \"./app/webpacker/images/social_preview_default.jpg\",\n\t\"./social_preview_default.jpg\": \"./app/webpacker/images/social_preview_default.jpg\",\n\t\"./start_footer\": \"./app/webpacker/images/start_footer.webp\",\n\t\"./start_footer.webp\": \"./app/webpacker/images/start_footer.webp\",\n\t\"./start_footer.webp.orig\": \"./app/webpacker/images/start_footer.webp.orig\",\n\t\"./start_footer_default\": \"./app/webpacker/images/start_footer_default.webp\",\n\t\"./start_footer_default.webp\": \"./app/webpacker/images/start_footer_default.webp\",\n\t\"./start_header\": \"./app/webpacker/images/start_header.webp\",\n\t\"./start_header.webp\": \"./app/webpacker/images/start_header.webp\",\n\t\"./start_header_default\": \"./app/webpacker/images/start_header_default.webp\",\n\t\"./start_header_default.webp\": \"./app/webpacker/images/start_header_default.webp\",\n\t\"./static-1\": \"./app/webpacker/images/static-1.jpg\",\n\t\"./static-1.jpg\": \"./app/webpacker/images/static-1.jpg\"\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/webpacker/images sync recursive ^\\\\.\\\\/.*$\";","module.exports = __webpack_public_path__ + \"media/images/apple-touch-icon-114x114-d40a0c32d6da958ff9026f4eeadc4437.png\";","module.exports = __webpack_public_path__ + \"media/images/apple-touch-icon-120x120-430deb4668cf678d19d32553381dc0ba.png\";","module.exports = __webpack_public_path__ + \"media/images/apple-touch-icon-144x144-e2c5a00aa28e6ceb85e51138fc83e2ed.png\";","module.exports = __webpack_public_path__ + \"media/images/apple-touch-icon-152x152-8a2a8cf3e69f61a572688c1afe0e1d3a.png\";","module.exports = __webpack_public_path__ + \"media/images/apple-touch-icon-180x180-551c4bb61c140caf1fc35ee3ed524eca.png\";","module.exports = __webpack_public_path__ + \"media/images/apple-touch-icon-57x57-0a7f289b50eb9aa672c46c6533209435.png\";","module.exports = __webpack_public_path__ + \"media/images/apple-touch-icon-72x72-b451f16269c122f34df112fb4d94d89d.png\";","module.exports = __webpack_public_path__ + \"media/images/apple-touch-icon-76x76-fe92a6db3f4ef916e4a436382f3c2191.png\";","module.exports = __webpack_public_path__ + \"media/images/apple-touch-icon-0a7f289b50eb9aa672c46c6533209435.png\";","module.exports = __webpack_public_path__ + \"media/images/favicon-528c53b28eaf1dbc5f05a4a8cfa6d21f.ico\";","module.exports = __webpack_public_path__ + \"media/images/favicon-b17ff0a86292b821980c59cc04744315.png\";","module.exports = __webpack_public_path__ + \"media/images/header-logo-21f8ac3395e0e71f8a40a4c8e623c96f.png\";","module.exports = __webpack_public_path__ + \"media/images/header-logo-cd0b2e8205e7388d19d4d1d42de7a828.webp\";","module.exports = __webpack_public_path__ + \"media/images/item-placeholder-ee007b2245fb443f98064b7396a9097d.jpg\";","module.exports = __webpack_public_path__ + \"media/images/navbar-logo-b113984b5f839830a1fd089cc00e133f.png\";","module.exports = __webpack_public_path__ + \"media/images/navbar-logo-cab6eb726033809a65f937fc281d3046.webp\";","module.exports = __webpack_public_path__ + \"media/images/prando-shop-f6fd211c3e78702f1f50e88f90fb17b4.jpg\";","module.exports = __webpack_public_path__ + \"media/images/social_preview-e68983459d5443e5198709e8d40f742e.jpg\";","module.exports = __webpack_public_path__ + \"media/images/social_preview_default-9f27aeb9d882e146ff2c2945b7686cff.jpg\";","module.exports = __webpack_public_path__ + \"media/images/start_footer-92ea99c6cedce47473f3b7987650047f.webp\";","module.exports = __webpack_public_path__ + \"media/images/start_footer_default-483fae834ec7448d6b865471e2789c10.webp\";","module.exports = __webpack_public_path__ + \"media/images/start_header-585b4490e605b9720d4abffd9ef048bd.webp\";","module.exports = __webpack_public_path__ + \"media/images/start_header_default-2b3670c8058939a55f9afb02eb17fa30.webp\";","module.exports = __webpack_public_path__ + \"media/images/static-1-6d3f1bed79cef8485e7616b6c51be4e2.jpg\";","var map = {\n\t\"./de.json\": \"./app/webpacker/locales/de.json\",\n\t\"./en.json\": \"./app/webpacker/locales/en.json\",\n\t\"./it.json\": \"./app/webpacker/locales/it.json\"\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/webpacker/locales sync recursive ^\\\\.\\\\/.*\\\\.json$\";","require(\"@rails/ujs\").start()\nrequire(\"turbolinks\").start()\nrequire(\"@rails/activestorage\").start()\nrequire(\"channels\");\nrequire(\"i18n-iso-countries\");\nrequire(\"pinch-zoom-js\");\nrequire(\"tinygesture\");\n\ncountries.registerLocale(require(\"../src/javascripts/i18n-iso-countries/langs/en.json\"));\ncountries.registerLocale(require(\"../src/javascripts/i18n-iso-countries/langs/de.json\"));\n\nimport Rails from '@rails/ujs';\nimport \"../src/javascripts/i18n.js.erb\";\n\nconst images = require.context('../images', true)\n//const imagePath = (name) => images(name, true)\n\nimport countries from 'i18n-iso-countries';\n\nimport \"controllers\"\n\nimport Modal from \"../src/javascripts/modal.js\";\nimport * as main from \"../src/javascripts/main.js.erb\";\n\nimport bulmaCarousel from \"bulma-carousel/dist/js/bulma-carousel.min.js\";\n\nwindow.Rails = Rails;\nwindow.countries = countries;\nwindow.main = main;\nwindow.I18n = I18n;\nwindow.Modal = Modal;\nwindow.bulmaCarousel = bulmaCarousel;\n","require(\"i18n-js\");\nlet locale = document.querySelector(\"meta[name='locale']\").getAttribute('content');\n\nimport I18n from 'i18n-js'\nvar locales = require(`locales/${locale}.json`)\nI18n.translations = locales;\nI18n.defaultLocale = 'en'\nI18n.locale = locale;\n\nwindow.I18n = I18n;\n","document.addEventListener('turbolinks:load', () => {\n\n Rails.refreshCSRFTokens();\n\n // Get all \"navbar-burger\" elements\n const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);\n\n // Check if there are any navbar burgers\n if ($navbarBurgers.length > 0) {\n\n // Add a click event on each of them\n $navbarBurgers.forEach( el => {\n el.addEventListener('click', () => {\n\n // Get the target from the \"data-target\" attribute\n const target = el.dataset.target;\n const $target = document.getElementById(target);\n\n // Toggle the \"is-active\" class on both the \"navbar-burger\" and the \"navbar-menu\"\n el.classList.toggle('is-active');\n $target.classList.toggle('is-active');\n\n });\n });\n }\n\n if (typeof gtag === \"function\") {\n if(window.location.href.match(/\\/category\\//)) {\n gtag('event', 'view_category', {'category' : window.location.href.split('/').slice(-1)});\n } else if(window.location.href.match(/\\/product\\//)) {\n gtag('event', 'view_item', {'item' : window.location.href.split('/').slice(-1)});\n } else if(window.location.href.match(/\\/page\\//)) {\n gtag('event', 'view_page', {'page' : window.location.href.split('/').slice(-1)});\n } else if(window.location.href.match(/\\/signin/)) {\n gtag('event', 'login', {});\n }\n\n document.querySelectorAll(\"a\").forEach((link) => {\n let text = link.innerText.trim();\n if(text != '') {\n text = text.replace(\" \", \"_\");\n\n link.addEventListener('click', () => {\n gtag('event', 'click', {'event_category' : 'e-commerce', 'event_label' : text});\n })\n }\n });\n }\n\n // Dropdowns\n var dropdowns = document.querySelectorAll(\".dropdown:not(.is-hoverable), .navbar-item.has-dropdown:not(.is-hoverable)\");\n\n if (dropdowns.length > 0) {\n dropdowns.forEach(function (el) {\n el.addEventListener(\"click\", function (event) {\n event.stopPropagation();\n el.classList.toggle(\"is-active\");\n });\n });\n\n document.addEventListener(\"click\", function (event) {\n dropdowns.forEach(function (el) {\n el.classList.remove(\"is-active\");\n });\n });\n }\n\n document.querySelectorAll(\".trix-content\").forEach((div, i) => {\n div.querySelectorAll('a').forEach((a, i) => {\n let domain = (new URL(a.href));\n if(domain.origin != window.location.origin) {\n a.setAttribute('target', '_blank');\n }\n });\n });\n\n});\n\nexport function fadeOut(el, timeout = 2000) {\n setTimeout(() => {\n var fadeEffect = setInterval(function () {\n if (!el.style.opacity) {\n el.style.opacity = 1;\n }\n if (el.style.opacity > 0) {\n el.style.opacity -= 0.1;\n } else {\n clearInterval(fadeEffect);\n el.classList.add('is-hidden');\n el.style.opacity = 1;\n }\n }, 50);\n }, timeout);\n\n}\n","var modal = exports;\nvar $el;\n\nfunction eventListeners($el) {\n // Add a click event on various child elements to close the parent modal\n ($el.querySelectorAll('.modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button') || []).forEach(($close) => {\n const $target = $close.closest('.modal');\n\n $close.addEventListener('click', (event) => {\n\t\t\tif(event.target.classList.contains('event-success')) {\n\t\t\t\tonSuccess();\n\t\t\t} else {\n\t\t\t\tonCancel();\n\t\t\t}\n modal.closeModal($target);\n });\n });\n\n // Add a keyboard event to close all modals\n document.addEventListener('keydown', (event) => {\n const e = event || window.event;\n\n if (e.keyCode === 27) { // Escape key\n modal.closeAllModals();\n }\n });\n}\n\nfunction onSuccess() {\n data = {};\n let section = document.querySelector(\".modal-card-body\");\n section.querySelectorAll(\"input\").forEach((inp, i) => {\n data[inp.id] = inp.value\n });\n\n const eventSuccess = new CustomEvent('success', {\n detail: data\n });\n\t$el.dispatchEvent(eventSuccess);\n}\n\nfunction onCancel() {\n const eventCancel = new Event('cancel');\n\t$el.dispatchEvent(eventCancel);\n}\n\nmodal.createModal = function(title, content, buttons = [{label: I18n.t('btn.close'), event: 'close', classes: ''}]) {\n\tlet html = `\n\t\t
    \n\t\t\t
    \n\t`\n\tif(title != '') {\n\t\thtml += `\n\t\t\t
    \n\t\t\t\t

    ${title}

    \n\t\t\t\t\n\t\t\t
    \n\t\t`\n\t}\n\thtml += `\n\t\t\t
    \n\t\t\t\t${content}\n\t\t\t
    \n\t\t\t
    \n `\n buttons.forEach((btn, i) => {\n html += ``\n });\n\n html += `\n\t\t\t
    \n\t\t
    \n\t`\n\n\tlet body = document.querySelector('body');\n\tlet modal = document.createElement('div');\n\tmodal.classList.add(\"modal\");\n\tmodal.innerHTML = html;\n\t$el = body.appendChild(modal);\n\n\treturn this;\n}\n\nmodal.openModal = function() {\n\t$el.classList.add('is-active');\n\teventListeners($el);\n\n\treturn $el;\n}\n\nmodal.closeModal = function($el) {\n\t$el.classList.remove('is-active');\n\t$el.remove();\n}\n\nmodal.closeAllModals = function () {\n\t(document.querySelectorAll('.modal') || []).forEach(($modal) => {\n\t\tmodal.closeModal($modal);\n\t});\n}\n\nmodal.addEventListener = function(event, callback) {\n\t$el.addEventListener(event, callback)\n}\n","var sparkMd5 = {\n exports: {}\n};\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\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\n function md5blk(s) {\n var md5blks = [],\n i;\n\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\n return md5blks;\n }\n\n function md5blk_array(a) {\n var md5blks = [],\n i;\n\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\n return md5blks;\n }\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\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\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\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);\n }\n\n tail[i >> 2] |= 128 << (i % 4 << 3);\n\n if (i > 55) {\n md5cycle(state, tail);\n\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\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\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\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\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\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << (i % 4 << 3);\n }\n\n tail[i >> 2] |= 128 << (i % 4 << 3);\n\n if (i > 55) {\n md5cycle(state, tail);\n\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\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\n function rhex(n) {\n var s = \"\",\n j;\n\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\n return s;\n }\n\n function hex(x) {\n var i;\n\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n\n return x.join(\"\");\n }\n\n if (hex(md51(\"hello\")) !== \"5d41402abc4b2a76b9719d911017c592\") ;\n\n if (typeof ArrayBuffer !== \"undefined\" && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = val | 0 || 0;\n\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n\n return Math.min(val, length);\n }\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\n if (to !== undefined$1) {\n end = clamp(to, length);\n }\n\n if (begin > end) {\n return new ArrayBuffer(0);\n }\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\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n\n return str;\n }\n\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n\n return returnUInt8Array ? arr : buff;\n }\n\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\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\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n\n return String.fromCharCode.apply(String, bytes);\n }\n\n function SparkMD5() {\n this.reset();\n }\n\n SparkMD5.prototype.append = function (str) {\n this.appendBinary(toUtf8(str));\n return this;\n };\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\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n\n this._buff = this._buff.substring(i - 64);\n return this;\n };\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\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3);\n }\n\n this._finish(tail, length);\n\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n return ret;\n };\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\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash.slice()\n };\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\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\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\n if (i > 55) {\n md5cycle(this._hash, tail);\n\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\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\n SparkMD5.hash = function (str, raw) {\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n SparkMD5.ArrayBuffer = function () {\n this.reset();\n };\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\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n\n this._buff = i - 64 < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n return this;\n };\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\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << (i % 4 << 3);\n }\n\n this._finish(tail, length);\n\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n return ret;\n };\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\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\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n return SparkMD5.prototype.setState.call(this, state);\n };\n\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n\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\n return SparkMD5;\n });\n})(sparkMd5);\n\nvar SparkMD5 = sparkMd5.exports;\nconst fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;\n\nclass FileChecksum {\n static create(file, callback) {\n const instance = new FileChecksum(file);\n instance.create(callback);\n }\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\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\n fileReaderDidLoad(event) {\n this.md5Buffer.append(event.target.result);\n\n if (!this.readNextChunk()) {\n const binaryDigest = this.md5Buffer.end(true);\n const base64digest = btoa(binaryDigest);\n this.callback(null, base64digest);\n }\n }\n\n fileReaderDidError(event) {\n this.callback(`Error reading ${this.file.name}`);\n }\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\n}\n\nfunction getMetaValue(name) {\n const element = findElement(document.head, `meta[name=\"${name}\"]`);\n\n if (element) {\n return element.getAttribute(\"content\");\n }\n}\n\nfunction findElements(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n\n const elements = root.querySelectorAll(selector);\n return toArray(elements);\n}\n\nfunction findElement(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n\n return root.querySelector(selector);\n}\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\n try {\n element.disabled = false;\n element.dispatchEvent(event);\n } finally {\n element.disabled = disabled;\n }\n\n return event;\n}\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}\n\nclass BlobRecord {\n constructor(file, checksum, url) {\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 const csrfToken = getMetaValue(\"csrf-token\");\n\n if (csrfToken != undefined) {\n this.xhr.setRequestHeader(\"X-CSRF-Token\", csrfToken);\n }\n\n this.xhr.addEventListener(\"load\", event => this.requestDidLoad(event));\n this.xhr.addEventListener(\"error\", event => this.requestDidError(event));\n }\n\n get status() {\n return this.xhr.status;\n }\n\n get response() {\n const _this$xhr = this.xhr,\n responseType = _this$xhr.responseType,\n response = _this$xhr.response;\n\n if (responseType == \"json\") {\n return response;\n } else {\n return JSON.parse(response);\n }\n }\n\n create(callback) {\n this.callback = callback;\n this.xhr.send(JSON.stringify({\n blob: this.attributes\n }));\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\n requestDidError(event) {\n this.callback(`Error creating Blob for \"${this.file.name}\". Status: ${this.status}`);\n }\n\n toJSON() {\n const result = {};\n\n for (const key in this.attributes) {\n result[key] = this.attributes[key];\n }\n\n return result;\n }\n\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\n for (const key in headers) {\n this.xhr.setRequestHeader(key, headers[key]);\n }\n\n this.xhr.addEventListener(\"load\", event => this.requestDidLoad(event));\n this.xhr.addEventListener(\"error\", event => this.requestDidError(event));\n }\n\n create(callback) {\n this.callback = callback;\n this.xhr.send(this.file.slice());\n }\n\n requestDidLoad(event) {\n const _this$xhr2 = this.xhr,\n status = _this$xhr2.status,\n response = _this$xhr2.response;\n\n if (status >= 200 && status < 300) {\n this.callback(null, response);\n } else {\n this.requestDidError(event);\n }\n }\n\n requestDidError(event) {\n this.callback(`Error storing \"${this.file.name}\". Status: ${this.xhr.status}`);\n }\n\n}\n\nlet id = 0;\n\nclass DirectUpload {\n constructor(file, url, delegate) {\n this.id = ++id;\n this.file = file;\n this.url = url;\n this.delegate = delegate;\n }\n\n create(callback) {\n FileChecksum.create(this.file, (error, checksum) => {\n if (error) {\n callback(error);\n return;\n }\n\n const blob = new BlobRecord(this.file, checksum, this.url);\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\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\n return object[methodName](...messages);\n }\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\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\n this.dispatch(\"end\");\n callback(error);\n });\n }\n\n uploadRequestDidProgress(event) {\n const progress = event.loaded / event.total * 100;\n\n if (progress) {\n this.dispatch(\"progress\", {\n progress: progress\n });\n }\n }\n\n get url() {\n return this.input.getAttribute(\"data-direct-upload-url\");\n }\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\n dispatchError(error) {\n const event = this.dispatch(\"error\", {\n error: error\n });\n\n if (!event.defaultPrevented) {\n alert(error);\n }\n }\n\n directUploadWillCreateBlobWithXHR(xhr) {\n this.dispatch(\"before-blob-request\", {\n xhr: xhr\n });\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\n}\n\nconst inputSelector = \"input[type=file][data-direct-upload-url]:not([disabled])\";\n\nclass DirectUploadsController {\n constructor(form) {\n this.form = form;\n this.inputs = findElements(form, inputSelector).filter(input => input.files.length);\n }\n\n start(callback) {\n const controllers = this.createDirectUploadControllers();\n\n const startNextController = () => {\n const controller = controllers.shift();\n\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\n this.dispatch(\"start\");\n startNextController();\n }\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\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\n}\n\nconst processingAttribute = \"data-direct-uploads-processing\";\nconst submitButtonsByForm = new WeakMap();\nlet started = false;\n\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}\n\nfunction didClick(event) {\n const target = event.target;\n\n if ((target.tagName == \"INPUT\" || target.tagName == \"BUTTON\") && target.type == \"submit\" && target.form) {\n submitButtonsByForm.set(target.form, target);\n }\n}\n\nfunction didSubmitForm(event) {\n handleFormSubmissionEvent(event);\n}\n\nfunction didSubmitRemoteElement(event) {\n if (event.target.tagName == \"FORM\") {\n handleFormSubmissionEvent(event);\n }\n}\n\nfunction handleFormSubmissionEvent(event) {\n const form = event.target;\n\n if (form.hasAttribute(processingAttribute)) {\n event.preventDefault();\n return;\n }\n\n const controller = new DirectUploadsController(form);\n const inputs = controller.inputs;\n\n if (inputs.length) {\n event.preventDefault();\n form.setAttribute(processingAttribute, \"\");\n inputs.forEach(disable);\n controller.start(error => {\n form.removeAttribute(processingAttribute);\n\n if (error) {\n inputs.forEach(enable);\n } else {\n submitForm(form);\n }\n });\n }\n}\n\nfunction submitForm(form) {\n let button = submitButtonsByForm.get(form) || findElement(form, \"input[type=submit], button[type=submit]\");\n\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\n submitButtonsByForm.delete(form);\n}\n\nfunction disable(input) {\n input.disabled = true;\n}\n\nfunction enable(input) {\n input.disabled = false;\n}\n\nfunction autostart() {\n if (window.ActiveStorage) {\n start();\n }\n}\n\nsetTimeout(autostart, 1);\nexport { DirectUpload, start };","/*\nUnobtrusive JavaScript\nhttps://github.com/rails/rails/blob/main/actionview/app/assets/javascripts\nReleased under the MIT license\n */\n;\n(function () {\n var context = this;\n (function () {\n (function () {\n this.Rails = {\n linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',\n buttonClickSelector: {\n selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',\n exclude: 'form button'\n },\n inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',\n formSubmitSelector: 'form:not([data-turbo=true])',\n formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',\n formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',\n formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',\n fileInputSelector: 'input[name][type=file]:not([disabled])',\n linkDisableSelector: 'a[data-disable-with], a[data-disable]',\n buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'\n };\n }).call(this);\n }).call(context);\n var Rails = context.Rails;\n (function () {\n (function () {\n var nonce;\n nonce = null;\n\n Rails.loadCSPNonce = function () {\n var ref;\n return nonce = (ref = document.querySelector(\"meta[name=csp-nonce]\")) != null ? ref.content : void 0;\n };\n\n Rails.cspNonce = function () {\n return nonce != null ? nonce : Rails.loadCSPNonce();\n };\n }).call(this);\n (function () {\n var expando, m;\n m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n\n Rails.matches = function (element, selector) {\n if (selector.exclude != null) {\n return m.call(element, selector.selector) && !m.call(element, selector.exclude);\n } else {\n return m.call(element, selector);\n }\n };\n\n expando = '_ujsData';\n\n Rails.getData = function (element, key) {\n var ref;\n return (ref = element[expando]) != null ? ref[key] : void 0;\n };\n\n Rails.setData = function (element, key, value) {\n if (element[expando] == null) {\n element[expando] = {};\n }\n\n return element[expando][key] = value;\n };\n\n Rails.$ = function (selector) {\n return Array.prototype.slice.call(document.querySelectorAll(selector));\n };\n }).call(this);\n (function () {\n var $, csrfParam, csrfToken;\n $ = Rails.$;\n\n csrfToken = Rails.csrfToken = function () {\n var meta;\n meta = document.querySelector('meta[name=csrf-token]');\n return meta && meta.content;\n };\n\n csrfParam = Rails.csrfParam = function () {\n var meta;\n meta = document.querySelector('meta[name=csrf-param]');\n return meta && meta.content;\n };\n\n Rails.CSRFProtection = function (xhr) {\n var token;\n token = csrfToken();\n\n if (token != null) {\n return xhr.setRequestHeader('X-CSRF-Token', token);\n }\n };\n\n Rails.refreshCSRFTokens = function () {\n var param, token;\n token = csrfToken();\n param = csrfParam();\n\n if (token != null && param != null) {\n return $('form input[name=\"' + param + '\"]').forEach(function (input) {\n return input.value = token;\n });\n }\n };\n }).call(this);\n (function () {\n var CustomEvent, fire, matches, preventDefault;\n matches = Rails.matches;\n CustomEvent = window.CustomEvent;\n\n if (typeof CustomEvent !== 'function') {\n CustomEvent = function (event, params) {\n var evt;\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n preventDefault = CustomEvent.prototype.preventDefault;\n\n CustomEvent.prototype.preventDefault = function () {\n var result;\n result = preventDefault.call(this);\n\n if (this.cancelable && !this.defaultPrevented) {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function () {\n return true;\n }\n });\n }\n\n return result;\n };\n }\n\n fire = Rails.fire = function (obj, name, data) {\n var event;\n event = new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail: data\n });\n obj.dispatchEvent(event);\n return !event.defaultPrevented;\n };\n\n Rails.stopEverything = function (e) {\n fire(e.target, 'ujs:everythingStopped');\n e.preventDefault();\n e.stopPropagation();\n return e.stopImmediatePropagation();\n };\n\n Rails.delegate = function (element, selector, eventType, handler) {\n return element.addEventListener(eventType, function (e) {\n var target;\n target = e.target;\n\n while (!(!(target instanceof Element) || matches(target, selector))) {\n target = target.parentNode;\n }\n\n if (target instanceof Element && handler.call(target, e) === false) {\n e.preventDefault();\n return e.stopPropagation();\n }\n });\n };\n }).call(this);\n (function () {\n var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;\n cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;\n AcceptHeaders = {\n '*': '*/*',\n text: 'text/plain',\n html: 'text/html',\n xml: 'application/xml, text/xml',\n json: 'application/json, text/javascript',\n script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'\n };\n\n Rails.ajax = function (options) {\n var xhr;\n options = prepareOptions(options);\n xhr = createXHR(options, function () {\n var ref, response;\n response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));\n\n if (Math.floor(xhr.status / 100) === 2) {\n if (typeof options.success === \"function\") {\n options.success(response, xhr.statusText, xhr);\n }\n } else {\n if (typeof options.error === \"function\") {\n options.error(response, xhr.statusText, xhr);\n }\n }\n\n return typeof options.complete === \"function\" ? options.complete(xhr, xhr.statusText) : void 0;\n });\n\n if (options.beforeSend != null && !options.beforeSend(xhr, options)) {\n return false;\n }\n\n if (xhr.readyState === XMLHttpRequest.OPENED) {\n return xhr.send(options.data);\n }\n };\n\n prepareOptions = function (options) {\n options.url = options.url || location.href;\n options.type = options.type.toUpperCase();\n\n if (options.type === 'GET' && options.data) {\n if (options.url.indexOf('?') < 0) {\n options.url += '?' + options.data;\n } else {\n options.url += '&' + options.data;\n }\n }\n\n if (AcceptHeaders[options.dataType] == null) {\n options.dataType = '*';\n }\n\n options.accept = AcceptHeaders[options.dataType];\n\n if (options.dataType !== '*') {\n options.accept += ', */*; q=0.01';\n }\n\n return options;\n };\n\n createXHR = function (options, done) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.open(options.type, options.url, true);\n xhr.setRequestHeader('Accept', options.accept);\n\n if (typeof options.data === 'string') {\n xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n }\n\n if (!options.crossDomain) {\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n CSRFProtection(xhr);\n }\n\n xhr.withCredentials = !!options.withCredentials;\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n return done(xhr);\n }\n };\n\n return xhr;\n };\n\n processResponse = function (response, type) {\n var parser, script;\n\n if (typeof response === 'string' && typeof type === 'string') {\n if (type.match(/\\bjson\\b/)) {\n try {\n response = JSON.parse(response);\n } catch (error) {}\n } else if (type.match(/\\b(?:java|ecma)script\\b/)) {\n script = document.createElement('script');\n script.setAttribute('nonce', cspNonce());\n script.text = response;\n document.head.appendChild(script).parentNode.removeChild(script);\n } else if (type.match(/\\b(xml|html|svg)\\b/)) {\n parser = new DOMParser();\n type = type.replace(/;.+/, '');\n\n try {\n response = parser.parseFromString(response, type);\n } catch (error) {}\n }\n }\n\n return response;\n };\n\n Rails.href = function (element) {\n return element.href;\n };\n\n Rails.isCrossDomain = function (url) {\n var e, originAnchor, urlAnchor;\n originAnchor = document.createElement('a');\n originAnchor.href = location.href;\n urlAnchor = document.createElement('a');\n\n try {\n urlAnchor.href = url;\n return !((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host || originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host);\n } catch (error) {\n e = error;\n return true;\n }\n };\n }).call(this);\n (function () {\n var matches, toArray;\n matches = Rails.matches;\n\n toArray = function (e) {\n return Array.prototype.slice.call(e);\n };\n\n Rails.serializeElement = function (element, additionalParam) {\n var inputs, params;\n inputs = [element];\n\n if (matches(element, 'form')) {\n inputs = toArray(element.elements);\n }\n\n params = [];\n inputs.forEach(function (input) {\n if (!input.name || input.disabled) {\n return;\n }\n\n if (matches(input, 'fieldset[disabled] *')) {\n return;\n }\n\n if (matches(input, 'select')) {\n return toArray(input.options).forEach(function (option) {\n if (option.selected) {\n return params.push({\n name: input.name,\n value: option.value\n });\n }\n });\n } else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {\n return params.push({\n name: input.name,\n value: input.value\n });\n }\n });\n\n if (additionalParam) {\n params.push(additionalParam);\n }\n\n return params.map(function (param) {\n if (param.name != null) {\n return encodeURIComponent(param.name) + \"=\" + encodeURIComponent(param.value);\n } else {\n return param;\n }\n }).join('&');\n };\n\n Rails.formElements = function (form, selector) {\n if (matches(form, 'form')) {\n return toArray(form.elements).filter(function (el) {\n return matches(el, selector);\n });\n } else {\n return toArray(form.querySelectorAll(selector));\n }\n };\n }).call(this);\n (function () {\n var allowAction, fire, stopEverything;\n fire = Rails.fire, stopEverything = Rails.stopEverything;\n\n Rails.handleConfirm = function (e) {\n if (!allowAction(this)) {\n return stopEverything(e);\n }\n };\n\n Rails.confirm = function (message, element) {\n return confirm(message);\n };\n\n allowAction = function (element) {\n var answer, callback, message;\n message = element.getAttribute('data-confirm');\n\n if (!message) {\n return true;\n }\n\n answer = false;\n\n if (fire(element, 'confirm')) {\n try {\n answer = Rails.confirm(message, element);\n } catch (error) {}\n\n callback = fire(element, 'confirm:complete', [answer]);\n }\n\n return answer && callback;\n };\n }).call(this);\n (function () {\n var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isXhrRedirect, matches, setData, stopEverything;\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;\n\n Rails.handleDisabledElement = function (e) {\n var element;\n element = this;\n\n if (element.disabled) {\n return stopEverything(e);\n }\n };\n\n Rails.enableElement = function (e) {\n var element;\n\n if (e instanceof Event) {\n if (isXhrRedirect(e)) {\n return;\n }\n\n element = e.target;\n } else {\n element = e;\n }\n\n if (matches(element, Rails.linkDisableSelector)) {\n return enableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {\n return enableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return enableFormElements(element);\n }\n };\n\n Rails.disableElement = function (e) {\n var element;\n element = e instanceof Event ? e.target : e;\n\n if (matches(element, Rails.linkDisableSelector)) {\n return disableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {\n return disableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return disableFormElements(element);\n }\n };\n\n disableLinkElement = function (element) {\n var replacement;\n\n if (getData(element, 'ujs:disabled')) {\n return;\n }\n\n replacement = element.getAttribute('data-disable-with');\n\n if (replacement != null) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n }\n\n element.addEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', true);\n };\n\n enableLinkElement = function (element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n\n if (originalText != null) {\n element.innerHTML = originalText;\n setData(element, 'ujs:enable-with', null);\n }\n\n element.removeEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', null);\n };\n\n disableFormElements = function (form) {\n return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);\n };\n\n disableFormElement = function (element) {\n var replacement;\n\n if (getData(element, 'ujs:disabled')) {\n return;\n }\n\n replacement = element.getAttribute('data-disable-with');\n\n if (replacement != null) {\n if (matches(element, 'button')) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n } else {\n setData(element, 'ujs:enable-with', element.value);\n element.value = replacement;\n }\n }\n\n element.disabled = true;\n return setData(element, 'ujs:disabled', true);\n };\n\n enableFormElements = function (form) {\n return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);\n };\n\n enableFormElement = function (element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n\n if (originalText != null) {\n if (matches(element, 'button')) {\n element.innerHTML = originalText;\n } else {\n element.value = originalText;\n }\n\n setData(element, 'ujs:enable-with', null);\n }\n\n element.disabled = false;\n return setData(element, 'ujs:disabled', null);\n };\n\n isXhrRedirect = function (event) {\n var ref, xhr;\n xhr = (ref = event.detail) != null ? ref[0] : void 0;\n return (xhr != null ? xhr.getResponseHeader(\"X-Xhr-Redirect\") : void 0) != null;\n };\n }).call(this);\n (function () {\n var stopEverything;\n stopEverything = Rails.stopEverything;\n\n Rails.handleMethod = function (e) {\n var csrfParam, csrfToken, form, formContent, href, link, method;\n link = this;\n method = link.getAttribute('data-method');\n\n if (!method) {\n return;\n }\n\n href = Rails.href(link);\n csrfToken = Rails.csrfToken();\n csrfParam = Rails.csrfParam();\n form = document.createElement('form');\n formContent = \"\";\n\n if (csrfParam != null && csrfToken != null && !Rails.isCrossDomain(href)) {\n formContent += \"\";\n }\n\n formContent += '';\n form.method = 'post';\n form.action = href;\n form.target = link.target;\n form.innerHTML = formContent;\n form.style.display = 'none';\n document.body.appendChild(form);\n form.querySelector('[type=\"submit\"]').click();\n return stopEverything(e);\n };\n }).call(this);\n (function () {\n var ajax,\n fire,\n getData,\n isCrossDomain,\n isRemote,\n matches,\n serializeElement,\n setData,\n stopEverything,\n slice = [].slice;\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement;\n\n isRemote = function (element) {\n var value;\n value = element.getAttribute('data-remote');\n return value != null && value !== 'false';\n };\n\n Rails.handleRemote = function (e) {\n var button, data, dataType, element, method, url, withCredentials;\n element = this;\n\n if (!isRemote(element)) {\n return true;\n }\n\n if (!fire(element, 'ajax:before')) {\n fire(element, 'ajax:stopped');\n return false;\n }\n\n withCredentials = element.getAttribute('data-with-credentials');\n dataType = element.getAttribute('data-type') || 'script';\n\n if (matches(element, Rails.formSubmitSelector)) {\n button = getData(element, 'ujs:submit-button');\n method = getData(element, 'ujs:submit-button-formmethod') || element.method;\n url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;\n\n if (method.toUpperCase() === 'GET') {\n url = url.replace(/\\?.*$/, '');\n }\n\n if (element.enctype === 'multipart/form-data') {\n data = new FormData(element);\n\n if (button != null) {\n data.append(button.name, button.value);\n }\n } else {\n data = serializeElement(element, button);\n }\n\n setData(element, 'ujs:submit-button', null);\n setData(element, 'ujs:submit-button-formmethod', null);\n setData(element, 'ujs:submit-button-formaction', null);\n } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {\n method = element.getAttribute('data-method');\n url = element.getAttribute('data-url');\n data = serializeElement(element, element.getAttribute('data-params'));\n } else {\n method = element.getAttribute('data-method');\n url = Rails.href(element);\n data = element.getAttribute('data-params');\n }\n\n ajax({\n type: method || 'GET',\n url: url,\n data: data,\n dataType: dataType,\n beforeSend: function (xhr, options) {\n if (fire(element, 'ajax:beforeSend', [xhr, options])) {\n return fire(element, 'ajax:send', [xhr]);\n } else {\n fire(element, 'ajax:stopped');\n return false;\n }\n },\n success: function () {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:success', args);\n },\n error: function () {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:error', args);\n },\n complete: function () {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:complete', args);\n },\n crossDomain: isCrossDomain(url),\n withCredentials: withCredentials != null && withCredentials !== 'false'\n });\n return stopEverything(e);\n };\n\n Rails.formSubmitButtonClick = function (e) {\n var button, form;\n button = this;\n form = button.form;\n\n if (!form) {\n return;\n }\n\n if (button.name) {\n setData(form, 'ujs:submit-button', {\n name: button.name,\n value: button.value\n });\n }\n\n setData(form, 'ujs:formnovalidate-button', button.formNoValidate);\n setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));\n return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));\n };\n\n Rails.preventInsignificantClick = function (e) {\n var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;\n link = this;\n method = (link.getAttribute('data-method') || 'GET').toUpperCase();\n data = link.getAttribute('data-params');\n metaClick = e.metaKey || e.ctrlKey;\n insignificantMetaClick = metaClick && method === 'GET' && !data;\n nonPrimaryMouseClick = e.button != null && e.button !== 0;\n\n if (nonPrimaryMouseClick || insignificantMetaClick) {\n return e.stopImmediatePropagation();\n }\n };\n }).call(this);\n (function () {\n var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;\n fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;\n\n if (typeof jQuery !== \"undefined\" && jQuery !== null && jQuery.ajax != null) {\n if (jQuery.rails) {\n throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');\n }\n\n jQuery.rails = Rails;\n jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {\n if (!options.crossDomain) {\n return CSRFProtection(xhr);\n }\n });\n }\n\n Rails.start = function () {\n if (window._rails_loaded) {\n throw new Error('rails-ujs has already been loaded!');\n }\n\n window.addEventListener('pageshow', function () {\n $(Rails.formEnableSelector).forEach(function (el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n return $(Rails.linkDisableSelector).forEach(function (el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n });\n delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.linkClickSelector, 'click', handleConfirm);\n delegate(document, Rails.linkClickSelector, 'click', disableElement);\n delegate(document, Rails.linkClickSelector, 'click', handleRemote);\n delegate(document, Rails.linkClickSelector, 'click', handleMethod);\n delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);\n delegate(document, Rails.buttonClickSelector, 'click', disableElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleRemote);\n delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);\n delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);\n delegate(document, Rails.inputChangeSelector, 'change', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);\n delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);\n delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', function (e) {\n return setTimeout(function () {\n return disableElement(e);\n }, 13);\n });\n delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);\n delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);\n delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);\n document.addEventListener('DOMContentLoaded', refreshCSRFTokens);\n document.addEventListener('DOMContentLoaded', loadCSPNonce);\n return window._rails_loaded = true;\n };\n\n if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {\n Rails.start();\n }\n }).call(this);\n }).call(this);\n\n if (typeof module === \"object\" && module.exports) {\n module.exports = Rails;\n } else if (typeof define === \"function\" && define.amd) {\n define(Rails);\n }\n}).call(this);","import { parseActionDescriptorString, stringifyEventTarget } from \"./action_descriptor\";\n\nvar Action =\n/** @class */\nfunction () {\n function Action(element, index, descriptor) {\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 }\n\n Action.forToken = function (token) {\n return new this(token.element, token.index, parseActionDescriptorString(token.content));\n };\n\n Action.prototype.toString = function () {\n var eventNameSuffix = this.eventTargetName ? \"@\" + this.eventTargetName : \"\";\n return \"\" + this.eventName + eventNameSuffix + \"->\" + this.identifier + \"#\" + this.methodName;\n };\n\n Object.defineProperty(Action.prototype, \"eventTargetName\", {\n get: function () {\n return stringifyEventTarget(this.eventTarget);\n },\n enumerable: false,\n configurable: true\n });\n return Action;\n}();\n\nexport { Action };\nvar defaultEventNames = {\n \"a\": function (e) {\n return \"click\";\n },\n \"button\": function (e) {\n return \"click\";\n },\n \"form\": function (e) {\n return \"submit\";\n },\n \"input\": function (e) {\n return e.getAttribute(\"type\") == \"submit\" ? \"click\" : \"input\";\n },\n \"select\": function (e) {\n return \"change\";\n },\n \"textarea\": function (e) {\n return \"input\";\n }\n};\nexport function getDefaultEventNameForElement(element) {\n var tagName = element.tagName.toLowerCase();\n\n if (tagName in defaultEventNames) {\n return defaultEventNames[tagName](element);\n }\n}\n\nfunction error(message) {\n throw new Error(message);\n}","// capture nos.: 12 23 4 43 1 5 56 7 768 9 98\nvar descriptorPattern = /^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;\nexport function parseActionDescriptorString(descriptorString) {\n var source = descriptorString.trim();\n var matches = source.match(descriptorPattern) || [];\n return {\n eventTarget: parseEventTarget(matches[4]),\n eventName: matches[2],\n eventOptions: matches[9] ? parseEventOptions(matches[9]) : {},\n identifier: matches[5],\n methodName: matches[7]\n };\n}\n\nfunction parseEventTarget(eventTargetName) {\n if (eventTargetName == \"window\") {\n return window;\n } else if (eventTargetName == \"document\") {\n return document;\n }\n}\n\nfunction parseEventOptions(eventOptions) {\n return eventOptions.split(\":\").reduce(function (options, token) {\n var _a;\n\n return Object.assign(options, (_a = {}, _a[token.replace(/^!/, \"\")] = !/^!/.test(token), _a));\n }, {});\n}\n\nexport function stringifyEventTarget(eventTarget) {\n if (eventTarget == window) {\n return \"window\";\n } else if (eventTarget == document) {\n return \"document\";\n }\n}","var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function () {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n\nvar __spreadArrays = this && this.__spreadArrays || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n\n return r;\n};\n\nimport { Dispatcher } from \"./dispatcher\";\nimport { Router } from \"./router\";\nimport { defaultSchema } from \"./schema\";\n\nvar Application =\n/** @class */\nfunction () {\n function Application(element, schema) {\n if (element === void 0) {\n element = document.documentElement;\n }\n\n if (schema === void 0) {\n schema = defaultSchema;\n }\n\n this.logger = console;\n this.element = element;\n this.schema = schema;\n this.dispatcher = new Dispatcher(this);\n this.router = new Router(this);\n }\n\n Application.start = function (element, schema) {\n var application = new Application(element, schema);\n application.start();\n return application;\n };\n\n Application.prototype.start = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , domReady()];\n\n case 1:\n _a.sent();\n\n this.dispatcher.start();\n this.router.start();\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n Application.prototype.stop = function () {\n this.dispatcher.stop();\n this.router.stop();\n };\n\n Application.prototype.register = function (identifier, controllerConstructor) {\n this.load({\n identifier: identifier,\n controllerConstructor: controllerConstructor\n });\n };\n\n Application.prototype.load = function (head) {\n var _this = this;\n\n var rest = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments[_i];\n }\n\n var definitions = Array.isArray(head) ? head : __spreadArrays([head], rest);\n definitions.forEach(function (definition) {\n return _this.router.loadDefinition(definition);\n });\n };\n\n Application.prototype.unload = function (head) {\n var _this = this;\n\n var rest = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments[_i];\n }\n\n var identifiers = Array.isArray(head) ? head : __spreadArrays([head], rest);\n identifiers.forEach(function (identifier) {\n return _this.router.unloadIdentifier(identifier);\n });\n };\n\n Object.defineProperty(Application.prototype, \"controllers\", {\n // Controllers\n get: function () {\n return this.router.contexts.map(function (context) {\n return context.controller;\n });\n },\n enumerable: false,\n configurable: true\n });\n\n Application.prototype.getControllerForElementAndIdentifier = function (element, identifier) {\n var context = this.router.getContextForElementAndIdentifier(element, identifier);\n return context ? context.controller : null;\n }; // Error handling\n\n\n Application.prototype.handleError = function (error, message, detail) {\n this.logger.error(\"%s\\n\\n%o\\n\\n%o\", message, error, detail);\n };\n\n return Application;\n}();\n\nexport { Application };\n\nfunction domReady() {\n return new Promise(function (resolve) {\n if (document.readyState == \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", resolve);\n } else {\n resolve();\n }\n });\n}","var Binding =\n/** @class */\nfunction () {\n function Binding(context, action) {\n this.context = context;\n this.action = action;\n }\n\n Object.defineProperty(Binding.prototype, \"index\", {\n get: function () {\n return this.action.index;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"eventTarget\", {\n get: function () {\n return this.action.eventTarget;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"eventOptions\", {\n get: function () {\n return this.action.eventOptions;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"identifier\", {\n get: function () {\n return this.context.identifier;\n },\n enumerable: false,\n configurable: true\n });\n\n Binding.prototype.handleEvent = function (event) {\n if (this.willBeInvokedByEvent(event)) {\n this.invokeWithEvent(event);\n }\n };\n\n Object.defineProperty(Binding.prototype, \"eventName\", {\n get: function () {\n return this.action.eventName;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"method\", {\n get: function () {\n var method = this.controller[this.methodName];\n\n if (typeof method == \"function\") {\n return method;\n }\n\n throw new Error(\"Action \\\"\" + this.action + \"\\\" references undefined method \\\"\" + this.methodName + \"\\\"\");\n },\n enumerable: false,\n configurable: true\n });\n\n Binding.prototype.invokeWithEvent = function (event) {\n try {\n this.method.call(this.controller, event);\n } catch (error) {\n var _a = this,\n identifier = _a.identifier,\n controller = _a.controller,\n element = _a.element,\n index = _a.index;\n\n var detail = {\n identifier: identifier,\n controller: controller,\n element: element,\n index: index,\n event: event\n };\n this.context.handleError(error, \"invoking action \\\"\" + this.action + \"\\\"\", detail);\n }\n };\n\n Binding.prototype.willBeInvokedByEvent = function (event) {\n var eventTarget = event.target;\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\n Object.defineProperty(Binding.prototype, \"controller\", {\n get: function () {\n return this.context.controller;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"methodName\", {\n get: function () {\n return this.action.methodName;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"scope\", {\n get: function () {\n return this.context.scope;\n },\n enumerable: false,\n configurable: true\n });\n return Binding;\n}();\n\nexport { Binding };","import { Action } from \"./action\";\nimport { Binding } from \"./binding\";\nimport { ValueListObserver } from \"@stimulus/mutation-observers\";\n\nvar BindingObserver =\n/** @class */\nfunction () {\n function BindingObserver(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.bindingsByAction = new Map();\n }\n\n BindingObserver.prototype.start = function () {\n if (!this.valueListObserver) {\n this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this);\n this.valueListObserver.start();\n }\n };\n\n BindingObserver.prototype.stop = function () {\n if (this.valueListObserver) {\n this.valueListObserver.stop();\n delete this.valueListObserver;\n this.disconnectAllActions();\n }\n };\n\n Object.defineProperty(BindingObserver.prototype, \"element\", {\n get: function () {\n return this.context.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"identifier\", {\n get: function () {\n return this.context.identifier;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"actionAttribute\", {\n get: function () {\n return this.schema.actionAttribute;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"schema\", {\n get: function () {\n return this.context.schema;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"bindings\", {\n get: function () {\n return Array.from(this.bindingsByAction.values());\n },\n enumerable: false,\n configurable: true\n });\n\n BindingObserver.prototype.connectAction = function (action) {\n var binding = new Binding(this.context, action);\n this.bindingsByAction.set(action, binding);\n this.delegate.bindingConnected(binding);\n };\n\n BindingObserver.prototype.disconnectAction = function (action) {\n var binding = this.bindingsByAction.get(action);\n\n if (binding) {\n this.bindingsByAction.delete(action);\n this.delegate.bindingDisconnected(binding);\n }\n };\n\n BindingObserver.prototype.disconnectAllActions = function () {\n var _this = this;\n\n this.bindings.forEach(function (binding) {\n return _this.delegate.bindingDisconnected(binding);\n });\n this.bindingsByAction.clear();\n }; // Value observer delegate\n\n\n BindingObserver.prototype.parseValueForToken = function (token) {\n var action = Action.forToken(token);\n\n if (action.identifier == this.identifier) {\n return action;\n }\n };\n\n BindingObserver.prototype.elementMatchedValue = function (element, action) {\n this.connectAction(action);\n };\n\n BindingObserver.prototype.elementUnmatchedValue = function (element, action) {\n this.disconnectAction(action);\n };\n\n return BindingObserver;\n}();\n\nexport { BindingObserver };","var __extends = this && this.__extends || function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n };\n\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nvar __spreadArrays = this && this.__spreadArrays || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n\n return r;\n};\n\nimport { readInheritableStaticArrayValues } from \"./inheritable_statics\";\n/** @hidden */\n\nexport function bless(constructor) {\n return shadow(constructor, getBlessedProperties(constructor));\n}\n\nfunction shadow(constructor, properties) {\n var shadowConstructor = extend(constructor);\n var shadowProperties = getShadowProperties(constructor.prototype, properties);\n Object.defineProperties(shadowConstructor.prototype, shadowProperties);\n return shadowConstructor;\n}\n\nfunction getBlessedProperties(constructor) {\n var blessings = readInheritableStaticArrayValues(constructor, \"blessings\");\n return blessings.reduce(function (blessedProperties, blessing) {\n var properties = blessing(constructor);\n\n for (var key in properties) {\n var descriptor = blessedProperties[key] || {};\n blessedProperties[key] = Object.assign(descriptor, properties[key]);\n }\n\n return blessedProperties;\n }, {});\n}\n\nfunction getShadowProperties(prototype, properties) {\n return getOwnKeys(properties).reduce(function (shadowProperties, key) {\n var _a;\n\n var descriptor = getShadowedDescriptor(prototype, properties, key);\n\n if (descriptor) {\n Object.assign(shadowProperties, (_a = {}, _a[key] = descriptor, _a));\n }\n\n return shadowProperties;\n }, {});\n}\n\nfunction getShadowedDescriptor(prototype, properties, key) {\n var shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key);\n var shadowedByValue = shadowingDescriptor && \"value\" in shadowingDescriptor;\n\n if (!shadowedByValue) {\n var descriptor = Object.getOwnPropertyDescriptor(properties, key).value;\n\n if (shadowingDescriptor) {\n descriptor.get = shadowingDescriptor.get || descriptor.get;\n descriptor.set = shadowingDescriptor.set || descriptor.set;\n }\n\n return descriptor;\n }\n}\n\nvar getOwnKeys = function () {\n if (typeof Object.getOwnPropertySymbols == \"function\") {\n return function (object) {\n return __spreadArrays(Object.getOwnPropertyNames(object), Object.getOwnPropertySymbols(object));\n };\n } else {\n return Object.getOwnPropertyNames;\n }\n}();\n\nvar extend = function () {\n function extendWithReflect(constructor) {\n function extended() {\n var _newTarget = this && this instanceof extended ? this.constructor : void 0;\n\n return Reflect.construct(constructor, arguments, _newTarget);\n }\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\n function testReflectExtension() {\n var a = function () {\n this.a.call(this);\n };\n\n var b = extendWithReflect(a);\n\n b.prototype.a = function () {};\n\n return new b();\n }\n\n try {\n testReflectExtension();\n return extendWithReflect;\n } catch (error) {\n return function (constructor) {\n return (\n /** @class */\n function (_super) {\n __extends(extended, _super);\n\n function extended() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n return extended;\n }(constructor)\n );\n };\n }\n}();","var ClassMap =\n/** @class */\nfunction () {\n function ClassMap(scope) {\n this.scope = scope;\n }\n\n ClassMap.prototype.has = function (name) {\n return this.data.has(this.getDataKey(name));\n };\n\n ClassMap.prototype.get = function (name) {\n return this.data.get(this.getDataKey(name));\n };\n\n ClassMap.prototype.getAttributeName = function (name) {\n return this.data.getAttributeNameForKey(this.getDataKey(name));\n };\n\n ClassMap.prototype.getDataKey = function (name) {\n return name + \"-class\";\n };\n\n Object.defineProperty(ClassMap.prototype, \"data\", {\n get: function () {\n return this.scope.data;\n },\n enumerable: false,\n configurable: true\n });\n return ClassMap;\n}();\n\nexport { ClassMap };","import { readInheritableStaticArrayValues } from \"./inheritable_statics\";\nimport { capitalize } from \"./string_helpers\";\n/** @hidden */\n\nexport function ClassPropertiesBlessing(constructor) {\n var classes = readInheritableStaticArrayValues(constructor, \"classes\");\n return classes.reduce(function (properties, classDefinition) {\n return Object.assign(properties, propertiesForClassDefinition(classDefinition));\n }, {});\n}\n\nfunction propertiesForClassDefinition(key) {\n var _a;\n\n var name = key + \"Class\";\n return _a = {}, _a[name] = {\n get: function () {\n var classes = this.classes;\n\n if (classes.has(key)) {\n return classes.get(key);\n } else {\n var attribute = classes.getAttributeName(key);\n throw new Error(\"Missing attribute \\\"\" + attribute + \"\\\"\");\n }\n }\n }, _a[\"has\" + capitalize(name)] = {\n get: function () {\n return this.classes.has(key);\n }\n }, _a;\n}","import { BindingObserver } from \"./binding_observer\";\nimport { ValueObserver } from \"./value_observer\";\n\nvar Context =\n/** @class */\nfunction () {\n function Context(module, scope) {\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\n try {\n this.controller.initialize();\n } catch (error) {\n this.handleError(error, \"initializing controller\");\n }\n }\n\n Context.prototype.connect = function () {\n this.bindingObserver.start();\n this.valueObserver.start();\n\n try {\n this.controller.connect();\n } catch (error) {\n this.handleError(error, \"connecting controller\");\n }\n };\n\n Context.prototype.disconnect = function () {\n try {\n this.controller.disconnect();\n } catch (error) {\n this.handleError(error, \"disconnecting controller\");\n }\n\n this.valueObserver.stop();\n this.bindingObserver.stop();\n };\n\n Object.defineProperty(Context.prototype, \"application\", {\n get: function () {\n return this.module.application;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"identifier\", {\n get: function () {\n return this.module.identifier;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"schema\", {\n get: function () {\n return this.application.schema;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"dispatcher\", {\n get: function () {\n return this.application.dispatcher;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"parentElement\", {\n get: function () {\n return this.element.parentElement;\n },\n enumerable: false,\n configurable: true\n }); // Error handling\n\n Context.prototype.handleError = function (error, message, detail) {\n if (detail === void 0) {\n detail = {};\n }\n\n var _a = this,\n identifier = _a.identifier,\n controller = _a.controller,\n element = _a.element;\n\n detail = Object.assign({\n identifier: identifier,\n controller: controller,\n element: element\n }, detail);\n this.application.handleError(error, \"Error \" + message, detail);\n };\n\n return Context;\n}();\n\nexport { Context };","import { ClassPropertiesBlessing } from \"./class_properties\";\nimport { TargetPropertiesBlessing } from \"./target_properties\";\nimport { ValuePropertiesBlessing } from \"./value_properties\";\n\nvar Controller =\n/** @class */\nfunction () {\n function Controller(context) {\n this.context = context;\n }\n\n Object.defineProperty(Controller.prototype, \"application\", {\n get: function () {\n return this.context.application;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"scope\", {\n get: function () {\n return this.context.scope;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"identifier\", {\n get: function () {\n return this.scope.identifier;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"targets\", {\n get: function () {\n return this.scope.targets;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"classes\", {\n get: function () {\n return this.scope.classes;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"data\", {\n get: function () {\n return this.scope.data;\n },\n enumerable: false,\n configurable: true\n });\n\n Controller.prototype.initialize = function () {// Override in your subclass to set up initial controller state\n };\n\n Controller.prototype.connect = function () {// Override in your subclass to respond when the controller is connected to the DOM\n };\n\n Controller.prototype.disconnect = function () {// Override in your subclass to respond when the controller is disconnected from the DOM\n };\n\n Controller.blessings = [ClassPropertiesBlessing, TargetPropertiesBlessing, ValuePropertiesBlessing];\n Controller.targets = [];\n Controller.values = {};\n return Controller;\n}();\n\nexport { Controller };","import { dasherize } from \"./string_helpers\";\n\nvar DataMap =\n/** @class */\nfunction () {\n function DataMap(scope) {\n this.scope = scope;\n }\n\n Object.defineProperty(DataMap.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(DataMap.prototype, \"identifier\", {\n get: function () {\n return this.scope.identifier;\n },\n enumerable: false,\n configurable: true\n });\n\n DataMap.prototype.get = function (key) {\n var name = this.getAttributeNameForKey(key);\n return this.element.getAttribute(name);\n };\n\n DataMap.prototype.set = function (key, value) {\n var name = this.getAttributeNameForKey(key);\n this.element.setAttribute(name, value);\n return this.get(key);\n };\n\n DataMap.prototype.has = function (key) {\n var name = this.getAttributeNameForKey(key);\n return this.element.hasAttribute(name);\n };\n\n DataMap.prototype.delete = function (key) {\n if (this.has(key)) {\n var name_1 = this.getAttributeNameForKey(key);\n this.element.removeAttribute(name_1);\n return true;\n } else {\n return false;\n }\n };\n\n DataMap.prototype.getAttributeNameForKey = function (key) {\n return \"data-\" + this.identifier + \"-\" + dasherize(key);\n };\n\n return DataMap;\n}();\n\nexport { DataMap };","import { bless } from \"./blessing\";\n/** @hidden */\n\nexport function blessDefinition(definition) {\n return {\n identifier: definition.identifier,\n controllerConstructor: bless(definition.controllerConstructor)\n };\n}","import { EventListener } from \"./event_listener\";\n\nvar Dispatcher =\n/** @class */\nfunction () {\n function Dispatcher(application) {\n this.application = application;\n this.eventListenerMaps = new Map();\n this.started = false;\n }\n\n Dispatcher.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this.eventListeners.forEach(function (eventListener) {\n return eventListener.connect();\n });\n }\n };\n\n Dispatcher.prototype.stop = function () {\n if (this.started) {\n this.started = false;\n this.eventListeners.forEach(function (eventListener) {\n return eventListener.disconnect();\n });\n }\n };\n\n Object.defineProperty(Dispatcher.prototype, \"eventListeners\", {\n get: function () {\n return Array.from(this.eventListenerMaps.values()).reduce(function (listeners, map) {\n return listeners.concat(Array.from(map.values()));\n }, []);\n },\n enumerable: false,\n configurable: true\n }); // Binding observer delegate\n\n /** @hidden */\n\n Dispatcher.prototype.bindingConnected = function (binding) {\n this.fetchEventListenerForBinding(binding).bindingConnected(binding);\n };\n /** @hidden */\n\n\n Dispatcher.prototype.bindingDisconnected = function (binding) {\n this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);\n }; // Error handling\n\n\n Dispatcher.prototype.handleError = function (error, message, detail) {\n if (detail === void 0) {\n detail = {};\n }\n\n this.application.handleError(error, \"Error \" + message, detail);\n };\n\n Dispatcher.prototype.fetchEventListenerForBinding = function (binding) {\n var eventTarget = binding.eventTarget,\n eventName = binding.eventName,\n eventOptions = binding.eventOptions;\n return this.fetchEventListener(eventTarget, eventName, eventOptions);\n };\n\n Dispatcher.prototype.fetchEventListener = function (eventTarget, eventName, eventOptions) {\n var eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n var cacheKey = this.cacheKey(eventName, eventOptions);\n var eventListener = eventListenerMap.get(cacheKey);\n\n if (!eventListener) {\n eventListener = this.createEventListener(eventTarget, eventName, eventOptions);\n eventListenerMap.set(cacheKey, eventListener);\n }\n\n return eventListener;\n };\n\n Dispatcher.prototype.createEventListener = function (eventTarget, eventName, eventOptions) {\n var eventListener = new EventListener(eventTarget, eventName, eventOptions);\n\n if (this.started) {\n eventListener.connect();\n }\n\n return eventListener;\n };\n\n Dispatcher.prototype.fetchEventListenerMapForEventTarget = function (eventTarget) {\n var eventListenerMap = this.eventListenerMaps.get(eventTarget);\n\n if (!eventListenerMap) {\n eventListenerMap = new Map();\n this.eventListenerMaps.set(eventTarget, eventListenerMap);\n }\n\n return eventListenerMap;\n };\n\n Dispatcher.prototype.cacheKey = function (eventName, eventOptions) {\n var parts = [eventName];\n Object.keys(eventOptions).sort().forEach(function (key) {\n parts.push(\"\" + (eventOptions[key] ? \"\" : \"!\") + key);\n });\n return parts.join(\":\");\n };\n\n return Dispatcher;\n}();\n\nexport { Dispatcher };","var EventListener =\n/** @class */\nfunction () {\n function EventListener(eventTarget, eventName, eventOptions) {\n this.eventTarget = eventTarget;\n this.eventName = eventName;\n this.eventOptions = eventOptions;\n this.unorderedBindings = new Set();\n }\n\n EventListener.prototype.connect = function () {\n this.eventTarget.addEventListener(this.eventName, this, this.eventOptions);\n };\n\n EventListener.prototype.disconnect = function () {\n this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions);\n }; // Binding observer delegate\n\n /** @hidden */\n\n\n EventListener.prototype.bindingConnected = function (binding) {\n this.unorderedBindings.add(binding);\n };\n /** @hidden */\n\n\n EventListener.prototype.bindingDisconnected = function (binding) {\n this.unorderedBindings.delete(binding);\n };\n\n EventListener.prototype.handleEvent = function (event) {\n var extendedEvent = extendEvent(event);\n\n for (var _i = 0, _a = this.bindings; _i < _a.length; _i++) {\n var binding = _a[_i];\n\n if (extendedEvent.immediatePropagationStopped) {\n break;\n } else {\n binding.handleEvent(extendedEvent);\n }\n }\n };\n\n Object.defineProperty(EventListener.prototype, \"bindings\", {\n get: function () {\n return Array.from(this.unorderedBindings).sort(function (left, right) {\n var leftIndex = left.index,\n rightIndex = right.index;\n return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0;\n });\n },\n enumerable: false,\n configurable: true\n });\n return EventListener;\n}();\n\nexport { EventListener };\n\nfunction extendEvent(event) {\n if (\"immediatePropagationStopped\" in event) {\n return event;\n } else {\n var stopImmediatePropagation_1 = event.stopImmediatePropagation;\n return Object.assign(event, {\n immediatePropagationStopped: false,\n stopImmediatePropagation: function () {\n this.immediatePropagationStopped = true;\n stopImmediatePropagation_1.call(this);\n }\n });\n }\n}","var Guide =\n/** @class */\nfunction () {\n function Guide(logger) {\n this.warnedKeysByObject = new WeakMap();\n this.logger = logger;\n }\n\n Guide.prototype.warn = function (object, key, message) {\n var warnedKeys = this.warnedKeysByObject.get(object);\n\n if (!warnedKeys) {\n warnedKeys = new Set();\n this.warnedKeysByObject.set(object, warnedKeys);\n }\n\n if (!warnedKeys.has(key)) {\n warnedKeys.add(key);\n this.logger.warn(message, object);\n }\n };\n\n return Guide;\n}();\n\nexport { Guide };","export { Application } from \"./application\";\nexport { Context } from \"./context\";\nexport { Controller } from \"./controller\";\nexport { defaultSchema } from \"./schema\";","export function readInheritableStaticArrayValues(constructor, propertyName) {\n var ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce(function (values, constructor) {\n getOwnStaticArrayValues(constructor, propertyName).forEach(function (name) {\n return values.add(name);\n });\n return values;\n }, new Set()));\n}\nexport function readInheritableStaticObjectPairs(constructor, propertyName) {\n var ancestors = getAncestorsForConstructor(constructor);\n return ancestors.reduce(function (pairs, constructor) {\n pairs.push.apply(pairs, getOwnStaticObjectPairs(constructor, propertyName));\n return pairs;\n }, []);\n}\n\nfunction getAncestorsForConstructor(constructor) {\n var ancestors = [];\n\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n\n return ancestors.reverse();\n}\n\nfunction getOwnStaticArrayValues(constructor, propertyName) {\n var definition = constructor[propertyName];\n return Array.isArray(definition) ? definition : [];\n}\n\nfunction getOwnStaticObjectPairs(constructor, propertyName) {\n var definition = constructor[propertyName];\n return definition ? Object.keys(definition).map(function (key) {\n return [key, definition[key]];\n }) : [];\n}","import { Context } from \"./context\";\nimport { blessDefinition } from \"./definition\";\n\nvar Module =\n/** @class */\nfunction () {\n function Module(application, definition) {\n this.application = application;\n this.definition = blessDefinition(definition);\n this.contextsByScope = new WeakMap();\n this.connectedContexts = new Set();\n }\n\n Object.defineProperty(Module.prototype, \"identifier\", {\n get: function () {\n return this.definition.identifier;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Module.prototype, \"controllerConstructor\", {\n get: function () {\n return this.definition.controllerConstructor;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Module.prototype, \"contexts\", {\n get: function () {\n return Array.from(this.connectedContexts);\n },\n enumerable: false,\n configurable: true\n });\n\n Module.prototype.connectContextForScope = function (scope) {\n var context = this.fetchContextForScope(scope);\n this.connectedContexts.add(context);\n context.connect();\n };\n\n Module.prototype.disconnectContextForScope = function (scope) {\n var context = this.contextsByScope.get(scope);\n\n if (context) {\n this.connectedContexts.delete(context);\n context.disconnect();\n }\n };\n\n Module.prototype.fetchContextForScope = function (scope) {\n var context = this.contextsByScope.get(scope);\n\n if (!context) {\n context = new Context(this, scope);\n this.contextsByScope.set(scope, context);\n }\n\n return context;\n };\n\n return Module;\n}();\n\nexport { Module };","import { Module } from \"./module\";\nimport { Multimap } from \"@stimulus/multimap\";\nimport { Scope } from \"./scope\";\nimport { ScopeObserver } from \"./scope_observer\";\n\nvar Router =\n/** @class */\nfunction () {\n function Router(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\n Object.defineProperty(Router.prototype, \"element\", {\n get: function () {\n return this.application.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"schema\", {\n get: function () {\n return this.application.schema;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"logger\", {\n get: function () {\n return this.application.logger;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"controllerAttribute\", {\n get: function () {\n return this.schema.controllerAttribute;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"modules\", {\n get: function () {\n return Array.from(this.modulesByIdentifier.values());\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"contexts\", {\n get: function () {\n return this.modules.reduce(function (contexts, module) {\n return contexts.concat(module.contexts);\n }, []);\n },\n enumerable: false,\n configurable: true\n });\n\n Router.prototype.start = function () {\n this.scopeObserver.start();\n };\n\n Router.prototype.stop = function () {\n this.scopeObserver.stop();\n };\n\n Router.prototype.loadDefinition = function (definition) {\n this.unloadIdentifier(definition.identifier);\n var module = new Module(this.application, definition);\n this.connectModule(module);\n };\n\n Router.prototype.unloadIdentifier = function (identifier) {\n var module = this.modulesByIdentifier.get(identifier);\n\n if (module) {\n this.disconnectModule(module);\n }\n };\n\n Router.prototype.getContextForElementAndIdentifier = function (element, identifier) {\n var module = this.modulesByIdentifier.get(identifier);\n\n if (module) {\n return module.contexts.find(function (context) {\n return context.element == element;\n });\n }\n }; // Error handler delegate\n\n /** @hidden */\n\n\n Router.prototype.handleError = function (error, message, detail) {\n this.application.handleError(error, message, detail);\n }; // Scope observer delegate\n\n /** @hidden */\n\n\n Router.prototype.createScopeForElementAndIdentifier = function (element, identifier) {\n return new Scope(this.schema, element, identifier, this.logger);\n };\n /** @hidden */\n\n\n Router.prototype.scopeConnected = function (scope) {\n this.scopesByIdentifier.add(scope.identifier, scope);\n var module = this.modulesByIdentifier.get(scope.identifier);\n\n if (module) {\n module.connectContextForScope(scope);\n }\n };\n /** @hidden */\n\n\n Router.prototype.scopeDisconnected = function (scope) {\n this.scopesByIdentifier.delete(scope.identifier, scope);\n var module = this.modulesByIdentifier.get(scope.identifier);\n\n if (module) {\n module.disconnectContextForScope(scope);\n }\n }; // Modules\n\n\n Router.prototype.connectModule = function (module) {\n this.modulesByIdentifier.set(module.identifier, module);\n var scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(function (scope) {\n return module.connectContextForScope(scope);\n });\n };\n\n Router.prototype.disconnectModule = function (module) {\n this.modulesByIdentifier.delete(module.identifier);\n var scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(function (scope) {\n return module.disconnectContextForScope(scope);\n });\n };\n\n return Router;\n}();\n\nexport { Router };","export var defaultSchema = {\n controllerAttribute: \"data-controller\",\n actionAttribute: \"data-action\",\n targetAttribute: \"data-target\"\n};","var __spreadArrays = this && this.__spreadArrays || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n\n return r;\n};\n\nimport { ClassMap } from \"./class_map\";\nimport { DataMap } from \"./data_map\";\nimport { Guide } from \"./guide\";\nimport { attributeValueContainsToken } from \"./selectors\";\nimport { TargetSet } from \"./target_set\";\n\nvar Scope =\n/** @class */\nfunction () {\n function Scope(schema, element, identifier, logger) {\n var _this = this;\n\n this.targets = new TargetSet(this);\n this.classes = new ClassMap(this);\n this.data = new DataMap(this);\n\n this.containsElement = function (element) {\n return element.closest(_this.controllerSelector) === _this.element;\n };\n\n this.schema = schema;\n this.element = element;\n this.identifier = identifier;\n this.guide = new Guide(logger);\n }\n\n Scope.prototype.findElement = function (selector) {\n return this.element.matches(selector) ? this.element : this.queryElements(selector).find(this.containsElement);\n };\n\n Scope.prototype.findAllElements = function (selector) {\n return __spreadArrays(this.element.matches(selector) ? [this.element] : [], this.queryElements(selector).filter(this.containsElement));\n };\n\n Scope.prototype.queryElements = function (selector) {\n return Array.from(this.element.querySelectorAll(selector));\n };\n\n Object.defineProperty(Scope.prototype, \"controllerSelector\", {\n get: function () {\n return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier);\n },\n enumerable: false,\n configurable: true\n });\n return Scope;\n}();\n\nexport { Scope };","import { ValueListObserver } from \"@stimulus/mutation-observers\";\n\nvar ScopeObserver =\n/** @class */\nfunction () {\n function ScopeObserver(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\n ScopeObserver.prototype.start = function () {\n this.valueListObserver.start();\n };\n\n ScopeObserver.prototype.stop = function () {\n this.valueListObserver.stop();\n };\n\n Object.defineProperty(ScopeObserver.prototype, \"controllerAttribute\", {\n get: function () {\n return this.schema.controllerAttribute;\n },\n enumerable: false,\n configurable: true\n }); // Value observer delegate\n\n /** @hidden */\n\n ScopeObserver.prototype.parseValueForToken = function (token) {\n var element = token.element,\n identifier = token.content;\n var scopesByIdentifier = this.fetchScopesByIdentifierForElement(element);\n var scope = scopesByIdentifier.get(identifier);\n\n if (!scope) {\n scope = this.delegate.createScopeForElementAndIdentifier(element, identifier);\n scopesByIdentifier.set(identifier, scope);\n }\n\n return scope;\n };\n /** @hidden */\n\n\n ScopeObserver.prototype.elementMatchedValue = function (element, value) {\n var referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;\n this.scopeReferenceCounts.set(value, referenceCount);\n\n if (referenceCount == 1) {\n this.delegate.scopeConnected(value);\n }\n };\n /** @hidden */\n\n\n ScopeObserver.prototype.elementUnmatchedValue = function (element, value) {\n var referenceCount = this.scopeReferenceCounts.get(value);\n\n if (referenceCount) {\n this.scopeReferenceCounts.set(value, referenceCount - 1);\n\n if (referenceCount == 1) {\n this.delegate.scopeDisconnected(value);\n }\n }\n };\n\n ScopeObserver.prototype.fetchScopesByIdentifierForElement = function (element) {\n var scopesByIdentifier = this.scopesByIdentifierByElement.get(element);\n\n if (!scopesByIdentifier) {\n scopesByIdentifier = new Map();\n this.scopesByIdentifierByElement.set(element, scopesByIdentifier);\n }\n\n return scopesByIdentifier;\n };\n\n return ScopeObserver;\n}();\n\nexport { ScopeObserver };","/** @hidden */\nexport function attributeValueContainsToken(attributeName, token) {\n return \"[\" + attributeName + \"~=\\\"\" + token + \"\\\"]\";\n}","export function camelize(value) {\n return value.replace(/(?:[_-])([a-z0-9])/g, function (_, char) {\n return char.toUpperCase();\n });\n}\nexport function capitalize(value) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\nexport function dasherize(value) {\n return value.replace(/([A-Z])/g, function (_, char) {\n return \"-\" + char.toLowerCase();\n });\n}","import { readInheritableStaticArrayValues } from \"./inheritable_statics\";\nimport { capitalize } from \"./string_helpers\";\n/** @hidden */\n\nexport function TargetPropertiesBlessing(constructor) {\n var targets = readInheritableStaticArrayValues(constructor, \"targets\");\n return targets.reduce(function (properties, targetDefinition) {\n return Object.assign(properties, propertiesForTargetDefinition(targetDefinition));\n }, {});\n}\n\nfunction propertiesForTargetDefinition(name) {\n var _a;\n\n return _a = {}, _a[name + \"Target\"] = {\n get: function () {\n var target = this.targets.find(name);\n\n if (target) {\n return target;\n } else {\n throw new Error(\"Missing target element \\\"\" + this.identifier + \".\" + name + \"\\\"\");\n }\n }\n }, _a[name + \"Targets\"] = {\n get: function () {\n return this.targets.findAll(name);\n }\n }, _a[\"has\" + capitalize(name) + \"Target\"] = {\n get: function () {\n return this.targets.has(name);\n }\n }, _a;\n}","var __spreadArrays = this && this.__spreadArrays || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n\n return r;\n};\n\nimport { attributeValueContainsToken } from \"./selectors\";\n\nvar TargetSet =\n/** @class */\nfunction () {\n function TargetSet(scope) {\n this.scope = scope;\n }\n\n Object.defineProperty(TargetSet.prototype, \"element\", {\n get: function () {\n return this.scope.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TargetSet.prototype, \"identifier\", {\n get: function () {\n return this.scope.identifier;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TargetSet.prototype, \"schema\", {\n get: function () {\n return this.scope.schema;\n },\n enumerable: false,\n configurable: true\n });\n\n TargetSet.prototype.has = function (targetName) {\n return this.find(targetName) != null;\n };\n\n TargetSet.prototype.find = function () {\n var _this = this;\n\n var targetNames = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n targetNames[_i] = arguments[_i];\n }\n\n return targetNames.reduce(function (target, targetName) {\n return target || _this.findTarget(targetName) || _this.findLegacyTarget(targetName);\n }, undefined);\n };\n\n TargetSet.prototype.findAll = function () {\n var _this = this;\n\n var targetNames = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n targetNames[_i] = arguments[_i];\n }\n\n return targetNames.reduce(function (targets, targetName) {\n return __spreadArrays(targets, _this.findAllTargets(targetName), _this.findAllLegacyTargets(targetName));\n }, []);\n };\n\n TargetSet.prototype.findTarget = function (targetName) {\n var selector = this.getSelectorForTargetName(targetName);\n return this.scope.findElement(selector);\n };\n\n TargetSet.prototype.findAllTargets = function (targetName) {\n var selector = this.getSelectorForTargetName(targetName);\n return this.scope.findAllElements(selector);\n };\n\n TargetSet.prototype.getSelectorForTargetName = function (targetName) {\n var attributeName = \"data-\" + this.identifier + \"-target\";\n return attributeValueContainsToken(attributeName, targetName);\n };\n\n TargetSet.prototype.findLegacyTarget = function (targetName) {\n var selector = this.getLegacySelectorForTargetName(targetName);\n return this.deprecate(this.scope.findElement(selector), targetName);\n };\n\n TargetSet.prototype.findAllLegacyTargets = function (targetName) {\n var _this = this;\n\n var selector = this.getLegacySelectorForTargetName(targetName);\n return this.scope.findAllElements(selector).map(function (element) {\n return _this.deprecate(element, targetName);\n });\n };\n\n TargetSet.prototype.getLegacySelectorForTargetName = function (targetName) {\n var targetDescriptor = this.identifier + \".\" + targetName;\n return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor);\n };\n\n TargetSet.prototype.deprecate = function (element, targetName) {\n if (element) {\n var identifier = this.identifier;\n var attributeName = this.schema.targetAttribute;\n this.guide.warn(element, \"target:\" + targetName, \"Please replace \" + attributeName + \"=\\\"\" + identifier + \".\" + targetName + \"\\\" with data-\" + identifier + \"-target=\\\"\" + targetName + \"\\\". \" + (\"The \" + attributeName + \" attribute is deprecated and will be removed in a future version of Stimulus.\"));\n }\n\n return element;\n };\n\n Object.defineProperty(TargetSet.prototype, \"guide\", {\n get: function () {\n return this.scope.guide;\n },\n enumerable: false,\n configurable: true\n });\n return TargetSet;\n}();\n\nexport { TargetSet };","import { StringMapObserver } from \"@stimulus/mutation-observers\";\n\nvar ValueObserver =\n/** @class */\nfunction () {\n function ValueObserver(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 this.invokeChangedCallbacksForDefaultValues();\n }\n\n ValueObserver.prototype.start = function () {\n this.stringMapObserver.start();\n };\n\n ValueObserver.prototype.stop = function () {\n this.stringMapObserver.stop();\n };\n\n Object.defineProperty(ValueObserver.prototype, \"element\", {\n get: function () {\n return this.context.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ValueObserver.prototype, \"controller\", {\n get: function () {\n return this.context.controller;\n },\n enumerable: false,\n configurable: true\n }); // String map observer delegate\n\n ValueObserver.prototype.getStringMapKeyForAttribute = function (attributeName) {\n if (attributeName in this.valueDescriptorMap) {\n return this.valueDescriptorMap[attributeName].name;\n }\n };\n\n ValueObserver.prototype.stringMapValueChanged = function (attributeValue, name) {\n this.invokeChangedCallbackForValue(name);\n };\n\n ValueObserver.prototype.invokeChangedCallbacksForDefaultValues = function () {\n for (var _i = 0, _a = this.valueDescriptors; _i < _a.length; _i++) {\n var _b = _a[_i],\n key = _b.key,\n name_1 = _b.name,\n defaultValue = _b.defaultValue;\n\n if (defaultValue != undefined && !this.controller.data.has(key)) {\n this.invokeChangedCallbackForValue(name_1);\n }\n }\n };\n\n ValueObserver.prototype.invokeChangedCallbackForValue = function (name) {\n var methodName = name + \"Changed\";\n var method = this.receiver[methodName];\n\n if (typeof method == \"function\") {\n var value = this.receiver[name];\n method.call(this.receiver, value);\n }\n };\n\n Object.defineProperty(ValueObserver.prototype, \"valueDescriptors\", {\n get: function () {\n var valueDescriptorMap = this.valueDescriptorMap;\n return Object.keys(valueDescriptorMap).map(function (key) {\n return valueDescriptorMap[key];\n });\n },\n enumerable: false,\n configurable: true\n });\n return ValueObserver;\n}();\n\nexport { ValueObserver };","import { readInheritableStaticObjectPairs } from \"./inheritable_statics\";\nimport { camelize, capitalize, dasherize } from \"./string_helpers\";\n/** @hidden */\n\nexport function ValuePropertiesBlessing(constructor) {\n var valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, \"values\");\n var propertyDescriptorMap = {\n valueDescriptorMap: {\n get: function () {\n var _this = this;\n\n return valueDefinitionPairs.reduce(function (result, valueDefinitionPair) {\n var _a;\n\n var valueDescriptor = parseValueDefinitionPair(valueDefinitionPair);\n\n var attributeName = _this.data.getAttributeNameForKey(valueDescriptor.key);\n\n return Object.assign(result, (_a = {}, _a[attributeName] = valueDescriptor, _a));\n }, {});\n }\n }\n };\n return valueDefinitionPairs.reduce(function (properties, valueDefinitionPair) {\n return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair));\n }, propertyDescriptorMap);\n}\n/** @hidden */\n\nexport function propertiesForValueDefinitionPair(valueDefinitionPair) {\n var _a;\n\n var definition = parseValueDefinitionPair(valueDefinitionPair);\n var type = definition.type,\n key = definition.key,\n name = definition.name;\n var read = readers[type],\n write = writers[type] || writers.default;\n return _a = {}, _a[name] = {\n get: function () {\n var value = this.data.get(key);\n\n if (value !== null) {\n return read(value);\n } else {\n return definition.defaultValue;\n }\n },\n set: function (value) {\n if (value === undefined) {\n this.data.delete(key);\n } else {\n this.data.set(key, write(value));\n }\n }\n }, _a[\"has\" + capitalize(name)] = {\n get: function () {\n return this.data.has(key);\n }\n }, _a;\n}\n\nfunction parseValueDefinitionPair(_a) {\n var token = _a[0],\n typeConstant = _a[1];\n var type = parseValueTypeConstant(typeConstant);\n return valueDescriptorForTokenAndType(token, type);\n}\n\nfunction parseValueTypeConstant(typeConstant) {\n switch (typeConstant) {\n case Array:\n return \"array\";\n\n case Boolean:\n return \"boolean\";\n\n case Number:\n return \"number\";\n\n case Object:\n return \"object\";\n\n case String:\n return \"string\";\n }\n\n throw new Error(\"Unknown value type constant \\\"\" + typeConstant + \"\\\"\");\n}\n\nfunction valueDescriptorForTokenAndType(token, type) {\n var key = dasherize(token) + \"-value\";\n return {\n type: type,\n key: key,\n name: camelize(key),\n\n get defaultValue() {\n return defaultValuesByType[type];\n }\n\n };\n}\n\nvar defaultValuesByType = {\n get array() {\n return [];\n },\n\n boolean: false,\n number: 0,\n\n get object() {\n return {};\n },\n\n string: \"\"\n};\nvar readers = {\n array: function (value) {\n var array = JSON.parse(value);\n\n if (!Array.isArray(array)) {\n throw new TypeError(\"Expected array\");\n }\n\n return array;\n },\n boolean: function (value) {\n return !(value == \"0\" || value == \"false\");\n },\n number: function (value) {\n return parseFloat(value);\n },\n object: function (value) {\n var object = JSON.parse(value);\n\n if (object === null || typeof object != \"object\" || Array.isArray(object)) {\n throw new TypeError(\"Expected object\");\n }\n\n return object;\n },\n string: function (value) {\n return value;\n }\n};\nvar writers = {\n default: writeString,\n array: writeJSON,\n object: writeJSON\n};\n\nfunction writeJSON(value) {\n return JSON.stringify(value);\n}\n\nfunction writeString(value) {\n return \"\" + value;\n}","export * from \"./indexed_multimap\";\nexport * from \"./multimap\";\nexport * from \"./set_operations\";","var __extends = this && this.__extends || function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n };\n\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nimport { Multimap } from \"./multimap\";\nimport { add, del } from \"./set_operations\";\n\nvar IndexedMultimap =\n/** @class */\nfunction (_super) {\n __extends(IndexedMultimap, _super);\n\n function IndexedMultimap() {\n var _this = _super.call(this) || this;\n\n _this.keysByValue = new Map();\n return _this;\n }\n\n Object.defineProperty(IndexedMultimap.prototype, \"values\", {\n get: function () {\n return Array.from(this.keysByValue.keys());\n },\n enumerable: false,\n configurable: true\n });\n\n IndexedMultimap.prototype.add = function (key, value) {\n _super.prototype.add.call(this, key, value);\n\n add(this.keysByValue, value, key);\n };\n\n IndexedMultimap.prototype.delete = function (key, value) {\n _super.prototype.delete.call(this, key, value);\n\n del(this.keysByValue, value, key);\n };\n\n IndexedMultimap.prototype.hasValue = function (value) {\n return this.keysByValue.has(value);\n };\n\n IndexedMultimap.prototype.getKeysForValue = function (value) {\n var set = this.keysByValue.get(value);\n return set ? Array.from(set) : [];\n };\n\n return IndexedMultimap;\n}(Multimap);\n\nexport { IndexedMultimap };","import { add, del } from \"./set_operations\";\n\nvar Multimap =\n/** @class */\nfunction () {\n function Multimap() {\n this.valuesByKey = new Map();\n }\n\n Object.defineProperty(Multimap.prototype, \"values\", {\n get: function () {\n var sets = Array.from(this.valuesByKey.values());\n return sets.reduce(function (values, set) {\n return values.concat(Array.from(set));\n }, []);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Multimap.prototype, \"size\", {\n get: function () {\n var sets = Array.from(this.valuesByKey.values());\n return sets.reduce(function (size, set) {\n return size + set.size;\n }, 0);\n },\n enumerable: false,\n configurable: true\n });\n\n Multimap.prototype.add = function (key, value) {\n add(this.valuesByKey, key, value);\n };\n\n Multimap.prototype.delete = function (key, value) {\n del(this.valuesByKey, key, value);\n };\n\n Multimap.prototype.has = function (key, value) {\n var values = this.valuesByKey.get(key);\n return values != null && values.has(value);\n };\n\n Multimap.prototype.hasKey = function (key) {\n return this.valuesByKey.has(key);\n };\n\n Multimap.prototype.hasValue = function (value) {\n var sets = Array.from(this.valuesByKey.values());\n return sets.some(function (set) {\n return set.has(value);\n });\n };\n\n Multimap.prototype.getValuesForKey = function (key) {\n var values = this.valuesByKey.get(key);\n return values ? Array.from(values) : [];\n };\n\n Multimap.prototype.getKeysForValue = function (value) {\n return Array.from(this.valuesByKey).filter(function (_a) {\n var key = _a[0],\n values = _a[1];\n return values.has(value);\n }).map(function (_a) {\n var key = _a[0],\n values = _a[1];\n return key;\n });\n };\n\n return Multimap;\n}();\n\nexport { Multimap };","export function add(map, key, value) {\n fetch(map, key).add(value);\n}\nexport function del(map, key, value) {\n fetch(map, key).delete(value);\n prune(map, key);\n}\nexport function fetch(map, key) {\n var values = map.get(key);\n\n if (!values) {\n values = new Set();\n map.set(key, values);\n }\n\n return values;\n}\nexport function prune(map, key) {\n var values = map.get(key);\n\n if (values != null && values.size == 0) {\n map.delete(key);\n }\n}","import { ElementObserver } from \"./element_observer\";\n\nvar AttributeObserver =\n/** @class */\nfunction () {\n function AttributeObserver(element, attributeName, delegate) {\n this.attributeName = attributeName;\n this.delegate = delegate;\n this.elementObserver = new ElementObserver(element, this);\n }\n\n Object.defineProperty(AttributeObserver.prototype, \"element\", {\n get: function () {\n return this.elementObserver.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AttributeObserver.prototype, \"selector\", {\n get: function () {\n return \"[\" + this.attributeName + \"]\";\n },\n enumerable: false,\n configurable: true\n });\n\n AttributeObserver.prototype.start = function () {\n this.elementObserver.start();\n };\n\n AttributeObserver.prototype.stop = function () {\n this.elementObserver.stop();\n };\n\n AttributeObserver.prototype.refresh = function () {\n this.elementObserver.refresh();\n };\n\n Object.defineProperty(AttributeObserver.prototype, \"started\", {\n get: function () {\n return this.elementObserver.started;\n },\n enumerable: false,\n configurable: true\n }); // Element observer delegate\n\n AttributeObserver.prototype.matchElement = function (element) {\n return element.hasAttribute(this.attributeName);\n };\n\n AttributeObserver.prototype.matchElementsInTree = function (tree) {\n var match = this.matchElement(tree) ? [tree] : [];\n var matches = Array.from(tree.querySelectorAll(this.selector));\n return match.concat(matches);\n };\n\n AttributeObserver.prototype.elementMatched = function (element) {\n if (this.delegate.elementMatchedAttribute) {\n this.delegate.elementMatchedAttribute(element, this.attributeName);\n }\n };\n\n AttributeObserver.prototype.elementUnmatched = function (element) {\n if (this.delegate.elementUnmatchedAttribute) {\n this.delegate.elementUnmatchedAttribute(element, this.attributeName);\n }\n };\n\n AttributeObserver.prototype.elementAttributeChanged = function (element, attributeName) {\n if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) {\n this.delegate.elementAttributeValueChanged(element, attributeName);\n }\n };\n\n return AttributeObserver;\n}();\n\nexport { AttributeObserver };","var ElementObserver =\n/** @class */\nfunction () {\n function ElementObserver(element, delegate) {\n var _this = this;\n\n this.element = element;\n this.started = false;\n this.delegate = delegate;\n this.elements = new Set();\n this.mutationObserver = new MutationObserver(function (mutations) {\n return _this.processMutations(mutations);\n });\n }\n\n ElementObserver.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, {\n attributes: true,\n childList: true,\n subtree: true\n });\n this.refresh();\n }\n };\n\n ElementObserver.prototype.stop = function () {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n };\n\n ElementObserver.prototype.refresh = function () {\n if (this.started) {\n var matches = new Set(this.matchElementsInTree());\n\n for (var _i = 0, _a = Array.from(this.elements); _i < _a.length; _i++) {\n var element = _a[_i];\n\n if (!matches.has(element)) {\n this.removeElement(element);\n }\n }\n\n for (var _b = 0, _c = Array.from(matches); _b < _c.length; _b++) {\n var element = _c[_b];\n this.addElement(element);\n }\n }\n }; // Mutation record processing\n\n\n ElementObserver.prototype.processMutations = function (mutations) {\n if (this.started) {\n for (var _i = 0, mutations_1 = mutations; _i < mutations_1.length; _i++) {\n var mutation = mutations_1[_i];\n this.processMutation(mutation);\n }\n }\n };\n\n ElementObserver.prototype.processMutation = function (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\n ElementObserver.prototype.processAttributeChange = function (node, attributeName) {\n var element = node;\n\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\n ElementObserver.prototype.processRemovedNodes = function (nodes) {\n for (var _i = 0, _a = Array.from(nodes); _i < _a.length; _i++) {\n var node = _a[_i];\n var element = this.elementFromNode(node);\n\n if (element) {\n this.processTree(element, this.removeElement);\n }\n }\n };\n\n ElementObserver.prototype.processAddedNodes = function (nodes) {\n for (var _i = 0, _a = Array.from(nodes); _i < _a.length; _i++) {\n var node = _a[_i];\n var element = this.elementFromNode(node);\n\n if (element && this.elementIsActive(element)) {\n this.processTree(element, this.addElement);\n }\n }\n }; // Element matching\n\n\n ElementObserver.prototype.matchElement = function (element) {\n return this.delegate.matchElement(element);\n };\n\n ElementObserver.prototype.matchElementsInTree = function (tree) {\n if (tree === void 0) {\n tree = this.element;\n }\n\n return this.delegate.matchElementsInTree(tree);\n };\n\n ElementObserver.prototype.processTree = function (tree, processor) {\n for (var _i = 0, _a = this.matchElementsInTree(tree); _i < _a.length; _i++) {\n var element = _a[_i];\n processor.call(this, element);\n }\n };\n\n ElementObserver.prototype.elementFromNode = function (node) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n return node;\n }\n };\n\n ElementObserver.prototype.elementIsActive = function (element) {\n if (element.isConnected != this.element.isConnected) {\n return false;\n } else {\n return this.element.contains(element);\n }\n }; // Element tracking\n\n\n ElementObserver.prototype.addElement = function (element) {\n if (!this.elements.has(element)) {\n if (this.elementIsActive(element)) {\n this.elements.add(element);\n\n if (this.delegate.elementMatched) {\n this.delegate.elementMatched(element);\n }\n }\n }\n };\n\n ElementObserver.prototype.removeElement = function (element) {\n if (this.elements.has(element)) {\n this.elements.delete(element);\n\n if (this.delegate.elementUnmatched) {\n this.delegate.elementUnmatched(element);\n }\n }\n };\n\n return ElementObserver;\n}();\n\nexport { ElementObserver };","export * from \"./attribute_observer\";\nexport * from \"./element_observer\";\nexport * from \"./string_map_observer\";\nexport * from \"./token_list_observer\";\nexport * from \"./value_list_observer\";","var StringMapObserver =\n/** @class */\nfunction () {\n function StringMapObserver(element, delegate) {\n var _this = this;\n\n this.element = element;\n this.delegate = delegate;\n this.started = false;\n this.stringMap = new Map();\n this.mutationObserver = new MutationObserver(function (mutations) {\n return _this.processMutations(mutations);\n });\n }\n\n StringMapObserver.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, {\n attributes: true\n });\n this.refresh();\n }\n };\n\n StringMapObserver.prototype.stop = function () {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n };\n\n StringMapObserver.prototype.refresh = function () {\n if (this.started) {\n for (var _i = 0, _a = this.knownAttributeNames; _i < _a.length; _i++) {\n var attributeName = _a[_i];\n this.refreshAttribute(attributeName);\n }\n }\n }; // Mutation record processing\n\n\n StringMapObserver.prototype.processMutations = function (mutations) {\n if (this.started) {\n for (var _i = 0, mutations_1 = mutations; _i < mutations_1.length; _i++) {\n var mutation = mutations_1[_i];\n this.processMutation(mutation);\n }\n }\n };\n\n StringMapObserver.prototype.processMutation = function (mutation) {\n var attributeName = mutation.attributeName;\n\n if (attributeName) {\n this.refreshAttribute(attributeName);\n }\n }; // State tracking\n\n\n StringMapObserver.prototype.refreshAttribute = function (attributeName) {\n var key = this.delegate.getStringMapKeyForAttribute(attributeName);\n\n if (key != null) {\n if (!this.stringMap.has(attributeName)) {\n this.stringMapKeyAdded(key, attributeName);\n }\n\n var value = this.element.getAttribute(attributeName);\n\n if (this.stringMap.get(attributeName) != value) {\n this.stringMapValueChanged(value, key);\n }\n\n if (value == null) {\n this.stringMap.delete(attributeName);\n this.stringMapKeyRemoved(key, attributeName);\n } else {\n this.stringMap.set(attributeName, value);\n }\n }\n };\n\n StringMapObserver.prototype.stringMapKeyAdded = function (key, attributeName) {\n if (this.delegate.stringMapKeyAdded) {\n this.delegate.stringMapKeyAdded(key, attributeName);\n }\n };\n\n StringMapObserver.prototype.stringMapValueChanged = function (value, key) {\n if (this.delegate.stringMapValueChanged) {\n this.delegate.stringMapValueChanged(value, key);\n }\n };\n\n StringMapObserver.prototype.stringMapKeyRemoved = function (key, attributeName) {\n if (this.delegate.stringMapKeyRemoved) {\n this.delegate.stringMapKeyRemoved(key, attributeName);\n }\n };\n\n Object.defineProperty(StringMapObserver.prototype, \"knownAttributeNames\", {\n get: function () {\n return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)));\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StringMapObserver.prototype, \"currentAttributeNames\", {\n get: function () {\n return Array.from(this.element.attributes).map(function (attribute) {\n return attribute.name;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StringMapObserver.prototype, \"recordedAttributeNames\", {\n get: function () {\n return Array.from(this.stringMap.keys());\n },\n enumerable: false,\n configurable: true\n });\n return StringMapObserver;\n}();\n\nexport { StringMapObserver };","import { AttributeObserver } from \"./attribute_observer\";\nimport { Multimap } from \"@stimulus/multimap\";\n\nvar TokenListObserver =\n/** @class */\nfunction () {\n function TokenListObserver(element, attributeName, delegate) {\n this.attributeObserver = new AttributeObserver(element, attributeName, this);\n this.delegate = delegate;\n this.tokensByElement = new Multimap();\n }\n\n Object.defineProperty(TokenListObserver.prototype, \"started\", {\n get: function () {\n return this.attributeObserver.started;\n },\n enumerable: false,\n configurable: true\n });\n\n TokenListObserver.prototype.start = function () {\n this.attributeObserver.start();\n };\n\n TokenListObserver.prototype.stop = function () {\n this.attributeObserver.stop();\n };\n\n TokenListObserver.prototype.refresh = function () {\n this.attributeObserver.refresh();\n };\n\n Object.defineProperty(TokenListObserver.prototype, \"element\", {\n get: function () {\n return this.attributeObserver.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TokenListObserver.prototype, \"attributeName\", {\n get: function () {\n return this.attributeObserver.attributeName;\n },\n enumerable: false,\n configurable: true\n }); // Attribute observer delegate\n\n TokenListObserver.prototype.elementMatchedAttribute = function (element) {\n this.tokensMatched(this.readTokensForElement(element));\n };\n\n TokenListObserver.prototype.elementAttributeValueChanged = function (element) {\n var _a = this.refreshTokensForElement(element),\n unmatchedTokens = _a[0],\n matchedTokens = _a[1];\n\n this.tokensUnmatched(unmatchedTokens);\n this.tokensMatched(matchedTokens);\n };\n\n TokenListObserver.prototype.elementUnmatchedAttribute = function (element) {\n this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));\n };\n\n TokenListObserver.prototype.tokensMatched = function (tokens) {\n var _this = this;\n\n tokens.forEach(function (token) {\n return _this.tokenMatched(token);\n });\n };\n\n TokenListObserver.prototype.tokensUnmatched = function (tokens) {\n var _this = this;\n\n tokens.forEach(function (token) {\n return _this.tokenUnmatched(token);\n });\n };\n\n TokenListObserver.prototype.tokenMatched = function (token) {\n this.delegate.tokenMatched(token);\n this.tokensByElement.add(token.element, token);\n };\n\n TokenListObserver.prototype.tokenUnmatched = function (token) {\n this.delegate.tokenUnmatched(token);\n this.tokensByElement.delete(token.element, token);\n };\n\n TokenListObserver.prototype.refreshTokensForElement = function (element) {\n var previousTokens = this.tokensByElement.getValuesForKey(element);\n var currentTokens = this.readTokensForElement(element);\n var firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(function (_a) {\n var previousToken = _a[0],\n currentToken = _a[1];\n return !tokensAreEqual(previousToken, currentToken);\n });\n\n if (firstDifferingIndex == -1) {\n return [[], []];\n } else {\n return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];\n }\n };\n\n TokenListObserver.prototype.readTokensForElement = function (element) {\n var attributeName = this.attributeName;\n var tokenString = element.getAttribute(attributeName) || \"\";\n return parseTokenString(tokenString, element, attributeName);\n };\n\n return TokenListObserver;\n}();\n\nexport { TokenListObserver };\n\nfunction parseTokenString(tokenString, element, attributeName) {\n return tokenString.trim().split(/\\s+/).filter(function (content) {\n return content.length;\n }).map(function (content, index) {\n return {\n element: element,\n attributeName: attributeName,\n content: content,\n index: index\n };\n });\n}\n\nfunction zip(left, right) {\n var length = Math.max(left.length, right.length);\n return Array.from({\n length: length\n }, function (_, index) {\n return [left[index], right[index]];\n });\n}\n\nfunction tokensAreEqual(left, right) {\n return left && right && left.index == right.index && left.content == right.content;\n}","import { TokenListObserver } from \"./token_list_observer\";\n\nvar ValueListObserver =\n/** @class */\nfunction () {\n function ValueListObserver(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\n Object.defineProperty(ValueListObserver.prototype, \"started\", {\n get: function () {\n return this.tokenListObserver.started;\n },\n enumerable: false,\n configurable: true\n });\n\n ValueListObserver.prototype.start = function () {\n this.tokenListObserver.start();\n };\n\n ValueListObserver.prototype.stop = function () {\n this.tokenListObserver.stop();\n };\n\n ValueListObserver.prototype.refresh = function () {\n this.tokenListObserver.refresh();\n };\n\n Object.defineProperty(ValueListObserver.prototype, \"element\", {\n get: function () {\n return this.tokenListObserver.element;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ValueListObserver.prototype, \"attributeName\", {\n get: function () {\n return this.tokenListObserver.attributeName;\n },\n enumerable: false,\n configurable: true\n });\n\n ValueListObserver.prototype.tokenMatched = function (token) {\n var element = token.element;\n var value = this.fetchParseResultForToken(token).value;\n\n if (value) {\n this.fetchValuesByTokenForElement(element).set(token, value);\n this.delegate.elementMatchedValue(element, value);\n }\n };\n\n ValueListObserver.prototype.tokenUnmatched = function (token) {\n var element = token.element;\n var value = this.fetchParseResultForToken(token).value;\n\n if (value) {\n this.fetchValuesByTokenForElement(element).delete(token);\n this.delegate.elementUnmatchedValue(element, value);\n }\n };\n\n ValueListObserver.prototype.fetchParseResultForToken = function (token) {\n var parseResult = this.parseResultsByToken.get(token);\n\n if (!parseResult) {\n parseResult = this.parseToken(token);\n this.parseResultsByToken.set(token, parseResult);\n }\n\n return parseResult;\n };\n\n ValueListObserver.prototype.fetchValuesByTokenForElement = function (element) {\n var valuesByToken = this.valuesByTokenByElement.get(element);\n\n if (!valuesByToken) {\n valuesByToken = new Map();\n this.valuesByTokenByElement.set(element, valuesByToken);\n }\n\n return valuesByToken;\n };\n\n ValueListObserver.prototype.parseToken = function (token) {\n try {\n var value = this.delegate.parseValueForToken(token);\n return {\n value: value\n };\n } catch (error) {\n return {\n error: error\n };\n }\n };\n\n return ValueListObserver;\n}();\n\nexport { ValueListObserver };","export function definitionsFromContext(context) {\n return context.keys().map(function (key) {\n return definitionForModuleWithContextAndKey(context, key);\n }).filter(function (value) {\n return value;\n });\n}\n\nfunction definitionForModuleWithContextAndKey(context, key) {\n var identifier = identifierForContextKey(key);\n\n if (identifier) {\n return definitionForModuleAndIdentifier(context(key), identifier);\n }\n}\n\nfunction definitionForModuleAndIdentifier(module, identifier) {\n var controllerConstructor = module.default;\n\n if (typeof controllerConstructor == \"function\") {\n return {\n identifier: identifier,\n controllerConstructor: controllerConstructor\n };\n }\n}\n\nexport function identifierForContextKey(key) {\n var logicalName = (key.match(/^(?:\\.\\/)?(.+)(?:[_-]controller\\..+?)$/) || [])[1];\n\n if (logicalName) {\n return logicalName.replace(/_/g, \"-\").replace(/\\//g, \"--\");\n }\n}","!function (t, e) {\n \"object\" == typeof exports && \"object\" == typeof module ? module.exports = e() : \"function\" == typeof define && define.amd ? define([], e) : \"object\" == typeof exports ? exports.bulmaCarousel = e() : t.bulmaCarousel = e();\n}(\"undefined\" != typeof self ? self : this, function () {\n return function (i) {\n var n = {};\n\n function s(t) {\n if (n[t]) return n[t].exports;\n var e = n[t] = {\n i: t,\n l: !1,\n exports: {}\n };\n return i[t].call(e.exports, e, e.exports, s), e.l = !0, e.exports;\n }\n\n return s.m = i, s.c = n, s.d = function (t, e, i) {\n s.o(t, e) || Object.defineProperty(t, e, {\n configurable: !1,\n enumerable: !0,\n get: i\n });\n }, s.n = function (t) {\n var e = t && t.__esModule ? function () {\n return t.default;\n } : function () {\n return t;\n };\n return s.d(e, \"a\", e), e;\n }, s.o = function (t, e) {\n return Object.prototype.hasOwnProperty.call(t, e);\n }, s.p = \"\", s(s.s = 5);\n }([function (t, e, i) {\n \"use strict\";\n\n i.d(e, \"d\", function () {\n return s;\n }), i.d(e, \"e\", function () {\n return r;\n }), i.d(e, \"b\", function () {\n return o;\n }), i.d(e, \"c\", function () {\n return a;\n }), i.d(e, \"a\", function () {\n return l;\n });\n\n var n = i(2),\n s = function (e, t) {\n (t = Array.isArray(t) ? t : t.split(\" \")).forEach(function (t) {\n e.classList.remove(t);\n });\n },\n r = function (t) {\n return t.getBoundingClientRect().width || t.offsetWidth;\n },\n o = function (t) {\n return t.getBoundingClientRect().height || t.offsetHeight;\n },\n a = function (t) {\n var e = 1 < arguments.length && void 0 !== arguments[1] && arguments[1],\n i = t.offsetHeight;\n\n if (e) {\n var n = window.getComputedStyle(t);\n i += parseInt(n.marginTop) + parseInt(n.marginBottom);\n }\n\n return i;\n },\n l = function (t, e) {\n if (!e) return window.getComputedStyle(t);\n\n if (Object(n.b)(e)) {\n var i = \"\";\n Object.keys(e).forEach(function (t) {\n i += t + \": \" + e[t] + \";\";\n }), t.style.cssText += i;\n }\n };\n }, function (t, e, i) {\n \"use strict\";\n\n e.a = function () {\n var t = !1;\n\n try {\n var e = Object.defineProperty({}, \"passive\", {\n get: function () {\n t = !0;\n }\n });\n window.addEventListener(\"testPassive\", null, e), window.removeEventListener(\"testPassive\", null, e);\n } catch (t) {}\n\n return t;\n };\n }, function (t, e, i) {\n \"use strict\";\n\n i.d(e, \"a\", function () {\n return s;\n }), i.d(e, \"c\", function () {\n return r;\n }), i.d(e, \"b\", function () {\n return o;\n });\n\n var n = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (t) {\n return typeof t;\n } : function (t) {\n return t && \"function\" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? \"symbol\" : typeof t;\n },\n s = function (t) {\n return \"function\" == typeof t;\n },\n r = function (t) {\n return \"string\" == typeof t || !!t && \"object\" === (void 0 === t ? \"undefined\" : n(t)) && \"[object String]\" === Object.prototype.toString.call(t);\n },\n o = function (t) {\n return (\"function\" == typeof t || \"object\" === (void 0 === t ? \"undefined\" : n(t)) && !!t) && !Array.isArray(t);\n };\n }, function (t, e, i) {\n \"use strict\";\n\n var n = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var s = function () {\n function e() {\n var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [];\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e), this.events = new Map(t);\n }\n\n return n(e, [{\n key: \"on\",\n value: function (t, e) {\n var i = this;\n return this.events.set(t, [].concat(function (t) {\n if (Array.isArray(t)) {\n for (var e = 0, i = Array(t.length); e < t.length; e++) i[e] = t[e];\n\n return i;\n }\n\n return Array.from(t);\n }(this.events.has(t) ? this.events.get(t) : []), [e])), function () {\n return i.events.set(t, i.events.get(t).filter(function (t) {\n return t !== e;\n }));\n };\n }\n }, {\n key: \"emit\",\n value: function (t) {\n for (var e = arguments.length, i = Array(1 < e ? e - 1 : 0), n = 1; n < e; n++) i[n - 1] = arguments[n];\n\n return this.events.has(t) && this.events.get(t).map(function (t) {\n return t.apply(void 0, i);\n });\n }\n }]), e;\n }();\n\n e.a = s;\n }, function (t, e, i) {\n \"use strict\";\n\n var n = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var s = function () {\n function s() {\n var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0,\n e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0;\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, s), this._x = t, this._y = e;\n }\n\n return n(s, [{\n key: \"add\",\n value: function (t) {\n return new s(this._x + t._x, this._y + t._y);\n }\n }, {\n key: \"sub\",\n value: function (t) {\n return new s(this._x - t._x, this._y - t._y);\n }\n }, {\n key: \"distance\",\n value: function (t) {\n var e = this._x - t._x,\n i = this._y - t._y;\n return Math.sqrt(Math.pow(e, 2) + Math.pow(i, 2));\n }\n }, {\n key: \"max\",\n value: function (t) {\n return new s(Math.max(this._x, t._x), Math.max(this._y, t._y));\n }\n }, {\n key: \"equals\",\n value: function (t) {\n return this == t || !(!t || null == t) && this._x == t._x && this._y == t._y;\n }\n }, {\n key: \"inside\",\n value: function (t, e) {\n return this._x >= t._x && this._x <= e._x && this._y >= t._y && this._y <= e._y;\n }\n }, {\n key: \"constrain\",\n value: function (t, e) {\n if (t._x > e._x || t._y > e._y) return this;\n var i = this._x,\n n = this._y;\n return null !== t._x && (i = Math.max(i, t._x)), null !== e._x && (i = Math.min(i, e._x)), null !== t._y && (n = Math.max(n, t._y)), null !== e._y && (n = Math.min(n, e._y)), new s(i, n);\n }\n }, {\n key: \"reposition\",\n value: function (t) {\n t.style.top = this._y + \"px\", t.style.left = this._x + \"px\";\n }\n }, {\n key: \"toString\",\n value: function () {\n return \"(\" + this._x + \",\" + this._y + \")\";\n }\n }, {\n key: \"x\",\n get: function () {\n return this._x;\n },\n set: function () {\n var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0;\n return this._x = t, this;\n }\n }, {\n key: \"y\",\n get: function () {\n return this._y;\n },\n set: function () {\n var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0;\n return this._y = t, this;\n }\n }]), s;\n }();\n\n e.a = s;\n }, function (t, e, i) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n\n var n = i(6),\n s = i(0),\n a = i(2),\n r = i(3),\n l = i(7),\n h = i(9),\n u = i(10),\n d = i(11),\n c = i(13),\n f = i(15),\n p = i(18),\n v = i(19),\n y = i(22),\n _ = i(23),\n g = i(24),\n b = Object.assign || function (t) {\n for (var e = 1; e < arguments.length; e++) {\n var i = arguments[e];\n\n for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);\n }\n\n return t;\n },\n w = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var o = function (t) {\n function o(t) {\n var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, o);\n\n var r = function (t, e) {\n if (!t) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return !e || \"object\" != typeof e && \"function\" != typeof e ? t : e;\n }(this, (o.__proto__ || Object.getPrototypeOf(o)).call(this));\n\n if (r.element = Object(a.c)(t) ? document.querySelector(t) : t, !r.element) throw new Error(\"An invalid selector or non-DOM node has been provided.\");\n r._clickEvents = [\"click\", \"touch\"];\n var i = r.element.dataset ? Object.keys(r.element.dataset).filter(function (t) {\n return Object.keys(y.a).includes(t);\n }).reduce(function (t, e) {\n return b({}, t, (i = {}, n = e, s = r.element.dataset[e], n in i ? Object.defineProperty(i, n, {\n value: s,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : i[n] = s, i));\n var i, n, s;\n }, {}) : {};\n return r.options = b({}, y.a, e, i), r._id = Object(n.a)(\"slider\"), r.onShow = r.onShow.bind(r), r._init(), r;\n }\n\n return function (t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function, not \" + typeof e);\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);\n }(o, r[\"a\"]), w(o, [{\n key: \"_init\",\n value: function () {\n return this._items = Array.from(this.element.children), this._breakpoint = new h.a(this), this._autoplay = new l.a(this), this._navigation = new c.a(this), this._pagination = new f.a(this), this._infinite = new u.a(this), this._loop = new d.a(this), this._swipe = new p.a(this), this._build(), Object(a.a)(this.options.onReady) && this.options.onReady(this), this;\n }\n }, {\n key: \"_build\",\n value: function () {\n var i = this;\n this.node = document.createRange().createContextualFragment(Object(_.a)(this.id)), this._ui = {\n wrapper: this.node.firstChild,\n container: this.node.querySelector(\".slider-container\")\n }, this.element.appendChild(this.node), this._ui.wrapper.classList.add(\"is-loading\"), this._ui.container.style.opacity = 0, this._transitioner = new v.a(this), this._slides = this._items.map(function (t, e) {\n return i._createSlide(t, e);\n }), this.reset(), this._bindEvents(), this._ui.container.style.opacity = 1, this._ui.wrapper.classList.remove(\"is-loading\");\n }\n }, {\n key: \"_bindEvents\",\n value: function () {\n this.on(\"show\", this.onShow);\n }\n }, {\n key: \"_unbindEvents\",\n value: function () {\n this.off(\"show\", this.onShow);\n }\n }, {\n key: \"_createSlide\",\n value: function (t, e) {\n var i = document.createRange().createContextualFragment(Object(g.a)()).firstChild;\n return i.dataset.sliderIndex = e, i.appendChild(t), i;\n }\n }, {\n key: \"_setDimensions\",\n value: function () {\n var e = this;\n this.options.vertical ? (this._ui.wrapper.style.height = Object(s.c)(this._slides[0]) * this.slidesToShow, this.options.centerMode && (this._ui.wrapper.style.padding = this.options.centerPadding + \" 0px\")) : this.options.centerMode && (this._ui.wrapper.style.padding = \"0px \" + this.options.centerPadding), this._wrapperWidth = Object(s.e)(this._ui.wrapper), this._wrapperHeight = Object(s.c)(this._ui.wrapper), this.options.vertical ? (this._slideWidth = Math.ceil(this._wrapperWidth), this._containerHeight = Math.ceil(Object(s.c)(this._slides[0]) * this._slides.length), this._ui.container.style.height = this._containerHeight + \"px\") : (this._slideWidth = Math.ceil(this._wrapperWidth / this.slidesToShow), this._containerWidth = Math.ceil(this._slideWidth * this._slides.length), this._ui.container.style.width = this._containerWidth + \"px\"), this._slides.forEach(function (t) {\n t.style.width = e._slideWidth + \"px\";\n });\n }\n }, {\n key: \"_setHeight\",\n value: function () {\n \"translate\" !== this.options.effect && (this._ui.container.style.height = Object(s.c)(this._slides[this.state.index]) + \"px\");\n }\n }, {\n key: \"_setClasses\",\n value: function () {\n var e = this;\n\n this._slides.forEach(function (t) {\n Object(s.d)(t, \"is-active is-current is-slide-previous is-slide-next\"), Math.abs((e.state.index - 1) % e.state.length) === parseInt(t.dataset.sliderIndex, 10) && t.classList.add(\"is-slide-previous\"), Math.abs(e.state.index % e.state.length) === parseInt(t.dataset.sliderIndex, 10) && t.classList.add(\"is-current\"), Math.abs((e.state.index + 1) % e.state.length) === parseInt(t.dataset.sliderIndex, 10) && t.classList.add(\"is-slide-next\");\n });\n }\n }, {\n key: \"onShow\",\n value: function (t) {\n this._navigation.refresh(), this._pagination.refresh(), this._setClasses();\n }\n }, {\n key: \"next\",\n value: function () {\n !this.options.loop && !this.options.infinite && this.state.index + this.slidesToScroll > this.state.length - this.slidesToShow && !this.options.centerMode ? this.state.next = this.state.index : this.state.next = this.state.index + this.slidesToScroll, this.show();\n }\n }, {\n key: \"previous\",\n value: function () {\n this.options.loop || this.options.infinite || 0 !== this.state.index ? this.state.next = this.state.index - this.slidesToScroll : this.state.next = this.state.index, this.show();\n }\n }, {\n key: \"start\",\n value: function () {\n this._autoplay.start();\n }\n }, {\n key: \"pause\",\n value: function () {\n this._autoplay.pause();\n }\n }, {\n key: \"stop\",\n value: function () {\n this._autoplay.stop();\n }\n }, {\n key: \"show\",\n value: function (t) {\n var e = 1 < arguments.length && void 0 !== arguments[1] && arguments[1];\n !this.state.length || this.state.length <= this.slidesToShow || (\"Number\" == typeof t && (this.state.next = t), this.options.loop && this._loop.apply(), this.options.infinite && this._infinite.apply(), this.state.index !== this.state.next && (this.emit(\"before:show\", this.state), this._transitioner.apply(e, this._setHeight.bind(this)), this.emit(\"after:show\", this.state), this.emit(\"show\", this)));\n }\n }, {\n key: \"reset\",\n value: function () {\n var e = this;\n this.state = {\n length: this._items.length,\n index: Math.abs(this.options.initialSlide),\n next: Math.abs(this.options.initialSlide),\n prev: void 0\n }, this.options.loop && this.options.infinite && (this.options.loop = !1), this.options.slidesToScroll > this.options.slidesToShow && (this.options.slidesToScroll = this.slidesToShow), this._breakpoint.init(), this.state.index >= this.state.length && 0 !== this.state.index && (this.state.index = this.state.index - this.slidesToScroll), this.state.length <= this.slidesToShow && (this.state.index = 0), this._ui.wrapper.appendChild(this._navigation.init().render()), this._ui.wrapper.appendChild(this._pagination.init().render()), this.options.navigationSwipe ? this._swipe.bindEvents() : this._swipe._bindEvents(), this._breakpoint.apply(), this._slides.forEach(function (t) {\n return e._ui.container.appendChild(t);\n }), this._transitioner.init().apply(!0, this._setHeight.bind(this)), this.options.autoplay && this._autoplay.init().start();\n }\n }, {\n key: \"destroy\",\n value: function () {\n var e = this;\n this._unbindEvents(), this._items.forEach(function (t) {\n e.element.appendChild(t);\n }), this.node.remove();\n }\n }, {\n key: \"id\",\n get: function () {\n return this._id;\n }\n }, {\n key: \"index\",\n set: function (t) {\n this._index = t;\n },\n get: function () {\n return this._index;\n }\n }, {\n key: \"length\",\n set: function (t) {\n this._length = t;\n },\n get: function () {\n return this._length;\n }\n }, {\n key: \"slides\",\n get: function () {\n return this._slides;\n },\n set: function (t) {\n this._slides = t;\n }\n }, {\n key: \"slidesToScroll\",\n get: function () {\n return \"translate\" === this.options.effect ? this._breakpoint.getSlidesToScroll() : 1;\n }\n }, {\n key: \"slidesToShow\",\n get: function () {\n return \"translate\" === this.options.effect ? this._breakpoint.getSlidesToShow() : 1;\n }\n }, {\n key: \"direction\",\n get: function () {\n return \"rtl\" === this.element.dir.toLowerCase() || \"rtl\" === this.element.style.direction ? \"rtl\" : \"ltr\";\n }\n }, {\n key: \"wrapper\",\n get: function () {\n return this._ui.wrapper;\n }\n }, {\n key: \"wrapperWidth\",\n get: function () {\n return this._wrapperWidth || 0;\n }\n }, {\n key: \"container\",\n get: function () {\n return this._ui.container;\n }\n }, {\n key: \"containerWidth\",\n get: function () {\n return this._containerWidth || 0;\n }\n }, {\n key: \"slideWidth\",\n get: function () {\n return this._slideWidth || 0;\n }\n }, {\n key: \"transitioner\",\n get: function () {\n return this._transitioner;\n }\n }], [{\n key: \"attach\",\n value: function () {\n var i = this,\n t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : \".slider\",\n n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},\n s = new Array(),\n e = Object(a.c)(t) ? document.querySelectorAll(t) : Array.isArray(t) ? t : [t];\n return [].forEach.call(e, function (t) {\n if (void 0 === t[i.constructor.name]) {\n var e = new o(t, n);\n t[i.constructor.name] = e, s.push(e);\n } else s.push(t[i.constructor.name]);\n }), s;\n }\n }]), o;\n }();\n\n e.default = o;\n }, function (t, e, i) {\n \"use strict\";\n\n i.d(e, \"a\", function () {\n return n;\n });\n\n var n = function () {\n return (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : \"\") + ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (t) {\n return (t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> t / 4).toString(16);\n });\n };\n }, function (t, e, i) {\n \"use strict\";\n\n var n = i(3),\n s = i(8),\n r = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n Symbol(\"onVisibilityChange\"), Symbol(\"onMouseEnter\"), Symbol(\"onMouseLeave\");\n\n var o = function (t) {\n function i(t) {\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, i);\n\n var e = function (t, e) {\n if (!t) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return !e || \"object\" != typeof e && \"function\" != typeof e ? t : e;\n }(this, (i.__proto__ || Object.getPrototypeOf(i)).call(this));\n\n return e.slider = t, e.onVisibilityChange = e.onVisibilityChange.bind(e), e.onMouseEnter = e.onMouseEnter.bind(e), e.onMouseLeave = e.onMouseLeave.bind(e), e;\n }\n\n return function (t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function, not \" + typeof e);\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);\n }(i, n[\"a\"]), r(i, [{\n key: \"init\",\n value: function () {\n return this._bindEvents(), this;\n }\n }, {\n key: \"_bindEvents\",\n value: function () {\n document.addEventListener(\"visibilitychange\", this.onVisibilityChange), this.slider.options.pauseOnHover && (this.slider.container.addEventListener(s.a, this.onMouseEnter), this.slider.container.addEventListener(s.b, this.onMouseLeave));\n }\n }, {\n key: \"_unbindEvents\",\n value: function () {\n document.removeEventListener(\"visibilitychange\", this.onVisibilityChange), this.slider.container.removeEventListener(s.a, this.onMouseEnter), this.slider.container.removeEventListener(s.b, this.onMouseLeave);\n }\n }, {\n key: \"start\",\n value: function () {\n var t = this;\n this.stop(), this.slider.options.autoplay && (this.emit(\"start\", this), this._interval = setInterval(function () {\n t._hovering && t.slider.options.pauseOnHover || (!t.slider.options.centerMode && t.slider.state.next >= t.slider.state.length - t.slider.slidesToShow && !t.slider.options.loop && !t.slider.options.infinite ? t.stop() : t.slider.next());\n }, this.slider.options.autoplaySpeed));\n }\n }, {\n key: \"stop\",\n value: function () {\n this._interval = clearInterval(this._interval), this.emit(\"stop\", this);\n }\n }, {\n key: \"pause\",\n value: function () {\n var t = this,\n e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0;\n this.paused || (this.timer && this.stop(), this.paused = !0, 0 === e ? (this.paused = !1, this.start()) : this.slider.on(\"transition:end\", function () {\n t && (t.paused = !1, t.run ? t.start() : t.stop());\n }));\n }\n }, {\n key: \"onVisibilityChange\",\n value: function (t) {\n document.hidden ? this.stop() : this.start();\n }\n }, {\n key: \"onMouseEnter\",\n value: function (t) {\n this._hovering = !0, this.slider.options.pauseOnHover && this.pause();\n }\n }, {\n key: \"onMouseLeave\",\n value: function (t) {\n this._hovering = !1, this.slider.options.pauseOnHover && this.pause();\n }\n }]), i;\n }();\n\n e.a = o;\n }, function (t, e, i) {\n \"use strict\";\n\n i.d(e, \"a\", function () {\n return o;\n }), i.d(e, \"b\", function () {\n return a;\n });\n window.navigator.pointerEnabled || window.navigator.msPointerEnabled, window.navigator.msPointerEnabled && 1 < window.navigator.msMaxTouchPoints || window.navigator.pointerEnabled && window.navigator.maxTouchPoints, navigator.userAgent.match(/(Android);?[\\s\\/]+([\\d.]+)?/), navigator.userAgent.match(/(iPad).*OS\\s([\\d_]+)/), navigator.userAgent.match(/(iPod)(.*OS\\s([\\d_]+))?/), !navigator.userAgent.match(/(iPad).*OS\\s([\\d_]+)/) && navigator.userAgent.match(/(iPhone\\sOS)\\s([\\d_]+)/), 0 <= navigator.userAgent.toLowerCase().indexOf(\"safari\") && navigator.userAgent.toLowerCase().indexOf(\"chrome\") < 0 && navigator.userAgent.toLowerCase().indexOf(\"android\"), /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent);\n var n = !!(\"ontouchstart\" in window),\n s = !!(\"PointerEvent\" in window),\n r = n || window.DocumentTouch && document instanceof DocumentTouch || navigator.maxTouchPoints,\n o = r && s ? \"pointerenter\" : \"mouseenter\",\n a = r && s ? \"pointerleave\" : \"mouseleave\";\n }, function (t, e, i) {\n \"use strict\";\n\n var n = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var s = Symbol(\"onResize\"),\n r = function () {\n function e(t) {\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e), this.slider = t, this.options = t.options, this[s] = this[s].bind(this), this._bindEvents();\n }\n\n return n(e, [{\n key: \"init\",\n value: function () {\n return this._defaultBreakpoint = {\n slidesToShow: this.options.slidesToShow,\n slidesToScroll: this.options.slidesToScroll\n }, this.options.breakpoints.sort(function (t, e) {\n return parseInt(t.changePoint, 10) > parseInt(e.changePoint, 10);\n }), this._currentBreakpoint = this._getActiveBreakpoint(), this;\n }\n }, {\n key: \"destroy\",\n value: function () {\n this._unbindEvents();\n }\n }, {\n key: \"_bindEvents\",\n value: function () {\n window.addEventListener(\"resize\", this[s]), window.addEventListener(\"orientationchange\", this[s]);\n }\n }, {\n key: \"_unbindEvents\",\n value: function () {\n window.removeEventListener(\"resize\", this[s]), window.removeEventListener(\"orientationchange\", this[s]);\n }\n }, {\n key: \"_getActiveBreakpoint\",\n value: function () {\n var t = !0,\n e = !1,\n i = void 0;\n\n try {\n for (var n, s = this.options.breakpoints[Symbol.iterator](); !(t = (n = s.next()).done); t = !0) {\n var r = n.value;\n if (r.changePoint >= window.innerWidth) return r;\n }\n } catch (t) {\n e = !0, i = t;\n } finally {\n try {\n !t && s.return && s.return();\n } finally {\n if (e) throw i;\n }\n }\n\n return this._defaultBreakpoint;\n }\n }, {\n key: \"getSlidesToShow\",\n value: function () {\n return this._currentBreakpoint ? this._currentBreakpoint.slidesToShow : this._defaultBreakpoint.slidesToShow;\n }\n }, {\n key: \"getSlidesToScroll\",\n value: function () {\n return this._currentBreakpoint ? this._currentBreakpoint.slidesToScroll : this._defaultBreakpoint.slidesToScroll;\n }\n }, {\n key: \"apply\",\n value: function () {\n this.slider.state.index >= this.slider.state.length && 0 !== this.slider.state.index && (this.slider.state.index = this.slider.state.index - this._currentBreakpoint.slidesToScroll), this.slider.state.length <= this._currentBreakpoint.slidesToShow && (this.slider.state.index = 0), this.options.loop && this.slider._loop.init().apply(), this.options.infinite && this.slider._infinite.init().apply(), this.slider._setDimensions(), this.slider._transitioner.init().apply(!0, this.slider._setHeight.bind(this.slider)), this.slider._setClasses(), this.slider._navigation.refresh(), this.slider._pagination.refresh();\n }\n }, {\n key: s,\n value: function (t) {\n var e = this._getActiveBreakpoint();\n\n e.slidesToShow !== this._currentBreakpoint.slidesToShow && (this._currentBreakpoint = e, this.apply());\n }\n }]), e;\n }();\n\n e.a = r;\n }, function (t, e, i) {\n \"use strict\";\n\n var n = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var s = function () {\n function e(t) {\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e), this.slider = t;\n }\n\n return n(e, [{\n key: \"init\",\n value: function () {\n if (this.slider.options.infinite && \"translate\" === this.slider.options.effect) {\n this.slider.options.centerMode ? this._infiniteCount = Math.ceil(this.slider.slidesToShow + this.slider.slidesToShow / 2) : this._infiniteCount = this.slider.slidesToShow;\n\n for (var t = [], e = 0, i = this.slider.state.length; i > this.slider.state.length - 1 - this._infiniteCount; i -= 1) e = i - 1, t.unshift(this._cloneSlide(this.slider.slides[e], e - this.slider.state.length));\n\n for (var n = [], s = 0; s < this._infiniteCount + this.slider.state.length; s += 1) n.push(this._cloneSlide(this.slider.slides[s % this.slider.state.length], s + this.slider.state.length));\n\n this.slider.slides = [].concat(t, function (t) {\n if (Array.isArray(t)) {\n for (var e = 0, i = Array(t.length); e < t.length; e++) i[e] = t[e];\n\n return i;\n }\n\n return Array.from(t);\n }(this.slider.slides), n);\n }\n\n return this;\n }\n }, {\n key: \"apply\",\n value: function () {}\n }, {\n key: \"onTransitionEnd\",\n value: function (t) {\n this.slider.options.infinite && (this.slider.state.next >= this.slider.state.length ? (this.slider.state.index = this.slider.state.next = this.slider.state.next - this.slider.state.length, this.slider.transitioner.apply(!0)) : this.slider.state.next < 0 && (this.slider.state.index = this.slider.state.next = this.slider.state.length + this.slider.state.next, this.slider.transitioner.apply(!0)));\n }\n }, {\n key: \"_cloneSlide\",\n value: function (t, e) {\n var i = t.cloneNode(!0);\n return i.dataset.sliderIndex = e, i.dataset.cloned = !0, (i.querySelectorAll(\"[id]\") || []).forEach(function (t) {\n t.setAttribute(\"id\", \"\");\n }), i;\n }\n }]), e;\n }();\n\n e.a = s;\n }, function (t, e, i) {\n \"use strict\";\n\n var n = i(12),\n s = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var r = function () {\n function e(t) {\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e), this.slider = t;\n }\n\n return s(e, [{\n key: \"init\",\n value: function () {\n return this;\n }\n }, {\n key: \"apply\",\n value: function () {\n this.slider.options.loop && (0 < this.slider.state.next ? this.slider.state.next < this.slider.state.length ? this.slider.state.next > this.slider.state.length - this.slider.slidesToShow && Object(n.a)(this.slider._slides[this.slider.state.length - 1], this.slider.wrapper) ? this.slider.state.next = 0 : this.slider.state.next = Math.min(Math.max(this.slider.state.next, 0), this.slider.state.length - this.slider.slidesToShow) : this.slider.state.next = 0 : this.slider.state.next <= 0 - this.slider.slidesToScroll ? this.slider.state.next = this.slider.state.length - this.slider.slidesToShow : this.slider.state.next = 0);\n }\n }]), e;\n }();\n\n e.a = r;\n }, function (t, e, i) {\n \"use strict\";\n\n i.d(e, \"a\", function () {\n return n;\n });\n\n var n = function (t, e) {\n var i = t.getBoundingClientRect();\n return e = e || document.documentElement, 0 <= i.top && 0 <= i.left && i.bottom <= (window.innerHeight || e.clientHeight) && i.right <= (window.innerWidth || e.clientWidth);\n };\n }, function (t, e, i) {\n \"use strict\";\n\n var n = i(14),\n s = i(1),\n r = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var o = function () {\n function e(t) {\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e), this.slider = t, this._clickEvents = [\"click\", \"touch\"], this._supportsPassive = Object(s.a)(), this.onPreviousClick = this.onPreviousClick.bind(this), this.onNextClick = this.onNextClick.bind(this), this.onKeyUp = this.onKeyUp.bind(this);\n }\n\n return r(e, [{\n key: \"init\",\n value: function () {\n return this.node = document.createRange().createContextualFragment(Object(n.a)(this.slider.options.icons)), this._ui = {\n previous: this.node.querySelector(\".slider-navigation-previous\"),\n next: this.node.querySelector(\".slider-navigation-next\")\n }, this._unbindEvents(), this._bindEvents(), this.refresh(), this;\n }\n }, {\n key: \"destroy\",\n value: function () {\n this._unbindEvents();\n }\n }, {\n key: \"_bindEvents\",\n value: function () {\n var e = this;\n this.slider.wrapper.addEventListener(\"keyup\", this.onKeyUp), this._clickEvents.forEach(function (t) {\n e._ui.previous.addEventListener(t, e.onPreviousClick), e._ui.next.addEventListener(t, e.onNextClick);\n });\n }\n }, {\n key: \"_unbindEvents\",\n value: function () {\n var e = this;\n this.slider.wrapper.removeEventListener(\"keyup\", this.onKeyUp), this._clickEvents.forEach(function (t) {\n e._ui.previous.removeEventListener(t, e.onPreviousClick), e._ui.next.removeEventListener(t, e.onNextClick);\n });\n }\n }, {\n key: \"onNextClick\",\n value: function (t) {\n this._supportsPassive || t.preventDefault(), this.slider.options.navigation && this.slider.next();\n }\n }, {\n key: \"onPreviousClick\",\n value: function (t) {\n this._supportsPassive || t.preventDefault(), this.slider.options.navigation && this.slider.previous();\n }\n }, {\n key: \"onKeyUp\",\n value: function (t) {\n this.slider.options.keyNavigation && (\"ArrowRight\" === t.key || \"Right\" === t.key ? this.slider.next() : \"ArrowLeft\" !== t.key && \"Left\" !== t.key || this.slider.previous());\n }\n }, {\n key: \"refresh\",\n value: function () {\n this.slider.options.loop || this.slider.options.infinite || (this.slider.options.navigation && this.slider.state.length > this.slider.slidesToShow ? (this._ui.previous.classList.remove(\"is-hidden\"), this._ui.next.classList.remove(\"is-hidden\"), 0 === this.slider.state.next ? (this._ui.previous.classList.add(\"is-hidden\"), this._ui.next.classList.remove(\"is-hidden\")) : this.slider.state.next >= this.slider.state.length - this.slider.slidesToShow && !this.slider.options.centerMode ? (this._ui.previous.classList.remove(\"is-hidden\"), this._ui.next.classList.add(\"is-hidden\")) : this.slider.state.next >= this.slider.state.length - 1 && this.slider.options.centerMode && (this._ui.previous.classList.remove(\"is-hidden\"), this._ui.next.classList.add(\"is-hidden\"))) : (this._ui.previous.classList.add(\"is-hidden\"), this._ui.next.classList.add(\"is-hidden\")));\n }\n }, {\n key: \"render\",\n value: function () {\n return this.node;\n }\n }]), e;\n }();\n\n e.a = o;\n }, function (t, e, i) {\n \"use strict\";\n\n e.a = function (t) {\n return '
    ' + t.previous + '
    \\n
    ' + t.next + \"
    \";\n };\n }, function (t, e, i) {\n \"use strict\";\n\n var n = i(16),\n s = i(17),\n r = i(1),\n o = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var a = function () {\n function e(t) {\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e), this.slider = t, this._clickEvents = [\"click\", \"touch\"], this._supportsPassive = Object(r.a)(), this.onPageClick = this.onPageClick.bind(this), this.onResize = this.onResize.bind(this);\n }\n\n return o(e, [{\n key: \"init\",\n value: function () {\n return this._pages = [], this.node = document.createRange().createContextualFragment(Object(n.a)()), this._ui = {\n container: this.node.firstChild\n }, this._count = Math.ceil((this.slider.state.length - this.slider.slidesToShow) / this.slider.slidesToScroll), this._draw(), this.refresh(), this;\n }\n }, {\n key: \"destroy\",\n value: function () {\n this._unbindEvents();\n }\n }, {\n key: \"_bindEvents\",\n value: function () {\n var i = this;\n window.addEventListener(\"resize\", this.onResize), window.addEventListener(\"orientationchange\", this.onResize), this._clickEvents.forEach(function (e) {\n i._pages.forEach(function (t) {\n return t.addEventListener(e, i.onPageClick);\n });\n });\n }\n }, {\n key: \"_unbindEvents\",\n value: function () {\n var i = this;\n window.removeEventListener(\"resize\", this.onResize), window.removeEventListener(\"orientationchange\", this.onResize), this._clickEvents.forEach(function (e) {\n i._pages.forEach(function (t) {\n return t.removeEventListener(e, i.onPageClick);\n });\n });\n }\n }, {\n key: \"_draw\",\n value: function () {\n if (this._ui.container.innerHTML = \"\", this.slider.options.pagination && this.slider.state.length > this.slider.slidesToShow) {\n for (var t = 0; t <= this._count; t++) {\n var e = document.createRange().createContextualFragment(Object(s.a)()).firstChild;\n e.dataset.index = t * this.slider.slidesToScroll, this._pages.push(e), this._ui.container.appendChild(e);\n }\n\n this._bindEvents();\n }\n }\n }, {\n key: \"onPageClick\",\n value: function (t) {\n this._supportsPassive || t.preventDefault(), this.slider.state.next = t.currentTarget.dataset.index, this.slider.show();\n }\n }, {\n key: \"onResize\",\n value: function () {\n this._draw();\n }\n }, {\n key: \"refresh\",\n value: function () {\n var e = this,\n t = void 0;\n (t = this.slider.options.infinite ? Math.ceil(this.slider.state.length - 1 / this.slider.slidesToScroll) : Math.ceil((this.slider.state.length - this.slider.slidesToShow) / this.slider.slidesToScroll)) !== this._count && (this._count = t, this._draw()), this._pages.forEach(function (t) {\n t.classList.remove(\"is-active\"), parseInt(t.dataset.index, 10) === e.slider.state.next % e.slider.state.length && t.classList.add(\"is-active\");\n });\n }\n }, {\n key: \"render\",\n value: function () {\n return this.node;\n }\n }]), e;\n }();\n\n e.a = a;\n }, function (t, e, i) {\n \"use strict\";\n\n e.a = function () {\n return '
    ';\n };\n }, function (t, e, i) {\n \"use strict\";\n\n e.a = function () {\n return '
    ';\n };\n }, function (t, e, i) {\n \"use strict\";\n\n var n = i(4),\n s = i(1),\n r = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var o = function () {\n function e(t) {\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e), this.slider = t, this._supportsPassive = Object(s.a)(), this.onStartDrag = this.onStartDrag.bind(this), this.onMoveDrag = this.onMoveDrag.bind(this), this.onStopDrag = this.onStopDrag.bind(this), this._init();\n }\n\n return r(e, [{\n key: \"_init\",\n value: function () {}\n }, {\n key: \"bindEvents\",\n value: function () {\n var e = this;\n this.slider.container.addEventListener(\"dragstart\", function (t) {\n e._supportsPassive || t.preventDefault();\n }), this.slider.container.addEventListener(\"mousedown\", this.onStartDrag), this.slider.container.addEventListener(\"touchstart\", this.onStartDrag), window.addEventListener(\"mousemove\", this.onMoveDrag), window.addEventListener(\"touchmove\", this.onMoveDrag), window.addEventListener(\"mouseup\", this.onStopDrag), window.addEventListener(\"touchend\", this.onStopDrag), window.addEventListener(\"touchcancel\", this.onStopDrag);\n }\n }, {\n key: \"unbindEvents\",\n value: function () {\n var e = this;\n this.slider.container.removeEventListener(\"dragstart\", function (t) {\n e._supportsPassive || t.preventDefault();\n }), this.slider.container.removeEventListener(\"mousedown\", this.onStartDrag), this.slider.container.removeEventListener(\"touchstart\", this.onStartDrag), window.removeEventListener(\"mousemove\", this.onMoveDrag), window.removeEventListener(\"touchmove\", this.onMoveDrag), window.removeEventListener(\"mouseup\", this.onStopDrag), window.removeEventListener(\"mouseup\", this.onStopDrag), window.removeEventListener(\"touchcancel\", this.onStopDrag);\n }\n }, {\n key: \"onStartDrag\",\n value: function (t) {\n if (t.touches) {\n if (1 < t.touches.length) return;\n t = t.touches[0];\n }\n\n this._origin = new n.a(t.screenX, t.screenY), this.width = this.slider.wrapperWidth, this.slider.transitioner.disable();\n }\n }, {\n key: \"onMoveDrag\",\n value: function (t) {\n if (this._origin) {\n var e = t.touches ? t.touches[0] : t;\n this._lastTranslate = new n.a(e.screenX - this._origin.x, e.screenY - this._origin.y), t.touches && Math.abs(this._lastTranslate.x) > Math.abs(this._lastTranslate.y) && (this._supportsPassive || t.preventDefault(), t.stopPropagation());\n }\n }\n }, {\n key: \"onStopDrag\",\n value: function (t) {\n this._origin && this._lastTranslate && (Math.abs(this._lastTranslate.x) > .2 * this.width ? this._lastTranslate.x < 0 ? this.slider.next() : this.slider.previous() : this.slider.show(!0)), this._origin = null, this._lastTranslate = null;\n }\n }]), e;\n }();\n\n e.a = o;\n }, function (t, e, i) {\n \"use strict\";\n\n var n = i(20),\n s = i(21),\n r = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var o = function () {\n function e(t) {\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e), this.slider = t, this.options = t.options, this._animating = !1, this._animation = void 0, this._translate = new s.a(this, t, t.options), this._fade = new n.a(this, t, t.options);\n }\n\n return r(e, [{\n key: \"init\",\n value: function () {\n return this._fade.init(), this._translate.init(), this;\n }\n }, {\n key: \"isAnimating\",\n value: function () {\n return this._animating;\n }\n }, {\n key: \"enable\",\n value: function () {\n this._animation && this._animation.enable();\n }\n }, {\n key: \"disable\",\n value: function () {\n this._animation && this._animation.disable();\n }\n }, {\n key: \"apply\",\n value: function (t, e) {\n if (!this._animating || t) {\n switch (this.options.effect) {\n case \"fade\":\n this._animation = this._fade;\n break;\n\n case \"translate\":\n default:\n this._animation = this._translate;\n }\n\n this._animationCallback = e, t ? this._animation && this._animation.disable() : (this._animation && this._animation.enable(), this._animating = !0), this._animation && this._animation.apply(), t && this.end();\n }\n }\n }, {\n key: \"end\",\n value: function () {\n this._animating = !1, this._animation = void 0, this.slider.state.index = this.slider.state.next, this._animationCallback && this._animationCallback();\n }\n }]), e;\n }();\n\n e.a = o;\n }, function (t, e, i) {\n \"use strict\";\n\n var s = i(0),\n r = Object.assign || function (t) {\n for (var e = 1; e < arguments.length; e++) {\n var i = arguments[e];\n\n for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);\n }\n\n return t;\n },\n o = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var n = function () {\n function n(t, e) {\n var i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {};\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, n), this.transitioner = t, this.slider = e, this.options = r({}, i);\n }\n\n return o(n, [{\n key: \"init\",\n value: function () {\n var i = this;\n return \"fade\" === this.options.effect && this.slider.slides.forEach(function (t, e) {\n Object(s.a)(t, {\n position: \"absolute\",\n left: 0,\n top: 0,\n bottom: 0,\n \"z-index\": t.dataset.sliderIndex == i.slider.state.index ? 0 : -2,\n opacity: t.dataset.sliderIndex == i.slider.state.index ? 1 : 0\n });\n }), this;\n }\n }, {\n key: \"enable\",\n value: function () {\n var e = this;\n this._oldSlide = this.slider.slides.filter(function (t) {\n return t.dataset.sliderIndex == e.slider.state.index;\n })[0], this._newSlide = this.slider.slides.filter(function (t) {\n return t.dataset.sliderIndex == e.slider.state.next;\n })[0], this._newSlide && (this._newSlide.addEventListener(\"transitionend\", this.onTransitionEnd.bind(this)), this._newSlide.style.transition = this.options.duration + \"ms \" + this.options.timing, this._oldSlide && (this._oldSlide.addEventListener(\"transitionend\", this.onTransitionEnd.bind(this)), this._oldSlide.style.transition = this.options.duration + \"ms \" + this.options.timing));\n }\n }, {\n key: \"disable\",\n value: function () {\n var e = this;\n this._oldSlide = this.slider.slides.filter(function (t) {\n return t.dataset.sliderIndex == e.slider.state.index;\n })[0], this._newSlide = this.slider.slides.filter(function (t) {\n return t.dataset.sliderIndex == e.slider.state.next;\n })[0], this._newSlide && (this._newSlide.removeEventListener(\"transitionend\", this.onTransitionEnd.bind(this)), this._newSlide.style.transition = \"none\", this._oldSlide && (this._oldSlide.removeEventListener(\"transitionend\", this.onTransitionEnd.bind(this)), this._oldSlide.style.transition = \"none\"));\n }\n }, {\n key: \"apply\",\n value: function (t) {\n var e = this;\n this._oldSlide = this.slider.slides.filter(function (t) {\n return t.dataset.sliderIndex == e.slider.state.index;\n })[0], this._newSlide = this.slider.slides.filter(function (t) {\n return t.dataset.sliderIndex == e.slider.state.next;\n })[0], this._oldSlide && this._newSlide && (Object(s.a)(this._oldSlide, {\n opacity: 0\n }), Object(s.a)(this._newSlide, {\n opacity: 1,\n \"z-index\": t ? 0 : -1\n }));\n }\n }, {\n key: \"onTransitionEnd\",\n value: function (t) {\n \"fade\" === this.options.effect && (this.transitioner.isAnimating() && t.target == this._newSlide && (this._newSlide && (Object(s.a)(this._newSlide, {\n \"z-index\": 0\n }), this._newSlide.removeEventListener(\"transitionend\", this.onTransitionEnd.bind(this))), this._oldSlide && (Object(s.a)(this._oldSlide, {\n \"z-index\": -2\n }), this._oldSlide.removeEventListener(\"transitionend\", this.onTransitionEnd.bind(this)))), this.transitioner.end());\n }\n }]), n;\n }();\n\n e.a = n;\n }, function (t, e, i) {\n \"use strict\";\n\n var r = i(4),\n o = i(0),\n s = Object.assign || function (t) {\n for (var e = 1; e < arguments.length; e++) {\n var i = arguments[e];\n\n for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);\n }\n\n return t;\n },\n a = function () {\n function n(t, e) {\n for (var i = 0; i < e.length; i++) {\n var n = e[i];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n\n return function (t, e, i) {\n return e && n(t.prototype, e), i && n(t, i), t;\n };\n }();\n\n var n = function () {\n function n(t, e) {\n var i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {};\n !function (t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, n), this.transitioner = t, this.slider = e, this.options = s({}, i), this.onTransitionEnd = this.onTransitionEnd.bind(this);\n }\n\n return a(n, [{\n key: \"init\",\n value: function () {\n return this._position = new r.a(this.slider.container.offsetLeft, this.slider.container.offsetTop), this._bindEvents(), this;\n }\n }, {\n key: \"destroy\",\n value: function () {\n this._unbindEvents();\n }\n }, {\n key: \"_bindEvents\",\n value: function () {\n this.slider.container.addEventListener(\"transitionend\", this.onTransitionEnd);\n }\n }, {\n key: \"_unbindEvents\",\n value: function () {\n this.slider.container.removeEventListener(\"transitionend\", this.onTransitionEnd);\n }\n }, {\n key: \"enable\",\n value: function () {\n this.slider.container.style.transition = this.options.duration + \"ms \" + this.options.timing;\n }\n }, {\n key: \"disable\",\n value: function () {\n this.slider.container.style.transition = \"none\";\n }\n }, {\n key: \"apply\",\n value: function () {\n var e = this,\n t = void 0;\n\n if (\"translate\" === this.options.effect) {\n var i = this.slider.slides.filter(function (t) {\n return t.dataset.sliderIndex == e.slider.state.next;\n })[0],\n n = new r.a(i.offsetLeft, i.offsetTop);\n t = this.options.centerMode ? new r.a(Math.round(Object(o.e)(this.slider.container)), Math.round(Object(o.b)(this.slider.container))) : new r.a(Math.round(Object(o.e)(this.slider.container) - Object(o.e)(this.slider.wrapper)), Math.round(Object(o.b)(this.slider.container) - Object(o.b)(this.slider.wrapper)));\n var s = new r.a(Math.min(Math.max(-1 * n.x, -1 * t.x), 0), Math.min(Math.max(-1 * n.y, -1 * t.y), 0));\n this.options.loop && (!this.options.vertical && Math.abs(this._position.x) > t.x ? (s.x = 0, this.slider.state.next = 0) : this.options.vertical && Math.abs(this._position.y) > t.y && (s.y = 0, this.slider.state.next = 0)), this._position.x = s.x, this._position.y = s.y, this.options.centerMode && (this._position.x = this._position.x + this.slider.wrapperWidth / 2 - Object(o.e)(i) / 2), \"rtl\" === this.slider.direction && (this._position.x = -this._position.x, this._position.y = -this._position.y), this.slider.container.style.transform = \"translate3d(\" + this._position.x + \"px, \" + this._position.y + \"px, 0)\", n.x > t.x && this.slider.transitioner.end();\n }\n }\n }, {\n key: \"onTransitionEnd\",\n value: function (t) {\n \"translate\" === this.options.effect && (this.transitioner.isAnimating() && t.target == this.slider.container && this.options.infinite && this.slider._infinite.onTransitionEnd(t), this.transitioner.end());\n }\n }]), n;\n }();\n\n e.a = n;\n }, function (t, e, i) {\n \"use strict\";\n\n e.a = {\n initialSlide: 0,\n slidesToScroll: 1,\n slidesToShow: 1,\n navigation: !0,\n navigationKeys: !0,\n navigationSwipe: !0,\n pagination: !0,\n loop: !1,\n infinite: !1,\n effect: \"translate\",\n duration: 300,\n timing: \"ease\",\n autoplay: !1,\n autoplaySpeed: 3e3,\n pauseOnHover: !0,\n breakpoints: [{\n changePoint: 480,\n slidesToShow: 1,\n slidesToScroll: 1\n }, {\n changePoint: 640,\n slidesToShow: 2,\n slidesToScroll: 2\n }, {\n changePoint: 768,\n slidesToShow: 3,\n slidesToScroll: 3\n }],\n onReady: null,\n icons: {\n previous: '\\n \\n ',\n next: '\\n \\n '\n }\n };\n }, function (t, e, i) {\n \"use strict\";\n\n e.a = function (t) {\n return '
    \\n
    \\n
    ';\n };\n }, function (t, e, i) {\n \"use strict\";\n\n e.a = function () {\n return '
    ';\n };\n }]).default;\n});","exports.remove = removeDiacritics;\nvar replacementList = [{\n base: ' ',\n chars: \"\\u00A0\"\n}, {\n base: '0',\n chars: \"\\u07C0\"\n}, {\n base: 'A',\n chars: \"\\u24B6\\uFF21\\u00C0\\u00C1\\u00C2\\u1EA6\\u1EA4\\u1EAA\\u1EA8\\u00C3\\u0100\\u0102\\u1EB0\\u1EAE\\u1EB4\\u1EB2\\u0226\\u01E0\\u00C4\\u01DE\\u1EA2\\u00C5\\u01FA\\u01CD\\u0200\\u0202\\u1EA0\\u1EAC\\u1EB6\\u1E00\\u0104\\u023A\\u2C6F\"\n}, {\n base: 'AA',\n chars: \"\\uA732\"\n}, {\n base: 'AE',\n chars: \"\\u00C6\\u01FC\\u01E2\"\n}, {\n base: 'AO',\n chars: \"\\uA734\"\n}, {\n base: 'AU',\n chars: \"\\uA736\"\n}, {\n base: 'AV',\n chars: \"\\uA738\\uA73A\"\n}, {\n base: 'AY',\n chars: \"\\uA73C\"\n}, {\n base: 'B',\n chars: \"\\u24B7\\uFF22\\u1E02\\u1E04\\u1E06\\u0243\\u0181\"\n}, {\n base: 'C',\n chars: \"\\u24b8\\uff23\\uA73E\\u1E08\\u0106\\u0043\\u0108\\u010A\\u010C\\u00C7\\u0187\\u023B\"\n}, {\n base: 'D',\n chars: \"\\u24B9\\uFF24\\u1E0A\\u010E\\u1E0C\\u1E10\\u1E12\\u1E0E\\u0110\\u018A\\u0189\\u1D05\\uA779\"\n}, {\n base: 'Dh',\n chars: \"\\u00D0\"\n}, {\n base: 'DZ',\n chars: \"\\u01F1\\u01C4\"\n}, {\n base: 'Dz',\n chars: \"\\u01F2\\u01C5\"\n}, {\n base: 'E',\n chars: \"\\u025B\\u24BA\\uFF25\\u00C8\\u00C9\\u00CA\\u1EC0\\u1EBE\\u1EC4\\u1EC2\\u1EBC\\u0112\\u1E14\\u1E16\\u0114\\u0116\\u00CB\\u1EBA\\u011A\\u0204\\u0206\\u1EB8\\u1EC6\\u0228\\u1E1C\\u0118\\u1E18\\u1E1A\\u0190\\u018E\\u1D07\"\n}, {\n base: 'F',\n chars: \"\\uA77C\\u24BB\\uFF26\\u1E1E\\u0191\\uA77B\"\n}, {\n base: 'G',\n chars: \"\\u24BC\\uFF27\\u01F4\\u011C\\u1E20\\u011E\\u0120\\u01E6\\u0122\\u01E4\\u0193\\uA7A0\\uA77D\\uA77E\\u0262\"\n}, {\n base: 'H',\n chars: \"\\u24BD\\uFF28\\u0124\\u1E22\\u1E26\\u021E\\u1E24\\u1E28\\u1E2A\\u0126\\u2C67\\u2C75\\uA78D\"\n}, {\n base: 'I',\n chars: \"\\u24BE\\uFF29\\xCC\\xCD\\xCE\\u0128\\u012A\\u012C\\u0130\\xCF\\u1E2E\\u1EC8\\u01CF\\u0208\\u020A\\u1ECA\\u012E\\u1E2C\\u0197\"\n}, {\n base: 'J',\n chars: \"\\u24BF\\uFF2A\\u0134\\u0248\\u0237\"\n}, {\n base: 'K',\n chars: \"\\u24C0\\uFF2B\\u1E30\\u01E8\\u1E32\\u0136\\u1E34\\u0198\\u2C69\\uA740\\uA742\\uA744\\uA7A2\"\n}, {\n base: 'L',\n chars: \"\\u24C1\\uFF2C\\u013F\\u0139\\u013D\\u1E36\\u1E38\\u013B\\u1E3C\\u1E3A\\u0141\\u023D\\u2C62\\u2C60\\uA748\\uA746\\uA780\"\n}, {\n base: 'LJ',\n chars: \"\\u01C7\"\n}, {\n base: 'Lj',\n chars: \"\\u01C8\"\n}, {\n base: 'M',\n chars: \"\\u24C2\\uFF2D\\u1E3E\\u1E40\\u1E42\\u2C6E\\u019C\\u03FB\"\n}, {\n base: 'N',\n chars: \"\\uA7A4\\u0220\\u24C3\\uFF2E\\u01F8\\u0143\\xD1\\u1E44\\u0147\\u1E46\\u0145\\u1E4A\\u1E48\\u019D\\uA790\\u1D0E\"\n}, {\n base: 'NJ',\n chars: \"\\u01CA\"\n}, {\n base: 'Nj',\n chars: \"\\u01CB\"\n}, {\n base: 'O',\n chars: \"\\u24C4\\uFF2F\\xD2\\xD3\\xD4\\u1ED2\\u1ED0\\u1ED6\\u1ED4\\xD5\\u1E4C\\u022C\\u1E4E\\u014C\\u1E50\\u1E52\\u014E\\u022E\\u0230\\xD6\\u022A\\u1ECE\\u0150\\u01D1\\u020C\\u020E\\u01A0\\u1EDC\\u1EDA\\u1EE0\\u1EDE\\u1EE2\\u1ECC\\u1ED8\\u01EA\\u01EC\\xD8\\u01FE\\u0186\\u019F\\uA74A\\uA74C\"\n}, {\n base: 'OE',\n chars: \"\\u0152\"\n}, {\n base: 'OI',\n chars: \"\\u01A2\"\n}, {\n base: 'OO',\n chars: \"\\uA74E\"\n}, {\n base: 'OU',\n chars: \"\\u0222\"\n}, {\n base: 'P',\n chars: \"\\u24C5\\uFF30\\u1E54\\u1E56\\u01A4\\u2C63\\uA750\\uA752\\uA754\"\n}, {\n base: 'Q',\n chars: \"\\u24C6\\uFF31\\uA756\\uA758\\u024A\"\n}, {\n base: 'R',\n chars: \"\\u24C7\\uFF32\\u0154\\u1E58\\u0158\\u0210\\u0212\\u1E5A\\u1E5C\\u0156\\u1E5E\\u024C\\u2C64\\uA75A\\uA7A6\\uA782\"\n}, {\n base: 'S',\n chars: \"\\u24C8\\uFF33\\u1E9E\\u015A\\u1E64\\u015C\\u1E60\\u0160\\u1E66\\u1E62\\u1E68\\u0218\\u015E\\u2C7E\\uA7A8\\uA784\"\n}, {\n base: 'T',\n chars: \"\\u24C9\\uFF34\\u1E6A\\u0164\\u1E6C\\u021A\\u0162\\u1E70\\u1E6E\\u0166\\u01AC\\u01AE\\u023E\\uA786\"\n}, {\n base: 'Th',\n chars: \"\\u00DE\"\n}, {\n base: 'TZ',\n chars: \"\\uA728\"\n}, {\n base: 'U',\n chars: \"\\u24CA\\uFF35\\xD9\\xDA\\xDB\\u0168\\u1E78\\u016A\\u1E7A\\u016C\\xDC\\u01DB\\u01D7\\u01D5\\u01D9\\u1EE6\\u016E\\u0170\\u01D3\\u0214\\u0216\\u01AF\\u1EEA\\u1EE8\\u1EEE\\u1EEC\\u1EF0\\u1EE4\\u1E72\\u0172\\u1E76\\u1E74\\u0244\"\n}, {\n base: 'V',\n chars: \"\\u24CB\\uFF36\\u1E7C\\u1E7E\\u01B2\\uA75E\\u0245\"\n}, {\n base: 'VY',\n chars: \"\\uA760\"\n}, {\n base: 'W',\n chars: \"\\u24CC\\uFF37\\u1E80\\u1E82\\u0174\\u1E86\\u1E84\\u1E88\\u2C72\"\n}, {\n base: 'X',\n chars: \"\\u24CD\\uFF38\\u1E8A\\u1E8C\"\n}, {\n base: 'Y',\n chars: \"\\u24CE\\uFF39\\u1EF2\\xDD\\u0176\\u1EF8\\u0232\\u1E8E\\u0178\\u1EF6\\u1EF4\\u01B3\\u024E\\u1EFE\"\n}, {\n base: 'Z',\n chars: \"\\u24CF\\uFF3A\\u0179\\u1E90\\u017B\\u017D\\u1E92\\u1E94\\u01B5\\u0224\\u2C7F\\u2C6B\\uA762\"\n}, {\n base: 'a',\n chars: \"\\u24D0\\uFF41\\u1E9A\\u00E0\\u00E1\\u00E2\\u1EA7\\u1EA5\\u1EAB\\u1EA9\\u00E3\\u0101\\u0103\\u1EB1\\u1EAF\\u1EB5\\u1EB3\\u0227\\u01E1\\u00E4\\u01DF\\u1EA3\\u00E5\\u01FB\\u01CE\\u0201\\u0203\\u1EA1\\u1EAD\\u1EB7\\u1E01\\u0105\\u2C65\\u0250\\u0251\"\n}, {\n base: 'aa',\n chars: \"\\uA733\"\n}, {\n base: 'ae',\n chars: \"\\u00E6\\u01FD\\u01E3\"\n}, {\n base: 'ao',\n chars: \"\\uA735\"\n}, {\n base: 'au',\n chars: \"\\uA737\"\n}, {\n base: 'av',\n chars: \"\\uA739\\uA73B\"\n}, {\n base: 'ay',\n chars: \"\\uA73D\"\n}, {\n base: 'b',\n chars: \"\\u24D1\\uFF42\\u1E03\\u1E05\\u1E07\\u0180\\u0183\\u0253\\u0182\"\n}, {\n base: 'c',\n chars: \"\\uFF43\\u24D2\\u0107\\u0109\\u010B\\u010D\\u00E7\\u1E09\\u0188\\u023C\\uA73F\\u2184\"\n}, {\n base: 'd',\n chars: \"\\u24D3\\uFF44\\u1E0B\\u010F\\u1E0D\\u1E11\\u1E13\\u1E0F\\u0111\\u018C\\u0256\\u0257\\u018B\\u13E7\\u0501\\uA7AA\"\n}, {\n base: 'dh',\n chars: \"\\u00F0\"\n}, {\n base: 'dz',\n chars: \"\\u01F3\\u01C6\"\n}, {\n base: 'e',\n chars: \"\\u24D4\\uFF45\\u00E8\\u00E9\\u00EA\\u1EC1\\u1EBF\\u1EC5\\u1EC3\\u1EBD\\u0113\\u1E15\\u1E17\\u0115\\u0117\\u00EB\\u1EBB\\u011B\\u0205\\u0207\\u1EB9\\u1EC7\\u0229\\u1E1D\\u0119\\u1E19\\u1E1B\\u0247\\u01DD\"\n}, {\n base: 'f',\n chars: \"\\u24D5\\uFF46\\u1E1F\\u0192\"\n}, {\n base: 'ff',\n chars: \"\\uFB00\"\n}, {\n base: 'fi',\n chars: \"\\uFB01\"\n}, {\n base: 'fl',\n chars: \"\\uFB02\"\n}, {\n base: 'ffi',\n chars: \"\\uFB03\"\n}, {\n base: 'ffl',\n chars: \"\\uFB04\"\n}, {\n base: 'g',\n chars: \"\\u24D6\\uFF47\\u01F5\\u011D\\u1E21\\u011F\\u0121\\u01E7\\u0123\\u01E5\\u0260\\uA7A1\\uA77F\\u1D79\"\n}, {\n base: 'h',\n chars: \"\\u24D7\\uFF48\\u0125\\u1E23\\u1E27\\u021F\\u1E25\\u1E29\\u1E2B\\u1E96\\u0127\\u2C68\\u2C76\\u0265\"\n}, {\n base: 'hv',\n chars: \"\\u0195\"\n}, {\n base: 'i',\n chars: \"\\u24D8\\uFF49\\xEC\\xED\\xEE\\u0129\\u012B\\u012D\\xEF\\u1E2F\\u1EC9\\u01D0\\u0209\\u020B\\u1ECB\\u012F\\u1E2D\\u0268\\u0131\"\n}, {\n base: 'j',\n chars: \"\\u24D9\\uFF4A\\u0135\\u01F0\\u0249\"\n}, {\n base: 'k',\n chars: \"\\u24DA\\uFF4B\\u1E31\\u01E9\\u1E33\\u0137\\u1E35\\u0199\\u2C6A\\uA741\\uA743\\uA745\\uA7A3\"\n}, {\n base: 'l',\n chars: \"\\u24DB\\uFF4C\\u0140\\u013A\\u013E\\u1E37\\u1E39\\u013C\\u1E3D\\u1E3B\\u017F\\u0142\\u019A\\u026B\\u2C61\\uA749\\uA781\\uA747\\u026D\"\n}, {\n base: 'lj',\n chars: \"\\u01C9\"\n}, {\n base: 'm',\n chars: \"\\u24DC\\uFF4D\\u1E3F\\u1E41\\u1E43\\u0271\\u026F\"\n}, {\n base: 'n',\n chars: \"\\u24DD\\uFF4E\\u01F9\\u0144\\xF1\\u1E45\\u0148\\u1E47\\u0146\\u1E4B\\u1E49\\u019E\\u0272\\u0149\\uA791\\uA7A5\\u043B\\u0509\"\n}, {\n base: 'nj',\n chars: \"\\u01CC\"\n}, {\n base: 'o',\n chars: \"\\u24DE\\uFF4F\\xF2\\xF3\\xF4\\u1ED3\\u1ED1\\u1ED7\\u1ED5\\xF5\\u1E4D\\u022D\\u1E4F\\u014D\\u1E51\\u1E53\\u014F\\u022F\\u0231\\xF6\\u022B\\u1ECF\\u0151\\u01D2\\u020D\\u020F\\u01A1\\u1EDD\\u1EDB\\u1EE1\\u1EDF\\u1EE3\\u1ECD\\u1ED9\\u01EB\\u01ED\\xF8\\u01FF\\uA74B\\uA74D\\u0275\\u0254\\u1D11\"\n}, {\n base: 'oe',\n chars: \"\\u0153\"\n}, {\n base: 'oi',\n chars: \"\\u01A3\"\n}, {\n base: 'oo',\n chars: \"\\uA74F\"\n}, {\n base: 'ou',\n chars: \"\\u0223\"\n}, {\n base: 'p',\n chars: \"\\u24DF\\uFF50\\u1E55\\u1E57\\u01A5\\u1D7D\\uA751\\uA753\\uA755\\u03C1\"\n}, {\n base: 'q',\n chars: \"\\u24E0\\uFF51\\u024B\\uA757\\uA759\"\n}, {\n base: 'r',\n chars: \"\\u24E1\\uFF52\\u0155\\u1E59\\u0159\\u0211\\u0213\\u1E5B\\u1E5D\\u0157\\u1E5F\\u024D\\u027D\\uA75B\\uA7A7\\uA783\"\n}, {\n base: 's',\n chars: \"\\u24E2\\uFF53\\u015B\\u1E65\\u015D\\u1E61\\u0161\\u1E67\\u1E63\\u1E69\\u0219\\u015F\\u023F\\uA7A9\\uA785\\u1E9B\\u0282\"\n}, {\n base: 'ss',\n chars: \"\\xDF\"\n}, {\n base: 't',\n chars: \"\\u24E3\\uFF54\\u1E6B\\u1E97\\u0165\\u1E6D\\u021B\\u0163\\u1E71\\u1E6F\\u0167\\u01AD\\u0288\\u2C66\\uA787\"\n}, {\n base: 'th',\n chars: \"\\u00FE\"\n}, {\n base: 'tz',\n chars: \"\\uA729\"\n}, {\n base: 'u',\n chars: \"\\u24E4\\uFF55\\xF9\\xFA\\xFB\\u0169\\u1E79\\u016B\\u1E7B\\u016D\\xFC\\u01DC\\u01D8\\u01D6\\u01DA\\u1EE7\\u016F\\u0171\\u01D4\\u0215\\u0217\\u01B0\\u1EEB\\u1EE9\\u1EEF\\u1EED\\u1EF1\\u1EE5\\u1E73\\u0173\\u1E77\\u1E75\\u0289\"\n}, {\n base: 'v',\n chars: \"\\u24E5\\uFF56\\u1E7D\\u1E7F\\u028B\\uA75F\\u028C\"\n}, {\n base: 'vy',\n chars: \"\\uA761\"\n}, {\n base: 'w',\n chars: \"\\u24E6\\uFF57\\u1E81\\u1E83\\u0175\\u1E87\\u1E85\\u1E98\\u1E89\\u2C73\"\n}, {\n base: 'x',\n chars: \"\\u24E7\\uFF58\\u1E8B\\u1E8D\"\n}, {\n base: 'y',\n chars: \"\\u24E8\\uFF59\\u1EF3\\xFD\\u0177\\u1EF9\\u0233\\u1E8F\\xFF\\u1EF7\\u1E99\\u1EF5\\u01B4\\u024F\\u1EFF\"\n}, {\n base: 'z',\n chars: \"\\u24E9\\uFF5A\\u017A\\u1E91\\u017C\\u017E\\u1E93\\u1E95\\u01B6\\u0225\\u0240\\u2C6C\\uA763\"\n}];\nvar diacriticsMap = {};\n\nfor (var i = 0; i < replacementList.length; i += 1) {\n var chars = replacementList[i].chars;\n\n for (var j = 0; j < chars.length; j += 1) {\n diacriticsMap[chars[j]] = replacementList[i].base;\n }\n}\n\nfunction removeDiacritics(str) {\n return str.replace(/[^\\u0000-\\u007e]/g, function (c) {\n return diacriticsMap[c] || c;\n });\n}\n\nexports.replacementList = replacementList;\nexports.diacriticsMap = diacriticsMap;","\"use strict\";\n\nvar codes = require(\"./codes.json\");\n\nvar removeDiacritics = require('diacritics').remove;\n\nvar registeredLocales = {};\n/*\n * All codes map to ISO 3166-1 alpha-2\n */\n\nvar alpha2 = {},\n alpha3 = {},\n numeric = {},\n invertedNumeric = {};\ncodes.forEach(function (codeInformation) {\n var s = codeInformation;\n alpha2[s[0]] = s[1];\n alpha3[s[1]] = s[0];\n numeric[s[2]] = s[0];\n invertedNumeric[s[0]] = s[2];\n});\n\nfunction formatNumericCode(code) {\n return String('000' + (code ? code : '')).slice(-3);\n}\n\nfunction registerLocale(localeData) {\n if (!localeData.locale) {\n throw new TypeError('Missing localeData.locale');\n }\n\n if (!localeData.countries) {\n throw new TypeError('Missing localeData.countries');\n }\n\n registeredLocales[localeData.locale] = localeData.countries;\n}\n\nexports.registerLocale = registerLocale;\n/*\n * @param code Alpha-3 code\n * @return Alpha-2 code or undefined\n */\n\nfunction alpha3ToAlpha2(code) {\n return alpha3[code];\n}\n\nexports.alpha3ToAlpha2 = alpha3ToAlpha2;\n/*\n * @param code Alpha-2 code\n * @return Alpha-3 code or undefined\n */\n\nfunction alpha2ToAlpha3(code) {\n return alpha2[code];\n}\n\nexports.alpha2ToAlpha3 = alpha2ToAlpha3;\n/*\n * @param code Alpha-3 code\n * @return Numeric code or undefined\n */\n\nfunction alpha3ToNumeric(code) {\n return invertedNumeric[alpha3ToAlpha2(code)];\n}\n\nexports.alpha3ToNumeric = alpha3ToNumeric;\n/*\n * @param code Alpha-2 code\n * @return Numeric code or undefined\n */\n\nfunction alpha2ToNumeric(code) {\n return invertedNumeric[code];\n}\n\nexports.alpha2ToNumeric = alpha2ToNumeric;\n/*\n * @param code Numeric code\n * @return Alpha-3 code or undefined\n */\n\nfunction numericToAlpha3(code) {\n var padded = formatNumericCode(code);\n return alpha2ToAlpha3(numeric[padded]);\n}\n\nexports.numericToAlpha3 = numericToAlpha3;\n/*\n * @param code Numeric code\n * @return Alpha-2 code or undefined\n */\n\nfunction numericToAlpha2(code) {\n var padded = formatNumericCode(code);\n return numeric[padded];\n}\n\nexports.numericToAlpha2 = numericToAlpha2;\n/*\n * @param code ISO 3166-1 alpha-2, alpha-3 or numeric code\n * @return ISO 3166-1 alpha-3\n */\n\nfunction toAlpha3(code) {\n if (typeof code === \"string\") {\n if (/^[0-9]*$/.test(code)) {\n return numericToAlpha3(code);\n }\n\n if (code.length === 2) {\n return alpha2ToAlpha3(code.toUpperCase());\n }\n\n if (code.length === 3) {\n return code.toUpperCase();\n }\n }\n\n if (typeof code === \"number\") {\n return numericToAlpha3(code);\n }\n\n return undefined;\n}\n\nexports.toAlpha3 = toAlpha3;\n/*\n * @param code ISO 3166-1 alpha-2, alpha-3 or numeric code\n * @return ISO 3166-1 alpha-2\n */\n\nfunction toAlpha2(code) {\n if (typeof code === \"string\") {\n if (/^[0-9]*$/.test(code)) {\n return numericToAlpha2(code);\n }\n\n if (code.length === 2) {\n return code.toUpperCase();\n }\n\n if (code.length === 3) {\n return alpha3ToAlpha2(code.toUpperCase());\n }\n }\n\n if (typeof code === \"number\") {\n return numericToAlpha2(code);\n }\n\n return undefined;\n}\n\nexports.toAlpha2 = toAlpha2;\n/*\n * @param code ISO 3166-1 alpha-2, alpha-3 or numeric code\n * @param lang language for country name\n * @return name or undefined\n */\n\nexports.getName = function (code, lang) {\n try {\n const codeMaps = registeredLocales[lang.toLowerCase()];\n const names = codeMaps[toAlpha2(code)];\n return Array.isArray(names) ? names[0] : names;\n } catch (err) {\n return undefined;\n }\n};\n/*\n * @param lang language for country names\n * @return Object of country code mapped to county name\n */\n\n\nexports.getNames = function (lang) {\n var d = registeredLocales[lang.toLowerCase()];\n\n if (d === undefined) {\n return {};\n }\n\n return d;\n};\n/*\n * @param name name\n * @param lang language for country name\n * @return ISO 3166-1 alpha-2 or undefined\n */\n\n\nexports.getAlpha2Code = function (name, lang) {\n const normalizeString = string => string.toLowerCase();\n\n const areSimilar = (a, b) => normalizeString(a) === normalizeString(b);\n\n try {\n const codenames = registeredLocales[lang.toLowerCase()];\n\n for (const p in codenames) {\n if (!codenames.hasOwnProperty(p)) {\n continue;\n }\n\n if (typeof codenames[p] === \"string\") {\n if (areSimilar(codenames[p], name)) {\n return p;\n }\n }\n\n if (Array.isArray(codenames[p])) {\n for (const mappedName of codenames[p]) {\n if (areSimilar(mappedName, name)) {\n return p;\n }\n }\n }\n }\n\n return undefined;\n } catch (err) {\n return undefined;\n }\n};\n/*\n * @param name name\n * @param lang language for country name\n * @return ISO 3166-1 alpha-2 or undefined\n */\n\n\nexports.getSimpleAlpha2Code = function (name, lang) {\n const normalizeString = string => removeDiacritics(string.toLowerCase());\n\n const areSimilar = (a, b) => normalizeString(a) === normalizeString(b);\n\n try {\n const codenames = registeredLocales[lang.toLowerCase()];\n\n for (const p in codenames) {\n if (!codenames.hasOwnProperty(p)) {\n continue;\n }\n\n if (typeof codenames[p] === \"string\") {\n if (areSimilar(codenames[p], name)) {\n return p;\n }\n }\n\n if (Array.isArray(codenames[p])) {\n for (const mappedName of codenames[p]) {\n if (areSimilar(mappedName, name)) {\n return p;\n }\n }\n }\n }\n\n return undefined;\n } catch (err) {\n return undefined;\n }\n};\n/*\n * @return Object of alpha-2 codes mapped to alpha-3 codes\n */\n\n\nexports.getAlpha2Codes = function () {\n return alpha2;\n};\n/*\n * @param name name\n * @param lang language for country name\n * @return ISO 3166-1 alpha-3 or undefined\n */\n\n\nexports.getAlpha3Code = function (name, lang) {\n var alpha2 = this.getAlpha2Code(name, lang);\n\n if (alpha2) {\n return this.toAlpha3(alpha2);\n } else {\n return undefined;\n }\n};\n/*\n * @param name name\n * @param lang language for country name\n * @return ISO 3166-1 alpha-3 or undefined\n */\n\n\nexports.getSimpleAlpha3Code = function (name, lang) {\n var alpha2 = this.getSimpleAlpha2Code(name, lang);\n\n if (alpha2) {\n return this.toAlpha3(alpha2);\n } else {\n return undefined;\n }\n};\n/*\n * @return Object of alpha-3 codes mapped to alpha-2 codes\n */\n\n\nexports.getAlpha3Codes = function () {\n return alpha3;\n};\n/*\n * @return Object of numeric codes mapped to alpha-2 codes\n */\n\n\nexports.getNumericCodes = function () {\n return numeric;\n};\n/*\n * @return Array of supported languages\n */\n\n\nexports.langs = function () {\n return Object.keys(registeredLocales);\n};\n/*\n * @param code ISO 3166-1 alpha-2, alpha-3 or numeric code\n * @return Boolean\n */\n\n\nexports.isValid = function (code) {\n if (!code) {\n return false;\n }\n\n var coerced = code.toString().toUpperCase();\n return alpha3.hasOwnProperty(coerced) || alpha2.hasOwnProperty(coerced) || numeric.hasOwnProperty(coerced);\n};","// I18n.js\n// =======\n//\n// This small library provides the Rails I18n API on the Javascript.\n// You don't actually have to use Rails (or even Ruby) to use I18n.js.\n// Just make sure you export all translations in an object like this:\n//\n// I18n.translations.en = {\n// hello: \"Hello World\"\n// };\n//\n// See tests for specific formatting like numbers and dates.\n//\n// Using UMD pattern from\n// https://github.com/umdjs/umd#regular-module\n// `returnExports.js` version\n;\n\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(\"i18n\", function () {\n return factory(root);\n });\n } else if (typeof module === 'object' && module.exports) {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory(root);\n } else {\n // Browser globals (root is window)\n root.I18n = factory(root);\n }\n})(this, function (global) {\n \"use strict\"; // Use previously defined object if exists in current scope\n\n var I18n = global && global.I18n || {}; // Just cache the Array#slice function.\n\n var slice = Array.prototype.slice; // Apply number padding.\n\n var padding = function (number) {\n return (\"0\" + number.toString()).substr(-2);\n }; // Improved toFixed number rounding function with support for unprecise floating points\n // JavaScript's standard toFixed function does not round certain numbers correctly (for example 0.105 with precision 2).\n\n\n var toFixed = function (number, precision) {\n return decimalAdjust('round', number, -precision).toFixed(precision);\n }; // Is a given variable an object?\n // Borrowed from Underscore.js\n\n\n var isObject = function (obj) {\n var type = typeof obj;\n return type === 'function' || type === 'object';\n };\n\n var isFunction = function (func) {\n var type = typeof func;\n return type === 'function';\n }; // Check if value is different than undefined and null;\n\n\n var isSet = function (value) {\n return typeof value !== 'undefined' && value !== null;\n }; // Is a given value an array?\n // Borrowed from Underscore.js\n\n\n var isArray = function (val) {\n if (Array.isArray) {\n return Array.isArray(val);\n }\n\n return Object.prototype.toString.call(val) === '[object Array]';\n };\n\n var isString = function (val) {\n return typeof val === 'string' || Object.prototype.toString.call(val) === '[object String]';\n };\n\n var isNumber = function (val) {\n return typeof val === 'number' || Object.prototype.toString.call(val) === '[object Number]';\n };\n\n var isBoolean = function (val) {\n return val === true || val === false;\n };\n\n var isNull = function (val) {\n return val === null;\n };\n\n var decimalAdjust = function (type, value, exp) {\n // If the exp is undefined or zero...\n if (typeof exp === 'undefined' || +exp === 0) {\n return Math[type](value);\n }\n\n value = +value;\n exp = +exp; // If the value is not a number or the exp is not an integer...\n\n if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {\n return NaN;\n } // Shift\n\n\n value = value.toString().split('e');\n value = Math[type](+(value[0] + 'e' + (value[1] ? +value[1] - exp : -exp))); // Shift back\n\n value = value.toString().split('e');\n return +(value[0] + 'e' + (value[1] ? +value[1] + exp : exp));\n };\n\n var lazyEvaluate = function (message, scope) {\n if (isFunction(message)) {\n return message(scope);\n } else {\n return message;\n }\n };\n\n var merge = function (dest, obj) {\n var key, value;\n\n for (key in obj) if (obj.hasOwnProperty(key)) {\n value = obj[key];\n\n if (isString(value) || isNumber(value) || isBoolean(value) || isArray(value) || isNull(value)) {\n dest[key] = value;\n } else {\n if (dest[key] == null) dest[key] = {};\n merge(dest[key], value);\n }\n }\n\n return dest;\n }; // Set default days/months translations.\n\n\n var DATE = {\n day_names: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n abbr_day_names: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n month_names: [null, \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n abbr_month_names: [null, \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n meridian: [\"AM\", \"PM\"]\n }; // Set default number format.\n\n var NUMBER_FORMAT = {\n precision: 3,\n separator: \".\",\n delimiter: \",\",\n strip_insignificant_zeros: false\n }; // Set default currency format.\n\n var CURRENCY_FORMAT = {\n unit: \"$\",\n precision: 2,\n format: \"%u%n\",\n sign_first: true,\n delimiter: \",\",\n separator: \".\"\n }; // Set default percentage format.\n\n var PERCENTAGE_FORMAT = {\n unit: \"%\",\n precision: 3,\n format: \"%n%u\",\n separator: \".\",\n delimiter: \"\"\n }; // Set default size units.\n\n var SIZE_UNITS = [null, \"kb\", \"mb\", \"gb\", \"tb\"]; // Other default options\n\n var DEFAULT_OPTIONS = {\n // Set default locale. This locale will be used when fallback is enabled and\n // the translation doesn't exist in a particular locale.\n defaultLocale: \"en\" // Set the current locale to `en`.\n ,\n locale: \"en\" // Set the translation key separator.\n ,\n defaultSeparator: \".\" // Set the placeholder format. Accepts `{{placeholder}}` and `%{placeholder}`.\n ,\n placeholder: /(?:\\{\\{|%\\{)(.*?)(?:\\}\\}?)/gm // Set if engine should fallback to the default locale when a translation\n // is missing.\n ,\n fallbacks: false // Set the default translation object.\n ,\n translations: {} // Set missing translation behavior. 'message' will display a message\n // that the translation is missing, 'guess' will try to guess the string\n ,\n missingBehaviour: 'message' // if you use missingBehaviour with 'message', but want to know that the\n // string is actually missing for testing purposes, you can prefix the\n // guessed string by setting the value here. By default, no prefix!\n ,\n missingTranslationPrefix: ''\n }; // Set default locale. This locale will be used when fallback is enabled and\n // the translation doesn't exist in a particular locale.\n\n I18n.reset = function () {\n var key;\n\n for (key in DEFAULT_OPTIONS) {\n this[key] = DEFAULT_OPTIONS[key];\n }\n }; // Much like `reset`, but only assign options if not already assigned\n\n\n I18n.initializeOptions = function () {\n var key;\n\n for (key in DEFAULT_OPTIONS) if (!isSet(this[key])) {\n this[key] = DEFAULT_OPTIONS[key];\n }\n };\n\n I18n.initializeOptions(); // Return a list of all locales that must be tried before returning the\n // missing translation message. By default, this will consider the inline option,\n // current locale and fallback locale.\n //\n // I18n.locales.get(\"de-DE\");\n // // [\"de-DE\", \"de\", \"en\"]\n //\n // You can define custom rules for any locale. Just make sure you return a array\n // containing all locales.\n //\n // // Default the Wookie locale to English.\n // I18n.locales[\"wk\"] = function(locale) {\n // return [\"en\"];\n // };\n //\n\n I18n.locales = {}; // Retrieve locales based on inline locale, current locale or default to\n // I18n's detection.\n\n I18n.locales.get = function (locale) {\n var result = this[locale] || this[I18n.locale] || this[\"default\"];\n\n if (isFunction(result)) {\n result = result(locale);\n }\n\n if (isArray(result) === false) {\n result = [result];\n }\n\n return result;\n }; // The default locale list.\n\n\n I18n.locales[\"default\"] = function (locale) {\n var locales = [],\n list = []; // Handle the inline locale option that can be provided to\n // the `I18n.t` options.\n\n if (locale) {\n locales.push(locale);\n } // Add the current locale to the list.\n\n\n if (!locale && I18n.locale) {\n locales.push(I18n.locale);\n } // Add the default locale if fallback strategy is enabled.\n\n\n if (I18n.fallbacks && I18n.defaultLocale) {\n locales.push(I18n.defaultLocale);\n } // Locale code format 1:\n // According to RFC4646 (https://www.ietf.org/rfc/rfc4646.txt)\n // language codes for Traditional Chinese should be `zh-Hant`\n //\n // But due to backward compatibility\n // We use older version of IETF language tag\n // @see https://www.w3.org/TR/html401/struct/dirlang.html\n // @see https://en.wikipedia.org/wiki/IETF_language_tag\n //\n // Format: `language-code = primary-code ( \"-\" subcode )*`\n //\n // primary-code uses ISO639-1\n // @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\n // @see https://www.iso.org/iso/home/standards/language_codes.htm\n //\n // subcode uses ISO 3166-1 alpha-2\n // @see https://en.wikipedia.org/wiki/ISO_3166\n // @see https://www.iso.org/iso/country_codes.htm\n //\n // @note\n // subcode can be in upper case or lower case\n // defining it in upper case is a convention only\n // Locale code format 2:\n // Format: `code = primary-code ( \"-\" region-code )*`\n // primary-code uses ISO 639-1\n // script-code uses ISO 15924\n // region-code uses ISO 3166-1 alpha-2\n // Example: zh-Hant-TW, en-HK, zh-Hant-CN\n //\n // It is similar to RFC4646 (or actually the same),\n // but seems to be limited to language, script, region\n // Compute each locale with its country code.\n // So this will return an array containing\n // `de-DE` and `de`\n // or\n // `zh-hans-tw`, `zh-hans`, `zh`\n // locales.\n\n\n locales.forEach(function (locale) {\n var localeParts = locale.split(\"-\");\n var firstFallback = null;\n var secondFallback = null;\n\n if (localeParts.length === 3) {\n firstFallback = [localeParts[0], localeParts[1]].join(\"-\");\n secondFallback = localeParts[0];\n } else if (localeParts.length === 2) {\n firstFallback = localeParts[0];\n }\n\n if (list.indexOf(locale) === -1) {\n list.push(locale);\n }\n\n if (!I18n.fallbacks) {\n return;\n }\n\n [firstFallback, secondFallback].forEach(function (nullableFallbackLocale) {\n // We don't want null values\n if (typeof nullableFallbackLocale === \"undefined\") {\n return;\n }\n\n if (nullableFallbackLocale === null) {\n return;\n } // We don't want duplicate values\n //\n // Comparing with `locale` first is faster than\n // checking whether value's presence in the list\n\n\n if (nullableFallbackLocale === locale) {\n return;\n }\n\n if (list.indexOf(nullableFallbackLocale) !== -1) {\n return;\n }\n\n list.push(nullableFallbackLocale);\n });\n }); // No locales set? English it is.\n\n if (!locales.length) {\n locales.push(\"en\");\n }\n\n return list;\n }; // Hold pluralization rules.\n\n\n I18n.pluralization = {}; // Return the pluralizer for a specific locale.\n // If no specify locale is found, then I18n's default will be used.\n\n I18n.pluralization.get = function (locale) {\n return this[locale] || this[I18n.locale] || this[\"default\"];\n }; // The default pluralizer rule.\n // It detects the `zero`, `one`, and `other` scopes.\n\n\n I18n.pluralization[\"default\"] = function (count) {\n switch (count) {\n case 0:\n return [\"zero\", \"other\"];\n\n case 1:\n return [\"one\"];\n\n default:\n return [\"other\"];\n }\n }; // Return current locale. If no locale has been set, then\n // the current locale will be the default locale.\n\n\n I18n.currentLocale = function () {\n return this.locale || this.defaultLocale;\n }; // Check if value is different than undefined and null;\n\n\n I18n.isSet = isSet; // Find and process the translation using the provided scope and options.\n // This is used internally by some functions and should not be used as an\n // public API.\n\n I18n.lookup = function (scope, options) {\n options = options || {};\n var locales = this.locales.get(options.locale).slice(),\n locale,\n scopes,\n fullScope,\n translations;\n fullScope = this.getFullScope(scope, options);\n\n while (locales.length) {\n locale = locales.shift();\n scopes = fullScope.split(options.separator || this.defaultSeparator);\n translations = this.translations[locale];\n\n if (!translations) {\n continue;\n }\n\n while (scopes.length) {\n translations = translations[scopes.shift()];\n\n if (translations === undefined || translations === null) {\n break;\n }\n }\n\n if (translations !== undefined && translations !== null) {\n return translations;\n }\n }\n\n if (isSet(options.defaultValue)) {\n return lazyEvaluate(options.defaultValue, scope);\n }\n }; // lookup pluralization rule key into translations\n\n\n I18n.pluralizationLookupWithoutFallback = function (count, locale, translations) {\n var pluralizer = this.pluralization.get(locale),\n pluralizerKeys = pluralizer(count),\n pluralizerKey,\n message;\n\n if (translations && isObject(translations)) {\n while (pluralizerKeys.length) {\n pluralizerKey = pluralizerKeys.shift();\n\n if (isSet(translations[pluralizerKey])) {\n message = translations[pluralizerKey];\n break;\n }\n }\n }\n\n return message;\n }; // Lookup dedicated to pluralization\n\n\n I18n.pluralizationLookup = function (count, scope, options) {\n options = options || {};\n var locales = this.locales.get(options.locale).slice(),\n locale,\n scopes,\n translations,\n message;\n scope = this.getFullScope(scope, options);\n\n while (locales.length) {\n locale = locales.shift();\n scopes = scope.split(options.separator || this.defaultSeparator);\n translations = this.translations[locale];\n\n if (!translations) {\n continue;\n }\n\n while (scopes.length) {\n translations = translations[scopes.shift()];\n\n if (!isObject(translations)) {\n break;\n }\n\n if (scopes.length === 0) {\n message = this.pluralizationLookupWithoutFallback(count, locale, translations);\n }\n }\n\n if (typeof message !== \"undefined\" && message !== null) {\n break;\n }\n }\n\n if (typeof message === \"undefined\" || message === null) {\n if (isSet(options.defaultValue)) {\n if (isObject(options.defaultValue)) {\n message = this.pluralizationLookupWithoutFallback(count, options.locale, options.defaultValue);\n } else {\n message = options.defaultValue;\n }\n\n translations = options.defaultValue;\n }\n }\n\n return {\n message: message,\n translations: translations\n };\n }; // Rails changed the way the meridian is stored.\n // It started with `date.meridian` returning an array,\n // then it switched to `time.am` and `time.pm`.\n // This function abstracts this difference and returns\n // the correct meridian or the default value when none is provided.\n\n\n I18n.meridian = function () {\n var time = this.lookup(\"time\");\n var date = this.lookup(\"date\");\n\n if (time && time.am && time.pm) {\n return [time.am, time.pm];\n } else if (date && date.meridian) {\n return date.meridian;\n } else {\n return DATE.meridian;\n }\n }; // Merge serveral hash options, checking if value is set before\n // overwriting any value. The precedence is from left to right.\n //\n // I18n.prepareOptions({name: \"John Doe\"}, {name: \"Mary Doe\", role: \"user\"});\n // #=> {name: \"John Doe\", role: \"user\"}\n //\n\n\n I18n.prepareOptions = function () {\n var args = slice.call(arguments),\n options = {},\n subject;\n\n while (args.length) {\n subject = args.shift();\n\n if (typeof subject != \"object\") {\n continue;\n }\n\n for (var attr in subject) {\n if (!subject.hasOwnProperty(attr)) {\n continue;\n }\n\n if (isSet(options[attr])) {\n continue;\n }\n\n options[attr] = subject[attr];\n }\n }\n\n return options;\n }; // Generate a list of translation options for default fallbacks.\n // `defaultValue` is also deleted from options as it is returned as part of\n // the translationOptions array.\n\n\n I18n.createTranslationOptions = function (scope, options) {\n var translationOptions = [{\n scope: scope\n }]; // Defaults should be an array of hashes containing either\n // fallback scopes or messages\n\n if (isSet(options.defaults)) {\n translationOptions = translationOptions.concat(options.defaults);\n } // Maintain support for defaultValue. Since it is always a message\n // insert it in to the translation options as such.\n\n\n if (isSet(options.defaultValue)) {\n translationOptions.push({\n message: options.defaultValue\n });\n }\n\n return translationOptions;\n }; // Translate the given scope with the provided options.\n\n\n I18n.translate = function (scope, options) {\n options = options || {};\n var translationOptions = this.createTranslationOptions(scope, options);\n var translation;\n var usedScope = scope;\n var optionsWithoutDefault = this.prepareOptions(options);\n delete optionsWithoutDefault.defaultValue; // Iterate through the translation options until a translation\n // or message is found.\n\n var translationFound = translationOptions.some(function (translationOption) {\n if (isSet(translationOption.scope)) {\n usedScope = translationOption.scope;\n translation = this.lookup(usedScope, optionsWithoutDefault);\n } else if (isSet(translationOption.message)) {\n translation = lazyEvaluate(translationOption.message, scope);\n }\n\n if (translation !== undefined && translation !== null) {\n return true;\n }\n }, this);\n\n if (!translationFound) {\n return this.missingTranslation(scope, options);\n }\n\n if (typeof translation === \"string\") {\n translation = this.interpolate(translation, options);\n } else if (isArray(translation)) {\n translation = translation.map(function (t) {\n return typeof t === \"string\" ? this.interpolate(t, options) : t;\n }, this);\n } else if (isObject(translation) && isSet(options.count)) {\n translation = this.pluralize(options.count, usedScope, options);\n }\n\n return translation;\n }; // This function interpolates the all variables in the given message.\n\n\n I18n.interpolate = function (message, options) {\n if (message == null) {\n return message;\n }\n\n options = options || {};\n var matches = message.match(this.placeholder),\n placeholder,\n value,\n name,\n regex;\n\n if (!matches) {\n return message;\n }\n\n while (matches.length) {\n placeholder = matches.shift();\n name = placeholder.replace(this.placeholder, \"$1\");\n\n if (isSet(options[name])) {\n value = options[name].toString().replace(/\\$/gm, \"_#$#_\");\n } else if (name in options) {\n value = this.nullPlaceholder(placeholder, message, options);\n } else {\n value = this.missingPlaceholder(placeholder, message, options);\n }\n\n regex = new RegExp(placeholder.replace(/{/gm, \"\\\\{\").replace(/}/gm, \"\\\\}\"));\n message = message.replace(regex, value);\n }\n\n return message.replace(/_#\\$#_/g, \"$\");\n }; // Pluralize the given scope using the `count` value.\n // The pluralized translation may have other placeholders,\n // which will be retrieved from `options`.\n\n\n I18n.pluralize = function (count, scope, options) {\n options = this.prepareOptions({\n count: String(count)\n }, options);\n var pluralizer, result;\n result = this.pluralizationLookup(count, scope, options);\n\n if (typeof result.translations === \"undefined\" || result.translations == null) {\n return this.missingTranslation(scope, options);\n }\n\n if (typeof result.message !== \"undefined\" && result.message != null) {\n return this.interpolate(result.message, options);\n } else {\n pluralizer = this.pluralization.get(options.locale);\n return this.missingTranslation(scope + '.' + pluralizer(count)[0], options);\n }\n }; // Return a missing translation message for the given parameters.\n\n\n I18n.missingTranslation = function (scope, options) {\n //guess intended string\n if (this.missingBehaviour === 'guess') {\n //get only the last portion of the scope\n var s = scope.split('.').slice(-1)[0]; //replace underscore with space && camelcase with space and lowercase letter\n\n return (this.missingTranslationPrefix.length > 0 ? this.missingTranslationPrefix : '') + s.replace(/_/g, ' ').replace(/([a-z])([A-Z])/g, function (match, p1, p2) {\n return p1 + ' ' + p2.toLowerCase();\n });\n }\n\n var localeForTranslation = options != null && options.locale != null ? options.locale : this.currentLocale();\n var fullScope = this.getFullScope(scope, options);\n var fullScopeWithLocale = [localeForTranslation, fullScope].join(options.separator || this.defaultSeparator);\n return '[missing \"' + fullScopeWithLocale + '\" translation]';\n }; // Return a missing placeholder message for given parameters\n\n\n I18n.missingPlaceholder = function (placeholder, message, options) {\n return \"[missing \" + placeholder + \" value]\";\n };\n\n I18n.nullPlaceholder = function () {\n return I18n.missingPlaceholder.apply(I18n, arguments);\n }; // Format number using localization rules.\n // The options will be retrieved from the `number.format` scope.\n // If this isn't present, then the following options will be used:\n //\n // - `precision`: `3`\n // - `separator`: `\".\"`\n // - `delimiter`: `\",\"`\n // - `strip_insignificant_zeros`: `false`\n //\n // You can also override these options by providing the `options` argument.\n //\n\n\n I18n.toNumber = function (number, options) {\n options = this.prepareOptions(options, this.lookup(\"number.format\"), NUMBER_FORMAT);\n var negative = number < 0,\n string = toFixed(Math.abs(number), options.precision).toString(),\n parts = string.split(\".\"),\n precision,\n buffer = [],\n formattedNumber,\n format = options.format || \"%n\",\n sign = negative ? \"-\" : \"\";\n number = parts[0];\n precision = parts[1];\n\n while (number.length > 0) {\n buffer.unshift(number.substr(Math.max(0, number.length - 3), 3));\n number = number.substr(0, number.length - 3);\n }\n\n formattedNumber = buffer.join(options.delimiter);\n\n if (options.strip_insignificant_zeros && precision) {\n precision = precision.replace(/0+$/, \"\");\n }\n\n if (options.precision > 0 && precision) {\n formattedNumber += options.separator + precision;\n }\n\n if (options.sign_first) {\n format = \"%s\" + format;\n } else {\n format = format.replace(\"%n\", \"%s%n\");\n }\n\n formattedNumber = format.replace(\"%u\", options.unit).replace(\"%n\", formattedNumber).replace(\"%s\", sign);\n return formattedNumber;\n }; // Format currency with localization rules.\n // The options will be retrieved from the `number.currency.format` and\n // `number.format` scopes, in that order.\n //\n // Any missing option will be retrieved from the `I18n.toNumber` defaults and\n // the following options:\n //\n // - `unit`: `\"$\"`\n // - `precision`: `2`\n // - `format`: `\"%u%n\"`\n // - `delimiter`: `\",\"`\n // - `separator`: `\".\"`\n //\n // You can also override these options by providing the `options` argument.\n //\n\n\n I18n.toCurrency = function (number, options) {\n options = this.prepareOptions(options, this.lookup(\"number.currency.format\", options), this.lookup(\"number.format\", options), CURRENCY_FORMAT);\n return this.toNumber(number, options);\n }; // Localize several values.\n // You can provide the following scopes: `currency`, `number`, or `percentage`.\n // If you provide a scope that matches the `/^(date|time)/` regular expression\n // then the `value` will be converted by using the `I18n.toTime` function.\n //\n // It will default to the value's `toString` function.\n //\n\n\n I18n.localize = function (scope, value, options) {\n options || (options = {});\n\n switch (scope) {\n case \"currency\":\n return this.toCurrency(value, options);\n\n case \"number\":\n scope = this.lookup(\"number.format\", options);\n return this.toNumber(value, scope);\n\n case \"percentage\":\n return this.toPercentage(value, options);\n\n default:\n var localizedValue;\n\n if (scope.match(/^(date|time)/)) {\n localizedValue = this.toTime(scope, value, options);\n } else {\n localizedValue = value.toString();\n }\n\n return this.interpolate(localizedValue, options);\n }\n }; // Parse a given `date` string into a JavaScript Date object.\n // This function is time zone aware.\n //\n // The following string formats are recognized:\n //\n // yyyy-mm-dd\n // yyyy-mm-dd[ T]hh:mm::ss\n // yyyy-mm-dd[ T]hh:mm::ss\n // yyyy-mm-dd[ T]hh:mm::ssZ\n // yyyy-mm-dd[ T]hh:mm::ss+0000\n // yyyy-mm-dd[ T]hh:mm::ss+00:00\n // yyyy-mm-dd[ T]hh:mm::ss.123Z\n //\n\n\n I18n.parseDate = function (date) {\n var matches, convertedDate, fraction; // A date input of `null` or `undefined` will be returned as-is\n\n if (date == null) {\n return date;\n } // we have a date, so just return it.\n\n\n if (typeof date === \"object\") {\n return date;\n }\n\n matches = date.toString().match(/(\\d{4})-(\\d{2})-(\\d{2})(?:[ T](\\d{2}):(\\d{2}):(\\d{2})([\\.,]\\d{1,3})?)?(Z|\\+00:?00)?/);\n\n if (matches) {\n for (var i = 1; i <= 6; i++) {\n matches[i] = parseInt(matches[i], 10) || 0;\n } // month starts on 0\n\n\n matches[2] -= 1;\n fraction = matches[7] ? 1000 * (\"0\" + matches[7]) : null;\n\n if (matches[8]) {\n convertedDate = new Date(Date.UTC(matches[1], matches[2], matches[3], matches[4], matches[5], matches[6], fraction));\n } else {\n convertedDate = new Date(matches[1], matches[2], matches[3], matches[4], matches[5], matches[6], fraction);\n }\n } else if (typeof date == \"number\") {\n // UNIX timestamp\n convertedDate = new Date();\n convertedDate.setTime(date);\n } else if (date.match(/([A-Z][a-z]{2}) ([A-Z][a-z]{2}) (\\d+) (\\d+:\\d+:\\d+) ([+-]\\d+) (\\d+)/)) {\n // This format `Wed Jul 20 13:03:39 +0000 2011` is parsed by\n // webkit/firefox, but not by IE, so we must parse it manually.\n convertedDate = new Date();\n convertedDate.setTime(Date.parse([RegExp.$1, RegExp.$2, RegExp.$3, RegExp.$6, RegExp.$4, RegExp.$5].join(\" \")));\n } else if (date.match(/\\d+ \\d+:\\d+:\\d+ [+-]\\d+ \\d+/)) {\n // a valid javascript format with timezone info\n convertedDate = new Date();\n convertedDate.setTime(Date.parse(date));\n } else {\n // an arbitrary javascript string\n convertedDate = new Date();\n convertedDate.setTime(Date.parse(date));\n }\n\n return convertedDate;\n }; // Formats time according to the directives in the given format string.\n // The directives begins with a percent (%) character. Any text not listed as a\n // directive will be passed through to the output string.\n //\n // The accepted formats are:\n //\n // %a - The abbreviated weekday name (Sun)\n // %A - The full weekday name (Sunday)\n // %b - The abbreviated month name (Jan)\n // %B - The full month name (January)\n // %c - The preferred local date and time representation\n // %d - Day of the month (01..31)\n // %-d - Day of the month (1..31)\n // %H - Hour of the day, 24-hour clock (00..23)\n // %-H/%k - Hour of the day, 24-hour clock (0..23)\n // %I - Hour of the day, 12-hour clock (01..12)\n // %-I/%l - Hour of the day, 12-hour clock (1..12)\n // %m - Month of the year (01..12)\n // %-m - Month of the year (1..12)\n // %M - Minute of the hour (00..59)\n // %-M - Minute of the hour (0..59)\n // %p - Meridian indicator (AM or PM)\n // %P - Meridian indicator (am or pm)\n // %S - Second of the minute (00..60)\n // %-S - Second of the minute (0..60)\n // %w - Day of the week (Sunday is 0, 0..6)\n // %y - Year without a century (00..99)\n // %-y - Year without a century (0..99)\n // %Y - Year with century\n // %z/%Z - Timezone offset (+0545)\n //\n\n\n I18n.strftime = function (date, format, options) {\n var options = this.lookup(\"date\", options),\n meridianOptions = I18n.meridian();\n\n if (!options) {\n options = {};\n }\n\n options = this.prepareOptions(options, DATE);\n\n if (isNaN(date.getTime())) {\n throw new Error('I18n.strftime() requires a valid date object, but received an invalid date.');\n }\n\n var weekDay = date.getDay(),\n day = date.getDate(),\n year = date.getFullYear(),\n month = date.getMonth() + 1,\n hour = date.getHours(),\n hour12 = hour,\n meridian = hour > 11 ? 1 : 0,\n secs = date.getSeconds(),\n mins = date.getMinutes(),\n offset = date.getTimezoneOffset(),\n absOffsetHours = Math.floor(Math.abs(offset / 60)),\n absOffsetMinutes = Math.abs(offset) - absOffsetHours * 60,\n timezoneoffset = (offset > 0 ? \"-\" : \"+\") + (absOffsetHours.toString().length < 2 ? \"0\" + absOffsetHours : absOffsetHours) + (absOffsetMinutes.toString().length < 2 ? \"0\" + absOffsetMinutes : absOffsetMinutes);\n\n if (hour12 > 12) {\n hour12 = hour12 - 12;\n } else if (hour12 === 0) {\n hour12 = 12;\n }\n\n format = format.replace(\"%a\", options.abbr_day_names[weekDay]);\n format = format.replace(\"%A\", options.day_names[weekDay]);\n format = format.replace(\"%b\", options.abbr_month_names[month]);\n format = format.replace(\"%B\", options.month_names[month]);\n format = format.replace(\"%d\", padding(day));\n format = format.replace(\"%e\", day);\n format = format.replace(\"%-d\", day);\n format = format.replace(\"%H\", padding(hour));\n format = format.replace(\"%-H\", hour);\n format = format.replace(\"%k\", hour);\n format = format.replace(\"%I\", padding(hour12));\n format = format.replace(\"%-I\", hour12);\n format = format.replace(\"%l\", hour12);\n format = format.replace(\"%m\", padding(month));\n format = format.replace(\"%-m\", month);\n format = format.replace(\"%M\", padding(mins));\n format = format.replace(\"%-M\", mins);\n format = format.replace(\"%p\", meridianOptions[meridian]);\n format = format.replace(\"%P\", meridianOptions[meridian].toLowerCase());\n format = format.replace(\"%S\", padding(secs));\n format = format.replace(\"%-S\", secs);\n format = format.replace(\"%w\", weekDay);\n format = format.replace(\"%y\", padding(year));\n format = format.replace(\"%-y\", padding(year).replace(/^0+/, \"\"));\n format = format.replace(\"%Y\", year);\n format = format.replace(\"%z\", timezoneoffset);\n format = format.replace(\"%Z\", timezoneoffset);\n return format;\n }; // Convert the given dateString into a formatted date.\n\n\n I18n.toTime = function (scope, dateString, options) {\n var date = this.parseDate(dateString),\n format = this.lookup(scope, options); // A date input of `null` or `undefined` will be returned as-is\n\n if (date == null) {\n return date;\n }\n\n var date_string = date.toString();\n\n if (date_string.match(/invalid/i)) {\n return date_string;\n }\n\n if (!format) {\n return date_string;\n }\n\n return this.strftime(date, format, options);\n }; // Convert a number into a formatted percentage value.\n\n\n I18n.toPercentage = function (number, options) {\n options = this.prepareOptions(options, this.lookup(\"number.percentage.format\", options), this.lookup(\"number.format\", options), PERCENTAGE_FORMAT);\n return this.toNumber(number, options);\n }; // Convert a number into a readable size representation.\n\n\n I18n.toHumanSize = function (number, options) {\n var kb = 1024,\n size = number,\n iterations = 0,\n unit,\n precision,\n fullScope;\n\n while (size >= kb && iterations < 4) {\n size = size / kb;\n iterations += 1;\n }\n\n if (iterations === 0) {\n fullScope = this.getFullScope(\"number.human.storage_units.units.byte\", options);\n unit = this.t(fullScope, {\n count: size\n });\n precision = 0;\n } else {\n fullScope = this.getFullScope(\"number.human.storage_units.units.\" + SIZE_UNITS[iterations], options);\n unit = this.t(fullScope);\n precision = size - Math.floor(size) === 0 ? 0 : 1;\n }\n\n options = this.prepareOptions(options, {\n unit: unit,\n precision: precision,\n format: \"%n%u\",\n delimiter: \"\"\n });\n return this.toNumber(size, options);\n };\n\n I18n.getFullScope = function (scope, options) {\n options = options || {}; // Deal with the scope as an array.\n\n if (isArray(scope)) {\n scope = scope.join(options.separator || this.defaultSeparator);\n } // Deal with the scope option provided through the second argument.\n //\n // I18n.t('hello', {scope: 'greetings'});\n //\n\n\n if (options.scope) {\n scope = [options.scope, scope].join(options.separator || this.defaultSeparator);\n }\n\n return scope;\n };\n /**\n * Merge obj1 with obj2 (shallow merge), without modifying inputs\n * @param {Object} obj1\n * @param {Object} obj2\n * @returns {Object} Merged values of obj1 and obj2\n *\n * In order to support ES3, `Object.prototype.hasOwnProperty.call` is used\n * Idea is from:\n * https://stackoverflow.com/questions/8157700/object-has-no-hasownproperty-method-i-e-its-undefined-ie8\n */\n\n\n I18n.extend = function (obj1, obj2) {\n if (typeof obj1 === \"undefined\" && typeof obj2 === \"undefined\") {\n return {};\n }\n\n return merge(obj1, obj2);\n }; // Set aliases, so we can save some typing.\n\n\n I18n.t = I18n.translate.bind(I18n);\n I18n.l = I18n.localize.bind(I18n);\n I18n.p = I18n.pluralize.bind(I18n);\n return I18n;\n});","/*\n\n PinchZoom.js\n Copyright (c) Manuel Stofer 2013 - today\n\n Author: Manuel Stofer (mst@rtp.ch)\n Version: 2.3.5\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n\n*/\n// polyfills\nif (typeof Object.assign != 'function') {\n // Must be writable: true, enumerable: false, configurable: true\n Object.defineProperty(Object, \"assign\", {\n value: function assign(target, varArgs) {\n // .length of function is 2\n if (target == null) {\n // TypeError if undefined or null\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var to = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var nextSource = arguments[index];\n\n if (nextSource != null) {\n // Skip over if undefined or null\n for (var nextKey in nextSource) {\n // Avoid bugs when hasOwnProperty is shadowed\n if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n\n return to;\n },\n writable: true,\n configurable: true\n });\n}\n\nif (typeof Array.from != 'function') {\n Array.from = function (object) {\n return [].slice.call(object);\n };\n} // utils\n\n\nvar buildElement = function (str) {\n // empty string as title argument required by IE and Edge\n var tmp = document.implementation.createHTMLDocument('');\n tmp.body.innerHTML = str;\n return Array.from(tmp.body.children)[0];\n};\n\nvar triggerEvent = function (el, name) {\n var event = document.createEvent('HTMLEvents');\n event.initEvent(name, true, false);\n el.dispatchEvent(event);\n};\n\nvar definePinchZoom = function () {\n /**\n * Pinch zoom\n * @param el\n * @param options\n * @constructor\n */\n var PinchZoom = function (el, options) {\n this.el = el;\n this.zoomFactor = 1;\n this.lastScale = 1;\n this.offset = {\n x: 0,\n y: 0\n };\n this.initialOffset = {\n x: 0,\n y: 0\n };\n this.options = Object.assign({}, this.defaults, options);\n this.setupMarkup();\n this.bindEvents();\n this.update(); // The image may already be loaded when PinchZoom is initialized,\n // and then the load event (which trigger update) will never fire.\n\n if (this.isImageLoaded(this.el)) {\n this.updateAspectRatio();\n this.setupOffsets();\n }\n\n this.enable();\n },\n sum = function (a, b) {\n return a + b;\n },\n isCloseTo = function (value, expected) {\n return value > expected - 0.01 && value < expected + 0.01;\n };\n\n PinchZoom.prototype = {\n defaults: {\n tapZoomFactor: 2,\n zoomOutFactor: 1.3,\n animationDuration: 300,\n maxZoom: 4,\n minZoom: 0.5,\n draggableUnzoomed: true,\n lockDragAxis: false,\n setOffsetsOnce: false,\n use2d: true,\n zoomStartEventName: 'pz_zoomstart',\n zoomUpdateEventName: 'pz_zoomupdate',\n zoomEndEventName: 'pz_zoomend',\n dragStartEventName: 'pz_dragstart',\n dragUpdateEventName: 'pz_dragupdate',\n dragEndEventName: 'pz_dragend',\n doubleTapEventName: 'pz_doubletap',\n verticalPadding: 0,\n horizontalPadding: 0,\n onZoomStart: null,\n onZoomEnd: null,\n onZoomUpdate: null,\n onDragStart: null,\n onDragEnd: null,\n onDragUpdate: null,\n onDoubleTap: null\n },\n\n /**\n * Event handler for 'dragstart'\n * @param event\n */\n handleDragStart: function (event) {\n triggerEvent(this.el, this.options.dragStartEventName);\n\n if (typeof this.options.onDragStart == \"function\") {\n this.options.onDragStart(this, event);\n }\n\n this.stopAnimation();\n this.lastDragPosition = false;\n this.hasInteraction = true;\n this.handleDrag(event);\n },\n\n /**\n * Event handler for 'drag'\n * @param event\n */\n handleDrag: function (event) {\n var touch = this.getTouches(event)[0];\n this.drag(touch, this.lastDragPosition);\n this.offset = this.sanitizeOffset(this.offset);\n this.lastDragPosition = touch;\n },\n handleDragEnd: function () {\n triggerEvent(this.el, this.options.dragEndEventName);\n\n if (typeof this.options.onDragEnd == \"function\") {\n this.options.onDragEnd(this, event);\n }\n\n this.end();\n },\n\n /**\n * Event handler for 'zoomstart'\n * @param event\n */\n handleZoomStart: function (event) {\n triggerEvent(this.el, this.options.zoomStartEventName);\n\n if (typeof this.options.onZoomStart == \"function\") {\n this.options.onZoomStart(this, event);\n }\n\n this.stopAnimation();\n this.lastScale = 1;\n this.nthZoom = 0;\n this.lastZoomCenter = false;\n this.hasInteraction = true;\n },\n\n /**\n * Event handler for 'zoom'\n * @param event\n */\n handleZoom: function (event, newScale) {\n // a relative scale factor is used\n var touchCenter = this.getTouchCenter(this.getTouches(event)),\n scale = newScale / this.lastScale;\n this.lastScale = newScale; // the first touch events are thrown away since they are not precise\n\n this.nthZoom += 1;\n\n if (this.nthZoom > 3) {\n this.scale(scale, touchCenter);\n this.drag(touchCenter, this.lastZoomCenter);\n }\n\n this.lastZoomCenter = touchCenter;\n },\n handleZoomEnd: function () {\n triggerEvent(this.el, this.options.zoomEndEventName);\n\n if (typeof this.options.onZoomEnd == \"function\") {\n this.options.onZoomEnd(this, event);\n }\n\n this.end();\n },\n\n /**\n * Event handler for 'doubletap'\n * @param event\n */\n handleDoubleTap: function (event) {\n var center = this.getTouches(event)[0],\n zoomFactor = this.zoomFactor > 1 ? 1 : this.options.tapZoomFactor,\n startZoomFactor = this.zoomFactor,\n updateProgress = function (progress) {\n this.scaleTo(startZoomFactor + progress * (zoomFactor - startZoomFactor), center);\n }.bind(this);\n\n if (this.hasInteraction) {\n return;\n }\n\n this.isDoubleTap = true;\n\n if (startZoomFactor > zoomFactor) {\n center = this.getCurrentZoomCenter();\n }\n\n this.animate(this.options.animationDuration, updateProgress, this.swing);\n triggerEvent(this.el, this.options.doubleTapEventName);\n\n if (typeof this.options.onDoubleTap == \"function\") {\n this.options.onDoubleTap(this, event);\n }\n },\n\n /**\n * Compute the initial offset\n *\n * the element should be centered in the container upon initialization\n */\n computeInitialOffset: function () {\n this.initialOffset = {\n x: -Math.abs(this.el.offsetWidth * this.getInitialZoomFactor() - this.container.offsetWidth) / 2,\n y: -Math.abs(this.el.offsetHeight * this.getInitialZoomFactor() - this.container.offsetHeight) / 2\n };\n },\n\n /**\n * Reset current image offset to that of the initial offset\n */\n resetOffset: function () {\n this.offset.x = this.initialOffset.x;\n this.offset.y = this.initialOffset.y;\n },\n\n /**\n * Determine if image is loaded\n */\n isImageLoaded: function (el) {\n if (el.nodeName === 'IMG') {\n return el.complete && el.naturalHeight !== 0;\n } else {\n return Array.from(el.querySelectorAll('img')).every(this.isImageLoaded);\n }\n },\n setupOffsets: function () {\n if (this.options.setOffsetsOnce && this._isOffsetsSet) {\n return;\n }\n\n this._isOffsetsSet = true;\n this.computeInitialOffset();\n this.resetOffset();\n },\n\n /**\n * Max / min values for the offset\n * @param offset\n * @return {Object} the sanitized offset\n */\n sanitizeOffset: function (offset) {\n var elWidth = this.el.offsetWidth * this.getInitialZoomFactor() * this.zoomFactor;\n var elHeight = this.el.offsetHeight * this.getInitialZoomFactor() * this.zoomFactor;\n var maxX = elWidth - this.getContainerX() + this.options.horizontalPadding,\n maxY = elHeight - this.getContainerY() + this.options.verticalPadding,\n maxOffsetX = Math.max(maxX, 0),\n maxOffsetY = Math.max(maxY, 0),\n minOffsetX = Math.min(maxX, 0) - this.options.horizontalPadding,\n minOffsetY = Math.min(maxY, 0) - this.options.verticalPadding;\n return {\n x: Math.min(Math.max(offset.x, minOffsetX), maxOffsetX),\n y: Math.min(Math.max(offset.y, minOffsetY), maxOffsetY)\n };\n },\n\n /**\n * Scale to a specific zoom factor (not relative)\n * @param zoomFactor\n * @param center\n */\n scaleTo: function (zoomFactor, center) {\n this.scale(zoomFactor / this.zoomFactor, center);\n },\n\n /**\n * Scales the element from specified center\n * @param scale\n * @param center\n */\n scale: function (scale, center) {\n scale = this.scaleZoomFactor(scale);\n this.addOffset({\n x: (scale - 1) * (center.x + this.offset.x),\n y: (scale - 1) * (center.y + this.offset.y)\n });\n triggerEvent(this.el, this.options.zoomUpdateEventName);\n\n if (typeof this.options.onZoomUpdate == \"function\") {\n this.options.onZoomUpdate(this, event);\n }\n },\n\n /**\n * Scales the zoom factor relative to current state\n * @param scale\n * @return the actual scale (can differ because of max min zoom factor)\n */\n scaleZoomFactor: function (scale) {\n var originalZoomFactor = this.zoomFactor;\n this.zoomFactor *= scale;\n this.zoomFactor = Math.min(this.options.maxZoom, Math.max(this.zoomFactor, this.options.minZoom));\n return this.zoomFactor / originalZoomFactor;\n },\n\n /**\n * Determine if the image is in a draggable state\n *\n * When the image can be dragged, the drag event is acted upon and cancelled.\n * When not draggable, the drag event bubbles through this component.\n *\n * @return {Boolean}\n */\n canDrag: function () {\n return this.options.draggableUnzoomed || !isCloseTo(this.zoomFactor, 1);\n },\n\n /**\n * Drags the element\n * @param center\n * @param lastCenter\n */\n drag: function (center, lastCenter) {\n if (lastCenter) {\n if (this.options.lockDragAxis) {\n // lock scroll to position that was changed the most\n if (Math.abs(center.x - lastCenter.x) > Math.abs(center.y - lastCenter.y)) {\n this.addOffset({\n x: -(center.x - lastCenter.x),\n y: 0\n });\n } else {\n this.addOffset({\n y: -(center.y - lastCenter.y),\n x: 0\n });\n }\n } else {\n this.addOffset({\n y: -(center.y - lastCenter.y),\n x: -(center.x - lastCenter.x)\n });\n }\n\n triggerEvent(this.el, this.options.dragUpdateEventName);\n\n if (typeof this.options.onDragUpdate == \"function\") {\n this.options.onDragUpdate(this, event);\n }\n }\n },\n\n /**\n * Calculates the touch center of multiple touches\n * @param touches\n * @return {Object}\n */\n getTouchCenter: function (touches) {\n return this.getVectorAvg(touches);\n },\n\n /**\n * Calculates the average of multiple vectors (x, y values)\n */\n getVectorAvg: function (vectors) {\n return {\n x: vectors.map(function (v) {\n return v.x;\n }).reduce(sum) / vectors.length,\n y: vectors.map(function (v) {\n return v.y;\n }).reduce(sum) / vectors.length\n };\n },\n\n /**\n * Adds an offset\n * @param offset the offset to add\n * @return return true when the offset change was accepted\n */\n addOffset: function (offset) {\n this.offset = {\n x: this.offset.x + offset.x,\n y: this.offset.y + offset.y\n };\n },\n sanitize: function () {\n if (this.zoomFactor < this.options.zoomOutFactor) {\n this.zoomOutAnimation();\n } else if (this.isInsaneOffset(this.offset)) {\n this.sanitizeOffsetAnimation();\n }\n },\n\n /**\n * Checks if the offset is ok with the current zoom factor\n * @param offset\n * @return {Boolean}\n */\n isInsaneOffset: function (offset) {\n var sanitizedOffset = this.sanitizeOffset(offset);\n return sanitizedOffset.x !== offset.x || sanitizedOffset.y !== offset.y;\n },\n\n /**\n * Creates an animation moving to a sane offset\n */\n sanitizeOffsetAnimation: function () {\n var targetOffset = this.sanitizeOffset(this.offset),\n startOffset = {\n x: this.offset.x,\n y: this.offset.y\n },\n updateProgress = function (progress) {\n this.offset.x = startOffset.x + progress * (targetOffset.x - startOffset.x);\n this.offset.y = startOffset.y + progress * (targetOffset.y - startOffset.y);\n this.update();\n }.bind(this);\n\n this.animate(this.options.animationDuration, updateProgress, this.swing);\n },\n\n /**\n * Zooms back to the original position,\n * (no offset and zoom factor 1)\n */\n zoomOutAnimation: function () {\n if (this.zoomFactor === 1) {\n return;\n }\n\n var startZoomFactor = this.zoomFactor,\n zoomFactor = 1,\n center = this.getCurrentZoomCenter(),\n updateProgress = function (progress) {\n this.scaleTo(startZoomFactor + progress * (zoomFactor - startZoomFactor), center);\n }.bind(this);\n\n this.animate(this.options.animationDuration, updateProgress, this.swing);\n },\n\n /**\n * Updates the container aspect ratio\n *\n * Any previous container height must be cleared before re-measuring the\n * parent height, since it depends implicitly on the height of any of its children\n */\n updateAspectRatio: function () {\n this.unsetContainerY();\n this.setContainerY(this.container.parentElement.offsetHeight);\n },\n\n /**\n * Calculates the initial zoom factor (for the element to fit into the container)\n * @return {number} the initial zoom factor\n */\n getInitialZoomFactor: function () {\n var xZoomFactor = this.container.offsetWidth / this.el.offsetWidth;\n var yZoomFactor = this.container.offsetHeight / this.el.offsetHeight;\n return Math.min(xZoomFactor, yZoomFactor);\n },\n\n /**\n * Calculates the aspect ratio of the element\n * @return the aspect ratio\n */\n getAspectRatio: function () {\n return this.el.offsetWidth / this.el.offsetHeight;\n },\n\n /**\n * Calculates the virtual zoom center for the current offset and zoom factor\n * (used for reverse zoom)\n * @return {Object} the current zoom center\n */\n getCurrentZoomCenter: function () {\n var offsetLeft = this.offset.x - this.initialOffset.x;\n var centerX = -1 * this.offset.x - offsetLeft / (1 / this.zoomFactor - 1);\n var offsetTop = this.offset.y - this.initialOffset.y;\n var centerY = -1 * this.offset.y - offsetTop / (1 / this.zoomFactor - 1);\n return {\n x: centerX,\n y: centerY\n };\n },\n\n /**\n * Returns the touches of an event relative to the container offset\n * @param event\n * @return array touches\n */\n getTouches: function (event) {\n var rect = this.container.getBoundingClientRect();\n var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;\n var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;\n var posTop = rect.top + scrollTop;\n var posLeft = rect.left + scrollLeft;\n return Array.prototype.slice.call(event.touches).map(function (touch) {\n return {\n x: touch.pageX - posLeft,\n y: touch.pageY - posTop\n };\n });\n },\n\n /**\n * Animation loop\n * does not support simultaneous animations\n * @param duration\n * @param framefn\n * @param timefn\n * @param callback\n */\n animate: function (duration, framefn, timefn, callback) {\n var startTime = new Date().getTime(),\n renderFrame = function () {\n if (!this.inAnimation) {\n return;\n }\n\n var frameTime = new Date().getTime() - startTime,\n progress = frameTime / duration;\n\n if (frameTime >= duration) {\n framefn(1);\n\n if (callback) {\n callback();\n }\n\n this.update();\n this.stopAnimation();\n this.update();\n } else {\n if (timefn) {\n progress = timefn(progress);\n }\n\n framefn(progress);\n this.update();\n requestAnimationFrame(renderFrame);\n }\n }.bind(this);\n\n this.inAnimation = true;\n requestAnimationFrame(renderFrame);\n },\n\n /**\n * Stops the animation\n */\n stopAnimation: function () {\n this.inAnimation = false;\n },\n\n /**\n * Swing timing function for animations\n * @param p\n * @return {Number}\n */\n swing: function (p) {\n return -Math.cos(p * Math.PI) / 2 + 0.5;\n },\n getContainerX: function () {\n return this.container.offsetWidth;\n },\n getContainerY: function () {\n return this.container.offsetHeight;\n },\n setContainerY: function (y) {\n return this.container.style.height = y + 'px';\n },\n unsetContainerY: function () {\n this.container.style.height = null;\n },\n\n /**\n * Creates the expected html structure\n */\n setupMarkup: function () {\n this.container = buildElement('
    ');\n this.el.parentNode.insertBefore(this.container, this.el);\n this.container.appendChild(this.el);\n this.container.style.overflow = 'hidden';\n this.container.style.position = 'relative';\n this.el.style.webkitTransformOrigin = '0% 0%';\n this.el.style.mozTransformOrigin = '0% 0%';\n this.el.style.msTransformOrigin = '0% 0%';\n this.el.style.oTransformOrigin = '0% 0%';\n this.el.style.transformOrigin = '0% 0%';\n this.el.style.position = 'absolute';\n },\n end: function () {\n this.hasInteraction = false;\n this.sanitize();\n this.update();\n },\n\n /**\n * Binds all required event listeners\n */\n bindEvents: function () {\n var self = this;\n detectGestures(this.container, this);\n this.resizeHandler = this.update.bind(this);\n window.addEventListener('resize', this.resizeHandler);\n Array.from(this.el.querySelectorAll('img')).forEach(function (imgEl) {\n imgEl.addEventListener('load', self.update.bind(self));\n });\n\n if (this.el.nodeName === 'IMG') {\n this.el.addEventListener('load', this.update.bind(this));\n }\n },\n\n /**\n * Updates the css values according to the current zoom factor and offset\n */\n update: function (event) {\n if (event && event.type === 'resize') {\n this.updateAspectRatio();\n this.setupOffsets();\n }\n\n if (event && event.type === 'load') {\n this.updateAspectRatio();\n this.setupOffsets();\n }\n\n if (this.updatePlanned) {\n return;\n }\n\n this.updatePlanned = true;\n window.setTimeout(function () {\n this.updatePlanned = false;\n\n var zoomFactor = this.getInitialZoomFactor() * this.zoomFactor,\n offsetX = -this.offset.x / zoomFactor,\n offsetY = -this.offset.y / zoomFactor,\n transform3d = 'scale3d(' + zoomFactor + ', ' + zoomFactor + ',1) ' + 'translate3d(' + offsetX + 'px,' + offsetY + 'px,0px)',\n transform2d = 'scale(' + zoomFactor + ', ' + zoomFactor + ') ' + 'translate(' + offsetX + 'px,' + offsetY + 'px)',\n removeClone = function () {\n if (this.clone) {\n this.clone.parentNode.removeChild(this.clone);\n delete this.clone;\n }\n }.bind(this); // Scale 3d and translate3d are faster (at least on ios)\n // but they also reduce the quality.\n // PinchZoom uses the 3d transformations during interactions\n // after interactions it falls back to 2d transformations\n\n\n if (!this.options.use2d || this.hasInteraction || this.inAnimation) {\n this.is3d = true;\n removeClone();\n this.el.style.webkitTransform = transform3d;\n this.el.style.mozTransform = transform2d;\n this.el.style.msTransform = transform2d;\n this.el.style.oTransform = transform2d;\n this.el.style.transform = transform3d;\n } else {\n // When changing from 3d to 2d transform webkit has some glitches.\n // To avoid this, a copy of the 3d transformed element is displayed in the\n // foreground while the element is converted from 3d to 2d transform\n if (this.is3d) {\n this.clone = this.el.cloneNode(true);\n this.clone.style.pointerEvents = 'none';\n this.container.appendChild(this.clone);\n window.setTimeout(removeClone, 200);\n }\n\n this.el.style.webkitTransform = transform2d;\n this.el.style.mozTransform = transform2d;\n this.el.style.msTransform = transform2d;\n this.el.style.oTransform = transform2d;\n this.el.style.transform = transform2d;\n this.is3d = false;\n }\n }.bind(this), 0);\n },\n\n /**\n * Enables event handling for gestures\n */\n enable: function () {\n this.enabled = true;\n },\n\n /**\n * Disables event handling for gestures\n */\n disable: function () {\n this.enabled = false;\n },\n\n /**\n * Unmounts the zooming container and global event listeners\n */\n destroy: function () {\n window.removeEventListener('resize', this.resizeHandler);\n\n if (this.container) {\n this.container.remove();\n this.container = null;\n }\n }\n };\n\n var detectGestures = function (el, target) {\n var interaction = null,\n fingers = 0,\n lastTouchStart = null,\n startTouches = null,\n setInteraction = function (newInteraction, event) {\n if (interaction !== newInteraction) {\n if (interaction && !newInteraction) {\n switch (interaction) {\n case \"zoom\":\n target.handleZoomEnd(event);\n break;\n\n case 'drag':\n target.handleDragEnd(event);\n break;\n }\n }\n\n switch (newInteraction) {\n case 'zoom':\n target.handleZoomStart(event);\n break;\n\n case 'drag':\n target.handleDragStart(event);\n break;\n }\n }\n\n interaction = newInteraction;\n },\n updateInteraction = function (event) {\n if (fingers === 2) {\n setInteraction('zoom');\n } else if (fingers === 1 && target.canDrag()) {\n setInteraction('drag', event);\n } else {\n setInteraction(null, event);\n }\n },\n targetTouches = function (touches) {\n return Array.from(touches).map(function (touch) {\n return {\n x: touch.pageX,\n y: touch.pageY\n };\n });\n },\n getDistance = function (a, b) {\n var x, y;\n x = a.x - b.x;\n y = a.y - b.y;\n return Math.sqrt(x * x + y * y);\n },\n calculateScale = function (startTouches, endTouches) {\n var startDistance = getDistance(startTouches[0], startTouches[1]),\n endDistance = getDistance(endTouches[0], endTouches[1]);\n return endDistance / startDistance;\n },\n cancelEvent = function (event) {\n event.stopPropagation();\n event.preventDefault();\n },\n detectDoubleTap = function (event) {\n var time = new Date().getTime();\n\n if (fingers > 1) {\n lastTouchStart = null;\n }\n\n if (time - lastTouchStart < 300) {\n cancelEvent(event);\n target.handleDoubleTap(event);\n\n switch (interaction) {\n case \"zoom\":\n target.handleZoomEnd(event);\n break;\n\n case 'drag':\n target.handleDragEnd(event);\n break;\n }\n } else {\n target.isDoubleTap = false;\n }\n\n if (fingers === 1) {\n lastTouchStart = time;\n }\n },\n firstMove = true;\n\n el.addEventListener('touchstart', function (event) {\n if (target.enabled) {\n firstMove = true;\n fingers = event.touches.length;\n detectDoubleTap(event);\n }\n }, {\n passive: false\n });\n el.addEventListener('touchmove', function (event) {\n if (target.enabled && !target.isDoubleTap) {\n if (firstMove) {\n updateInteraction(event);\n\n if (interaction) {\n cancelEvent(event);\n }\n\n startTouches = targetTouches(event.touches);\n } else {\n switch (interaction) {\n case 'zoom':\n if (startTouches.length == 2 && event.touches.length == 2) {\n target.handleZoom(event, calculateScale(startTouches, targetTouches(event.touches)));\n }\n\n break;\n\n case 'drag':\n target.handleDrag(event);\n break;\n }\n\n if (interaction) {\n cancelEvent(event);\n target.update();\n }\n }\n\n firstMove = false;\n }\n }, {\n passive: false\n });\n el.addEventListener('touchend', function (event) {\n if (target.enabled) {\n fingers = event.touches.length;\n updateInteraction(event);\n }\n });\n };\n\n return PinchZoom;\n};\n\nvar PinchZoom = definePinchZoom();\nexport default PinchZoom;","export * from \"@stimulus/core\";","export * from \"@stimulus/webpack-helpers\";","export default class TinyGesture {\n constructor(element, options) {\n this.element = element;\n this.touchStartX = null;\n this.touchStartY = null;\n this.touchEndX = null;\n this.touchEndY = null;\n this.touchMoveX = null;\n this.touchMoveY = null;\n this.velocityX = null;\n this.velocityY = null;\n this.longPressTimer = null;\n this.doubleTapTimer = null;\n this.doubleTapWaiting = false;\n this.thresholdX = 0;\n this.thresholdY = 0;\n this.disregardVelocityThresholdX = 0;\n this.disregardVelocityThresholdY = 0;\n this.swipingHorizontal = false;\n this.swipingVertical = false;\n this.swipingDirection = null;\n this.swipedHorizontal = false;\n this.swipedVertical = false;\n this.handlers = {\n panstart: [],\n panmove: [],\n panend: [],\n swipeleft: [],\n swiperight: [],\n swipeup: [],\n swipedown: [],\n tap: [],\n doubletap: [],\n longpress: []\n };\n this._onTouchStart = this.onTouchStart.bind(this);\n this._onTouchMove = this.onTouchMove.bind(this);\n this._onTouchEnd = this.onTouchEnd.bind(this);\n this.opts = Object.assign({}, TinyGesture.defaults, options);\n this.element.addEventListener('touchstart', this._onTouchStart, passiveIfSupported);\n this.element.addEventListener('touchmove', this._onTouchMove, passiveIfSupported);\n this.element.addEventListener('touchend', this._onTouchEnd, passiveIfSupported);\n\n if (this.opts.mouseSupport && !('ontouchstart' in window)) {\n this.element.addEventListener('mousedown', this._onTouchStart, passiveIfSupported);\n document.addEventListener('mousemove', this._onTouchMove, passiveIfSupported);\n document.addEventListener('mouseup', this._onTouchEnd, passiveIfSupported);\n }\n }\n\n destroy() {\n var _a, _b;\n\n this.element.removeEventListener('touchstart', this._onTouchStart);\n this.element.removeEventListener('touchmove', this._onTouchMove);\n this.element.removeEventListener('touchend', this._onTouchEnd);\n this.element.removeEventListener('mousedown', this._onTouchStart);\n document.removeEventListener('mousemove', this._onTouchMove);\n document.removeEventListener('mouseup', this._onTouchEnd);\n clearTimeout((_a = this.longPressTimer) !== null && _a !== void 0 ? _a : undefined);\n clearTimeout((_b = this.doubleTapTimer) !== null && _b !== void 0 ? _b : undefined);\n }\n\n on(type, fn) {\n if (this.handlers[type]) {\n this.handlers[type].push(fn);\n return {\n type,\n fn,\n cancel: () => this.off(type, fn)\n };\n }\n }\n\n off(type, fn) {\n if (this.handlers[type]) {\n const idx = this.handlers[type].indexOf(fn);\n\n if (idx !== -1) {\n this.handlers[type].splice(idx, 1);\n }\n }\n }\n\n fire(type, event) {\n for (let i = 0; i < this.handlers[type].length; i++) {\n this.handlers[type][i](event);\n }\n }\n\n onTouchStart(event) {\n this.thresholdX = this.opts.threshold('x', this);\n this.thresholdY = this.opts.threshold('y', this);\n this.disregardVelocityThresholdX = this.opts.disregardVelocityThreshold('x', this);\n this.disregardVelocityThresholdY = this.opts.disregardVelocityThreshold('y', this);\n this.touchStartX = event.type === 'mousedown' ? event.screenX : event.changedTouches[0].screenX;\n this.touchStartY = event.type === 'mousedown' ? event.screenY : event.changedTouches[0].screenY;\n this.touchMoveX = null;\n this.touchMoveY = null;\n this.touchEndX = null;\n this.touchEndY = null;\n this.swipingDirection = null;\n this.longPressTimer = setTimeout(() => this.fire('longpress', event), this.opts.longPressTime);\n this.fire('panstart', event);\n }\n\n onTouchMove(event) {\n var _a, _b, _c, _d, _e;\n\n if (event.type === 'mousemove' && (!this.touchStartX || this.touchEndX !== null)) {\n return;\n }\n\n const touchMoveX = (event.type === 'mousemove' ? event.screenX : event.changedTouches[0].screenX) - ((_a = this.touchStartX) !== null && _a !== void 0 ? _a : 0);\n this.velocityX = touchMoveX - ((_b = this.touchMoveX) !== null && _b !== void 0 ? _b : 0);\n this.touchMoveX = touchMoveX;\n const touchMoveY = (event.type === 'mousemove' ? event.screenY : event.changedTouches[0].screenY) - ((_c = this.touchStartY) !== null && _c !== void 0 ? _c : 0);\n this.velocityY = touchMoveY - ((_d = this.touchMoveY) !== null && _d !== void 0 ? _d : 0);\n this.touchMoveY = touchMoveY;\n const absTouchMoveX = Math.abs(this.touchMoveX);\n const absTouchMoveY = Math.abs(this.touchMoveY);\n this.swipingHorizontal = absTouchMoveX > this.thresholdX;\n this.swipingVertical = absTouchMoveY > this.thresholdY;\n this.swipingDirection = absTouchMoveX > absTouchMoveY ? this.swipingHorizontal ? 'horizontal' : 'pre-horizontal' : this.swipingVertical ? 'vertical' : 'pre-vertical';\n\n if (Math.max(absTouchMoveX, absTouchMoveY) > this.opts.pressThreshold) {\n clearTimeout((_e = this.longPressTimer) !== null && _e !== void 0 ? _e : undefined);\n }\n\n this.fire('panmove', event);\n }\n\n onTouchEnd(event) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n\n if (event.type === 'mouseup' && (!this.touchStartX || this.touchEndX !== null)) {\n return;\n }\n\n this.touchEndX = event.type === 'mouseup' ? event.screenX : event.changedTouches[0].screenX;\n this.touchEndY = event.type === 'mouseup' ? event.screenY : event.changedTouches[0].screenY;\n this.fire('panend', event);\n clearTimeout((_a = this.longPressTimer) !== null && _a !== void 0 ? _a : undefined);\n const x = this.touchEndX - ((_b = this.touchStartX) !== null && _b !== void 0 ? _b : 0);\n const absX = Math.abs(x);\n const y = this.touchEndY - ((_c = this.touchStartY) !== null && _c !== void 0 ? _c : 0);\n const absY = Math.abs(y);\n\n if (absX > this.thresholdX || absY > this.thresholdY) {\n this.swipedHorizontal = this.opts.diagonalSwipes ? Math.abs(x / y) <= this.opts.diagonalLimit : absX >= absY && absX > this.thresholdX;\n this.swipedVertical = this.opts.diagonalSwipes ? Math.abs(y / x) <= this.opts.diagonalLimit : absY > absX && absY > this.thresholdY;\n\n if (this.swipedHorizontal) {\n if (x < 0) {\n if (((_d = this.velocityX) !== null && _d !== void 0 ? _d : 0) < -this.opts.velocityThreshold || x < -this.disregardVelocityThresholdX) {\n this.fire('swipeleft', event);\n }\n } else {\n if (((_e = this.velocityX) !== null && _e !== void 0 ? _e : 0) > this.opts.velocityThreshold || x > this.disregardVelocityThresholdX) {\n this.fire('swiperight', event);\n }\n }\n }\n\n if (this.swipedVertical) {\n if (y < 0) {\n if (((_f = this.velocityY) !== null && _f !== void 0 ? _f : 0) < -this.opts.velocityThreshold || y < -this.disregardVelocityThresholdY) {\n this.fire('swipeup', event);\n }\n } else {\n if (((_g = this.velocityY) !== null && _g !== void 0 ? _g : 0) > this.opts.velocityThreshold || y > this.disregardVelocityThresholdY) {\n this.fire('swipedown', event);\n }\n }\n }\n } else if (absX < this.opts.pressThreshold && absY < this.opts.pressThreshold) {\n if (this.doubleTapWaiting) {\n this.doubleTapWaiting = false;\n clearTimeout((_h = this.doubleTapTimer) !== null && _h !== void 0 ? _h : undefined);\n this.fire('doubletap', event);\n } else {\n this.doubleTapWaiting = true;\n this.doubleTapTimer = setTimeout(() => this.doubleTapWaiting = false, this.opts.doubleTapTime);\n this.fire('tap', event);\n }\n }\n }\n\n}\nTinyGesture.defaults = {\n threshold: (type, _self) => Math.max(25, Math.floor(0.15 * (type === 'x' ? window.innerWidth || document.body.clientWidth : window.innerHeight || document.body.clientHeight))),\n velocityThreshold: 10,\n disregardVelocityThreshold: (type, self) => Math.floor(0.5 * (type === 'x' ? self.element.clientWidth : self.element.clientHeight)),\n pressThreshold: 8,\n diagonalSwipes: false,\n diagonalLimit: Math.tan(45 * 1.5 / 180 * Math.PI),\n longPressTime: 500,\n doubleTapTime: 300,\n mouseSupport: true\n};\nlet passiveIfSupported = false;\n\ntry {\n window.addEventListener('test', null, Object.defineProperty({}, 'passive', {\n get: function () {\n passiveIfSupported = {\n passive: true\n };\n }\n }));\n} catch (err) {}","/*\nTurbolinks 5.2.0\nCopyright © 2018 Basecamp, LLC\n */\n(function () {\n var t = this;\n (function () {\n (function () {\n this.Turbolinks = {\n supported: function () {\n return null != window.history.pushState && null != window.requestAnimationFrame && null != window.addEventListener;\n }(),\n visit: function (t, r) {\n return e.controller.visit(t, r);\n },\n clearCache: function () {\n return e.controller.clearCache();\n },\n setProgressBarDelay: function (t) {\n return e.controller.setProgressBarDelay(t);\n }\n };\n }).call(this);\n }).call(t);\n var e = t.Turbolinks;\n (function () {\n (function () {\n var t,\n r,\n n,\n o = [].slice;\n e.copyObject = function (t) {\n var e, r, n;\n r = {};\n\n for (e in t) n = t[e], r[e] = n;\n\n return r;\n }, e.closest = function (e, r) {\n return t.call(e, r);\n }, t = function () {\n var t, e;\n return t = document.documentElement, null != (e = t.closest) ? e : function (t) {\n var e;\n\n for (e = this; e;) {\n if (e.nodeType === Node.ELEMENT_NODE && r.call(e, t)) return e;\n e = e.parentNode;\n }\n };\n }(), e.defer = function (t) {\n return setTimeout(t, 1);\n }, e.throttle = function (t) {\n var e;\n return e = null, function () {\n var r;\n return r = 1 <= arguments.length ? o.call(arguments, 0) : [], null != e ? e : e = requestAnimationFrame(function (n) {\n return function () {\n return e = null, t.apply(n, r);\n };\n }(this));\n };\n }, e.dispatch = function (t, e) {\n var r, o, i, s, a, u;\n return a = null != e ? e : {}, u = a.target, r = a.cancelable, o = a.data, i = document.createEvent(\"Events\"), i.initEvent(t, !0, r === !0), i.data = null != o ? o : {}, i.cancelable && !n && (s = i.preventDefault, i.preventDefault = function () {\n return this.defaultPrevented || Object.defineProperty(this, \"defaultPrevented\", {\n get: function () {\n return !0;\n }\n }), s.call(this);\n }), (null != u ? u : document).dispatchEvent(i), i;\n }, n = function () {\n var t;\n return t = document.createEvent(\"Events\"), t.initEvent(\"test\", !0, !0), t.preventDefault(), t.defaultPrevented;\n }(), e.match = function (t, e) {\n return r.call(t, e);\n }, r = function () {\n var t, e, r, n;\n return t = document.documentElement, null != (e = null != (r = null != (n = t.matchesSelector) ? n : t.webkitMatchesSelector) ? r : t.msMatchesSelector) ? e : t.mozMatchesSelector;\n }(), e.uuid = function () {\n var t, e, r;\n\n for (r = \"\", t = e = 1; 36 >= e; t = ++e) r += 9 === t || 14 === t || 19 === t || 24 === t ? \"-\" : 15 === t ? \"4\" : 20 === t ? (Math.floor(4 * Math.random()) + 8).toString(16) : Math.floor(15 * Math.random()).toString(16);\n\n return r;\n };\n }).call(this), function () {\n e.Location = function () {\n function t(t) {\n var e, r;\n null == t && (t = \"\"), r = document.createElement(\"a\"), r.href = t.toString(), this.absoluteURL = r.href, e = r.hash.length, 2 > e ? this.requestURL = this.absoluteURL : (this.requestURL = this.absoluteURL.slice(0, -e), this.anchor = r.hash.slice(1));\n }\n\n var e, r, n, o;\n return t.wrap = function (t) {\n return t instanceof this ? t : new this(t);\n }, t.prototype.getOrigin = function () {\n return this.absoluteURL.split(\"/\", 3).join(\"/\");\n }, t.prototype.getPath = function () {\n var t, e;\n return null != (t = null != (e = this.requestURL.match(/\\/\\/[^\\/]*(\\/[^?;]*)/)) ? e[1] : void 0) ? t : \"/\";\n }, t.prototype.getPathComponents = function () {\n return this.getPath().split(\"/\").slice(1);\n }, t.prototype.getLastPathComponent = function () {\n return this.getPathComponents().slice(-1)[0];\n }, t.prototype.getExtension = function () {\n var t, e;\n return null != (t = null != (e = this.getLastPathComponent().match(/\\.[^.]*$/)) ? e[0] : void 0) ? t : \"\";\n }, t.prototype.isHTML = function () {\n return this.getExtension().match(/^(?:|\\.(?:htm|html|xhtml))$/);\n }, t.prototype.isPrefixedBy = function (t) {\n var e;\n return e = r(t), this.isEqualTo(t) || o(this.absoluteURL, e);\n }, t.prototype.isEqualTo = function (t) {\n return this.absoluteURL === (null != t ? t.absoluteURL : void 0);\n }, t.prototype.toCacheKey = function () {\n return this.requestURL;\n }, t.prototype.toJSON = function () {\n return this.absoluteURL;\n }, t.prototype.toString = function () {\n return this.absoluteURL;\n }, t.prototype.valueOf = function () {\n return this.absoluteURL;\n }, r = function (t) {\n return e(t.getOrigin() + t.getPath());\n }, e = function (t) {\n return n(t, \"/\") ? t : t + \"/\";\n }, o = function (t, e) {\n return t.slice(0, e.length) === e;\n }, n = function (t, e) {\n return t.slice(-e.length) === e;\n }, t;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n\n e.HttpRequest = function () {\n function r(r, n, o) {\n this.delegate = r, this.requestCanceled = t(this.requestCanceled, this), this.requestTimedOut = t(this.requestTimedOut, this), this.requestFailed = t(this.requestFailed, this), this.requestLoaded = t(this.requestLoaded, this), this.requestProgressed = t(this.requestProgressed, this), this.url = e.Location.wrap(n).requestURL, this.referrer = e.Location.wrap(o).absoluteURL, this.createXHR();\n }\n\n return r.NETWORK_FAILURE = 0, r.TIMEOUT_FAILURE = -1, r.timeout = 60, r.prototype.send = function () {\n var t;\n return this.xhr && !this.sent ? (this.notifyApplicationBeforeRequestStart(), this.setProgress(0), this.xhr.send(), this.sent = !0, \"function\" == typeof (t = this.delegate).requestStarted ? t.requestStarted() : void 0) : void 0;\n }, r.prototype.cancel = function () {\n return this.xhr && this.sent ? this.xhr.abort() : void 0;\n }, r.prototype.requestProgressed = function (t) {\n return t.lengthComputable ? this.setProgress(t.loaded / t.total) : void 0;\n }, r.prototype.requestLoaded = function () {\n return this.endRequest(function (t) {\n return function () {\n var e;\n return 200 <= (e = t.xhr.status) && 300 > e ? t.delegate.requestCompletedWithResponse(t.xhr.responseText, t.xhr.getResponseHeader(\"Turbolinks-Location\")) : (t.failed = !0, t.delegate.requestFailedWithStatusCode(t.xhr.status, t.xhr.responseText));\n };\n }(this));\n }, r.prototype.requestFailed = function () {\n return this.endRequest(function (t) {\n return function () {\n return t.failed = !0, t.delegate.requestFailedWithStatusCode(t.constructor.NETWORK_FAILURE);\n };\n }(this));\n }, r.prototype.requestTimedOut = function () {\n return this.endRequest(function (t) {\n return function () {\n return t.failed = !0, t.delegate.requestFailedWithStatusCode(t.constructor.TIMEOUT_FAILURE);\n };\n }(this));\n }, r.prototype.requestCanceled = function () {\n return this.endRequest();\n }, r.prototype.notifyApplicationBeforeRequestStart = function () {\n return e.dispatch(\"turbolinks:request-start\", {\n data: {\n url: this.url,\n xhr: this.xhr\n }\n });\n }, r.prototype.notifyApplicationAfterRequestEnd = function () {\n return e.dispatch(\"turbolinks:request-end\", {\n data: {\n url: this.url,\n xhr: this.xhr\n }\n });\n }, r.prototype.createXHR = function () {\n return this.xhr = new XMLHttpRequest(), this.xhr.open(\"GET\", this.url, !0), this.xhr.timeout = 1e3 * this.constructor.timeout, this.xhr.setRequestHeader(\"Accept\", \"text/html, application/xhtml+xml\"), this.xhr.setRequestHeader(\"Turbolinks-Referrer\", this.referrer), this.xhr.onprogress = this.requestProgressed, this.xhr.onload = this.requestLoaded, this.xhr.onerror = this.requestFailed, this.xhr.ontimeout = this.requestTimedOut, this.xhr.onabort = this.requestCanceled;\n }, r.prototype.endRequest = function (t) {\n return this.xhr ? (this.notifyApplicationAfterRequestEnd(), null != t && t.call(this), this.destroy()) : void 0;\n }, r.prototype.setProgress = function (t) {\n var e;\n return this.progress = t, \"function\" == typeof (e = this.delegate).requestProgressed ? e.requestProgressed(this.progress) : void 0;\n }, r.prototype.destroy = function () {\n var t;\n return this.setProgress(1), \"function\" == typeof (t = this.delegate).requestFinished && t.requestFinished(), this.delegate = null, this.xhr = null;\n }, r;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n\n e.ProgressBar = function () {\n function e() {\n this.trickle = t(this.trickle, this), this.stylesheetElement = this.createStylesheetElement(), this.progressElement = this.createProgressElement();\n }\n\n var r;\n return r = 300, e.defaultCSS = \".turbolinks-progress-bar {\\n position: fixed;\\n display: block;\\n top: 0;\\n left: 0;\\n height: 3px;\\n background: #0076ff;\\n z-index: 9999;\\n transition: width \" + r + \"ms ease-out, opacity \" + r / 2 + \"ms \" + r / 2 + \"ms ease-in;\\n transform: translate3d(0, 0, 0);\\n}\", e.prototype.show = function () {\n return this.visible ? void 0 : (this.visible = !0, this.installStylesheetElement(), this.installProgressElement(), this.startTrickling());\n }, e.prototype.hide = function () {\n return this.visible && !this.hiding ? (this.hiding = !0, this.fadeProgressElement(function (t) {\n return function () {\n return t.uninstallProgressElement(), t.stopTrickling(), t.visible = !1, t.hiding = !1;\n };\n }(this))) : void 0;\n }, e.prototype.setValue = function (t) {\n return this.value = t, this.refresh();\n }, e.prototype.installStylesheetElement = function () {\n return document.head.insertBefore(this.stylesheetElement, document.head.firstChild);\n }, e.prototype.installProgressElement = function () {\n return this.progressElement.style.width = 0, this.progressElement.style.opacity = 1, document.documentElement.insertBefore(this.progressElement, document.body), this.refresh();\n }, e.prototype.fadeProgressElement = function (t) {\n return this.progressElement.style.opacity = 0, setTimeout(t, 1.5 * r);\n }, e.prototype.uninstallProgressElement = function () {\n return this.progressElement.parentNode ? document.documentElement.removeChild(this.progressElement) : void 0;\n }, e.prototype.startTrickling = function () {\n return null != this.trickleInterval ? this.trickleInterval : this.trickleInterval = setInterval(this.trickle, r);\n }, e.prototype.stopTrickling = function () {\n return clearInterval(this.trickleInterval), this.trickleInterval = null;\n }, e.prototype.trickle = function () {\n return this.setValue(this.value + Math.random() / 100);\n }, e.prototype.refresh = function () {\n return requestAnimationFrame(function (t) {\n return function () {\n return t.progressElement.style.width = 10 + 90 * t.value + \"%\";\n };\n }(this));\n }, e.prototype.createStylesheetElement = function () {\n var t;\n return t = document.createElement(\"style\"), t.type = \"text/css\", t.textContent = this.constructor.defaultCSS, t;\n }, e.prototype.createProgressElement = function () {\n var t;\n return t = document.createElement(\"div\"), t.className = \"turbolinks-progress-bar\", t;\n }, e;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n\n e.BrowserAdapter = function () {\n function r(r) {\n this.controller = r, this.showProgressBar = t(this.showProgressBar, this), this.progressBar = new e.ProgressBar();\n }\n\n var n, o, i;\n return i = e.HttpRequest, n = i.NETWORK_FAILURE, o = i.TIMEOUT_FAILURE, r.prototype.visitProposedToLocationWithAction = function (t, e) {\n return this.controller.startVisitToLocationWithAction(t, e);\n }, r.prototype.visitStarted = function (t) {\n return t.issueRequest(), t.changeHistory(), t.loadCachedSnapshot();\n }, r.prototype.visitRequestStarted = function (t) {\n return this.progressBar.setValue(0), t.hasCachedSnapshot() || \"restore\" !== t.action ? this.showProgressBarAfterDelay() : this.showProgressBar();\n }, r.prototype.visitRequestProgressed = function (t) {\n return this.progressBar.setValue(t.progress);\n }, r.prototype.visitRequestCompleted = function (t) {\n return t.loadResponse();\n }, r.prototype.visitRequestFailedWithStatusCode = function (t, e) {\n switch (e) {\n case n:\n case o:\n return this.reload();\n\n default:\n return t.loadResponse();\n }\n }, r.prototype.visitRequestFinished = function (t) {\n return this.hideProgressBar();\n }, r.prototype.visitCompleted = function (t) {\n return t.followRedirect();\n }, r.prototype.pageInvalidated = function () {\n return this.reload();\n }, r.prototype.showProgressBarAfterDelay = function () {\n return this.progressBarTimeout = setTimeout(this.showProgressBar, this.controller.progressBarDelay);\n }, r.prototype.showProgressBar = function () {\n return this.progressBar.show();\n }, r.prototype.hideProgressBar = function () {\n return this.progressBar.hide(), clearTimeout(this.progressBarTimeout);\n }, r.prototype.reload = function () {\n return window.location.reload();\n }, r;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n\n e.History = function () {\n function r(e) {\n this.delegate = e, this.onPageLoad = t(this.onPageLoad, this), this.onPopState = t(this.onPopState, this);\n }\n\n return r.prototype.start = function () {\n return this.started ? void 0 : (addEventListener(\"popstate\", this.onPopState, !1), addEventListener(\"load\", this.onPageLoad, !1), this.started = !0);\n }, r.prototype.stop = function () {\n return this.started ? (removeEventListener(\"popstate\", this.onPopState, !1), removeEventListener(\"load\", this.onPageLoad, !1), this.started = !1) : void 0;\n }, r.prototype.push = function (t, r) {\n return t = e.Location.wrap(t), this.update(\"push\", t, r);\n }, r.prototype.replace = function (t, r) {\n return t = e.Location.wrap(t), this.update(\"replace\", t, r);\n }, r.prototype.onPopState = function (t) {\n var r, n, o, i;\n return this.shouldHandlePopState() && (i = null != (n = t.state) ? n.turbolinks : void 0) ? (r = e.Location.wrap(window.location), o = i.restorationIdentifier, this.delegate.historyPoppedToLocationWithRestorationIdentifier(r, o)) : void 0;\n }, r.prototype.onPageLoad = function (t) {\n return e.defer(function (t) {\n return function () {\n return t.pageLoaded = !0;\n };\n }(this));\n }, r.prototype.shouldHandlePopState = function () {\n return this.pageIsLoaded();\n }, r.prototype.pageIsLoaded = function () {\n return this.pageLoaded || \"complete\" === document.readyState;\n }, r.prototype.update = function (t, e, r) {\n var n;\n return n = {\n turbolinks: {\n restorationIdentifier: r\n }\n }, history[t + \"State\"](n, null, e);\n }, r;\n }();\n }.call(this), function () {\n e.HeadDetails = function () {\n function t(t) {\n var e, r, n, s, a, u;\n\n for (this.elements = {}, n = 0, a = t.length; a > n; n++) u = t[n], u.nodeType === Node.ELEMENT_NODE && (s = u.outerHTML, r = null != (e = this.elements)[s] ? e[s] : e[s] = {\n type: i(u),\n tracked: o(u),\n elements: []\n }, r.elements.push(u));\n }\n\n var e, r, n, o, i;\n return t.fromHeadElement = function (t) {\n var e;\n return new this(null != (e = null != t ? t.childNodes : void 0) ? e : []);\n }, t.prototype.hasElementWithKey = function (t) {\n return t in this.elements;\n }, t.prototype.getTrackedElementSignature = function () {\n var t, e;\n return function () {\n var r, n;\n r = this.elements, n = [];\n\n for (t in r) e = r[t].tracked, e && n.push(t);\n\n return n;\n }.call(this).join(\"\");\n }, t.prototype.getScriptElementsNotInDetails = function (t) {\n return this.getElementsMatchingTypeNotInDetails(\"script\", t);\n }, t.prototype.getStylesheetElementsNotInDetails = function (t) {\n return this.getElementsMatchingTypeNotInDetails(\"stylesheet\", t);\n }, t.prototype.getElementsMatchingTypeNotInDetails = function (t, e) {\n var r, n, o, i, s, a;\n o = this.elements, s = [];\n\n for (n in o) i = o[n], a = i.type, r = i.elements, a !== t || e.hasElementWithKey(n) || s.push(r[0]);\n\n return s;\n }, t.prototype.getProvisionalElements = function () {\n var t, e, r, n, o, i, s;\n r = [], n = this.elements;\n\n for (e in n) o = n[e], s = o.type, i = o.tracked, t = o.elements, null != s || i ? t.length > 1 && r.push.apply(r, t.slice(1)) : r.push.apply(r, t);\n\n return r;\n }, t.prototype.getMetaValue = function (t) {\n var e;\n return null != (e = this.findMetaElementByName(t)) ? e.getAttribute(\"content\") : void 0;\n }, t.prototype.findMetaElementByName = function (t) {\n var r, n, o, i;\n r = void 0, i = this.elements;\n\n for (o in i) n = i[o].elements, e(n[0], t) && (r = n[0]);\n\n return r;\n }, i = function (t) {\n return r(t) ? \"script\" : n(t) ? \"stylesheet\" : void 0;\n }, o = function (t) {\n return \"reload\" === t.getAttribute(\"data-turbolinks-track\");\n }, r = function (t) {\n var e;\n return e = t.tagName.toLowerCase(), \"script\" === e;\n }, n = function (t) {\n var e;\n return e = t.tagName.toLowerCase(), \"style\" === e || \"link\" === e && \"stylesheet\" === t.getAttribute(\"rel\");\n }, e = function (t, e) {\n var r;\n return r = t.tagName.toLowerCase(), \"meta\" === r && t.getAttribute(\"name\") === e;\n }, t;\n }();\n }.call(this), function () {\n e.Snapshot = function () {\n function t(t, e) {\n this.headDetails = t, this.bodyElement = e;\n }\n\n return t.wrap = function (t) {\n return t instanceof this ? t : \"string\" == typeof t ? this.fromHTMLString(t) : this.fromHTMLElement(t);\n }, t.fromHTMLString = function (t) {\n var e;\n return e = document.createElement(\"html\"), e.innerHTML = t, this.fromHTMLElement(e);\n }, t.fromHTMLElement = function (t) {\n var r, n, o, i;\n return o = t.querySelector(\"head\"), r = null != (i = t.querySelector(\"body\")) ? i : document.createElement(\"body\"), n = e.HeadDetails.fromHeadElement(o), new this(n, r);\n }, t.prototype.clone = function () {\n return new this.constructor(this.headDetails, this.bodyElement.cloneNode(!0));\n }, t.prototype.getRootLocation = function () {\n var t, r;\n return r = null != (t = this.getSetting(\"root\")) ? t : \"/\", new e.Location(r);\n }, t.prototype.getCacheControlValue = function () {\n return this.getSetting(\"cache-control\");\n }, t.prototype.getElementForAnchor = function (t) {\n try {\n return this.bodyElement.querySelector(\"[id='\" + t + \"'], a[name='\" + t + \"']\");\n } catch (e) {}\n }, t.prototype.getPermanentElements = function () {\n return this.bodyElement.querySelectorAll(\"[id][data-turbolinks-permanent]\");\n }, t.prototype.getPermanentElementById = function (t) {\n return this.bodyElement.querySelector(\"#\" + t + \"[data-turbolinks-permanent]\");\n }, t.prototype.getPermanentElementsPresentInSnapshot = function (t) {\n var e, r, n, o, i;\n\n for (o = this.getPermanentElements(), i = [], r = 0, n = o.length; n > r; r++) e = o[r], t.getPermanentElementById(e.id) && i.push(e);\n\n return i;\n }, t.prototype.findFirstAutofocusableElement = function () {\n return this.bodyElement.querySelector(\"[autofocus]\");\n }, t.prototype.hasAnchor = function (t) {\n return null != this.getElementForAnchor(t);\n }, t.prototype.isPreviewable = function () {\n return \"no-preview\" !== this.getCacheControlValue();\n }, t.prototype.isCacheable = function () {\n return \"no-cache\" !== this.getCacheControlValue();\n }, t.prototype.isVisitable = function () {\n return \"reload\" !== this.getSetting(\"visit-control\");\n }, t.prototype.getSetting = function (t) {\n return this.headDetails.getMetaValue(\"turbolinks-\" + t);\n }, t;\n }();\n }.call(this), function () {\n var t = [].slice;\n\n e.Renderer = function () {\n function e() {}\n\n var r;\n return e.render = function () {\n var e, r, n, o;\n return n = arguments[0], r = arguments[1], e = 3 <= arguments.length ? t.call(arguments, 2) : [], o = function (t, e, r) {\n r.prototype = t.prototype;\n var n = new r(),\n o = t.apply(n, e);\n return Object(o) === o ? o : n;\n }(this, e, function () {}), o.delegate = n, o.render(r), o;\n }, e.prototype.renderView = function (t) {\n return this.delegate.viewWillRender(this.newBody), t(), this.delegate.viewRendered(this.newBody);\n }, e.prototype.invalidateView = function () {\n return this.delegate.viewInvalidated();\n }, e.prototype.createScriptElement = function (t) {\n var e;\n return \"false\" === t.getAttribute(\"data-turbolinks-eval\") ? t : (e = document.createElement(\"script\"), e.textContent = t.textContent, e.async = !1, r(e, t), e);\n }, r = function (t, e) {\n var r, n, o, i, s, a, u;\n\n for (i = e.attributes, a = [], r = 0, n = i.length; n > r; r++) s = i[r], o = s.name, u = s.value, a.push(t.setAttribute(o, u));\n\n return a;\n }, e;\n }();\n }.call(this), function () {\n var t,\n r,\n n = function (t, e) {\n function r() {\n this.constructor = t;\n }\n\n for (var n in e) o.call(e, n) && (t[n] = e[n]);\n\n return r.prototype = e.prototype, t.prototype = new r(), t.__super__ = e.prototype, t;\n },\n o = {}.hasOwnProperty;\n\n e.SnapshotRenderer = function (e) {\n function o(t, e, r) {\n this.currentSnapshot = t, this.newSnapshot = e, this.isPreview = r, this.currentHeadDetails = this.currentSnapshot.headDetails, this.newHeadDetails = this.newSnapshot.headDetails, this.currentBody = this.currentSnapshot.bodyElement, this.newBody = this.newSnapshot.bodyElement;\n }\n\n return n(o, e), o.prototype.render = function (t) {\n return this.shouldRender() ? (this.mergeHead(), this.renderView(function (e) {\n return function () {\n return e.replaceBody(), e.isPreview || e.focusFirstAutofocusableElement(), t();\n };\n }(this))) : this.invalidateView();\n }, o.prototype.mergeHead = function () {\n return this.copyNewHeadStylesheetElements(), this.copyNewHeadScriptElements(), this.removeCurrentHeadProvisionalElements(), this.copyNewHeadProvisionalElements();\n }, o.prototype.replaceBody = function () {\n var t;\n return t = this.relocateCurrentBodyPermanentElements(), this.activateNewBodyScriptElements(), this.assignNewBody(), this.replacePlaceholderElementsWithClonedPermanentElements(t);\n }, o.prototype.shouldRender = function () {\n return this.newSnapshot.isVisitable() && this.trackedElementsAreIdentical();\n }, o.prototype.trackedElementsAreIdentical = function () {\n return this.currentHeadDetails.getTrackedElementSignature() === this.newHeadDetails.getTrackedElementSignature();\n }, o.prototype.copyNewHeadStylesheetElements = function () {\n var t, e, r, n, o;\n\n for (n = this.getNewHeadStylesheetElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.appendChild(t));\n\n return o;\n }, o.prototype.copyNewHeadScriptElements = function () {\n var t, e, r, n, o;\n\n for (n = this.getNewHeadScriptElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.appendChild(this.createScriptElement(t)));\n\n return o;\n }, o.prototype.removeCurrentHeadProvisionalElements = function () {\n var t, e, r, n, o;\n\n for (n = this.getCurrentHeadProvisionalElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.removeChild(t));\n\n return o;\n }, o.prototype.copyNewHeadProvisionalElements = function () {\n var t, e, r, n, o;\n\n for (n = this.getNewHeadProvisionalElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.appendChild(t));\n\n return o;\n }, o.prototype.relocateCurrentBodyPermanentElements = function () {\n var e, n, o, i, s, a, u;\n\n for (a = this.getCurrentBodyPermanentElements(), u = [], e = 0, n = a.length; n > e; e++) i = a[e], s = t(i), o = this.newSnapshot.getPermanentElementById(i.id), r(i, s.element), r(o, i), u.push(s);\n\n return u;\n }, o.prototype.replacePlaceholderElementsWithClonedPermanentElements = function (t) {\n var e, n, o, i, s, a, u;\n\n for (u = [], o = 0, i = t.length; i > o; o++) a = t[o], n = a.element, s = a.permanentElement, e = s.cloneNode(!0), u.push(r(n, e));\n\n return u;\n }, o.prototype.activateNewBodyScriptElements = function () {\n var t, e, n, o, i, s;\n\n for (i = this.getNewBodyScriptElements(), s = [], e = 0, o = i.length; o > e; e++) n = i[e], t = this.createScriptElement(n), s.push(r(n, t));\n\n return s;\n }, o.prototype.assignNewBody = function () {\n return document.body = this.newBody;\n }, o.prototype.focusFirstAutofocusableElement = function () {\n var t;\n return null != (t = this.newSnapshot.findFirstAutofocusableElement()) ? t.focus() : void 0;\n }, o.prototype.getNewHeadStylesheetElements = function () {\n return this.newHeadDetails.getStylesheetElementsNotInDetails(this.currentHeadDetails);\n }, o.prototype.getNewHeadScriptElements = function () {\n return this.newHeadDetails.getScriptElementsNotInDetails(this.currentHeadDetails);\n }, o.prototype.getCurrentHeadProvisionalElements = function () {\n return this.currentHeadDetails.getProvisionalElements();\n }, o.prototype.getNewHeadProvisionalElements = function () {\n return this.newHeadDetails.getProvisionalElements();\n }, o.prototype.getCurrentBodyPermanentElements = function () {\n return this.currentSnapshot.getPermanentElementsPresentInSnapshot(this.newSnapshot);\n }, o.prototype.getNewBodyScriptElements = function () {\n return this.newBody.querySelectorAll(\"script\");\n }, o;\n }(e.Renderer), t = function (t) {\n var e;\n return e = document.createElement(\"meta\"), e.setAttribute(\"name\", \"turbolinks-permanent-placeholder\"), e.setAttribute(\"content\", t.id), {\n element: e,\n permanentElement: t\n };\n }, r = function (t, e) {\n var r;\n return (r = t.parentNode) ? r.replaceChild(e, t) : void 0;\n };\n }.call(this), function () {\n var t = function (t, e) {\n function n() {\n this.constructor = t;\n }\n\n for (var o in e) r.call(e, o) && (t[o] = e[o]);\n\n return n.prototype = e.prototype, t.prototype = new n(), t.__super__ = e.prototype, t;\n },\n r = {}.hasOwnProperty;\n\n e.ErrorRenderer = function (e) {\n function r(t) {\n var e;\n e = document.createElement(\"html\"), e.innerHTML = t, this.newHead = e.querySelector(\"head\"), this.newBody = e.querySelector(\"body\");\n }\n\n return t(r, e), r.prototype.render = function (t) {\n return this.renderView(function (e) {\n return function () {\n return e.replaceHeadAndBody(), e.activateBodyScriptElements(), t();\n };\n }(this));\n }, r.prototype.replaceHeadAndBody = function () {\n var t, e;\n return e = document.head, t = document.body, e.parentNode.replaceChild(this.newHead, e), t.parentNode.replaceChild(this.newBody, t);\n }, r.prototype.activateBodyScriptElements = function () {\n var t, e, r, n, o, i;\n\n for (n = this.getScriptElements(), i = [], e = 0, r = n.length; r > e; e++) o = n[e], t = this.createScriptElement(o), i.push(o.parentNode.replaceChild(t, o));\n\n return i;\n }, r.prototype.getScriptElements = function () {\n return document.documentElement.querySelectorAll(\"script\");\n }, r;\n }(e.Renderer);\n }.call(this), function () {\n e.View = function () {\n function t(t) {\n this.delegate = t, this.htmlElement = document.documentElement;\n }\n\n return t.prototype.getRootLocation = function () {\n return this.getSnapshot().getRootLocation();\n }, t.prototype.getElementForAnchor = function (t) {\n return this.getSnapshot().getElementForAnchor(t);\n }, t.prototype.getSnapshot = function () {\n return e.Snapshot.fromHTMLElement(this.htmlElement);\n }, t.prototype.render = function (t, e) {\n var r, n, o;\n return o = t.snapshot, r = t.error, n = t.isPreview, this.markAsPreview(n), null != o ? this.renderSnapshot(o, n, e) : this.renderError(r, e);\n }, t.prototype.markAsPreview = function (t) {\n return t ? this.htmlElement.setAttribute(\"data-turbolinks-preview\", \"\") : this.htmlElement.removeAttribute(\"data-turbolinks-preview\");\n }, t.prototype.renderSnapshot = function (t, r, n) {\n return e.SnapshotRenderer.render(this.delegate, n, this.getSnapshot(), e.Snapshot.wrap(t), r);\n }, t.prototype.renderError = function (t, r) {\n return e.ErrorRenderer.render(this.delegate, r, t);\n }, t;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n\n e.ScrollManager = function () {\n function r(r) {\n this.delegate = r, this.onScroll = t(this.onScroll, this), this.onScroll = e.throttle(this.onScroll);\n }\n\n return r.prototype.start = function () {\n return this.started ? void 0 : (addEventListener(\"scroll\", this.onScroll, !1), this.onScroll(), this.started = !0);\n }, r.prototype.stop = function () {\n return this.started ? (removeEventListener(\"scroll\", this.onScroll, !1), this.started = !1) : void 0;\n }, r.prototype.scrollToElement = function (t) {\n return t.scrollIntoView();\n }, r.prototype.scrollToPosition = function (t) {\n var e, r;\n return e = t.x, r = t.y, window.scrollTo(e, r);\n }, r.prototype.onScroll = function (t) {\n return this.updatePosition({\n x: window.pageXOffset,\n y: window.pageYOffset\n });\n }, r.prototype.updatePosition = function (t) {\n var e;\n return this.position = t, null != (e = this.delegate) ? e.scrollPositionChanged(this.position) : void 0;\n }, r;\n }();\n }.call(this), function () {\n e.SnapshotCache = function () {\n function t(t) {\n this.size = t, this.keys = [], this.snapshots = {};\n }\n\n var r;\n return t.prototype.has = function (t) {\n var e;\n return e = r(t), e in this.snapshots;\n }, t.prototype.get = function (t) {\n var e;\n if (this.has(t)) return e = this.read(t), this.touch(t), e;\n }, t.prototype.put = function (t, e) {\n return this.write(t, e), this.touch(t), e;\n }, t.prototype.read = function (t) {\n var e;\n return e = r(t), this.snapshots[e];\n }, t.prototype.write = function (t, e) {\n var n;\n return n = r(t), this.snapshots[n] = e;\n }, t.prototype.touch = function (t) {\n var e, n;\n return n = r(t), e = this.keys.indexOf(n), e > -1 && this.keys.splice(e, 1), this.keys.unshift(n), this.trim();\n }, t.prototype.trim = function () {\n var t, e, r, n, o;\n\n for (n = this.keys.splice(this.size), o = [], t = 0, r = n.length; r > t; t++) e = n[t], o.push(delete this.snapshots[e]);\n\n return o;\n }, r = function (t) {\n return e.Location.wrap(t).toCacheKey();\n }, t;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n\n e.Visit = function () {\n function r(r, n, o) {\n this.controller = r, this.action = o, this.performScroll = t(this.performScroll, this), this.identifier = e.uuid(), this.location = e.Location.wrap(n), this.adapter = this.controller.adapter, this.state = \"initialized\", this.timingMetrics = {};\n }\n\n var n;\n return r.prototype.start = function () {\n return \"initialized\" === this.state ? (this.recordTimingMetric(\"visitStart\"), this.state = \"started\", this.adapter.visitStarted(this)) : void 0;\n }, r.prototype.cancel = function () {\n var t;\n return \"started\" === this.state ? (null != (t = this.request) && t.cancel(), this.cancelRender(), this.state = \"canceled\") : void 0;\n }, r.prototype.complete = function () {\n var t;\n return \"started\" === this.state ? (this.recordTimingMetric(\"visitEnd\"), this.state = \"completed\", \"function\" == typeof (t = this.adapter).visitCompleted && t.visitCompleted(this), this.controller.visitCompleted(this)) : void 0;\n }, r.prototype.fail = function () {\n var t;\n return \"started\" === this.state ? (this.state = \"failed\", \"function\" == typeof (t = this.adapter).visitFailed ? t.visitFailed(this) : void 0) : void 0;\n }, r.prototype.changeHistory = function () {\n var t, e;\n return this.historyChanged ? void 0 : (t = this.location.isEqualTo(this.referrer) ? \"replace\" : this.action, e = n(t), this.controller[e](this.location, this.restorationIdentifier), this.historyChanged = !0);\n }, r.prototype.issueRequest = function () {\n return this.shouldIssueRequest() && null == this.request ? (this.progress = 0, this.request = new e.HttpRequest(this, this.location, this.referrer), this.request.send()) : void 0;\n }, r.prototype.getCachedSnapshot = function () {\n var t;\n return !(t = this.controller.getCachedSnapshotForLocation(this.location)) || null != this.location.anchor && !t.hasAnchor(this.location.anchor) || \"restore\" !== this.action && !t.isPreviewable() ? void 0 : t;\n }, r.prototype.hasCachedSnapshot = function () {\n return null != this.getCachedSnapshot();\n }, r.prototype.loadCachedSnapshot = function () {\n var t, e;\n return (e = this.getCachedSnapshot()) ? (t = this.shouldIssueRequest(), this.render(function () {\n var r;\n return this.cacheSnapshot(), this.controller.render({\n snapshot: e,\n isPreview: t\n }, this.performScroll), \"function\" == typeof (r = this.adapter).visitRendered && r.visitRendered(this), t ? void 0 : this.complete();\n })) : void 0;\n }, r.prototype.loadResponse = function () {\n return null != this.response ? this.render(function () {\n var t, e;\n return this.cacheSnapshot(), this.request.failed ? (this.controller.render({\n error: this.response\n }, this.performScroll), \"function\" == typeof (t = this.adapter).visitRendered && t.visitRendered(this), this.fail()) : (this.controller.render({\n snapshot: this.response\n }, this.performScroll), \"function\" == typeof (e = this.adapter).visitRendered && e.visitRendered(this), this.complete());\n }) : void 0;\n }, r.prototype.followRedirect = function () {\n return this.redirectedToLocation && !this.followedRedirect ? (this.location = this.redirectedToLocation, this.controller.replaceHistoryWithLocationAndRestorationIdentifier(this.redirectedToLocation, this.restorationIdentifier), this.followedRedirect = !0) : void 0;\n }, r.prototype.requestStarted = function () {\n var t;\n return this.recordTimingMetric(\"requestStart\"), \"function\" == typeof (t = this.adapter).visitRequestStarted ? t.visitRequestStarted(this) : void 0;\n }, r.prototype.requestProgressed = function (t) {\n var e;\n return this.progress = t, \"function\" == typeof (e = this.adapter).visitRequestProgressed ? e.visitRequestProgressed(this) : void 0;\n }, r.prototype.requestCompletedWithResponse = function (t, r) {\n return this.response = t, null != r && (this.redirectedToLocation = e.Location.wrap(r)), this.adapter.visitRequestCompleted(this);\n }, r.prototype.requestFailedWithStatusCode = function (t, e) {\n return this.response = e, this.adapter.visitRequestFailedWithStatusCode(this, t);\n }, r.prototype.requestFinished = function () {\n var t;\n return this.recordTimingMetric(\"requestEnd\"), \"function\" == typeof (t = this.adapter).visitRequestFinished ? t.visitRequestFinished(this) : void 0;\n }, r.prototype.performScroll = function () {\n return this.scrolled ? void 0 : (\"restore\" === this.action ? this.scrollToRestoredPosition() || this.scrollToTop() : this.scrollToAnchor() || this.scrollToTop(), this.scrolled = !0);\n }, r.prototype.scrollToRestoredPosition = function () {\n var t, e;\n return t = null != (e = this.restorationData) ? e.scrollPosition : void 0, null != t ? (this.controller.scrollToPosition(t), !0) : void 0;\n }, r.prototype.scrollToAnchor = function () {\n return null != this.location.anchor ? (this.controller.scrollToAnchor(this.location.anchor), !0) : void 0;\n }, r.prototype.scrollToTop = function () {\n return this.controller.scrollToPosition({\n x: 0,\n y: 0\n });\n }, r.prototype.recordTimingMetric = function (t) {\n var e;\n return null != (e = this.timingMetrics)[t] ? e[t] : e[t] = new Date().getTime();\n }, r.prototype.getTimingMetrics = function () {\n return e.copyObject(this.timingMetrics);\n }, n = function (t) {\n switch (t) {\n case \"replace\":\n return \"replaceHistoryWithLocationAndRestorationIdentifier\";\n\n case \"advance\":\n case \"restore\":\n return \"pushHistoryWithLocationAndRestorationIdentifier\";\n }\n }, r.prototype.shouldIssueRequest = function () {\n return \"restore\" === this.action ? !this.hasCachedSnapshot() : !0;\n }, r.prototype.cacheSnapshot = function () {\n return this.snapshotCached ? void 0 : (this.controller.cacheSnapshot(), this.snapshotCached = !0);\n }, r.prototype.render = function (t) {\n return this.cancelRender(), this.frame = requestAnimationFrame(function (e) {\n return function () {\n return e.frame = null, t.call(e);\n };\n }(this));\n }, r.prototype.cancelRender = function () {\n return this.frame ? cancelAnimationFrame(this.frame) : void 0;\n }, r;\n }();\n }.call(this), function () {\n var t = function (t, e) {\n return function () {\n return t.apply(e, arguments);\n };\n };\n\n e.Controller = function () {\n function r() {\n this.clickBubbled = t(this.clickBubbled, this), this.clickCaptured = t(this.clickCaptured, this), this.pageLoaded = t(this.pageLoaded, this), this.history = new e.History(this), this.view = new e.View(this), this.scrollManager = new e.ScrollManager(this), this.restorationData = {}, this.clearCache(), this.setProgressBarDelay(500);\n }\n\n return r.prototype.start = function () {\n return e.supported && !this.started ? (addEventListener(\"click\", this.clickCaptured, !0), addEventListener(\"DOMContentLoaded\", this.pageLoaded, !1), this.scrollManager.start(), this.startHistory(), this.started = !0, this.enabled = !0) : void 0;\n }, r.prototype.disable = function () {\n return this.enabled = !1;\n }, r.prototype.stop = function () {\n return this.started ? (removeEventListener(\"click\", this.clickCaptured, !0), removeEventListener(\"DOMContentLoaded\", this.pageLoaded, !1), this.scrollManager.stop(), this.stopHistory(), this.started = !1) : void 0;\n }, r.prototype.clearCache = function () {\n return this.cache = new e.SnapshotCache(10);\n }, r.prototype.visit = function (t, r) {\n var n, o;\n return null == r && (r = {}), t = e.Location.wrap(t), this.applicationAllowsVisitingLocation(t) ? this.locationIsVisitable(t) ? (n = null != (o = r.action) ? o : \"advance\", this.adapter.visitProposedToLocationWithAction(t, n)) : window.location = t : void 0;\n }, r.prototype.startVisitToLocationWithAction = function (t, r, n) {\n var o;\n return e.supported ? (o = this.getRestorationDataForIdentifier(n), this.startVisit(t, r, {\n restorationData: o\n })) : window.location = t;\n }, r.prototype.setProgressBarDelay = function (t) {\n return this.progressBarDelay = t;\n }, r.prototype.startHistory = function () {\n return this.location = e.Location.wrap(window.location), this.restorationIdentifier = e.uuid(), this.history.start(), this.history.replace(this.location, this.restorationIdentifier);\n }, r.prototype.stopHistory = function () {\n return this.history.stop();\n }, r.prototype.pushHistoryWithLocationAndRestorationIdentifier = function (t, r) {\n return this.restorationIdentifier = r, this.location = e.Location.wrap(t), this.history.push(this.location, this.restorationIdentifier);\n }, r.prototype.replaceHistoryWithLocationAndRestorationIdentifier = function (t, r) {\n return this.restorationIdentifier = r, this.location = e.Location.wrap(t), this.history.replace(this.location, this.restorationIdentifier);\n }, r.prototype.historyPoppedToLocationWithRestorationIdentifier = function (t, r) {\n var n;\n return this.restorationIdentifier = r, this.enabled ? (n = this.getRestorationDataForIdentifier(this.restorationIdentifier), this.startVisit(t, \"restore\", {\n restorationIdentifier: this.restorationIdentifier,\n restorationData: n,\n historyChanged: !0\n }), this.location = e.Location.wrap(t)) : this.adapter.pageInvalidated();\n }, r.prototype.getCachedSnapshotForLocation = function (t) {\n var e;\n return null != (e = this.cache.get(t)) ? e.clone() : void 0;\n }, r.prototype.shouldCacheSnapshot = function () {\n return this.view.getSnapshot().isCacheable();\n }, r.prototype.cacheSnapshot = function () {\n var t, r;\n return this.shouldCacheSnapshot() ? (this.notifyApplicationBeforeCachingSnapshot(), r = this.view.getSnapshot(), t = this.lastRenderedLocation, e.defer(function (e) {\n return function () {\n return e.cache.put(t, r.clone());\n };\n }(this))) : void 0;\n }, r.prototype.scrollToAnchor = function (t) {\n var e;\n return (e = this.view.getElementForAnchor(t)) ? this.scrollToElement(e) : this.scrollToPosition({\n x: 0,\n y: 0\n });\n }, r.prototype.scrollToElement = function (t) {\n return this.scrollManager.scrollToElement(t);\n }, r.prototype.scrollToPosition = function (t) {\n return this.scrollManager.scrollToPosition(t);\n }, r.prototype.scrollPositionChanged = function (t) {\n var e;\n return e = this.getCurrentRestorationData(), e.scrollPosition = t;\n }, r.prototype.render = function (t, e) {\n return this.view.render(t, e);\n }, r.prototype.viewInvalidated = function () {\n return this.adapter.pageInvalidated();\n }, r.prototype.viewWillRender = function (t) {\n return this.notifyApplicationBeforeRender(t);\n }, r.prototype.viewRendered = function () {\n return this.lastRenderedLocation = this.currentVisit.location, this.notifyApplicationAfterRender();\n }, r.prototype.pageLoaded = function () {\n return this.lastRenderedLocation = this.location, this.notifyApplicationAfterPageLoad();\n }, r.prototype.clickCaptured = function () {\n return removeEventListener(\"click\", this.clickBubbled, !1), addEventListener(\"click\", this.clickBubbled, !1);\n }, r.prototype.clickBubbled = function (t) {\n var e, r, n;\n return this.enabled && this.clickEventIsSignificant(t) && (r = this.getVisitableLinkForNode(t.target)) && (n = this.getVisitableLocationForLink(r)) && this.applicationAllowsFollowingLinkToLocation(r, n) ? (t.preventDefault(), e = this.getActionForLink(r), this.visit(n, {\n action: e\n })) : void 0;\n }, r.prototype.applicationAllowsFollowingLinkToLocation = function (t, e) {\n var r;\n return r = this.notifyApplicationAfterClickingLinkToLocation(t, e), !r.defaultPrevented;\n }, r.prototype.applicationAllowsVisitingLocation = function (t) {\n var e;\n return e = this.notifyApplicationBeforeVisitingLocation(t), !e.defaultPrevented;\n }, r.prototype.notifyApplicationAfterClickingLinkToLocation = function (t, r) {\n return e.dispatch(\"turbolinks:click\", {\n target: t,\n data: {\n url: r.absoluteURL\n },\n cancelable: !0\n });\n }, r.prototype.notifyApplicationBeforeVisitingLocation = function (t) {\n return e.dispatch(\"turbolinks:before-visit\", {\n data: {\n url: t.absoluteURL\n },\n cancelable: !0\n });\n }, r.prototype.notifyApplicationAfterVisitingLocation = function (t) {\n return e.dispatch(\"turbolinks:visit\", {\n data: {\n url: t.absoluteURL\n }\n });\n }, r.prototype.notifyApplicationBeforeCachingSnapshot = function () {\n return e.dispatch(\"turbolinks:before-cache\");\n }, r.prototype.notifyApplicationBeforeRender = function (t) {\n return e.dispatch(\"turbolinks:before-render\", {\n data: {\n newBody: t\n }\n });\n }, r.prototype.notifyApplicationAfterRender = function () {\n return e.dispatch(\"turbolinks:render\");\n }, r.prototype.notifyApplicationAfterPageLoad = function (t) {\n return null == t && (t = {}), e.dispatch(\"turbolinks:load\", {\n data: {\n url: this.location.absoluteURL,\n timing: t\n }\n });\n }, r.prototype.startVisit = function (t, e, r) {\n var n;\n return null != (n = this.currentVisit) && n.cancel(), this.currentVisit = this.createVisit(t, e, r), this.currentVisit.start(), this.notifyApplicationAfterVisitingLocation(t);\n }, r.prototype.createVisit = function (t, r, n) {\n var o, i, s, a, u;\n return i = null != n ? n : {}, a = i.restorationIdentifier, s = i.restorationData, o = i.historyChanged, u = new e.Visit(this, t, r), u.restorationIdentifier = null != a ? a : e.uuid(), u.restorationData = e.copyObject(s), u.historyChanged = o, u.referrer = this.location, u;\n }, r.prototype.visitCompleted = function (t) {\n return this.notifyApplicationAfterPageLoad(t.getTimingMetrics());\n }, r.prototype.clickEventIsSignificant = function (t) {\n return !(t.defaultPrevented || t.target.isContentEditable || t.which > 1 || t.altKey || t.ctrlKey || t.metaKey || t.shiftKey);\n }, r.prototype.getVisitableLinkForNode = function (t) {\n return this.nodeIsVisitable(t) ? e.closest(t, \"a[href]:not([target]):not([download])\") : void 0;\n }, r.prototype.getVisitableLocationForLink = function (t) {\n var r;\n return r = new e.Location(t.getAttribute(\"href\")), this.locationIsVisitable(r) ? r : void 0;\n }, r.prototype.getActionForLink = function (t) {\n var e;\n return null != (e = t.getAttribute(\"data-turbolinks-action\")) ? e : \"advance\";\n }, r.prototype.nodeIsVisitable = function (t) {\n var r;\n return (r = e.closest(t, \"[data-turbolinks]\")) ? \"false\" !== r.getAttribute(\"data-turbolinks\") : !0;\n }, r.prototype.locationIsVisitable = function (t) {\n return t.isPrefixedBy(this.view.getRootLocation()) && t.isHTML();\n }, r.prototype.getCurrentRestorationData = function () {\n return this.getRestorationDataForIdentifier(this.restorationIdentifier);\n }, r.prototype.getRestorationDataForIdentifier = function (t) {\n var e;\n return null != (e = this.restorationData)[t] ? e[t] : e[t] = {};\n }, r;\n }();\n }.call(this), function () {\n !function () {\n var t, e;\n if ((t = e = document.currentScript) && !e.hasAttribute(\"data-turbolinks-suppress-warning\")) for (; t = t.parentNode;) if (t === document.body) return console.warn(\"You are loading Turbolinks from a