{"version":3,"file":"main-BJsPS4tq.js","sources":["../../../node_modules/@wagich/medium-zoom/dist/medium-zoom.esm.js","../../../node_modules/ev-emitter/ev-emitter.js","../../../node_modules/get-size/get-size.js","../../../node_modules/desandro-matches-selector/matches-selector.js","../../../node_modules/fizzy-ui-utils/utils.js","../../../node_modules/flickity/js/cell.js","../../../node_modules/flickity/js/slide.js","../../../node_modules/flickity/js/animate.js","../../../node_modules/flickity/js/flickity.js","../../../node_modules/unipointer/unipointer.js","../../../node_modules/unidragger/unidragger.js","../../../node_modules/flickity/js/drag.js","../../../node_modules/flickity/js/prev-next-button.js","../../../node_modules/flickity/js/page-dots.js","../../../node_modules/flickity/js/player.js","../../../node_modules/flickity/js/add-remove-cell.js","../../../node_modules/flickity/js/lazyload.js","../../../node_modules/flickity/js/index.js","../../../node_modules/flickity-as-nav-for/as-nav-for.js","../../../node_modules/svelte-retag/utils.js","../../../node_modules/svelte-retag/index.js","../../../node_modules/plausible-tracker/build/module/lib/request.js","../../../node_modules/plausible-tracker/build/module/lib/tracker.js","../../../Scripts/analytics.ts","../../../Scripts/tabs.ts","../../../node_modules/svelte/src/runtime/internal/utils.js","../../../node_modules/svelte/src/runtime/internal/environment.js","../../../node_modules/svelte/src/runtime/internal/loop.js","../../../node_modules/svelte/src/runtime/internal/dom.js","../../../node_modules/svelte/src/runtime/internal/style_manager.js","../../../node_modules/svelte/src/runtime/internal/lifecycle.js","../../../node_modules/svelte/src/runtime/internal/scheduler.js","../../../node_modules/svelte/src/runtime/internal/transitions.js","../../../node_modules/svelte/src/runtime/internal/spread.js","../../../node_modules/svelte/src/runtime/internal/Component.js","../../../node_modules/svelte/src/shared/version.js","../../../node_modules/svelte/src/runtime/internal/disclose-version/index.js","../../../node_modules/svelma/src/components/Icon.svelte","../../../node_modules/svelte/src/runtime/easing/index.js","../../../node_modules/svelte/src/runtime/transition/index.js","../../../node_modules/svelma/src/utils/index.js","../../../node_modules/svelma/src/components/Button.svelte","../../../node_modules/svelma/src/components/Dialog/Dialog.svelte","../../../node_modules/svelma/src/components/Dialog/index.js","../../../node_modules/svelma/src/components/Modal/Modal.svelte","../../../node_modules/svelma/src/components/Modal/ModalCard.svelte","../../../node_modules/svelma/src/components/Modal/index.js","../../../node_modules/svelma/src/components/Notices.svelte","../../../node_modules/svelma/src/components/Notice.svelte","../../../node_modules/svelma/src/components/Notification/Notification.svelte","../../../node_modules/svelma/src/components/Notification/NotificationNotice.svelte","../../../node_modules/svelma/src/components/Notification/index.js","../../../node_modules/svelma/src/components/Snackbar/Snackbar.svelte","../../../node_modules/svelma/src/components/Snackbar/index.js","../../../node_modules/svelma/src/components/Toast/Toast.svelte","../../../node_modules/svelma/src/components/Toast/index.js","../../../Scripts/components/newsletter-signup.svelte","../../../Scripts/index.ts"],"sourcesContent":["/*! @wagich/medium-zoom 1.0.6-custom002 | MIT License | https://github.com/https://github.com/wagich/medium-zoom.git */\nvar _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n};\n\nvar isSupported = function isSupported(node) {\n return node.tagName === 'IMG';\n};\n\n/* eslint-disable-next-line no-prototype-builtins */\nvar isNodeList = function isNodeList(selector) {\n return NodeList.prototype.isPrototypeOf(selector);\n};\n\nvar isNode = function isNode(selector) {\n return selector && selector.nodeType === 1;\n};\n\nvar isSvg = function isSvg(image) {\n var source = image.currentSrc || image.src;\n return source.substr(-4).toLowerCase() === '.svg';\n};\n\nvar getImagesFromSelector = function getImagesFromSelector(selector) {\n try {\n if (Array.isArray(selector)) {\n return selector.filter(isSupported);\n }\n\n if (isNodeList(selector)) {\n // Do not use spread operator or Array.from() for IE support\n return [].slice.call(selector).filter(isSupported);\n }\n\n if (isNode(selector)) {\n return [selector].filter(isSupported);\n }\n\n if (typeof selector === 'string') {\n // Do not use spread operator or Array.from() for IE support\n return [].slice.call(document.querySelectorAll(selector)).filter(isSupported);\n }\n\n return [];\n } catch (err) {\n throw new TypeError('The provided selector is invalid.\\n' + 'Expects a CSS selector, a Node element, a NodeList or an array.\\n' + 'See: https://github.com/francoischalifour/medium-zoom');\n }\n};\n\nvar createOverlay = function createOverlay(background) {\n var overlay = document.createElement('div');\n overlay.classList.add('medium-zoom-overlay');\n overlay.style.background = background;\n\n return overlay;\n};\n\nvar createLoadingIndicator = function createLoadingIndicator(color) {\n var wrapper = document.createElement('div');\n wrapper.classList.add('medium-zoom-loader');\n\n var colorRgb = parseColor(color);\n var ringColor = 'rgba(' + colorRgb[0] + ',' + colorRgb[1] + ',' + colorRgb[2] + ',0.2)';\n\n var indicator = document.createElement('div');\n indicator.style.borderTopColor = ringColor;\n indicator.style.borderRightColor = ringColor;\n indicator.style.borderBottomColor = ringColor;\n indicator.style.borderLeftColor = color;\n\n wrapper.appendChild(indicator);\n return wrapper;\n};\n\n// color parsing function from https://stackoverflow.com/a/21966100\nvar parseColor = function parseColor(colorString) {\n if (colorString.substr(0, 1) == '#') {\n var collen = (colorString.length - 1) / 3;\n var fact = [17, 1, 0.062272][collen - 1];\n return [Math.round(parseInt(colorString.substr(1, collen), 16) * fact), Math.round(parseInt(colorString.substr(1 + collen, collen), 16) * fact), Math.round(parseInt(colorString.substr(1 + 2 * collen, collen), 16) * fact)];\n } else return colorString.split('(')[1].split(')')[0].split(',').map(function (x) {\n return +x;\n });\n};\n\nvar cloneTarget = function cloneTarget(template) {\n var _template$getBounding = template.getBoundingClientRect(),\n top = _template$getBounding.top,\n left = _template$getBounding.left,\n width = _template$getBounding.width,\n height = _template$getBounding.height;\n\n var clone = template.cloneNode();\n var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;\n var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;\n\n clone.removeAttribute('id');\n clone.style.position = 'absolute';\n clone.style.top = top + scrollTop + 'px';\n clone.style.left = left + scrollLeft + 'px';\n clone.style.width = width + 'px';\n clone.style.height = height + 'px';\n clone.style.transform = '';\n\n return clone;\n};\n\nvar createCustomEvent = function createCustomEvent(type, params) {\n var eventParams = _extends({\n bubbles: false,\n cancelable: false,\n detail: undefined\n }, params);\n\n if (typeof window.CustomEvent === 'function') {\n return new CustomEvent(type, eventParams);\n }\n\n var customEvent = document.createEvent('CustomEvent');\n customEvent.initCustomEvent(type, eventParams.bubbles, eventParams.cancelable, eventParams.detail);\n\n return customEvent;\n};\n\nvar mediumZoom = function mediumZoom(selector) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n /**\r\n * Ensure the compatibility with IE11 if no Promise polyfill are used.\r\n */\n var Promise = window.Promise || function Promise(fn) {\n function noop() {}\n fn(noop, noop);\n };\n\n var _handleClick = function _handleClick(event) {\n var target = event.target;\n\n\n if (target === overlay) {\n close();\n return;\n }\n\n if (images.indexOf(target) === -1) {\n return;\n }\n\n toggle({ target: target });\n };\n\n var _handleScroll = function _handleScroll() {\n if (isAnimating || !active.original) {\n return;\n }\n\n var currentScroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;\n\n if (Math.abs(scrollTop - currentScroll) > zoomOptions.scrollOffset) {\n setTimeout(close, 150);\n }\n };\n\n var _handleKeyUp = function _handleKeyUp(event) {\n var key = event.key || event.keyCode;\n\n // Close if escape key is pressed\n if (key === 'Escape' || key === 'Esc' || key === 27) {\n close();\n }\n };\n\n var update = function update() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var newOptions = options;\n\n if (options.background) {\n overlay.style.background = options.background;\n }\n\n if (options.container && options.container instanceof Object) {\n newOptions.container = _extends({}, zoomOptions.container, options.container);\n }\n\n if (options.template) {\n var template = isNode(options.template) ? options.template : document.querySelector(options.template);\n\n newOptions.template = template;\n }\n\n zoomOptions = _extends({}, zoomOptions, newOptions);\n\n images.forEach(function (image) {\n image.dispatchEvent(createCustomEvent('medium-zoom:update', {\n detail: { zoom: zoom }\n }));\n });\n\n return zoom;\n };\n\n var clone = function clone() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return mediumZoom(_extends({}, zoomOptions, options));\n };\n\n var attach = function attach() {\n for (var _len = arguments.length, selectors = Array(_len), _key = 0; _key < _len; _key++) {\n selectors[_key] = arguments[_key];\n }\n\n var newImages = selectors.reduce(function (imagesAccumulator, currentSelector) {\n return [].concat(imagesAccumulator, getImagesFromSelector(currentSelector));\n }, []);\n\n newImages.filter(function (newImage) {\n return images.indexOf(newImage) === -1;\n }).forEach(function (newImage) {\n images.push(newImage);\n newImage.classList.add('medium-zoom-image');\n });\n\n eventListeners.forEach(function (_ref) {\n var type = _ref.type,\n listener = _ref.listener,\n options = _ref.options;\n\n newImages.forEach(function (image) {\n image.addEventListener(type, listener, options);\n });\n });\n\n return zoom;\n };\n\n var detach = function detach() {\n for (var _len2 = arguments.length, selectors = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n selectors[_key2] = arguments[_key2];\n }\n\n if (active.zoomed) {\n close();\n }\n\n var imagesToDetach = selectors.length > 0 ? selectors.reduce(function (imagesAccumulator, currentSelector) {\n return [].concat(imagesAccumulator, getImagesFromSelector(currentSelector));\n }, []) : images;\n\n imagesToDetach.forEach(function (image) {\n image.classList.remove('medium-zoom-image');\n image.dispatchEvent(createCustomEvent('medium-zoom:detach', {\n detail: { zoom: zoom }\n }));\n });\n\n images = images.filter(function (image) {\n return imagesToDetach.indexOf(image) === -1;\n });\n\n return zoom;\n };\n\n var on = function on(type, listener) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n images.forEach(function (image) {\n image.addEventListener('medium-zoom:' + type, listener, options);\n });\n\n eventListeners.push({ type: 'medium-zoom:' + type, listener: listener, options: options });\n\n return zoom;\n };\n\n var off = function off(type, listener) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n images.forEach(function (image) {\n image.removeEventListener('medium-zoom:' + type, listener, options);\n });\n\n eventListeners = eventListeners.filter(function (eventListener) {\n return !(eventListener.type === 'medium-zoom:' + type && eventListener.listener.toString() === listener.toString());\n });\n\n return zoom;\n };\n\n var open = function open() {\n var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n target = _ref2.target;\n\n var _animate = function _animate() {\n var container = {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n left: 0,\n top: 0,\n right: 0,\n bottom: 0\n };\n var viewportWidth = void 0;\n var viewportHeight = void 0;\n\n if (zoomOptions.container) {\n if (zoomOptions.container instanceof Object) {\n // The container is given as an object with properties like width, height, left, top\n container = _extends({}, container, zoomOptions.container);\n\n // We need to adjust custom options like container.right or container.bottom\n viewportWidth = container.width - container.left - container.right - zoomOptions.margin * 2;\n viewportHeight = container.height - container.top - container.bottom - zoomOptions.margin * 2;\n } else {\n // The container is given as an element\n var zoomContainer = isNode(zoomOptions.container) ? zoomOptions.container : document.querySelector(zoomOptions.container);\n\n var _zoomContainer$getBou = zoomContainer.getBoundingClientRect(),\n _width = _zoomContainer$getBou.width,\n _height = _zoomContainer$getBou.height,\n _left = _zoomContainer$getBou.left,\n _top = _zoomContainer$getBou.top;\n\n container = _extends({}, container, {\n width: _width,\n height: _height,\n left: _left,\n top: _top\n });\n }\n }\n\n viewportWidth = viewportWidth || container.width - zoomOptions.margin * 2;\n viewportHeight = viewportHeight || container.height - zoomOptions.margin * 2;\n\n var zoomTarget = active.zoomedHd || active.original;\n var naturalWidth = isSvg(zoomTarget) ? viewportWidth : zoomTarget.naturalWidth || viewportWidth;\n var naturalHeight = isSvg(zoomTarget) ? viewportHeight : zoomTarget.naturalHeight || viewportHeight;\n\n var _zoomTarget$getBoundi = zoomTarget.getBoundingClientRect(),\n top = _zoomTarget$getBoundi.top,\n left = _zoomTarget$getBoundi.left,\n width = _zoomTarget$getBoundi.width,\n height = _zoomTarget$getBoundi.height;\n\n var scaleX = Math.min(naturalWidth, viewportWidth) / width;\n var scaleY = Math.min(naturalHeight, viewportHeight) / height;\n var scale = Math.min(scaleX, scaleY);\n var translateX = (-left + (viewportWidth - width) / 2 + zoomOptions.margin + container.left) / scale;\n var translateY = (-top + (viewportHeight - height) / 2 + zoomOptions.margin + container.top) / scale;\n var transform = 'scale(' + scale + ') translate3d(' + translateX + 'px, ' + translateY + 'px, 0)';\n\n active.zoomed.style.transform = transform;\n\n if (active.zoomedHd) {\n active.zoomed.style.opacity = 0;\n\n // correct aspect ratio of hd image and center-align it in relation to the thumbnail\n var aspectRatio = naturalWidth / naturalHeight;\n if (aspectRatio >= 1) {\n var currentWidth = active.zoomedHd.width;\n var correctedWidth = currentWidth * aspectRatio;\n active.zoomedHd.style.width = correctedWidth + 'px';\n active.zoomedHd.style.height = correctedWidth / aspectRatio + 'px';\n active.zoomedHd.style.marginLeft = '-' + (correctedWidth - currentWidth) / 2 + 'px';\n } else {\n var currentHeight = active.zoomedHd.height;\n var correctedHeight = currentHeight / aspectRatio;\n active.zoomedHd.style.width = correctedHeight * aspectRatio + 'px';\n active.zoomedHd.style.height = correctedHeight + 'px';\n active.zoomedHd.style.marginTop = '-' + (correctedHeight - currentHeight) / 2 + 'px';\n }\n\n var _active$zoomedHd$getB = active.zoomedHd.getBoundingClientRect(),\n _top2 = _active$zoomedHd$getB.top,\n _left2 = _active$zoomedHd$getB.left,\n _width2 = _active$zoomedHd$getB.width,\n _height2 = _active$zoomedHd$getB.height;\n\n var _scaleX = Math.min(naturalWidth, viewportWidth) / _width2;\n var _scaleY = Math.min(naturalHeight, viewportHeight) / _height2;\n var _scale = Math.min(_scaleX, _scaleY);\n var _translateX = (-_left2 + (viewportWidth - _width2) / 2 + zoomOptions.margin + container.left) / _scale;\n var _translateY = (-_top2 + (viewportHeight - _height2) / 2 + zoomOptions.margin + container.top) / _scale;\n var _transform = 'scale(' + _scale + ') translate3d(' + _translateX + 'px, ' + _translateY + 'px, 0)';\n\n active.zoomedHd.style.opacity = 1;\n active.zoomedHd.style.transform = _transform;\n }\n };\n\n var _addLoadingIndicator = function _addLoadingIndicator() {\n var _active$original$getB = active.original.getBoundingClientRect(),\n top = _active$original$getB.top,\n left = _active$original$getB.left,\n width = _active$original$getB.width,\n height = _active$original$getB.height;\n\n var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;\n var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;\n\n // position indicator over the original (thumbnail) image,\n // make it a centered square with the edge length corresponding to the shorter dimension of the image\n loadingIndicator.style.top = top + scrollTop + 'px';\n loadingIndicator.style.left = left + scrollLeft + 'px';\n\n var smallestDimension = Math.min(width, height);\n loadingIndicator.style.width = smallestDimension + 'px';\n loadingIndicator.style.height = smallestDimension + 'px';\n loadingIndicator.style.marginLeft = (width - smallestDimension) / 2 + 'px';\n\n // scale indicator based on original (thumbnail) image size, native size of the indicator is 100px\n var scale = 1.5 / (100 / smallestDimension ^ 2);\n loadingIndicator.style.transform = 'scale(' + scale + ')';\n\n document.body.appendChild(loadingIndicator);\n };\n\n return new Promise(function (resolve) {\n if (target && images.indexOf(target) === -1) {\n resolve(zoom);\n return;\n }\n\n var _handleOpenEnd = function _handleOpenEnd() {\n isAnimating = false;\n active.zoomed.removeEventListener('transitionend', _handleOpenEnd);\n active.original.dispatchEvent(createCustomEvent('medium-zoom:opened', {\n detail: { zoom: zoom }\n }));\n\n resolve(zoom);\n };\n\n if (active.zoomed) {\n resolve(zoom);\n return;\n }\n\n if (target) {\n // The zoom was triggered manually via a click\n active.original = target;\n } else if (images.length > 0) {\nvar _images = images;\n active.original = _images[0];\n } else {\n resolve(zoom);\n return;\n }\n\n active.original.dispatchEvent(createCustomEvent('medium-zoom:open', {\n detail: { zoom: zoom }\n }));\n\n scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;\n isAnimating = true;\n active.zoomed = cloneTarget(active.original);\n\n document.body.appendChild(overlay);\n\n if (zoomOptions.template) {\n var template = isNode(zoomOptions.template) ? zoomOptions.template : document.querySelector(zoomOptions.template);\n active.template = document.createElement('div');\n active.template.appendChild(template.content.cloneNode(true));\n\n document.body.appendChild(active.template);\n }\n\n document.body.appendChild(active.zoomed);\n\n window.requestAnimationFrame(function () {\n document.body.classList.add('medium-zoom--opened');\n });\n\n active.original.classList.add('medium-zoom-image--hidden');\n active.zoomed.classList.add('medium-zoom-image--opened');\n\n active.zoomed.addEventListener('click', close);\n active.zoomed.addEventListener('transitionend', _handleOpenEnd);\n\n if (active.original.getAttribute('data-zoom-src')) {\n active.zoomedHd = active.zoomed.cloneNode();\n active.zoomedHd.classList.add('medium-zoom-image-hd');\n\n // Reset the `scrset` property or the HD image won't load.\n active.zoomedHd.removeAttribute('srcset');\n active.zoomedHd.removeAttribute('sizes');\n\n active.zoomedHd.src = active.zoomed.getAttribute('data-zoom-src');\n\n active.zoomedHd.onerror = function () {\n clearInterval(getZoomTargetSize);\n console.warn('Unable to reach the zoom image target ' + active.zoomedHd.src);\n active.zoomedHd = null;\n _animate();\n };\n\n _addLoadingIndicator();\n // We need to access the natural size of the full HD\n // target as fast as possible to compute the animation.\n var getZoomTargetSize = setInterval(function () {\n if ( active.zoomedHd.complete) {\n clearInterval(getZoomTargetSize);\n active.zoomedHd.classList.add('medium-zoom-image--opened');\n active.zoomedHd.addEventListener('click', close);\n document.body.appendChild(active.zoomedHd);\n document.body.removeChild(loadingIndicator);\n _animate();\n }\n }, 10);\n } else if (active.original.hasAttribute('srcset')) {\n // If an image has a `srcset` attribuet, we don't know the dimensions of the\n // zoomed (HD) image (like when `data-zoom-src` is specified).\n // Therefore the approach is quite similar.\n active.zoomedHd = active.zoomed.cloneNode();\n active.zoomedHd.classList.add('medium-zoom-image-hd');\n\n // Resetting the sizes attribute tells the browser to load the\n // image best fitting the current viewport size, respecting the `srcset`.\n active.zoomedHd.removeAttribute('sizes');\n\n // In Firefox, the `loading` attribute needs to be set to `eager` (default\n // value) for the load event to be fired.\n active.zoomedHd.removeAttribute('loading');\n\n _addLoadingIndicator();\n // Wait for the load event of the hd image. This will fire if the image\n // is already cached.\n var loadEventListener = active.zoomedHd.addEventListener('load', function () {\n active.zoomedHd.removeEventListener('load', loadEventListener);\n active.zoomedHd.classList.add('medium-zoom-image--opened');\n active.zoomedHd.addEventListener('click', close);\n document.body.appendChild(active.zoomedHd);\n document.body.removeChild(loadingIndicator);\n _animate();\n });\n } else {\n _animate();\n }\n });\n };\n\n var close = function close() {\n return new Promise(function (resolve) {\n if (isAnimating || !active.original) {\n resolve(zoom);\n return;\n }\n\n var _handleCloseEnd = function _handleCloseEnd() {\n active.original.classList.remove('medium-zoom-image--hidden');\n document.body.removeChild(active.zoomed);\n if (active.zoomedHd) {\n document.body.removeChild(active.zoomedHd);\n }\n document.body.removeChild(overlay);\n active.zoomed.classList.remove('medium-zoom-image--opened');\n if (active.template) {\n document.body.removeChild(active.template);\n }\n\n isAnimating = false;\n active.zoomed.removeEventListener('transitionend', _handleCloseEnd);\n\n active.original.dispatchEvent(createCustomEvent('medium-zoom:closed', {\n detail: { zoom: zoom }\n }));\n\n active.original = null;\n active.zoomed = null;\n active.zoomedHd = null;\n active.template = null;\n\n resolve(zoom);\n };\n\n isAnimating = true;\n document.body.classList.remove('medium-zoom--opened');\n active.zoomed.style.transform = '';\n\n if (active.zoomedHd) {\n active.zoomedHd.style.transform = '';\n active.zoomedHd.style.opacity = 0;\n active.zoomed.style.opacity = 1;\n }\n\n // Fade out the template so it's not too abrupt\n if (active.template) {\n active.template.style.transition = 'opacity 150ms';\n active.template.style.opacity = 0;\n }\n\n active.original.dispatchEvent(createCustomEvent('medium-zoom:close', {\n detail: { zoom: zoom }\n }));\n\n active.zoomed.addEventListener('transitionend', _handleCloseEnd);\n });\n };\n\n var toggle = function toggle() {\n var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n target = _ref3.target;\n\n if (active.original) {\n return close();\n }\n\n return open({ target: target });\n };\n\n var getOptions = function getOptions() {\n return zoomOptions;\n };\n\n var getImages = function getImages() {\n return images;\n };\n\n var getZoomedImage = function getZoomedImage() {\n return active.original;\n };\n\n var images = [];\n var eventListeners = [];\n var isAnimating = false;\n var scrollTop = 0;\n var zoomOptions = options;\n var active = {\n original: null,\n zoomed: null,\n zoomedHd: null,\n template: null\n\n // If the selector is omitted, it's replaced by the options\n };if (Object.prototype.toString.call(selector) === '[object Object]') {\n zoomOptions = selector;\n } else if (selector || typeof selector === 'string' // to process empty string as a selector\n ) {\n attach(selector);\n }\n\n // Apply the default option values\n zoomOptions = _extends({\n margin: 0,\n background: '#fff',\n loadingIndicatorColor: '#eee',\n scrollOffset: 40,\n container: null,\n template: null\n }, zoomOptions);\n\n var overlay = createOverlay(zoomOptions.background);\n var loadingIndicator = createLoadingIndicator(zoomOptions.loadingIndicatorColor);\n\n document.addEventListener('click', _handleClick);\n document.addEventListener('keyup', _handleKeyUp);\n document.addEventListener('scroll', _handleScroll);\n window.addEventListener('resize', close);\n\n var zoom = {\n open: open,\n close: close,\n toggle: toggle,\n update: update,\n clone: clone,\n attach: attach,\n detach: detach,\n on: on,\n off: off,\n getOptions: getOptions,\n getImages: getImages,\n getZoomedImage: getZoomedImage\n };\n\n return zoom;\n};\n\nfunction styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar css = \".medium-zoom-overlay{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s;will-change:opacity}.medium-zoom--opened .medium-zoom-overlay{cursor:pointer;cursor:zoom-out;opacity:1}.medium-zoom-image{cursor:pointer;cursor:zoom-in;opacity:1;transition:transform .3s cubic-bezier(.2,0,.2,1),opacity .3s ease!important}.medium-zoom-image--hidden{visibility:hidden}.medium-zoom-image--opened{position:relative;cursor:pointer;cursor:zoom-out;will-change:transform}.medium-zoom-image-hd{max-width:none!important;max-height:none!important;opacity:0;will-change:opacity,transform}.medium-zoom-loader{display:flex;align-items:center;justify-content:center;position:absolute}.medium-zoom-loader>div{flex:0 0 auto;width:100px;height:100px;border-radius:50%;border:10px solid hsla(0,0%,40%,.2);border-left-color:#666;animation:medium-zoom-loader .8s linear infinite}@keyframes medium-zoom-loader{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}\";\nstyleInject(css);\n\nexport default mediumZoom;\n","/**\n * EvEmitter v1.1.0\n * Lil' event emitter\n * MIT License\n */\n\n/* jshint unused: true, undef: true, strict: true */\n\n( function( global, factory ) {\n // universal module definition\n /* jshint strict: false */ /* globals define, module, window */\n if ( typeof define == 'function' && define.amd ) {\n // AMD - RequireJS\n define( factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS - Browserify, Webpack\n module.exports = factory();\n } else {\n // Browser globals\n global.EvEmitter = factory();\n }\n\n}( typeof window != 'undefined' ? window : this, function() {\n\n\"use strict\";\n\nfunction EvEmitter() {}\n\nvar proto = EvEmitter.prototype;\n\nproto.on = function( eventName, listener ) {\n if ( !eventName || !listener ) {\n return;\n }\n // set events hash\n var events = this._events = this._events || {};\n // set listeners array\n var listeners = events[ eventName ] = events[ eventName ] || [];\n // only add once\n if ( listeners.indexOf( listener ) == -1 ) {\n listeners.push( listener );\n }\n\n return this;\n};\n\nproto.once = function( eventName, listener ) {\n if ( !eventName || !listener ) {\n return;\n }\n // add event\n this.on( eventName, listener );\n // set once flag\n // set onceEvents hash\n var onceEvents = this._onceEvents = this._onceEvents || {};\n // set onceListeners object\n var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};\n // set flag\n onceListeners[ listener ] = true;\n\n return this;\n};\n\nproto.off = function( eventName, listener ) {\n var listeners = this._events && this._events[ eventName ];\n if ( !listeners || !listeners.length ) {\n return;\n }\n var index = listeners.indexOf( listener );\n if ( index != -1 ) {\n listeners.splice( index, 1 );\n }\n\n return this;\n};\n\nproto.emitEvent = function( eventName, args ) {\n var listeners = this._events && this._events[ eventName ];\n if ( !listeners || !listeners.length ) {\n return;\n }\n // copy over to avoid interference if .off() in listener\n listeners = listeners.slice(0);\n args = args || [];\n // once stuff\n var onceListeners = this._onceEvents && this._onceEvents[ eventName ];\n\n for ( var i=0; i < listeners.length; i++ ) {\n var listener = listeners[i]\n var isOnce = onceListeners && onceListeners[ listener ];\n if ( isOnce ) {\n // remove listener\n // remove before trigger to prevent recursion\n this.off( eventName, listener );\n // unset once flag\n delete onceListeners[ listener ];\n }\n // trigger listener\n listener.apply( this, args );\n }\n\n return this;\n};\n\nproto.allOff = function() {\n delete this._events;\n delete this._onceEvents;\n};\n\nreturn EvEmitter;\n\n}));\n","/*!\n * getSize v2.0.3\n * measure size of elements\n * MIT license\n */\n\n/* jshint browser: true, strict: true, undef: true, unused: true */\n/* globals console: false */\n\n( function( window, factory ) {\n /* jshint strict: false */ /* globals define, module */\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory();\n } else {\n // browser global\n window.getSize = factory();\n }\n\n})( window, function factory() {\n'use strict';\n\n// -------------------------- helpers -------------------------- //\n\n// get a number from a string, not a percentage\nfunction getStyleSize( value ) {\n var num = parseFloat( value );\n // not a percent like '100%', and a number\n var isValid = value.indexOf('%') == -1 && !isNaN( num );\n return isValid && num;\n}\n\nfunction noop() {}\n\nvar logError = typeof console == 'undefined' ? noop :\n function( message ) {\n console.error( message );\n };\n\n// -------------------------- measurements -------------------------- //\n\nvar measurements = [\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'paddingBottom',\n 'marginLeft',\n 'marginRight',\n 'marginTop',\n 'marginBottom',\n 'borderLeftWidth',\n 'borderRightWidth',\n 'borderTopWidth',\n 'borderBottomWidth'\n];\n\nvar measurementsLength = measurements.length;\n\nfunction getZeroSize() {\n var size = {\n width: 0,\n height: 0,\n innerWidth: 0,\n innerHeight: 0,\n outerWidth: 0,\n outerHeight: 0\n };\n for ( var i=0; i < measurementsLength; i++ ) {\n var measurement = measurements[i];\n size[ measurement ] = 0;\n }\n return size;\n}\n\n// -------------------------- getStyle -------------------------- //\n\n/**\n * getStyle, get style of element, check for Firefox bug\n * https://bugzilla.mozilla.org/show_bug.cgi?id=548397\n */\nfunction getStyle( elem ) {\n var style = getComputedStyle( elem );\n if ( !style ) {\n logError( 'Style returned ' + style +\n '. Are you running this code in a hidden iframe on Firefox? ' +\n 'See https://bit.ly/getsizebug1' );\n }\n return style;\n}\n\n// -------------------------- setup -------------------------- //\n\nvar isSetup = false;\n\nvar isBoxSizeOuter;\n\n/**\n * setup\n * check isBoxSizerOuter\n * do on first getSize() rather than on page load for Firefox bug\n */\nfunction setup() {\n // setup once\n if ( isSetup ) {\n return;\n }\n isSetup = true;\n\n // -------------------------- box sizing -------------------------- //\n\n /**\n * Chrome & Safari measure the outer-width on style.width on border-box elems\n * IE11 & Firefox<29 measures the inner-width\n */\n var div = document.createElement('div');\n div.style.width = '200px';\n div.style.padding = '1px 2px 3px 4px';\n div.style.borderStyle = 'solid';\n div.style.borderWidth = '1px 2px 3px 4px';\n div.style.boxSizing = 'border-box';\n\n var body = document.body || document.documentElement;\n body.appendChild( div );\n var style = getStyle( div );\n // round value for browser zoom. desandro/masonry#928\n isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200;\n getSize.isBoxSizeOuter = isBoxSizeOuter;\n\n body.removeChild( div );\n}\n\n// -------------------------- getSize -------------------------- //\n\nfunction getSize( elem ) {\n setup();\n\n // use querySeletor if elem is string\n if ( typeof elem == 'string' ) {\n elem = document.querySelector( elem );\n }\n\n // do not proceed on non-objects\n if ( !elem || typeof elem != 'object' || !elem.nodeType ) {\n return;\n }\n\n var style = getStyle( elem );\n\n // if hidden, everything is 0\n if ( style.display == 'none' ) {\n return getZeroSize();\n }\n\n var size = {};\n size.width = elem.offsetWidth;\n size.height = elem.offsetHeight;\n\n var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box';\n\n // get all measurements\n for ( var i=0; i < measurementsLength; i++ ) {\n var measurement = measurements[i];\n var value = style[ measurement ];\n var num = parseFloat( value );\n // any 'auto', 'medium' value will be 0\n size[ measurement ] = !isNaN( num ) ? num : 0;\n }\n\n var paddingWidth = size.paddingLeft + size.paddingRight;\n var paddingHeight = size.paddingTop + size.paddingBottom;\n var marginWidth = size.marginLeft + size.marginRight;\n var marginHeight = size.marginTop + size.marginBottom;\n var borderWidth = size.borderLeftWidth + size.borderRightWidth;\n var borderHeight = size.borderTopWidth + size.borderBottomWidth;\n\n var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;\n\n // overwrite width and height if we can get it from style\n var styleWidth = getStyleSize( style.width );\n if ( styleWidth !== false ) {\n size.width = styleWidth +\n // add padding and border unless it's already including it\n ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );\n }\n\n var styleHeight = getStyleSize( style.height );\n if ( styleHeight !== false ) {\n size.height = styleHeight +\n // add padding and border unless it's already including it\n ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );\n }\n\n size.innerWidth = size.width - ( paddingWidth + borderWidth );\n size.innerHeight = size.height - ( paddingHeight + borderHeight );\n\n size.outerWidth = size.width + marginWidth;\n size.outerHeight = size.height + marginHeight;\n\n return size;\n}\n\nreturn getSize;\n\n});\n","/**\n * matchesSelector v2.0.2\n * matchesSelector( element, '.selector' )\n * MIT license\n */\n\n/*jshint browser: true, strict: true, undef: true, unused: true */\n\n( function( window, factory ) {\n /*global define: false, module: false */\n 'use strict';\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory();\n } else {\n // browser global\n window.matchesSelector = factory();\n }\n\n}( window, function factory() {\n 'use strict';\n\n var matchesMethod = ( function() {\n var ElemProto = window.Element.prototype;\n // check for the standard method name first\n if ( ElemProto.matches ) {\n return 'matches';\n }\n // check un-prefixed\n if ( ElemProto.matchesSelector ) {\n return 'matchesSelector';\n }\n // check vendor prefixes\n var prefixes = [ 'webkit', 'moz', 'ms', 'o' ];\n\n for ( var i=0; i < prefixes.length; i++ ) {\n var prefix = prefixes[i];\n var method = prefix + 'MatchesSelector';\n if ( ElemProto[ method ] ) {\n return method;\n }\n }\n })();\n\n return function matchesSelector( elem, selector ) {\n return elem[ matchesMethod ]( selector );\n };\n\n}));\n","/**\n * Fizzy UI utils v2.0.7\n * MIT license\n */\n\n/*jshint browser: true, undef: true, unused: true, strict: true */\n\n( function( window, factory ) {\n // universal module definition\n /*jshint strict: false */ /*globals define, module, require */\n\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'desandro-matches-selector/matches-selector'\n ], function( matchesSelector ) {\n return factory( window, matchesSelector );\n });\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('desandro-matches-selector')\n );\n } else {\n // browser global\n window.fizzyUIUtils = factory(\n window,\n window.matchesSelector\n );\n }\n\n}( window, function factory( window, matchesSelector ) {\n\n'use strict';\n\nvar utils = {};\n\n// ----- extend ----- //\n\n// extends objects\nutils.extend = function( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n};\n\n// ----- modulo ----- //\n\nutils.modulo = function( num, div ) {\n return ( ( num % div ) + div ) % div;\n};\n\n// ----- makeArray ----- //\n\nvar arraySlice = Array.prototype.slice;\n\n// turn element or nodeList into an array\nutils.makeArray = function( obj ) {\n if ( Array.isArray( obj ) ) {\n // use object if already an array\n return obj;\n }\n // return empty array if undefined or null. #6\n if ( obj === null || obj === undefined ) {\n return [];\n }\n\n var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';\n if ( isArrayLike ) {\n // convert nodeList to array\n return arraySlice.call( obj );\n }\n\n // array of single index\n return [ obj ];\n};\n\n// ----- removeFrom ----- //\n\nutils.removeFrom = function( ary, obj ) {\n var index = ary.indexOf( obj );\n if ( index != -1 ) {\n ary.splice( index, 1 );\n }\n};\n\n// ----- getParent ----- //\n\nutils.getParent = function( elem, selector ) {\n while ( elem.parentNode && elem != document.body ) {\n elem = elem.parentNode;\n if ( matchesSelector( elem, selector ) ) {\n return elem;\n }\n }\n};\n\n// ----- getQueryElement ----- //\n\n// use element as selector string\nutils.getQueryElement = function( elem ) {\n if ( typeof elem == 'string' ) {\n return document.querySelector( elem );\n }\n return elem;\n};\n\n// ----- handleEvent ----- //\n\n// enable .ontype to trigger from .addEventListener( elem, 'type' )\nutils.handleEvent = function( event ) {\n var method = 'on' + event.type;\n if ( this[ method ] ) {\n this[ method ]( event );\n }\n};\n\n// ----- filterFindElements ----- //\n\nutils.filterFindElements = function( elems, selector ) {\n // make array of elems\n elems = utils.makeArray( elems );\n var ffElems = [];\n\n elems.forEach( function( elem ) {\n // check that elem is an actual element\n if ( !( elem instanceof HTMLElement ) ) {\n return;\n }\n // add elem if no selector\n if ( !selector ) {\n ffElems.push( elem );\n return;\n }\n // filter & find items if we have a selector\n // filter\n if ( matchesSelector( elem, selector ) ) {\n ffElems.push( elem );\n }\n // find children\n var childElems = elem.querySelectorAll( selector );\n // concat childElems to filterFound array\n for ( var i=0; i < childElems.length; i++ ) {\n ffElems.push( childElems[i] );\n }\n });\n\n return ffElems;\n};\n\n// ----- debounceMethod ----- //\n\nutils.debounceMethod = function( _class, methodName, threshold ) {\n threshold = threshold || 100;\n // original method\n var method = _class.prototype[ methodName ];\n var timeoutName = methodName + 'Timeout';\n\n _class.prototype[ methodName ] = function() {\n var timeout = this[ timeoutName ];\n clearTimeout( timeout );\n\n var args = arguments;\n var _this = this;\n this[ timeoutName ] = setTimeout( function() {\n method.apply( _this, args );\n delete _this[ timeoutName ];\n }, threshold );\n };\n};\n\n// ----- docReady ----- //\n\nutils.docReady = function( callback ) {\n var readyState = document.readyState;\n if ( readyState == 'complete' || readyState == 'interactive' ) {\n // do async to allow for other scripts to run. metafizzy/flickity#441\n setTimeout( callback );\n } else {\n document.addEventListener( 'DOMContentLoaded', callback );\n }\n};\n\n// ----- htmlInit ----- //\n\n// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/\nutils.toDashed = function( str ) {\n return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {\n return $1 + '-' + $2;\n }).toLowerCase();\n};\n\nvar console = window.console;\n/**\n * allow user to initialize classes via [data-namespace] or .js-namespace class\n * htmlInit( Widget, 'widgetName' )\n * options are parsed from data-namespace-options\n */\nutils.htmlInit = function( WidgetClass, namespace ) {\n utils.docReady( function() {\n var dashedNamespace = utils.toDashed( namespace );\n var dataAttr = 'data-' + dashedNamespace;\n var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' );\n var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace );\n var elems = utils.makeArray( dataAttrElems )\n .concat( utils.makeArray( jsDashElems ) );\n var dataOptionsAttr = dataAttr + '-options';\n var jQuery = window.jQuery;\n\n elems.forEach( function( elem ) {\n var attr = elem.getAttribute( dataAttr ) ||\n elem.getAttribute( dataOptionsAttr );\n var options;\n try {\n options = attr && JSON.parse( attr );\n } catch ( error ) {\n // log error, do not initialize\n if ( console ) {\n console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className +\n ': ' + error );\n }\n return;\n }\n // initialize\n var instance = new WidgetClass( elem, options );\n // make available via $().data('namespace')\n if ( jQuery ) {\n jQuery.data( elem, namespace, instance );\n }\n });\n\n });\n};\n\n// ----- ----- //\n\nreturn utils;\n\n}));\n","// Flickity.Cell\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'get-size/get-size',\n ], function( getSize ) {\n return factory( window, getSize );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('get-size')\n );\n } else {\n // browser global\n window.Flickity = window.Flickity || {};\n window.Flickity.Cell = factory(\n window,\n window.getSize\n );\n }\n\n}( window, function factory( window, getSize ) {\n\n'use strict';\n\nfunction Cell( elem, parent ) {\n this.element = elem;\n this.parent = parent;\n\n this.create();\n}\n\nvar proto = Cell.prototype;\n\nproto.create = function() {\n this.element.style.position = 'absolute';\n this.element.setAttribute( 'aria-hidden', 'true' );\n this.x = 0;\n this.shift = 0;\n this.element.style[ this.parent.originSide ] = 0;\n};\n\nproto.destroy = function() {\n // reset style\n this.unselect();\n this.element.style.position = '';\n var side = this.parent.originSide;\n this.element.style[ side ] = '';\n this.element.style.transform = '';\n this.element.removeAttribute('aria-hidden');\n};\n\nproto.getSize = function() {\n this.size = getSize( this.element );\n};\n\nproto.setPosition = function( x ) {\n this.x = x;\n this.updateTarget();\n this.renderPosition( x );\n};\n\n// setDefaultTarget v1 method, backwards compatibility, remove in v3\nproto.updateTarget = proto.setDefaultTarget = function() {\n var marginProperty = this.parent.originSide == 'left' ? 'marginLeft' : 'marginRight';\n this.target = this.x + this.size[ marginProperty ] +\n this.size.width * this.parent.cellAlign;\n};\n\nproto.renderPosition = function( x ) {\n // render position of cell with in slider\n var sideOffset = this.parent.originSide === 'left' ? 1 : -1;\n\n var adjustedX = this.parent.options.percentPosition ?\n x * sideOffset * ( this.parent.size.innerWidth / this.size.width ) :\n x * sideOffset;\n\n this.element.style.transform = 'translateX(' +\n this.parent.getPositionValue( adjustedX ) + ')';\n};\n\nproto.select = function() {\n this.element.classList.add('is-selected');\n this.element.removeAttribute('aria-hidden');\n};\n\nproto.unselect = function() {\n this.element.classList.remove('is-selected');\n this.element.setAttribute( 'aria-hidden', 'true' );\n};\n\n/**\n * @param {Integer} shift - 0, 1, or -1\n */\nproto.wrapShift = function( shift ) {\n this.shift = shift;\n this.renderPosition( this.x + this.parent.slideableWidth * shift );\n};\n\nproto.remove = function() {\n this.element.parentNode.removeChild( this.element );\n};\n\nreturn Cell;\n\n} ) );\n","// slide\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory();\n } else {\n // browser global\n window.Flickity = window.Flickity || {};\n window.Flickity.Slide = factory();\n }\n\n}( window, function factory() {\n'use strict';\n\nfunction Slide( parent ) {\n this.parent = parent;\n this.isOriginLeft = parent.originSide == 'left';\n this.cells = [];\n this.outerWidth = 0;\n this.height = 0;\n}\n\nvar proto = Slide.prototype;\n\nproto.addCell = function( cell ) {\n this.cells.push( cell );\n this.outerWidth += cell.size.outerWidth;\n this.height = Math.max( cell.size.outerHeight, this.height );\n // first cell stuff\n if ( this.cells.length == 1 ) {\n this.x = cell.x; // x comes from first cell\n var beginMargin = this.isOriginLeft ? 'marginLeft' : 'marginRight';\n this.firstMargin = cell.size[ beginMargin ];\n }\n};\n\nproto.updateTarget = function() {\n var endMargin = this.isOriginLeft ? 'marginRight' : 'marginLeft';\n var lastCell = this.getLastCell();\n var lastMargin = lastCell ? lastCell.size[ endMargin ] : 0;\n var slideWidth = this.outerWidth - ( this.firstMargin + lastMargin );\n this.target = this.x + this.firstMargin + slideWidth * this.parent.cellAlign;\n};\n\nproto.getLastCell = function() {\n return this.cells[ this.cells.length - 1 ];\n};\n\nproto.select = function() {\n this.cells.forEach( function( cell ) {\n cell.select();\n } );\n};\n\nproto.unselect = function() {\n this.cells.forEach( function( cell ) {\n cell.unselect();\n } );\n};\n\nproto.getCellElements = function() {\n return this.cells.map( function( cell ) {\n return cell.element;\n } );\n};\n\nreturn Slide;\n\n} ) );\n","// animate\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'fizzy-ui-utils/utils',\n ], function( utils ) {\n return factory( window, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n window.Flickity = window.Flickity || {};\n window.Flickity.animatePrototype = factory(\n window,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, utils ) {\n\n'use strict';\n\n// -------------------------- animate -------------------------- //\n\nvar proto = {};\n\nproto.startAnimation = function() {\n if ( this.isAnimating ) {\n return;\n }\n\n this.isAnimating = true;\n this.restingFrames = 0;\n this.animate();\n};\n\nproto.animate = function() {\n this.applyDragForce();\n this.applySelectedAttraction();\n\n var previousX = this.x;\n\n this.integratePhysics();\n this.positionSlider();\n this.settle( previousX );\n // animate next frame\n if ( this.isAnimating ) {\n var _this = this;\n requestAnimationFrame( function animateFrame() {\n _this.animate();\n } );\n }\n};\n\nproto.positionSlider = function() {\n var x = this.x;\n // wrap position around\n if ( this.options.wrapAround && this.cells.length > 1 ) {\n x = utils.modulo( x, this.slideableWidth );\n x -= this.slideableWidth;\n this.shiftWrapCells( x );\n }\n\n this.setTranslateX( x, this.isAnimating );\n this.dispatchScrollEvent();\n};\n\nproto.setTranslateX = function( x, is3d ) {\n x += this.cursorPosition;\n // reverse if right-to-left and using transform\n x = this.options.rightToLeft ? -x : x;\n var translateX = this.getPositionValue( x );\n // use 3D transforms for hardware acceleration on iOS\n // but use 2D when settled, for better font-rendering\n this.slider.style.transform = is3d ?\n 'translate3d(' + translateX + ',0,0)' : 'translateX(' + translateX + ')';\n};\n\nproto.dispatchScrollEvent = function() {\n var firstSlide = this.slides[0];\n if ( !firstSlide ) {\n return;\n }\n var positionX = -this.x - firstSlide.target;\n var progress = positionX / this.slidesWidth;\n this.dispatchEvent( 'scroll', null, [ progress, positionX ] );\n};\n\nproto.positionSliderAtSelected = function() {\n if ( !this.cells.length ) {\n return;\n }\n this.x = -this.selectedSlide.target;\n this.velocity = 0; // stop wobble\n this.positionSlider();\n};\n\nproto.getPositionValue = function( position ) {\n if ( this.options.percentPosition ) {\n // percent position, round to 2 digits, like 12.34%\n return ( Math.round( ( position / this.size.innerWidth ) * 10000 ) * 0.01 ) + '%';\n } else {\n // pixel positioning\n return Math.round( position ) + 'px';\n }\n};\n\nproto.settle = function( previousX ) {\n // keep track of frames where x hasn't moved\n var isResting = !this.isPointerDown &&\n Math.round( this.x * 100 ) == Math.round( previousX * 100 );\n if ( isResting ) {\n this.restingFrames++;\n }\n // stop animating if resting for 3 or more frames\n if ( this.restingFrames > 2 ) {\n this.isAnimating = false;\n delete this.isFreeScrolling;\n // render position with translateX when settled\n this.positionSlider();\n this.dispatchEvent( 'settle', null, [ this.selectedIndex ] );\n }\n};\n\nproto.shiftWrapCells = function( x ) {\n // shift before cells\n var beforeGap = this.cursorPosition + x;\n this._shiftCells( this.beforeShiftCells, beforeGap, -1 );\n // shift after cells\n var afterGap = this.size.innerWidth - ( x + this.slideableWidth + this.cursorPosition );\n this._shiftCells( this.afterShiftCells, afterGap, 1 );\n};\n\nproto._shiftCells = function( cells, gap, shift ) {\n for ( var i = 0; i < cells.length; i++ ) {\n var cell = cells[i];\n var cellShift = gap > 0 ? shift : 0;\n cell.wrapShift( cellShift );\n gap -= cell.size.outerWidth;\n }\n};\n\nproto._unshiftCells = function( cells ) {\n if ( !cells || !cells.length ) {\n return;\n }\n for ( var i = 0; i < cells.length; i++ ) {\n cells[i].wrapShift( 0 );\n }\n};\n\n// -------------------------- physics -------------------------- //\n\nproto.integratePhysics = function() {\n this.x += this.velocity;\n this.velocity *= this.getFrictionFactor();\n};\n\nproto.applyForce = function( force ) {\n this.velocity += force;\n};\n\nproto.getFrictionFactor = function() {\n return 1 - this.options[ this.isFreeScrolling ? 'freeScrollFriction' : 'friction' ];\n};\n\nproto.getRestingPosition = function() {\n // my thanks to Steven Wittens, who simplified this math greatly\n return this.x + this.velocity / ( 1 - this.getFrictionFactor() );\n};\n\nproto.applyDragForce = function() {\n if ( !this.isDraggable || !this.isPointerDown ) {\n return;\n }\n // change the position to drag position by applying force\n var dragVelocity = this.dragX - this.x;\n var dragForce = dragVelocity - this.velocity;\n this.applyForce( dragForce );\n};\n\nproto.applySelectedAttraction = function() {\n // do not attract if pointer down or no slides\n var dragDown = this.isDraggable && this.isPointerDown;\n if ( dragDown || this.isFreeScrolling || !this.slides.length ) {\n return;\n }\n var distance = this.selectedSlide.target * -1 - this.x;\n var force = distance * this.options.selectedAttraction;\n this.applyForce( force );\n};\n\nreturn proto;\n\n} ) );\n","// Flickity main\n/* eslint-disable max-params */\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'ev-emitter/ev-emitter',\n 'get-size/get-size',\n 'fizzy-ui-utils/utils',\n './cell',\n './slide',\n './animate',\n ], function( EvEmitter, getSize, utils, Cell, Slide, animatePrototype ) {\n return factory( window, EvEmitter, getSize, utils, Cell, Slide, animatePrototype );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('ev-emitter'),\n require('get-size'),\n require('fizzy-ui-utils'),\n require('./cell'),\n require('./slide'),\n require('./animate')\n );\n } else {\n // browser global\n var _Flickity = window.Flickity;\n\n window.Flickity = factory(\n window,\n window.EvEmitter,\n window.getSize,\n window.fizzyUIUtils,\n _Flickity.Cell,\n _Flickity.Slide,\n _Flickity.animatePrototype\n );\n }\n\n}( window, function factory( window, EvEmitter, getSize,\n utils, Cell, Slide, animatePrototype ) {\n\n/* eslint-enable max-params */\n'use strict';\n\n// vars\nvar jQuery = window.jQuery;\nvar getComputedStyle = window.getComputedStyle;\nvar console = window.console;\n\nfunction moveElements( elems, toElem ) {\n elems = utils.makeArray( elems );\n while ( elems.length ) {\n toElem.appendChild( elems.shift() );\n }\n}\n\n// -------------------------- Flickity -------------------------- //\n\n// globally unique identifiers\nvar GUID = 0;\n// internal store of all Flickity intances\nvar instances = {};\n\nfunction Flickity( element, options ) {\n var queryElement = utils.getQueryElement( element );\n if ( !queryElement ) {\n if ( console ) {\n console.error( 'Bad element for Flickity: ' + ( queryElement || element ) );\n }\n return;\n }\n this.element = queryElement;\n // do not initialize twice on same element\n if ( this.element.flickityGUID ) {\n var instance = instances[ this.element.flickityGUID ];\n if ( instance ) instance.option( options );\n return instance;\n }\n\n // add jQuery\n if ( jQuery ) {\n this.$element = jQuery( this.element );\n }\n // options\n this.options = utils.extend( {}, this.constructor.defaults );\n this.option( options );\n\n // kick things off\n this._create();\n}\n\nFlickity.defaults = {\n accessibility: true,\n // adaptiveHeight: false,\n cellAlign: 'center',\n // cellSelector: undefined,\n // contain: false,\n freeScrollFriction: 0.075, // friction when free-scrolling\n friction: 0.28, // friction when selecting\n namespaceJQueryEvents: true,\n // initialIndex: 0,\n percentPosition: true,\n resize: true,\n selectedAttraction: 0.025,\n setGallerySize: true,\n // watchCSS: false,\n // wrapAround: false\n};\n\n// hash of methods triggered on _create()\nFlickity.createMethods = [];\n\nvar proto = Flickity.prototype;\n// inherit EventEmitter\nutils.extend( proto, EvEmitter.prototype );\n\nproto._create = function() {\n // add id for Flickity.data\n var id = this.guid = ++GUID;\n this.element.flickityGUID = id; // expando\n instances[ id ] = this; // associate via id\n // initial properties\n this.selectedIndex = 0;\n // how many frames slider has been in same position\n this.restingFrames = 0;\n // initial physics properties\n this.x = 0;\n this.velocity = 0;\n this.originSide = this.options.rightToLeft ? 'right' : 'left';\n // create viewport & slider\n this.viewport = document.createElement('div');\n this.viewport.className = 'flickity-viewport';\n this._createSlider();\n\n if ( this.options.resize || this.options.watchCSS ) {\n window.addEventListener( 'resize', this );\n }\n\n // add listeners from on option\n for ( var eventName in this.options.on ) {\n var listener = this.options.on[ eventName ];\n this.on( eventName, listener );\n }\n\n Flickity.createMethods.forEach( function( method ) {\n this[ method ]();\n }, this );\n\n if ( this.options.watchCSS ) {\n this.watchCSS();\n } else {\n this.activate();\n }\n\n};\n\n/**\n * set options\n * @param {Object} opts - options to extend\n */\nproto.option = function( opts ) {\n utils.extend( this.options, opts );\n};\n\nproto.activate = function() {\n if ( this.isActive ) {\n return;\n }\n this.isActive = true;\n this.element.classList.add('flickity-enabled');\n if ( this.options.rightToLeft ) {\n this.element.classList.add('flickity-rtl');\n }\n\n this.getSize();\n // move initial cell elements so they can be loaded as cells\n var cellElems = this._filterFindCellElements( this.element.children );\n moveElements( cellElems, this.slider );\n this.viewport.appendChild( this.slider );\n this.element.appendChild( this.viewport );\n // get cells from children\n this.reloadCells();\n\n if ( this.options.accessibility ) {\n // allow element to focusable\n this.element.tabIndex = 0;\n // listen for key presses\n this.element.addEventListener( 'keydown', this );\n }\n\n this.emitEvent('activate');\n this.selectInitialIndex();\n // flag for initial activation, for using initialIndex\n this.isInitActivated = true;\n // ready event. #493\n this.dispatchEvent('ready');\n};\n\n// slider positions the cells\nproto._createSlider = function() {\n // slider element does all the positioning\n var slider = document.createElement('div');\n slider.className = 'flickity-slider';\n slider.style[ this.originSide ] = 0;\n this.slider = slider;\n};\n\nproto._filterFindCellElements = function( elems ) {\n return utils.filterFindElements( elems, this.options.cellSelector );\n};\n\n// goes through all children\nproto.reloadCells = function() {\n // collection of item elements\n this.cells = this._makeCells( this.slider.children );\n this.positionCells();\n this._getWrapShiftCells();\n this.setGallerySize();\n};\n\n/**\n * turn elements into Flickity.Cells\n * @param {[Array, NodeList, HTMLElement]} elems - elements to make into cells\n * @returns {Array} items - collection of new Flickity Cells\n */\nproto._makeCells = function( elems ) {\n var cellElems = this._filterFindCellElements( elems );\n\n // create new Flickity for collection\n var cells = cellElems.map( function( cellElem ) {\n return new Cell( cellElem, this );\n }, this );\n\n return cells;\n};\n\nproto.getLastCell = function() {\n return this.cells[ this.cells.length - 1 ];\n};\n\nproto.getLastSlide = function() {\n return this.slides[ this.slides.length - 1 ];\n};\n\n// positions all cells\nproto.positionCells = function() {\n // size all cells\n this._sizeCells( this.cells );\n // position all cells\n this._positionCells( 0 );\n};\n\n/**\n * position certain cells\n * @param {Integer} index - which cell to start with\n */\nproto._positionCells = function( index ) {\n index = index || 0;\n // also measure maxCellHeight\n // start 0 if positioning all cells\n this.maxCellHeight = index ? this.maxCellHeight || 0 : 0;\n var cellX = 0;\n // get cellX\n if ( index > 0 ) {\n var startCell = this.cells[ index - 1 ];\n cellX = startCell.x + startCell.size.outerWidth;\n }\n var len = this.cells.length;\n for ( var i = index; i < len; i++ ) {\n var cell = this.cells[i];\n cell.setPosition( cellX );\n cellX += cell.size.outerWidth;\n this.maxCellHeight = Math.max( cell.size.outerHeight, this.maxCellHeight );\n }\n // keep track of cellX for wrap-around\n this.slideableWidth = cellX;\n // slides\n this.updateSlides();\n // contain slides target\n this._containSlides();\n // update slidesWidth\n this.slidesWidth = len ? this.getLastSlide().target - this.slides[0].target : 0;\n};\n\n/**\n * cell.getSize() on multiple cells\n * @param {Array} cells - cells to size\n */\nproto._sizeCells = function( cells ) {\n cells.forEach( function( cell ) {\n cell.getSize();\n } );\n};\n\n// -------------------------- -------------------------- //\n\nproto.updateSlides = function() {\n this.slides = [];\n if ( !this.cells.length ) {\n return;\n }\n\n var slide = new Slide( this );\n this.slides.push( slide );\n var isOriginLeft = this.originSide == 'left';\n var nextMargin = isOriginLeft ? 'marginRight' : 'marginLeft';\n\n var canCellFit = this._getCanCellFit();\n\n this.cells.forEach( function( cell, i ) {\n // just add cell if first cell in slide\n if ( !slide.cells.length ) {\n slide.addCell( cell );\n return;\n }\n\n var slideWidth = ( slide.outerWidth - slide.firstMargin ) +\n ( cell.size.outerWidth - cell.size[ nextMargin ] );\n\n if ( canCellFit.call( this, i, slideWidth ) ) {\n slide.addCell( cell );\n } else {\n // doesn't fit, new slide\n slide.updateTarget();\n\n slide = new Slide( this );\n this.slides.push( slide );\n slide.addCell( cell );\n }\n }, this );\n // last slide\n slide.updateTarget();\n // update .selectedSlide\n this.updateSelectedSlide();\n};\n\nproto._getCanCellFit = function() {\n var groupCells = this.options.groupCells;\n if ( !groupCells ) {\n return function() {\n return false;\n };\n } else if ( typeof groupCells == 'number' ) {\n // group by number. 3 -> [0,1,2], [3,4,5], ...\n var number = parseInt( groupCells, 10 );\n return function( i ) {\n return ( i % number ) !== 0;\n };\n }\n // default, group by width of slide\n // parse '75%\n var percentMatch = typeof groupCells == 'string' &&\n groupCells.match( /^(\\d+)%$/ );\n var percent = percentMatch ? parseInt( percentMatch[1], 10 ) / 100 : 1;\n return function( i, slideWidth ) {\n /* eslint-disable-next-line no-invalid-this */\n return slideWidth <= ( this.size.innerWidth + 1 ) * percent;\n };\n};\n\n// alias _init for jQuery plugin .flickity()\nproto._init =\nproto.reposition = function() {\n this.positionCells();\n this.positionSliderAtSelected();\n};\n\nproto.getSize = function() {\n this.size = getSize( this.element );\n this.setCellAlign();\n this.cursorPosition = this.size.innerWidth * this.cellAlign;\n};\n\nvar cellAlignShorthands = {\n // cell align, then based on origin side\n center: {\n left: 0.5,\n right: 0.5,\n },\n left: {\n left: 0,\n right: 1,\n },\n right: {\n right: 0,\n left: 1,\n },\n};\n\nproto.setCellAlign = function() {\n var shorthand = cellAlignShorthands[ this.options.cellAlign ];\n this.cellAlign = shorthand ? shorthand[ this.originSide ] : this.options.cellAlign;\n};\n\nproto.setGallerySize = function() {\n if ( this.options.setGallerySize ) {\n var height = this.options.adaptiveHeight && this.selectedSlide ?\n this.selectedSlide.height : this.maxCellHeight;\n this.viewport.style.height = height + 'px';\n }\n};\n\nproto._getWrapShiftCells = function() {\n // only for wrap-around\n if ( !this.options.wrapAround ) {\n return;\n }\n // unshift previous cells\n this._unshiftCells( this.beforeShiftCells );\n this._unshiftCells( this.afterShiftCells );\n // get before cells\n // initial gap\n var gapX = this.cursorPosition;\n var cellIndex = this.cells.length - 1;\n this.beforeShiftCells = this._getGapCells( gapX, cellIndex, -1 );\n // get after cells\n // ending gap between last cell and end of gallery viewport\n gapX = this.size.innerWidth - this.cursorPosition;\n // start cloning at first cell, working forwards\n this.afterShiftCells = this._getGapCells( gapX, 0, 1 );\n};\n\nproto._getGapCells = function( gapX, cellIndex, increment ) {\n // keep adding cells until the cover the initial gap\n var cells = [];\n while ( gapX > 0 ) {\n var cell = this.cells[ cellIndex ];\n if ( !cell ) {\n break;\n }\n cells.push( cell );\n cellIndex += increment;\n gapX -= cell.size.outerWidth;\n }\n return cells;\n};\n\n// ----- contain ----- //\n\n// contain cell targets so no excess sliding\nproto._containSlides = function() {\n if ( !this.options.contain || this.options.wrapAround || !this.cells.length ) {\n return;\n }\n var isRightToLeft = this.options.rightToLeft;\n var beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft';\n var endMargin = isRightToLeft ? 'marginLeft' : 'marginRight';\n var contentWidth = this.slideableWidth - this.getLastCell().size[ endMargin ];\n // content is less than gallery size\n var isContentSmaller = contentWidth < this.size.innerWidth;\n // bounds\n var beginBound = this.cursorPosition + this.cells[0].size[ beginMargin ];\n var endBound = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign );\n // contain each cell target\n this.slides.forEach( function( slide ) {\n if ( isContentSmaller ) {\n // all cells fit inside gallery\n slide.target = contentWidth * this.cellAlign;\n } else {\n // contain to bounds\n slide.target = Math.max( slide.target, beginBound );\n slide.target = Math.min( slide.target, endBound );\n }\n }, this );\n};\n\n// ----- ----- //\n\n/**\n * emits events via eventEmitter and jQuery events\n * @param {String} type - name of event\n * @param {Event} event - original event\n * @param {Array} args - extra arguments\n */\nproto.dispatchEvent = function( type, event, args ) {\n var emitArgs = event ? [ event ].concat( args ) : args;\n this.emitEvent( type, emitArgs );\n\n if ( jQuery && this.$element ) {\n // default trigger with type if no event\n type += this.options.namespaceJQueryEvents ? '.flickity' : '';\n var $event = type;\n if ( event ) {\n // create jQuery event\n var jQEvent = new jQuery.Event( event );\n jQEvent.type = type;\n $event = jQEvent;\n }\n this.$element.trigger( $event, args );\n }\n};\n\n// -------------------------- select -------------------------- //\n\n/**\n * @param {Integer} index - index of the slide\n * @param {Boolean} isWrap - will wrap-around to last/first if at the end\n * @param {Boolean} isInstant - will immediately set position at selected cell\n */\nproto.select = function( index, isWrap, isInstant ) {\n if ( !this.isActive ) {\n return;\n }\n index = parseInt( index, 10 );\n this._wrapSelect( index );\n\n if ( this.options.wrapAround || isWrap ) {\n index = utils.modulo( index, this.slides.length );\n }\n // bail if invalid index\n if ( !this.slides[ index ] ) {\n return;\n }\n var prevIndex = this.selectedIndex;\n this.selectedIndex = index;\n this.updateSelectedSlide();\n if ( isInstant ) {\n this.positionSliderAtSelected();\n } else {\n this.startAnimation();\n }\n if ( this.options.adaptiveHeight ) {\n this.setGallerySize();\n }\n // events\n this.dispatchEvent( 'select', null, [ index ] );\n // change event if new index\n if ( index != prevIndex ) {\n this.dispatchEvent( 'change', null, [ index ] );\n }\n // old v1 event name, remove in v3\n this.dispatchEvent('cellSelect');\n};\n\n// wraps position for wrapAround, to move to closest slide. #113\nproto._wrapSelect = function( index ) {\n var len = this.slides.length;\n var isWrapping = this.options.wrapAround && len > 1;\n if ( !isWrapping ) {\n return index;\n }\n var wrapIndex = utils.modulo( index, len );\n // go to shortest\n var delta = Math.abs( wrapIndex - this.selectedIndex );\n var backWrapDelta = Math.abs( ( wrapIndex + len ) - this.selectedIndex );\n var forewardWrapDelta = Math.abs( ( wrapIndex - len ) - this.selectedIndex );\n if ( !this.isDragSelect && backWrapDelta < delta ) {\n index += len;\n } else if ( !this.isDragSelect && forewardWrapDelta < delta ) {\n index -= len;\n }\n // wrap position so slider is within normal area\n if ( index < 0 ) {\n this.x -= this.slideableWidth;\n } else if ( index >= len ) {\n this.x += this.slideableWidth;\n }\n};\n\nproto.previous = function( isWrap, isInstant ) {\n this.select( this.selectedIndex - 1, isWrap, isInstant );\n};\n\nproto.next = function( isWrap, isInstant ) {\n this.select( this.selectedIndex + 1, isWrap, isInstant );\n};\n\nproto.updateSelectedSlide = function() {\n var slide = this.slides[ this.selectedIndex ];\n // selectedIndex could be outside of slides, if triggered before resize()\n if ( !slide ) {\n return;\n }\n // unselect previous selected slide\n this.unselectSelectedSlide();\n // update new selected slide\n this.selectedSlide = slide;\n slide.select();\n this.selectedCells = slide.cells;\n this.selectedElements = slide.getCellElements();\n // HACK: selectedCell & selectedElement is first cell in slide, backwards compatibility\n // Remove in v3?\n this.selectedCell = slide.cells[0];\n this.selectedElement = this.selectedElements[0];\n};\n\nproto.unselectSelectedSlide = function() {\n if ( this.selectedSlide ) {\n this.selectedSlide.unselect();\n }\n};\n\nproto.selectInitialIndex = function() {\n var initialIndex = this.options.initialIndex;\n // already activated, select previous selectedIndex\n if ( this.isInitActivated ) {\n this.select( this.selectedIndex, false, true );\n return;\n }\n // select with selector string\n if ( initialIndex && typeof initialIndex == 'string' ) {\n var cell = this.queryCell( initialIndex );\n if ( cell ) {\n this.selectCell( initialIndex, false, true );\n return;\n }\n }\n\n var index = 0;\n // select with number\n if ( initialIndex && this.slides[ initialIndex ] ) {\n index = initialIndex;\n }\n // select instantly\n this.select( index, false, true );\n};\n\n/**\n * select slide from number or cell element\n * @param {[Element, Number]} value - zero-based index or element to select\n * @param {Boolean} isWrap - enables wrapping around for extra index\n * @param {Boolean} isInstant - disables slide animation\n */\nproto.selectCell = function( value, isWrap, isInstant ) {\n // get cell\n var cell = this.queryCell( value );\n if ( !cell ) {\n return;\n }\n\n var index = this.getCellSlideIndex( cell );\n this.select( index, isWrap, isInstant );\n};\n\nproto.getCellSlideIndex = function( cell ) {\n // get index of slides that has cell\n for ( var i = 0; i < this.slides.length; i++ ) {\n var slide = this.slides[i];\n var index = slide.cells.indexOf( cell );\n if ( index != -1 ) {\n return i;\n }\n }\n};\n\n// -------------------------- get cells -------------------------- //\n\n/**\n * get Flickity.Cell, given an Element\n * @param {Element} elem - matching cell element\n * @returns {Flickity.Cell} cell - matching cell\n */\nproto.getCell = function( elem ) {\n // loop through cells to get the one that matches\n for ( var i = 0; i < this.cells.length; i++ ) {\n var cell = this.cells[i];\n if ( cell.element == elem ) {\n return cell;\n }\n }\n};\n\n/**\n * get collection of Flickity.Cells, given Elements\n * @param {[Element, Array, NodeList]} elems - multiple elements\n * @returns {Array} cells - Flickity.Cells\n */\nproto.getCells = function( elems ) {\n elems = utils.makeArray( elems );\n var cells = [];\n elems.forEach( function( elem ) {\n var cell = this.getCell( elem );\n if ( cell ) {\n cells.push( cell );\n }\n }, this );\n return cells;\n};\n\n/**\n * get cell elements\n * @returns {Array} cellElems\n */\nproto.getCellElements = function() {\n return this.cells.map( function( cell ) {\n return cell.element;\n } );\n};\n\n/**\n * get parent cell from an element\n * @param {Element} elem - child element\n * @returns {Flickit.Cell} cell - parent cell\n */\nproto.getParentCell = function( elem ) {\n // first check if elem is cell\n var cell = this.getCell( elem );\n if ( cell ) {\n return cell;\n }\n // try to get parent cell elem\n elem = utils.getParent( elem, '.flickity-slider > *' );\n return this.getCell( elem );\n};\n\n/**\n * get cells adjacent to a slide\n * @param {Integer} adjCount - number of adjacent slides\n * @param {Integer} index - index of slide to start\n * @returns {Array} cells - array of Flickity.Cells\n */\nproto.getAdjacentCellElements = function( adjCount, index ) {\n if ( !adjCount ) {\n return this.selectedSlide.getCellElements();\n }\n index = index === undefined ? this.selectedIndex : index;\n\n var len = this.slides.length;\n if ( 1 + ( adjCount * 2 ) >= len ) {\n return this.getCellElements();\n }\n\n var cellElems = [];\n for ( var i = index - adjCount; i <= index + adjCount; i++ ) {\n var slideIndex = this.options.wrapAround ? utils.modulo( i, len ) : i;\n var slide = this.slides[ slideIndex ];\n if ( slide ) {\n cellElems = cellElems.concat( slide.getCellElements() );\n }\n }\n return cellElems;\n};\n\n/**\n * select slide from number or cell element\n * @param {[Element, String, Number]} selector - element, selector string, or index\n * @returns {Flickity.Cell} - matching cell\n */\nproto.queryCell = function( selector ) {\n if ( typeof selector == 'number' ) {\n // use number as index\n return this.cells[ selector ];\n }\n if ( typeof selector == 'string' ) {\n // do not select invalid selectors from hash: #123, #/. #791\n if ( selector.match( /^[#.]?[\\d/]/ ) ) {\n return;\n }\n // use string as selector, get element\n selector = this.element.querySelector( selector );\n }\n // get cell from element\n return this.getCell( selector );\n};\n\n// -------------------------- events -------------------------- //\n\nproto.uiChange = function() {\n this.emitEvent('uiChange');\n};\n\n// keep focus on element when child UI elements are clicked\nproto.childUIPointerDown = function( event ) {\n // HACK iOS does not allow touch events to bubble up?!\n if ( event.type != 'touchstart' ) {\n event.preventDefault();\n }\n this.focus();\n};\n\n// ----- resize ----- //\n\nproto.onresize = function() {\n this.watchCSS();\n this.resize();\n};\n\nutils.debounceMethod( Flickity, 'onresize', 150 );\n\nproto.resize = function() {\n // #1177 disable resize behavior when animating or dragging for iOS 15\n if ( !this.isActive || this.isAnimating || this.isDragging ) {\n return;\n }\n this.getSize();\n // wrap values\n if ( this.options.wrapAround ) {\n this.x = utils.modulo( this.x, this.slideableWidth );\n }\n this.positionCells();\n this._getWrapShiftCells();\n this.setGallerySize();\n this.emitEvent('resize');\n // update selected index for group slides, instant\n // TODO: position can be lost between groups of various numbers\n var selectedElement = this.selectedElements && this.selectedElements[0];\n this.selectCell( selectedElement, false, true );\n};\n\n// watches the :after property, activates/deactivates\nproto.watchCSS = function() {\n var watchOption = this.options.watchCSS;\n if ( !watchOption ) {\n return;\n }\n\n var afterContent = getComputedStyle( this.element, ':after' ).content;\n // activate if :after { content: 'flickity' }\n if ( afterContent.indexOf('flickity') != -1 ) {\n this.activate();\n } else {\n this.deactivate();\n }\n};\n\n// ----- keydown ----- //\n\n// go previous/next if left/right keys pressed\nproto.onkeydown = function( event ) {\n // only work if element is in focus\n var isNotFocused = document.activeElement && document.activeElement != this.element;\n if ( !this.options.accessibility || isNotFocused ) {\n return;\n }\n\n var handler = Flickity.keyboardHandlers[ event.keyCode ];\n if ( handler ) {\n handler.call( this );\n }\n};\n\nFlickity.keyboardHandlers = {\n // left arrow\n 37: function() {\n var leftMethod = this.options.rightToLeft ? 'next' : 'previous';\n this.uiChange();\n this[ leftMethod ]();\n },\n // right arrow\n 39: function() {\n var rightMethod = this.options.rightToLeft ? 'previous' : 'next';\n this.uiChange();\n this[ rightMethod ]();\n },\n};\n\n// ----- focus ----- //\n\nproto.focus = function() {\n // TODO remove scrollTo once focus options gets more support\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus ...\n // #Browser_compatibility\n var prevScrollY = window.pageYOffset;\n this.element.focus({ preventScroll: true });\n // hack to fix scroll jump after focus, #76\n if ( window.pageYOffset != prevScrollY ) {\n window.scrollTo( window.pageXOffset, prevScrollY );\n }\n};\n\n// -------------------------- destroy -------------------------- //\n\n// deactivate all Flickity functionality, but keep stuff available\nproto.deactivate = function() {\n if ( !this.isActive ) {\n return;\n }\n this.element.classList.remove('flickity-enabled');\n this.element.classList.remove('flickity-rtl');\n this.unselectSelectedSlide();\n // destroy cells\n this.cells.forEach( function( cell ) {\n cell.destroy();\n } );\n this.element.removeChild( this.viewport );\n // move child elements back into element\n moveElements( this.slider.children, this.element );\n if ( this.options.accessibility ) {\n this.element.removeAttribute('tabIndex');\n this.element.removeEventListener( 'keydown', this );\n }\n // set flags\n this.isActive = false;\n this.emitEvent('deactivate');\n};\n\nproto.destroy = function() {\n this.deactivate();\n window.removeEventListener( 'resize', this );\n this.allOff();\n this.emitEvent('destroy');\n if ( jQuery && this.$element ) {\n jQuery.removeData( this.element, 'flickity' );\n }\n delete this.element.flickityGUID;\n delete instances[ this.guid ];\n};\n\n// -------------------------- prototype -------------------------- //\n\nutils.extend( proto, animatePrototype );\n\n// -------------------------- extras -------------------------- //\n\n/**\n * get Flickity instance from element\n * @param {[Element, String]} elem - element or selector string\n * @returns {Flickity} - Flickity instance\n */\nFlickity.data = function( elem ) {\n elem = utils.getQueryElement( elem );\n var id = elem && elem.flickityGUID;\n return id && instances[ id ];\n};\n\nutils.htmlInit( Flickity, 'flickity' );\n\nif ( jQuery && jQuery.bridget ) {\n jQuery.bridget( 'flickity', Flickity );\n}\n\n// set internal jQuery, for Webpack + jQuery v3, #478\nFlickity.setJQuery = function( jq ) {\n jQuery = jq;\n};\n\nFlickity.Cell = Cell;\nFlickity.Slide = Slide;\n\nreturn Flickity;\n\n} ) );\n","/*!\n * Unipointer v2.4.0\n * base class for doing one thing with pointer event\n * MIT license\n */\n\n/*jshint browser: true, undef: true, unused: true, strict: true */\n\n( function( window, factory ) {\n // universal module definition\n /* jshint strict: false */ /*global define, module, require */\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'ev-emitter/ev-emitter'\n ], function( EvEmitter ) {\n return factory( window, EvEmitter );\n });\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('ev-emitter')\n );\n } else {\n // browser global\n window.Unipointer = factory(\n window,\n window.EvEmitter\n );\n }\n\n}( window, function factory( window, EvEmitter ) {\n\n'use strict';\n\nfunction noop() {}\n\nfunction Unipointer() {}\n\n// inherit EvEmitter\nvar proto = Unipointer.prototype = Object.create( EvEmitter.prototype );\n\nproto.bindStartEvent = function( elem ) {\n this._bindStartEvent( elem, true );\n};\n\nproto.unbindStartEvent = function( elem ) {\n this._bindStartEvent( elem, false );\n};\n\n/**\n * Add or remove start event\n * @param {Boolean} isAdd - remove if falsey\n */\nproto._bindStartEvent = function( elem, isAdd ) {\n // munge isAdd, default to true\n isAdd = isAdd === undefined ? true : isAdd;\n var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';\n\n // default to mouse events\n var startEvent = 'mousedown';\n if ( 'ontouchstart' in window ) {\n // HACK prefer Touch Events as you can preventDefault on touchstart to\n // disable scroll in iOS & mobile Chrome metafizzy/flickity#1177\n startEvent = 'touchstart';\n } else if ( window.PointerEvent ) {\n // Pointer Events\n startEvent = 'pointerdown';\n }\n elem[ bindMethod ]( startEvent, this );\n};\n\n// trigger handler methods for events\nproto.handleEvent = function( event ) {\n var method = 'on' + event.type;\n if ( this[ method ] ) {\n this[ method ]( event );\n }\n};\n\n// returns the touch that we're keeping track of\nproto.getTouch = function( touches ) {\n for ( var i=0; i < touches.length; i++ ) {\n var touch = touches[i];\n if ( touch.identifier == this.pointerIdentifier ) {\n return touch;\n }\n }\n};\n\n// ----- start event ----- //\n\nproto.onmousedown = function( event ) {\n // dismiss clicks from right or middle buttons\n var button = event.button;\n if ( button && ( button !== 0 && button !== 1 ) ) {\n return;\n }\n this._pointerDown( event, event );\n};\n\nproto.ontouchstart = function( event ) {\n this._pointerDown( event, event.changedTouches[0] );\n};\n\nproto.onpointerdown = function( event ) {\n this._pointerDown( event, event );\n};\n\n/**\n * pointer start\n * @param {Event} event\n * @param {Event or Touch} pointer\n */\nproto._pointerDown = function( event, pointer ) {\n // dismiss right click and other pointers\n // button = 0 is okay, 1-4 not\n if ( event.button || this.isPointerDown ) {\n return;\n }\n\n this.isPointerDown = true;\n // save pointer identifier to match up touch events\n this.pointerIdentifier = pointer.pointerId !== undefined ?\n // pointerId for pointer events, touch.indentifier for touch events\n pointer.pointerId : pointer.identifier;\n\n this.pointerDown( event, pointer );\n};\n\nproto.pointerDown = function( event, pointer ) {\n this._bindPostStartEvents( event );\n this.emitEvent( 'pointerDown', [ event, pointer ] );\n};\n\n// hash of events to be bound after start event\nvar postStartEvents = {\n mousedown: [ 'mousemove', 'mouseup' ],\n touchstart: [ 'touchmove', 'touchend', 'touchcancel' ],\n pointerdown: [ 'pointermove', 'pointerup', 'pointercancel' ],\n};\n\nproto._bindPostStartEvents = function( event ) {\n if ( !event ) {\n return;\n }\n // get proper events to match start event\n var events = postStartEvents[ event.type ];\n // bind events to node\n events.forEach( function( eventName ) {\n window.addEventListener( eventName, this );\n }, this );\n // save these arguments\n this._boundPointerEvents = events;\n};\n\nproto._unbindPostStartEvents = function() {\n // check for _boundEvents, in case dragEnd triggered twice (old IE8 bug)\n if ( !this._boundPointerEvents ) {\n return;\n }\n this._boundPointerEvents.forEach( function( eventName ) {\n window.removeEventListener( eventName, this );\n }, this );\n\n delete this._boundPointerEvents;\n};\n\n// ----- move event ----- //\n\nproto.onmousemove = function( event ) {\n this._pointerMove( event, event );\n};\n\nproto.onpointermove = function( event ) {\n if ( event.pointerId == this.pointerIdentifier ) {\n this._pointerMove( event, event );\n }\n};\n\nproto.ontouchmove = function( event ) {\n var touch = this.getTouch( event.changedTouches );\n if ( touch ) {\n this._pointerMove( event, touch );\n }\n};\n\n/**\n * pointer move\n * @param {Event} event\n * @param {Event or Touch} pointer\n * @private\n */\nproto._pointerMove = function( event, pointer ) {\n this.pointerMove( event, pointer );\n};\n\n// public\nproto.pointerMove = function( event, pointer ) {\n this.emitEvent( 'pointerMove', [ event, pointer ] );\n};\n\n// ----- end event ----- //\n\n\nproto.onmouseup = function( event ) {\n this._pointerUp( event, event );\n};\n\nproto.onpointerup = function( event ) {\n if ( event.pointerId == this.pointerIdentifier ) {\n this._pointerUp( event, event );\n }\n};\n\nproto.ontouchend = function( event ) {\n var touch = this.getTouch( event.changedTouches );\n if ( touch ) {\n this._pointerUp( event, touch );\n }\n};\n\n/**\n * pointer up\n * @param {Event} event\n * @param {Event or Touch} pointer\n * @private\n */\nproto._pointerUp = function( event, pointer ) {\n this._pointerDone();\n this.pointerUp( event, pointer );\n};\n\n// public\nproto.pointerUp = function( event, pointer ) {\n this.emitEvent( 'pointerUp', [ event, pointer ] );\n};\n\n// ----- pointer done ----- //\n\n// triggered on pointer up & pointer cancel\nproto._pointerDone = function() {\n this._pointerReset();\n this._unbindPostStartEvents();\n this.pointerDone();\n};\n\nproto._pointerReset = function() {\n // reset properties\n this.isPointerDown = false;\n delete this.pointerIdentifier;\n};\n\nproto.pointerDone = noop;\n\n// ----- pointer cancel ----- //\n\nproto.onpointercancel = function( event ) {\n if ( event.pointerId == this.pointerIdentifier ) {\n this._pointerCancel( event, event );\n }\n};\n\nproto.ontouchcancel = function( event ) {\n var touch = this.getTouch( event.changedTouches );\n if ( touch ) {\n this._pointerCancel( event, touch );\n }\n};\n\n/**\n * pointer cancel\n * @param {Event} event\n * @param {Event or Touch} pointer\n * @private\n */\nproto._pointerCancel = function( event, pointer ) {\n this._pointerDone();\n this.pointerCancel( event, pointer );\n};\n\n// public\nproto.pointerCancel = function( event, pointer ) {\n this.emitEvent( 'pointerCancel', [ event, pointer ] );\n};\n\n// ----- ----- //\n\n// utility function for getting x/y coords from event\nUnipointer.getPointerPoint = function( pointer ) {\n return {\n x: pointer.pageX,\n y: pointer.pageY\n };\n};\n\n// ----- ----- //\n\nreturn Unipointer;\n\n}));\n","/*!\n * Unidragger v2.4.0\n * Draggable base class\n * MIT license\n */\n\n/*jshint browser: true, unused: true, undef: true, strict: true */\n\n( function( window, factory ) {\n // universal module definition\n /*jshint strict: false */ /*globals define, module, require */\n\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'unipointer/unipointer'\n ], function( Unipointer ) {\n return factory( window, Unipointer );\n });\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('unipointer')\n );\n } else {\n // browser global\n window.Unidragger = factory(\n window,\n window.Unipointer\n );\n }\n\n}( window, function factory( window, Unipointer ) {\n\n'use strict';\n\n// -------------------------- Unidragger -------------------------- //\n\nfunction Unidragger() {}\n\n// inherit Unipointer & EvEmitter\nvar proto = Unidragger.prototype = Object.create( Unipointer.prototype );\n\n// ----- bind start ----- //\n\nproto.bindHandles = function() {\n this._bindHandles( true );\n};\n\nproto.unbindHandles = function() {\n this._bindHandles( false );\n};\n\n/**\n * Add or remove start event\n * @param {Boolean} isAdd\n */\nproto._bindHandles = function( isAdd ) {\n // munge isAdd, default to true\n isAdd = isAdd === undefined ? true : isAdd;\n // bind each handle\n var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';\n var touchAction = isAdd ? this._touchActionValue : '';\n for ( var i=0; i < this.handles.length; i++ ) {\n var handle = this.handles[i];\n this._bindStartEvent( handle, isAdd );\n handle[ bindMethod ]( 'click', this );\n // touch-action: none to override browser touch gestures. metafizzy/flickity#540\n if ( window.PointerEvent ) {\n handle.style.touchAction = touchAction;\n }\n }\n};\n\n// prototype so it can be overwriteable by Flickity\nproto._touchActionValue = 'none';\n\n// ----- start event ----- //\n\n/**\n * pointer start\n * @param {Event} event\n * @param {Event or Touch} pointer\n */\nproto.pointerDown = function( event, pointer ) {\n var isOkay = this.okayPointerDown( event );\n if ( !isOkay ) {\n return;\n }\n // track start event position\n // Safari 9 overrides pageX and pageY. These values needs to be copied. flickity#842\n this.pointerDownPointer = {\n pageX: pointer.pageX,\n pageY: pointer.pageY,\n };\n\n event.preventDefault();\n this.pointerDownBlur();\n // bind move and end events\n this._bindPostStartEvents( event );\n this.emitEvent( 'pointerDown', [ event, pointer ] );\n};\n\n// nodes that have text fields\nvar cursorNodes = {\n TEXTAREA: true,\n INPUT: true,\n SELECT: true,\n OPTION: true,\n};\n\n// input types that do not have text fields\nvar clickTypes = {\n radio: true,\n checkbox: true,\n button: true,\n submit: true,\n image: true,\n file: true,\n};\n\n// dismiss inputs with text fields. flickity#403, flickity#404\nproto.okayPointerDown = function( event ) {\n var isCursorNode = cursorNodes[ event.target.nodeName ];\n var isClickType = clickTypes[ event.target.type ];\n var isOkay = !isCursorNode || isClickType;\n if ( !isOkay ) {\n this._pointerReset();\n }\n return isOkay;\n};\n\n// kludge to blur previously focused input\nproto.pointerDownBlur = function() {\n var focused = document.activeElement;\n // do not blur body for IE10, metafizzy/flickity#117\n var canBlur = focused && focused.blur && focused != document.body;\n if ( canBlur ) {\n focused.blur();\n }\n};\n\n// ----- move event ----- //\n\n/**\n * drag move\n * @param {Event} event\n * @param {Event or Touch} pointer\n */\nproto.pointerMove = function( event, pointer ) {\n var moveVector = this._dragPointerMove( event, pointer );\n this.emitEvent( 'pointerMove', [ event, pointer, moveVector ] );\n this._dragMove( event, pointer, moveVector );\n};\n\n// base pointer move logic\nproto._dragPointerMove = function( event, pointer ) {\n var moveVector = {\n x: pointer.pageX - this.pointerDownPointer.pageX,\n y: pointer.pageY - this.pointerDownPointer.pageY\n };\n // start drag if pointer has moved far enough to start drag\n if ( !this.isDragging && this.hasDragStarted( moveVector ) ) {\n this._dragStart( event, pointer );\n }\n return moveVector;\n};\n\n// condition if pointer has moved far enough to start drag\nproto.hasDragStarted = function( moveVector ) {\n return Math.abs( moveVector.x ) > 3 || Math.abs( moveVector.y ) > 3;\n};\n\n// ----- end event ----- //\n\n/**\n * pointer up\n * @param {Event} event\n * @param {Event or Touch} pointer\n */\nproto.pointerUp = function( event, pointer ) {\n this.emitEvent( 'pointerUp', [ event, pointer ] );\n this._dragPointerUp( event, pointer );\n};\n\nproto._dragPointerUp = function( event, pointer ) {\n if ( this.isDragging ) {\n this._dragEnd( event, pointer );\n } else {\n // pointer didn't move enough for drag to start\n this._staticClick( event, pointer );\n }\n};\n\n// -------------------------- drag -------------------------- //\n\n// dragStart\nproto._dragStart = function( event, pointer ) {\n this.isDragging = true;\n // prevent clicks\n this.isPreventingClicks = true;\n this.dragStart( event, pointer );\n};\n\nproto.dragStart = function( event, pointer ) {\n this.emitEvent( 'dragStart', [ event, pointer ] );\n};\n\n// dragMove\nproto._dragMove = function( event, pointer, moveVector ) {\n // do not drag if not dragging yet\n if ( !this.isDragging ) {\n return;\n }\n\n this.dragMove( event, pointer, moveVector );\n};\n\nproto.dragMove = function( event, pointer, moveVector ) {\n event.preventDefault();\n this.emitEvent( 'dragMove', [ event, pointer, moveVector ] );\n};\n\n// dragEnd\nproto._dragEnd = function( event, pointer ) {\n // set flags\n this.isDragging = false;\n // re-enable clicking async\n setTimeout( function() {\n delete this.isPreventingClicks;\n }.bind( this ) );\n\n this.dragEnd( event, pointer );\n};\n\nproto.dragEnd = function( event, pointer ) {\n this.emitEvent( 'dragEnd', [ event, pointer ] );\n};\n\n// ----- onclick ----- //\n\n// handle all clicks and prevent clicks when dragging\nproto.onclick = function( event ) {\n if ( this.isPreventingClicks ) {\n event.preventDefault();\n }\n};\n\n// ----- staticClick ----- //\n\n// triggered after pointer down & up with no/tiny movement\nproto._staticClick = function( event, pointer ) {\n // ignore emulated mouse up clicks\n if ( this.isIgnoringMouseUp && event.type == 'mouseup' ) {\n return;\n }\n\n this.staticClick( event, pointer );\n\n // set flag for emulated clicks 300ms after touchend\n if ( event.type != 'mouseup' ) {\n this.isIgnoringMouseUp = true;\n // reset flag after 300ms\n setTimeout( function() {\n delete this.isIgnoringMouseUp;\n }.bind( this ), 400 );\n }\n};\n\nproto.staticClick = function( event, pointer ) {\n this.emitEvent( 'staticClick', [ event, pointer ] );\n};\n\n// ----- utils ----- //\n\nUnidragger.getPointerPoint = Unipointer.getPointerPoint;\n\n// ----- ----- //\n\nreturn Unidragger;\n\n}));\n","// drag\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n 'unidragger/unidragger',\n 'fizzy-ui-utils/utils',\n ], function( Flickity, Unidragger, utils ) {\n return factory( window, Flickity, Unidragger, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('./flickity'),\n require('unidragger'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n window.Flickity = factory(\n window,\n window.Flickity,\n window.Unidragger,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, Flickity, Unidragger, utils ) {\n\n'use strict';\n\n// ----- defaults ----- //\n\nutils.extend( Flickity.defaults, {\n draggable: '>1',\n dragThreshold: 3,\n} );\n\n// ----- create ----- //\n\nFlickity.createMethods.push('_createDrag');\n\n// -------------------------- drag prototype -------------------------- //\n\nvar proto = Flickity.prototype;\nutils.extend( proto, Unidragger.prototype );\nproto._touchActionValue = 'pan-y';\n\n// -------------------------- -------------------------- //\n\nproto._createDrag = function() {\n this.on( 'activate', this.onActivateDrag );\n this.on( 'uiChange', this._uiChangeDrag );\n this.on( 'deactivate', this.onDeactivateDrag );\n this.on( 'cellChange', this.updateDraggable );\n // TODO updateDraggable on resize? if groupCells & slides change\n};\n\nproto.onActivateDrag = function() {\n this.handles = [ this.viewport ];\n this.bindHandles();\n this.updateDraggable();\n};\n\nproto.onDeactivateDrag = function() {\n this.unbindHandles();\n this.element.classList.remove('is-draggable');\n};\n\nproto.updateDraggable = function() {\n // disable dragging if less than 2 slides. #278\n if ( this.options.draggable == '>1' ) {\n this.isDraggable = this.slides.length > 1;\n } else {\n this.isDraggable = this.options.draggable;\n }\n if ( this.isDraggable ) {\n this.element.classList.add('is-draggable');\n } else {\n this.element.classList.remove('is-draggable');\n }\n};\n\n// backwards compatibility\nproto.bindDrag = function() {\n this.options.draggable = true;\n this.updateDraggable();\n};\n\nproto.unbindDrag = function() {\n this.options.draggable = false;\n this.updateDraggable();\n};\n\nproto._uiChangeDrag = function() {\n delete this.isFreeScrolling;\n};\n\n// -------------------------- pointer events -------------------------- //\n\nproto.pointerDown = function( event, pointer ) {\n if ( !this.isDraggable ) {\n this._pointerDownDefault( event, pointer );\n return;\n }\n var isOkay = this.okayPointerDown( event );\n if ( !isOkay ) {\n return;\n }\n\n this._pointerDownPreventDefault( event );\n this.pointerDownFocus( event );\n // blur\n if ( document.activeElement != this.element ) {\n // do not blur if already focused\n this.pointerDownBlur();\n }\n\n // stop if it was moving\n this.dragX = this.x;\n this.viewport.classList.add('is-pointer-down');\n // track scrolling\n this.pointerDownScroll = getScrollPosition();\n window.addEventListener( 'scroll', this );\n\n this._pointerDownDefault( event, pointer );\n};\n\n// default pointerDown logic, used for staticClick\nproto._pointerDownDefault = function( event, pointer ) {\n // track start event position\n // Safari 9 overrides pageX and pageY. These values needs to be copied. #779\n this.pointerDownPointer = {\n pageX: pointer.pageX,\n pageY: pointer.pageY,\n };\n // bind move and end events\n this._bindPostStartEvents( event );\n this.dispatchEvent( 'pointerDown', event, [ pointer ] );\n};\n\nvar focusNodes = {\n INPUT: true,\n TEXTAREA: true,\n SELECT: true,\n};\n\nproto.pointerDownFocus = function( event ) {\n var isFocusNode = focusNodes[ event.target.nodeName ];\n if ( !isFocusNode ) {\n this.focus();\n }\n};\n\nproto._pointerDownPreventDefault = function( event ) {\n var isTouchStart = event.type == 'touchstart';\n var isTouchPointer = event.pointerType == 'touch';\n var isFocusNode = focusNodes[ event.target.nodeName ];\n if ( !isTouchStart && !isTouchPointer && !isFocusNode ) {\n event.preventDefault();\n }\n};\n\n// ----- move ----- //\n\nproto.hasDragStarted = function( moveVector ) {\n return Math.abs( moveVector.x ) > this.options.dragThreshold;\n};\n\n// ----- up ----- //\n\nproto.pointerUp = function( event, pointer ) {\n delete this.isTouchScrolling;\n this.viewport.classList.remove('is-pointer-down');\n this.dispatchEvent( 'pointerUp', event, [ pointer ] );\n this._dragPointerUp( event, pointer );\n};\n\nproto.pointerDone = function() {\n window.removeEventListener( 'scroll', this );\n delete this.pointerDownScroll;\n};\n\n// -------------------------- dragging -------------------------- //\n\nproto.dragStart = function( event, pointer ) {\n if ( !this.isDraggable ) {\n return;\n }\n this.dragStartPosition = this.x;\n this.startAnimation();\n window.removeEventListener( 'scroll', this );\n this.dispatchEvent( 'dragStart', event, [ pointer ] );\n};\n\nproto.pointerMove = function( event, pointer ) {\n var moveVector = this._dragPointerMove( event, pointer );\n this.dispatchEvent( 'pointerMove', event, [ pointer, moveVector ] );\n this._dragMove( event, pointer, moveVector );\n};\n\nproto.dragMove = function( event, pointer, moveVector ) {\n if ( !this.isDraggable ) {\n return;\n }\n event.preventDefault();\n\n this.previousDragX = this.dragX;\n // reverse if right-to-left\n var direction = this.options.rightToLeft ? -1 : 1;\n if ( this.options.wrapAround ) {\n // wrap around move. #589\n moveVector.x %= this.slideableWidth;\n }\n var dragX = this.dragStartPosition + moveVector.x * direction;\n\n if ( !this.options.wrapAround && this.slides.length ) {\n // slow drag\n var originBound = Math.max( -this.slides[0].target, this.dragStartPosition );\n dragX = dragX > originBound ? ( dragX + originBound ) * 0.5 : dragX;\n var endBound = Math.min( -this.getLastSlide().target, this.dragStartPosition );\n dragX = dragX < endBound ? ( dragX + endBound ) * 0.5 : dragX;\n }\n\n this.dragX = dragX;\n\n this.dragMoveTime = new Date();\n this.dispatchEvent( 'dragMove', event, [ pointer, moveVector ] );\n};\n\nproto.dragEnd = function( event, pointer ) {\n if ( !this.isDraggable ) {\n return;\n }\n if ( this.options.freeScroll ) {\n this.isFreeScrolling = true;\n }\n // set selectedIndex based on where flick will end up\n var index = this.dragEndRestingSelect();\n\n if ( this.options.freeScroll && !this.options.wrapAround ) {\n // if free-scroll & not wrap around\n // do not free-scroll if going outside of bounding slides\n // so bounding slides can attract slider, and keep it in bounds\n var restingX = this.getRestingPosition();\n this.isFreeScrolling = -restingX > this.slides[0].target &&\n -restingX < this.getLastSlide().target;\n } else if ( !this.options.freeScroll && index == this.selectedIndex ) {\n // boost selection if selected index has not changed\n index += this.dragEndBoostSelect();\n }\n delete this.previousDragX;\n // apply selection\n // TODO refactor this, selecting here feels weird\n // HACK, set flag so dragging stays in correct direction\n this.isDragSelect = this.options.wrapAround;\n this.select( index );\n delete this.isDragSelect;\n this.dispatchEvent( 'dragEnd', event, [ pointer ] );\n};\n\nproto.dragEndRestingSelect = function() {\n var restingX = this.getRestingPosition();\n // how far away from selected slide\n var distance = Math.abs( this.getSlideDistance( -restingX, this.selectedIndex ) );\n // get closet resting going up and going down\n var positiveResting = this._getClosestResting( restingX, distance, 1 );\n var negativeResting = this._getClosestResting( restingX, distance, -1 );\n // use closer resting for wrap-around\n var index = positiveResting.distance < negativeResting.distance ?\n positiveResting.index : negativeResting.index;\n return index;\n};\n\n/**\n * given resting X and distance to selected cell\n * get the distance and index of the closest cell\n * @param {Number} restingX - estimated post-flick resting position\n * @param {Number} distance - distance to selected cell\n * @param {Integer} increment - +1 or -1, going up or down\n * @returns {Object} - { distance: {Number}, index: {Integer} }\n */\nproto._getClosestResting = function( restingX, distance, increment ) {\n var index = this.selectedIndex;\n var minDistance = Infinity;\n var condition = this.options.contain && !this.options.wrapAround ?\n // if contain, keep going if distance is equal to minDistance\n function( dist, minDist ) {\n return dist <= minDist;\n } : function( dist, minDist ) {\n return dist < minDist;\n };\n while ( condition( distance, minDistance ) ) {\n // measure distance to next cell\n index += increment;\n minDistance = distance;\n distance = this.getSlideDistance( -restingX, index );\n if ( distance === null ) {\n break;\n }\n distance = Math.abs( distance );\n }\n return {\n distance: minDistance,\n // selected was previous index\n index: index - increment,\n };\n};\n\n/**\n * measure distance between x and a slide target\n * @param {Number} x - horizontal position\n * @param {Integer} index - slide index\n * @returns {Number} - slide distance\n */\nproto.getSlideDistance = function( x, index ) {\n var len = this.slides.length;\n // wrap around if at least 2 slides\n var isWrapAround = this.options.wrapAround && len > 1;\n var slideIndex = isWrapAround ? utils.modulo( index, len ) : index;\n var slide = this.slides[ slideIndex ];\n if ( !slide ) {\n return null;\n }\n // add distance for wrap-around slides\n var wrap = isWrapAround ? this.slideableWidth * Math.floor( index/len ) : 0;\n return x - ( slide.target + wrap );\n};\n\nproto.dragEndBoostSelect = function() {\n // do not boost if no previousDragX or dragMoveTime\n if ( this.previousDragX === undefined || !this.dragMoveTime ||\n // or if drag was held for 100 ms\n new Date() - this.dragMoveTime > 100 ) {\n return 0;\n }\n\n var distance = this.getSlideDistance( -this.dragX, this.selectedIndex );\n var delta = this.previousDragX - this.dragX;\n if ( distance > 0 && delta > 0 ) {\n // boost to next if moving towards the right, and positive velocity\n return 1;\n } else if ( distance < 0 && delta < 0 ) {\n // boost to previous if moving towards the left, and negative velocity\n return -1;\n }\n return 0;\n};\n\n// ----- staticClick ----- //\n\nproto.staticClick = function( event, pointer ) {\n // get clickedCell, if cell was clicked\n var clickedCell = this.getParentCell( event.target );\n var cellElem = clickedCell && clickedCell.element;\n var cellIndex = clickedCell && this.cells.indexOf( clickedCell );\n this.dispatchEvent( 'staticClick', event, [ pointer, cellElem, cellIndex ] );\n};\n\n// ----- scroll ----- //\n\nproto.onscroll = function() {\n var scroll = getScrollPosition();\n var scrollMoveX = this.pointerDownScroll.x - scroll.x;\n var scrollMoveY = this.pointerDownScroll.y - scroll.y;\n // cancel click/tap if scroll is too much\n if ( Math.abs( scrollMoveX ) > 3 || Math.abs( scrollMoveY ) > 3 ) {\n this._pointerDone();\n }\n};\n\n// ----- utils ----- //\n\nfunction getScrollPosition() {\n return {\n x: window.pageXOffset,\n y: window.pageYOffset,\n };\n}\n\n// ----- ----- //\n\nreturn Flickity;\n\n} ) );\n","// prev/next buttons\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n 'unipointer/unipointer',\n 'fizzy-ui-utils/utils',\n ], function( Flickity, Unipointer, utils ) {\n return factory( window, Flickity, Unipointer, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('./flickity'),\n require('unipointer'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n factory(\n window,\n window.Flickity,\n window.Unipointer,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, Flickity, Unipointer, utils ) {\n'use strict';\n\nvar svgURI = 'http://www.w3.org/2000/svg';\n\n// -------------------------- PrevNextButton -------------------------- //\n\nfunction PrevNextButton( direction, parent ) {\n this.direction = direction;\n this.parent = parent;\n this._create();\n}\n\nPrevNextButton.prototype = Object.create( Unipointer.prototype );\n\nPrevNextButton.prototype._create = function() {\n // properties\n this.isEnabled = true;\n this.isPrevious = this.direction == -1;\n var leftDirection = this.parent.options.rightToLeft ? 1 : -1;\n this.isLeft = this.direction == leftDirection;\n\n var element = this.element = document.createElement('button');\n element.className = 'flickity-button flickity-prev-next-button';\n element.className += this.isPrevious ? ' previous' : ' next';\n // prevent button from submitting form http://stackoverflow.com/a/10836076/182183\n element.setAttribute( 'type', 'button' );\n // init as disabled\n this.disable();\n\n element.setAttribute( 'aria-label', this.isPrevious ? 'Previous' : 'Next' );\n\n // create arrow\n var svg = this.createSVG();\n element.appendChild( svg );\n // events\n this.parent.on( 'select', this.update.bind( this ) );\n this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) );\n};\n\nPrevNextButton.prototype.activate = function() {\n this.bindStartEvent( this.element );\n this.element.addEventListener( 'click', this );\n // add to DOM\n this.parent.element.appendChild( this.element );\n};\n\nPrevNextButton.prototype.deactivate = function() {\n // remove from DOM\n this.parent.element.removeChild( this.element );\n // click events\n this.unbindStartEvent( this.element );\n this.element.removeEventListener( 'click', this );\n};\n\nPrevNextButton.prototype.createSVG = function() {\n var svg = document.createElementNS( svgURI, 'svg' );\n svg.setAttribute( 'class', 'flickity-button-icon' );\n svg.setAttribute( 'viewBox', '0 0 100 100' );\n var path = document.createElementNS( svgURI, 'path' );\n var pathMovements = getArrowMovements( this.parent.options.arrowShape );\n path.setAttribute( 'd', pathMovements );\n path.setAttribute( 'class', 'arrow' );\n // rotate arrow\n if ( !this.isLeft ) {\n path.setAttribute( 'transform', 'translate(100, 100) rotate(180) ' );\n }\n svg.appendChild( path );\n return svg;\n};\n\n// get SVG path movmement\nfunction getArrowMovements( shape ) {\n // use shape as movement if string\n if ( typeof shape == 'string' ) {\n return shape;\n }\n // create movement string\n return 'M ' + shape.x0 + ',50' +\n ' L ' + shape.x1 + ',' + ( shape.y1 + 50 ) +\n ' L ' + shape.x2 + ',' + ( shape.y2 + 50 ) +\n ' L ' + shape.x3 + ',50 ' +\n ' L ' + shape.x2 + ',' + ( 50 - shape.y2 ) +\n ' L ' + shape.x1 + ',' + ( 50 - shape.y1 ) +\n ' Z';\n}\n\nPrevNextButton.prototype.handleEvent = utils.handleEvent;\n\nPrevNextButton.prototype.onclick = function() {\n if ( !this.isEnabled ) {\n return;\n }\n this.parent.uiChange();\n var method = this.isPrevious ? 'previous' : 'next';\n this.parent[ method ]();\n};\n\n// ----- ----- //\n\nPrevNextButton.prototype.enable = function() {\n if ( this.isEnabled ) {\n return;\n }\n this.element.disabled = false;\n this.isEnabled = true;\n};\n\nPrevNextButton.prototype.disable = function() {\n if ( !this.isEnabled ) {\n return;\n }\n this.element.disabled = true;\n this.isEnabled = false;\n};\n\nPrevNextButton.prototype.update = function() {\n // index of first or last slide, if previous or next\n var slides = this.parent.slides;\n // enable is wrapAround and at least 2 slides\n if ( this.parent.options.wrapAround && slides.length > 1 ) {\n this.enable();\n return;\n }\n var lastIndex = slides.length ? slides.length - 1 : 0;\n var boundIndex = this.isPrevious ? 0 : lastIndex;\n var method = this.parent.selectedIndex == boundIndex ? 'disable' : 'enable';\n this[ method ]();\n};\n\nPrevNextButton.prototype.destroy = function() {\n this.deactivate();\n this.allOff();\n};\n\n// -------------------------- Flickity prototype -------------------------- //\n\nutils.extend( Flickity.defaults, {\n prevNextButtons: true,\n arrowShape: {\n x0: 10,\n x1: 60, y1: 50,\n x2: 70, y2: 40,\n x3: 30,\n },\n} );\n\nFlickity.createMethods.push('_createPrevNextButtons');\nvar proto = Flickity.prototype;\n\nproto._createPrevNextButtons = function() {\n if ( !this.options.prevNextButtons ) {\n return;\n }\n\n this.prevButton = new PrevNextButton( -1, this );\n this.nextButton = new PrevNextButton( 1, this );\n\n this.on( 'activate', this.activatePrevNextButtons );\n};\n\nproto.activatePrevNextButtons = function() {\n this.prevButton.activate();\n this.nextButton.activate();\n this.on( 'deactivate', this.deactivatePrevNextButtons );\n};\n\nproto.deactivatePrevNextButtons = function() {\n this.prevButton.deactivate();\n this.nextButton.deactivate();\n this.off( 'deactivate', this.deactivatePrevNextButtons );\n};\n\n// -------------------------- -------------------------- //\n\nFlickity.PrevNextButton = PrevNextButton;\n\nreturn Flickity;\n\n} ) );\n","// page dots\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n 'unipointer/unipointer',\n 'fizzy-ui-utils/utils',\n ], function( Flickity, Unipointer, utils ) {\n return factory( window, Flickity, Unipointer, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('./flickity'),\n require('unipointer'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n factory(\n window,\n window.Flickity,\n window.Unipointer,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, Flickity, Unipointer, utils ) {\n\n// -------------------------- PageDots -------------------------- //\n\n'use strict';\n\nfunction PageDots( parent ) {\n this.parent = parent;\n this._create();\n}\n\nPageDots.prototype = Object.create( Unipointer.prototype );\n\nPageDots.prototype._create = function() {\n // create holder element\n this.holder = document.createElement('ol');\n this.holder.className = 'flickity-page-dots';\n // create dots, array of elements\n this.dots = [];\n // events\n this.handleClick = this.onClick.bind( this );\n this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) );\n};\n\nPageDots.prototype.activate = function() {\n this.setDots();\n this.holder.addEventListener( 'click', this.handleClick );\n this.bindStartEvent( this.holder );\n // add to DOM\n this.parent.element.appendChild( this.holder );\n};\n\nPageDots.prototype.deactivate = function() {\n this.holder.removeEventListener( 'click', this.handleClick );\n this.unbindStartEvent( this.holder );\n // remove from DOM\n this.parent.element.removeChild( this.holder );\n};\n\nPageDots.prototype.setDots = function() {\n // get difference between number of slides and number of dots\n var delta = this.parent.slides.length - this.dots.length;\n if ( delta > 0 ) {\n this.addDots( delta );\n } else if ( delta < 0 ) {\n this.removeDots( -delta );\n }\n};\n\nPageDots.prototype.addDots = function( count ) {\n var fragment = document.createDocumentFragment();\n var newDots = [];\n var length = this.dots.length;\n var max = length + count;\n\n for ( var i = length; i < max; i++ ) {\n var dot = document.createElement('li');\n dot.className = 'dot';\n dot.setAttribute( 'aria-label', 'Page dot ' + ( i + 1 ) );\n fragment.appendChild( dot );\n newDots.push( dot );\n }\n\n this.holder.appendChild( fragment );\n this.dots = this.dots.concat( newDots );\n};\n\nPageDots.prototype.removeDots = function( count ) {\n // remove from this.dots collection\n var removeDots = this.dots.splice( this.dots.length - count, count );\n // remove from DOM\n removeDots.forEach( function( dot ) {\n this.holder.removeChild( dot );\n }, this );\n};\n\nPageDots.prototype.updateSelected = function() {\n // remove selected class on previous\n if ( this.selectedDot ) {\n this.selectedDot.className = 'dot';\n this.selectedDot.removeAttribute('aria-current');\n }\n // don't proceed if no dots\n if ( !this.dots.length ) {\n return;\n }\n this.selectedDot = this.dots[ this.parent.selectedIndex ];\n this.selectedDot.className = 'dot is-selected';\n this.selectedDot.setAttribute( 'aria-current', 'step' );\n};\n\nPageDots.prototype.onTap = // old method name, backwards-compatible\nPageDots.prototype.onClick = function( event ) {\n var target = event.target;\n // only care about dot clicks\n if ( target.nodeName != 'LI' ) {\n return;\n }\n\n this.parent.uiChange();\n var index = this.dots.indexOf( target );\n this.parent.select( index );\n};\n\nPageDots.prototype.destroy = function() {\n this.deactivate();\n this.allOff();\n};\n\nFlickity.PageDots = PageDots;\n\n// -------------------------- Flickity -------------------------- //\n\nutils.extend( Flickity.defaults, {\n pageDots: true,\n} );\n\nFlickity.createMethods.push('_createPageDots');\n\nvar proto = Flickity.prototype;\n\nproto._createPageDots = function() {\n if ( !this.options.pageDots ) {\n return;\n }\n this.pageDots = new PageDots( this );\n // events\n this.on( 'activate', this.activatePageDots );\n this.on( 'select', this.updateSelectedPageDots );\n this.on( 'cellChange', this.updatePageDots );\n this.on( 'resize', this.updatePageDots );\n this.on( 'deactivate', this.deactivatePageDots );\n};\n\nproto.activatePageDots = function() {\n this.pageDots.activate();\n};\n\nproto.updateSelectedPageDots = function() {\n this.pageDots.updateSelected();\n};\n\nproto.updatePageDots = function() {\n this.pageDots.setDots();\n};\n\nproto.deactivatePageDots = function() {\n this.pageDots.deactivate();\n};\n\n// ----- ----- //\n\nFlickity.PageDots = PageDots;\n\nreturn Flickity;\n\n} ) );\n","// player & autoPlay\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'ev-emitter/ev-emitter',\n 'fizzy-ui-utils/utils',\n './flickity',\n ], function( EvEmitter, utils, Flickity ) {\n return factory( EvEmitter, utils, Flickity );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n require('ev-emitter'),\n require('fizzy-ui-utils'),\n require('./flickity')\n );\n } else {\n // browser global\n factory(\n window.EvEmitter,\n window.fizzyUIUtils,\n window.Flickity\n );\n }\n\n}( window, function factory( EvEmitter, utils, Flickity ) {\n\n'use strict';\n\n// -------------------------- Player -------------------------- //\n\nfunction Player( parent ) {\n this.parent = parent;\n this.state = 'stopped';\n // visibility change event handler\n this.onVisibilityChange = this.visibilityChange.bind( this );\n this.onVisibilityPlay = this.visibilityPlay.bind( this );\n}\n\nPlayer.prototype = Object.create( EvEmitter.prototype );\n\n// start play\nPlayer.prototype.play = function() {\n if ( this.state == 'playing' ) {\n return;\n }\n // do not play if page is hidden, start playing when page is visible\n var isPageHidden = document.hidden;\n if ( isPageHidden ) {\n document.addEventListener( 'visibilitychange', this.onVisibilityPlay );\n return;\n }\n\n this.state = 'playing';\n // listen to visibility change\n document.addEventListener( 'visibilitychange', this.onVisibilityChange );\n // start ticking\n this.tick();\n};\n\nPlayer.prototype.tick = function() {\n // do not tick if not playing\n if ( this.state != 'playing' ) {\n return;\n }\n\n var time = this.parent.options.autoPlay;\n // default to 3 seconds\n time = typeof time == 'number' ? time : 3000;\n var _this = this;\n // HACK: reset ticks if stopped and started within interval\n this.clear();\n this.timeout = setTimeout( function() {\n _this.parent.next( true );\n _this.tick();\n }, time );\n};\n\nPlayer.prototype.stop = function() {\n this.state = 'stopped';\n this.clear();\n // remove visibility change event\n document.removeEventListener( 'visibilitychange', this.onVisibilityChange );\n};\n\nPlayer.prototype.clear = function() {\n clearTimeout( this.timeout );\n};\n\nPlayer.prototype.pause = function() {\n if ( this.state == 'playing' ) {\n this.state = 'paused';\n this.clear();\n }\n};\n\nPlayer.prototype.unpause = function() {\n // re-start play if paused\n if ( this.state == 'paused' ) {\n this.play();\n }\n};\n\n// pause if page visibility is hidden, unpause if visible\nPlayer.prototype.visibilityChange = function() {\n var isPageHidden = document.hidden;\n this[ isPageHidden ? 'pause' : 'unpause' ]();\n};\n\nPlayer.prototype.visibilityPlay = function() {\n this.play();\n document.removeEventListener( 'visibilitychange', this.onVisibilityPlay );\n};\n\n// -------------------------- Flickity -------------------------- //\n\nutils.extend( Flickity.defaults, {\n pauseAutoPlayOnHover: true,\n} );\n\nFlickity.createMethods.push('_createPlayer');\nvar proto = Flickity.prototype;\n\nproto._createPlayer = function() {\n this.player = new Player( this );\n\n this.on( 'activate', this.activatePlayer );\n this.on( 'uiChange', this.stopPlayer );\n this.on( 'pointerDown', this.stopPlayer );\n this.on( 'deactivate', this.deactivatePlayer );\n};\n\nproto.activatePlayer = function() {\n if ( !this.options.autoPlay ) {\n return;\n }\n this.player.play();\n this.element.addEventListener( 'mouseenter', this );\n};\n\n// Player API, don't hate the ... thanks I know where the door is\n\nproto.playPlayer = function() {\n this.player.play();\n};\n\nproto.stopPlayer = function() {\n this.player.stop();\n};\n\nproto.pausePlayer = function() {\n this.player.pause();\n};\n\nproto.unpausePlayer = function() {\n this.player.unpause();\n};\n\nproto.deactivatePlayer = function() {\n this.player.stop();\n this.element.removeEventListener( 'mouseenter', this );\n};\n\n// ----- mouseenter/leave ----- //\n\n// pause auto-play on hover\nproto.onmouseenter = function() {\n if ( !this.options.pauseAutoPlayOnHover ) {\n return;\n }\n this.player.pause();\n this.element.addEventListener( 'mouseleave', this );\n};\n\n// resume auto-play on hover off\nproto.onmouseleave = function() {\n this.player.unpause();\n this.element.removeEventListener( 'mouseleave', this );\n};\n\n// ----- ----- //\n\nFlickity.Player = Player;\n\nreturn Flickity;\n\n} ) );\n","// add, remove cell\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n 'fizzy-ui-utils/utils',\n ], function( Flickity, utils ) {\n return factory( window, Flickity, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('./flickity'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n factory(\n window,\n window.Flickity,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, Flickity, utils ) {\n\n'use strict';\n\n// append cells to a document fragment\nfunction getCellsFragment( cells ) {\n var fragment = document.createDocumentFragment();\n cells.forEach( function( cell ) {\n fragment.appendChild( cell.element );\n } );\n return fragment;\n}\n\n// -------------------------- add/remove cell prototype -------------------------- //\n\nvar proto = Flickity.prototype;\n\n/**\n * Insert, prepend, or append cells\n * @param {[Element, Array, NodeList]} elems - Elements to insert\n * @param {Integer} index - Zero-based number to insert\n */\nproto.insert = function( elems, index ) {\n var cells = this._makeCells( elems );\n if ( !cells || !cells.length ) {\n return;\n }\n var len = this.cells.length;\n // default to append\n index = index === undefined ? len : index;\n // add cells with document fragment\n var fragment = getCellsFragment( cells );\n // append to slider\n var isAppend = index == len;\n if ( isAppend ) {\n this.slider.appendChild( fragment );\n } else {\n var insertCellElement = this.cells[ index ].element;\n this.slider.insertBefore( fragment, insertCellElement );\n }\n // add to this.cells\n if ( index === 0 ) {\n // prepend, add to start\n this.cells = cells.concat( this.cells );\n } else if ( isAppend ) {\n // append, add to end\n this.cells = this.cells.concat( cells );\n } else {\n // insert in this.cells\n var endCells = this.cells.splice( index, len - index );\n this.cells = this.cells.concat( cells ).concat( endCells );\n }\n\n this._sizeCells( cells );\n this.cellChange( index, true );\n};\n\nproto.append = function( elems ) {\n this.insert( elems, this.cells.length );\n};\n\nproto.prepend = function( elems ) {\n this.insert( elems, 0 );\n};\n\n/**\n * Remove cells\n * @param {[Element, Array, NodeList]} elems - ELements to remove\n */\nproto.remove = function( elems ) {\n var cells = this.getCells( elems );\n if ( !cells || !cells.length ) {\n return;\n }\n\n var minCellIndex = this.cells.length - 1;\n // remove cells from collection & DOM\n cells.forEach( function( cell ) {\n cell.remove();\n var index = this.cells.indexOf( cell );\n minCellIndex = Math.min( index, minCellIndex );\n utils.removeFrom( this.cells, cell );\n }, this );\n\n this.cellChange( minCellIndex, true );\n};\n\n/**\n * logic to be run after a cell's size changes\n * @param {Element} elem - cell's element\n */\nproto.cellSizeChange = function( elem ) {\n var cell = this.getCell( elem );\n if ( !cell ) {\n return;\n }\n cell.getSize();\n\n var index = this.cells.indexOf( cell );\n this.cellChange( index );\n};\n\n/**\n * logic any time a cell is changed: added, removed, or size changed\n * @param {Integer} changedCellIndex - index of the changed cell, optional\n * @param {Boolean} isPositioningSlider - Positions slider after selection\n */\nproto.cellChange = function( changedCellIndex, isPositioningSlider ) {\n var prevSelectedElem = this.selectedElement;\n this._positionCells( changedCellIndex );\n this._getWrapShiftCells();\n this.setGallerySize();\n // update selectedIndex\n // try to maintain position & select previous selected element\n var cell = this.getCell( prevSelectedElem );\n if ( cell ) {\n this.selectedIndex = this.getCellSlideIndex( cell );\n }\n this.selectedIndex = Math.min( this.slides.length - 1, this.selectedIndex );\n\n this.emitEvent( 'cellChange', [ changedCellIndex ] );\n // position slider\n this.select( this.selectedIndex );\n // do not position slider after lazy load\n if ( isPositioningSlider ) {\n this.positionSliderAtSelected();\n }\n};\n\n// ----- ----- //\n\nreturn Flickity;\n\n} ) );\n","// lazyload\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n 'fizzy-ui-utils/utils',\n ], function( Flickity, utils ) {\n return factory( window, Flickity, utils );\n } );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('./flickity'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n factory(\n window,\n window.Flickity,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( window, Flickity, utils ) {\n'use strict';\n\nFlickity.createMethods.push('_createLazyload');\nvar proto = Flickity.prototype;\n\nproto._createLazyload = function() {\n this.on( 'select', this.lazyLoad );\n};\n\nproto.lazyLoad = function() {\n var lazyLoad = this.options.lazyLoad;\n if ( !lazyLoad ) {\n return;\n }\n // get adjacent cells, use lazyLoad option for adjacent count\n var adjCount = typeof lazyLoad == 'number' ? lazyLoad : 0;\n var cellElems = this.getAdjacentCellElements( adjCount );\n // get lazy images in those cells\n var lazyImages = [];\n cellElems.forEach( function( cellElem ) {\n var lazyCellImages = getCellLazyImages( cellElem );\n lazyImages = lazyImages.concat( lazyCellImages );\n } );\n // load lazy images\n lazyImages.forEach( function( img ) {\n new LazyLoader( img, this );\n }, this );\n};\n\nfunction getCellLazyImages( cellElem ) {\n // check if cell element is lazy image\n if ( cellElem.nodeName == 'IMG' ) {\n var lazyloadAttr = cellElem.getAttribute('data-flickity-lazyload');\n var srcAttr = cellElem.getAttribute('data-flickity-lazyload-src');\n var srcsetAttr = cellElem.getAttribute('data-flickity-lazyload-srcset');\n if ( lazyloadAttr || srcAttr || srcsetAttr ) {\n return [ cellElem ];\n }\n }\n // select lazy images in cell\n var lazySelector = 'img[data-flickity-lazyload], ' +\n 'img[data-flickity-lazyload-src], img[data-flickity-lazyload-srcset]';\n var imgs = cellElem.querySelectorAll( lazySelector );\n return utils.makeArray( imgs );\n}\n\n// -------------------------- LazyLoader -------------------------- //\n\n/**\n * class to handle loading images\n * @param {Image} img - Image element\n * @param {Flickity} flickity - Flickity instance\n */\nfunction LazyLoader( img, flickity ) {\n this.img = img;\n this.flickity = flickity;\n this.load();\n}\n\nLazyLoader.prototype.handleEvent = utils.handleEvent;\n\nLazyLoader.prototype.load = function() {\n this.img.addEventListener( 'load', this );\n this.img.addEventListener( 'error', this );\n // get src & srcset\n var src = this.img.getAttribute('data-flickity-lazyload') ||\n this.img.getAttribute('data-flickity-lazyload-src');\n var srcset = this.img.getAttribute('data-flickity-lazyload-srcset');\n // set src & serset\n this.img.src = src;\n if ( srcset ) {\n this.img.setAttribute( 'srcset', srcset );\n }\n // remove attr\n this.img.removeAttribute('data-flickity-lazyload');\n this.img.removeAttribute('data-flickity-lazyload-src');\n this.img.removeAttribute('data-flickity-lazyload-srcset');\n};\n\nLazyLoader.prototype.onload = function( event ) {\n this.complete( event, 'flickity-lazyloaded' );\n};\n\nLazyLoader.prototype.onerror = function( event ) {\n this.complete( event, 'flickity-lazyerror' );\n};\n\nLazyLoader.prototype.complete = function( event, className ) {\n // unbind events\n this.img.removeEventListener( 'load', this );\n this.img.removeEventListener( 'error', this );\n\n var cell = this.flickity.getParentCell( this.img );\n var cellElem = cell && cell.element;\n this.flickity.cellSizeChange( cellElem );\n\n this.img.classList.add( className );\n this.flickity.dispatchEvent( 'lazyLoad', event, cellElem );\n};\n\n// ----- ----- //\n\nFlickity.LazyLoader = LazyLoader;\n\nreturn Flickity;\n\n} ) );\n","/*!\n * Flickity v2.3.0\n * Touch, responsive, flickable carousels\n *\n * Licensed GPLv3 for open source use\n * or Flickity Commercial License for commercial use\n *\n * https://flickity.metafizzy.co\n * Copyright 2015-2021 Metafizzy\n */\n\n( function( window, factory ) {\n // universal module definition\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n './flickity',\n './drag',\n './prev-next-button',\n './page-dots',\n './player',\n './add-remove-cell',\n './lazyload',\n ], factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n require('./flickity'),\n require('./drag'),\n require('./prev-next-button'),\n require('./page-dots'),\n require('./player'),\n require('./add-remove-cell'),\n require('./lazyload')\n );\n }\n\n} )( window, function factory( Flickity ) {\n return Flickity;\n} );\n","/*!\n * Flickity asNavFor v2.0.1\n * enable asNavFor for Flickity\n */\n\n/*jshint browser: true, undef: true, unused: true, strict: true*/\n\n( function( window, factory ) {\n // universal module definition\n /*jshint strict: false */ /*globals define, module, require */\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'flickity/js/index',\n 'fizzy-ui-utils/utils'\n ], factory );\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n require('flickity'),\n require('fizzy-ui-utils')\n );\n } else {\n // browser global\n window.Flickity = factory(\n window.Flickity,\n window.fizzyUIUtils\n );\n }\n\n}( window, function factory( Flickity, utils ) {\n\n'use strict';\n\n// -------------------------- asNavFor prototype -------------------------- //\n\n// Flickity.defaults.asNavFor = null;\n\nFlickity.createMethods.push('_createAsNavFor');\n\nvar proto = Flickity.prototype;\n\nproto._createAsNavFor = function() {\n this.on( 'activate', this.activateAsNavFor );\n this.on( 'deactivate', this.deactivateAsNavFor );\n this.on( 'destroy', this.destroyAsNavFor );\n\n var asNavForOption = this.options.asNavFor;\n if ( !asNavForOption ) {\n return;\n }\n // HACK do async, give time for other flickity to be initalized\n var _this = this;\n setTimeout( function initNavCompanion() {\n _this.setNavCompanion( asNavForOption );\n });\n};\n\nproto.setNavCompanion = function( elem ) {\n elem = utils.getQueryElement( elem );\n var companion = Flickity.data( elem );\n // stop if no companion or companion is self\n if ( !companion || companion == this ) {\n return;\n }\n\n this.navCompanion = companion;\n // companion select\n var _this = this;\n this.onNavCompanionSelect = function() {\n _this.navCompanionSelect();\n };\n companion.on( 'select', this.onNavCompanionSelect );\n // click\n this.on( 'staticClick', this.onNavStaticClick );\n\n this.navCompanionSelect( true );\n};\n\nproto.navCompanionSelect = function( isInstant ) {\n if ( !this.navCompanion ) {\n return;\n }\n // select slide that matches first cell of slide\n var selectedCell = this.navCompanion.selectedCells[0];\n var firstIndex = this.navCompanion.cells.indexOf( selectedCell );\n var lastIndex = firstIndex + this.navCompanion.selectedCells.length - 1;\n var selectIndex = Math.floor( lerp( firstIndex, lastIndex,\n this.navCompanion.cellAlign ) );\n this.selectCell( selectIndex, false, isInstant );\n // set nav selected class\n this.removeNavSelectedElements();\n // stop if companion has more cells than this one\n if ( selectIndex >= this.cells.length ) {\n return;\n }\n\n var selectedCells = this.cells.slice( firstIndex, lastIndex + 1 );\n this.navSelectedElements = selectedCells.map( function( cell ) {\n return cell.element;\n });\n this.changeNavSelectedClass('add');\n};\n\nfunction lerp( a, b, t ) {\n return ( b - a ) * t + a;\n}\n\nproto.changeNavSelectedClass = function( method ) {\n this.navSelectedElements.forEach( function( navElem ) {\n navElem.classList[ method ]('is-nav-selected');\n });\n};\n\nproto.activateAsNavFor = function() {\n this.navCompanionSelect( true );\n};\n\nproto.removeNavSelectedElements = function() {\n if ( !this.navSelectedElements ) {\n return;\n }\n this.changeNavSelectedClass('remove');\n delete this.navSelectedElements;\n};\n\nproto.onNavStaticClick = function( event, pointer, cellElement, cellIndex ) {\n if ( typeof cellIndex == 'number' ) {\n this.navCompanion.selectCell( cellIndex );\n }\n};\n\nproto.deactivateAsNavFor = function() {\n this.removeNavSelectedElements();\n};\n\nproto.destroyAsNavFor = function() {\n if ( !this.navCompanion ) {\n return;\n }\n this.navCompanion.off( 'select', this.onNavCompanionSelect );\n this.off( 'staticClick', this.onNavStaticClick );\n delete this.navCompanion;\n};\n\n// ----- ----- //\n\nreturn Flickity;\n\n}));\n","/**\n * Functions are placed here for better encapsulation and readability of the main codebase. This helps to isolate them\n * from the DOM API of the implemented web component (particularly if they are static and do not need access to instance\n * level information, i.e. they do not call \"this\").\n */\n\n\n/**\n * Extracted from svelte's internal API @ src/runtime/internal/dom.js\n *\n * @param {Node} target\n * @param {Node} node\n * @param {Node} [anchor]\n * @returns {void}\n */\nfunction insert(target, node, anchor) {\n\ttarget.insertBefore(node, anchor || null);\n}\n\n\n/**\n * Extracted from svelte's internal API @ src/runtime/internal/dom.js\n *\n * @param {Node} node\n * @returns {void}\n */\nfunction detach(node) {\n\tif (node.parentNode) {\n\t\tnode.parentNode.removeChild(node);\n\t}\n}\n\n\n/**\n * Creates an object where each property represents the slot name and each value represents a Svelte-specific slot\n * object containing the lifecycle hooks for each slot. This wraps our slot elements and is passed to Svelte itself.\n *\n * Much of this witchcraft is from svelte issue - https://github.com/sveltejs/svelte/issues/2588\n */\nexport function createSvelteSlots(slots) {\n\tconst svelteSlots = {};\n\tfor(const slotName in slots) {\n\t\tsvelteSlots[slotName] = [createSlotFn(slots[slotName])];\n\t}\n\n\tfunction createSlotFn(element) {\n\t\treturn function() {\n\t\t\treturn {\n\t\t\t\tc: function() {}, // noop\n\t\t\t\tm: function mount(target, anchor) {\n\t\t\t\t\tinsert(target, element.cloneNode(true), anchor);\n\t\t\t\t},\n\t\t\t\td: function destroy(detaching) {\n\t\t\t\t\tif (detaching) {\n\t\t\t\t\t\tdetach(element);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tl: function() {}, // noop\n\t\t\t};\n\t\t};\n\t}\n\n\treturn svelteSlots;\n}\n\n\n/**\n * Traverses DOM to find the first custom element that the provided element happens to belong to.\n *\n * @param {Element} slot\n * @returns {HTMLElement|null}\n */\nexport function findSlotParent(slot) {\n\tlet parentEl = slot.parentElement;\n\twhile(parentEl) {\n\t\tif (parentEl.tagName.indexOf('-') !== -1) return parentEl;\n\t\tparentEl = parentEl.parentElement;\n\t}\n\treturn null;\n}\n\n\n/**\n * Carefully \"unwraps\" the custom element tag itself from its default slot content (particularly if that content\n * is just a text node). Only used when not using shadow root.\n *\n * @param {HTMLElement} from\n *\n * @returns {DocumentFragment}\n */\nexport function unwrap(from) {\n\tlet node = document.createDocumentFragment();\n\twhile(from.firstChild) {\n\t\tnode.appendChild(from.firstChild);\n\t}\n\treturn node;\n}\n","import { createSvelteSlots, findSlotParent, unwrap } from './utils.js';\n\n\n/**\n * Tracks the mapping of case-insensitive attributes to case-sensitive component props on a per-tag basis. Setup as a\n * global cache so we can avoid setting up a Proxy on every single component render but also to assist in mapping during\n * hits to attributeChangedCallback().\n */\nconst propMapCache = new Map();\n\n\n/**\n * Mutation observer must be used to track changes to attributes on our custom elements, since we cannot know the\n * component props ahead of time (required if we were to use observedAttributes instead). In this case, only one\n * observer is necessary, since each call to .observe() can have a different \"attributeFilter\" specified.\n * NOTE: We can .observe() many separate elements and don't have to .disconnect() each one individually, since if the\n * element being observed is removed from the DOM and released by the garbage collector, the MutationObserver will\n * stop observing the removed element automatically.\n */\nconst attributeObserver = new MutationObserver((mutations) => {\n\t// Go through each mutation and forward the updated attribute value to the corresponding Svelte prop.\n\tmutations.forEach(mutation => {\n\t\tconst element = mutation.target;\n\t\tconst attributeName = mutation.attributeName;\n\t\tconst newValue = element.getAttribute(attributeName);\n\t\telement.forwardAttributeToProp(attributeName, newValue);\n\t});\n});\n\n\n/**\n * Processes the queued set of svelte-retag managed elements which have been initialized, connected and flagged as ready\n * for render. This is done just before paint with the goal of processing as many as possible at once not only for speed\n * but also to ensure we can render properly from the top down (parent to child). This is necessary, as the actual\n * construct() and connectedCallback()'s for custom elements depends largely on *when* the elements are defined and\n * encountered in the DOM (can be in any order). This allows us to better control that process.\n *\n * @param {number} timestamp\n */\n// eslint-disable-next-line no-unused-vars\nfunction renderElements(timestamp) {\n\t// This is key: Fetches elements in document order so we can render top-down (for context).\n\tlet renderQueue = document.querySelectorAll('[data-svelte-retag-render]');\n\tif (renderQueue.length === 0) {\n\t\t// TODO: Consider build of svelte-retag so we can drop console.logs() when publishing without having to comment out. See: https://github.com/vitejs/vite/discussions/7920\n\t\t//console.debug(`renderElements(${timestamp}): returned, queue is now empty`);\n\t\treturn;\n\t}\n\n\tfor(let element of renderQueue) {\n\t\t// Element was queued but likely rearranged due to the parent rendering first (resulting in a new instance and this\n\t\t// being forever orphaned).\n\t\tif (!element.isConnected) {\n\t\t\t//console.debug(`renderElements(${timestamp}): skipped, already disconnected:`, element);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Quick double check: Skip any which have *light* DOM parents that are queued for render. See _queueForRender() for details.\n\t\tif (element.parentElement.closest('[data-svelte-retag-render=\"light\"]') === null) {\n\t\t\telement.removeAttribute('data-svelte-retag-render');\n\t\t\telement._renderSvelteComponent();\n\t\t} else {\n\t\t\t//console.debug(`renderElements(${timestamp}): skipped, light DOM parent is queued for render:`, element);\n\t\t}\n\t}\n}\n\n\n/**\n * @typedef {new(...args: any[]) => any} Newable Type alias for a really generic class constructor\n * @typedef {Newable} CmpConstructor Svelte component class constructor (basically a \"newable\" object)\n */\n\n/**\n * @typedef {object} SvelteRetagOptions Configuration options for svelte-retag. See README.md for details.\n *\n * @property {CmpConstructor} component The Svelte component *class* constructor to incorporate into your custom element (this is the imported component class, *not* an instance)\n * @property {string} tagname Name of the custom element tag you'd like to define.\n * @property {string[]|boolean} [attributes=[]] Optional array of attributes that should be reactively forwarded to the component when modified. Set to true to automatically watch all attributes.\n * @property {boolean|string[]} [ignoreCommonAttribWarnings=false] Suppresses warnings in development mode about common attributes (such as \"id\", \"class\" and \"data-*\") if they don't already exist on the component. Set to an array to customize the list of ignored attributes.\n * @property {boolean} [shadow=false] Indicates if we should build the component in the shadow root instead of in the regular (\"light\") DOM.\n * @property {string} [href=\"\"] URL to the CSS stylesheet to incorporate into the shadow DOM (if enabled).\n *\n * Experimental:\n * @property {boolean} [hydratable=false] EXPERIMENTAL. Light DOM slot hydration (specific to svelte-retag): Enables\n * \t pre-rendering of the web component (e.g. SSR) by adding extra markers\n * \t (attributes & wrappers) during rendering to enable svelte-retag to find and\n * \t restore light DOM slots when restoring interactivity. See README.md for more.\n * @property {boolean|'cli'} [debugMode=false] Hidden option to enable debugging for package development purposes.\n *\n */\n\n/**\n * Please see README.md for usage information.\n *\n * @param {SvelteRetagOptions} opts Configuration options for svelte-retag. See README.md for details.\n */\nexport default function svelteRetag(opts) {\n\t/**\n\t * Reserves our special custom element container which is used to wrap Svelte components.\n\t *\n\t * When performing light DOM rendering, this provides the opportunity to isolate the slot content away from the HTML\n\t * rendered by the component itself. This is particularly necessary if we're executing early (e.g. via IIFE formatted\n\t * bundles and not via native ESM modules, which are deferred) since we need to rerender the component as the parser\n\t * progresses along the current element's slot content. This ultimately reduces (if not eliminates) the typical\n\t * cumulative layout shift (CLS) seen when injecting components into the DOM like this (especially noticeable on\n\t * initial page loads). That CLS typically occurs because ESM modules are deferred (as noted above) but also because\n\t * it's difficult to know what the correct/final slot content will be until after the parser has rendered the DOM for\n\t * us.\n\t *\n\t * When performing shadow DOM rendering, it provides an un-styled container where we can attach the Svelte component\n\t * once it begins rendering.\n\t */\n\tif (!window.customElements.get('svelte-retag')) {\n\t\twindow.customElements.define('svelte-retag', class extends HTMLElement {\n\t\t\t// noop\n\t\t});\n\n\t\t// When the 'hydratable' option is enabled, this special wrapper will be applied around default slot content so\n\t\t// that it can be discovered and restored later after pre-rendering. NOTE: This tag is always available since\n\t\t// we can always hydrate. It is only applied to rendered content if elected for a particular component.\n\t\twindow.customElements.define('svelte-retag-default', class extends HTMLElement {\n\t\t\t// noop\n\t\t});\n\t}\n\n\t// Filter for dynamically ignoring errors when using common attributes which might potentially be on a custom element\n\t// but ALSO aren't already explicitly defined on the Svelte component. Default to false but allow user to enable.\n\tlet ignoreAttribFilter = () => false;\n\tif (opts?.ignoreCommonAttribWarnings === true) {\n\t\tignoreAttribFilter = (name) => {\n\t\t\treturn (name === 'id' || name === 'class' || name === 'style' || name.startsWith('data-'));\n\t\t};\n\t} else if (Array.isArray(opts.ignoreCommonAttribWarnings)) {\n\t\tignoreAttribFilter = (name) => {\n\t\t\treturn opts.ignoreCommonAttribWarnings.includes(name);\n\t\t};\n\t}\n\n\t/**\n\t * Object containing keys pointing to slots: Either an actual element or a document fragment created to wrap\n\t * default slot content.\n\t *\n\t * @typedef {Object.} SlotList\n\t */\n\n\t/**\n\t * Defines the actual custom element responsible for rendering the provided Svelte component.\n\t */\n\twindow.customElements.define(opts.tagname, class extends HTMLElement {\n\t\tconstructor() {\n\t\t\tsuper();\n\n\t\t\tthis._debug('constructor()');\n\n\t\t\t// New instances, attributes not yet being observed.\n\t\t\tthis.attributesObserved = false;\n\n\n\t\t\t// Setup shadow root early (light-DOM root is initialized in connectedCallback() below).\n\t\t\tif (opts.shadow) {\n\t\t\t\tthis.attachShadow({ mode: 'open' });\n\t\t\t\t// TODO: Better than
, but: Is a wrapper entirely necessary? Why not just set this._root = this.shadowRoot?\n\t\t\t\tthis._root = document.createElement('svelte-retag');\n\t\t\t\tthis.shadowRoot.appendChild(this._root);\n\n\t\t\t\t// Link generated style. Do early as possible to ensure we start downloading CSS (reduces FOUC).\n\t\t\t\tif (opts.href) {\n\t\t\t\t\tlet link = document.createElement('link');\n\t\t\t\t\tlink.setAttribute('href', opts.href);\n\t\t\t\t\tlink.setAttribute('rel', 'stylesheet');\n\t\t\t\t\tthis.shadowRoot.appendChild(link);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Attributes we're watching for changes after render (doesn't affect attributes already present prior to render).\n\t\t *\n\t\t * NOTE: This only applies if opts.attributes is an array. If opts.attributes is true, then all attributes are\n\t\t * watched using the mutation observer instead.\n\t\t *\n\t\t * @returns string[]\n\t\t */\n\t\tstatic get observedAttributes() {\n\t\t\tif (Array.isArray(opts.attributes)) {\n\t\t\t\t// User defined an explicit list or nothing at all.\n\t\t\t\treturn opts.attributes;\n\t\t\t} else {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Attached to DOM.\n\t\t */\n\t\tconnectedCallback() {\n\t\t\tthis._debug('connectedCallback()');\n\n\t\t\t/**\n\t\t\t * TODO: Light DOM: Potential optimization opportunities:\n\t\t\t * 1. Don't bother setting up wrapper if the component doesn't have a default slot and isn't hydratable\n\t\t\t * 2. Don't setup wrapper if we don't end up processing mutations (i.e. document not in loading state).\n\t\t\t * If this happens though, we must only setup/destroy in connected/disconnected callbacks and thus anything that\n\t\t\t * depends upon it needs a separate method of determining. Maybe getter that checks if this._root.tagName === 'SVELTE-RETAG'?\n\t\t\t */\n\n\t\t\t// Initialize the slot elements object which retains a reference to the original elements (by slot name) so they\n\t\t\t// can be restored later on disconnectedCallback(). Also useful for debugging purposes.\n\t\t\tthis.slotEls = {};\n\n\t\t\t// If compiled as IIFE/UMD and executed early, then the document is likely to be in the process of loading\n\t\t\t// and thus actively parsing tags, including not only this tag but also nested content (which may not yet be\n\t\t\t// available).\n\t\t\tconst isLoading = (document.readyState === 'loading');\n\n\t\t\t// Setup the special wrapper if not already present (which can happen when\n\t\t\t// disconnected/reconnected due to being in a slot).\n\t\t\tif (!opts.shadow) {\n\t\t\t\t// See if this component is pre-rendered and flagged as able to hydrate slots from the light DOM root.\n\t\t\t\tif (this.hasAttribute('data-svelte-retag-hydratable')) {\n\t\t\t\t\tif (isLoading) {\n\t\t\t\t\t\t// Wait for the slots to become fully available.\n\t\t\t\t\t\t// NOTE: We expect wrapper to already be present, however it may not be\n\t\t\t\t\t\t// accessible until after the browser has finished parsing the DOM.\n\t\t\t\t\t\tthis._onSlotsReady(() => {\n\t\t\t\t\t\t\tthis._initLightRoot();\n\t\t\t\t\t\t\tthis._hydrateLightSlots();\n\t\t\t\t\t\t\tthis._queueForRender();\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Light DOM slots are already all available, so hydrate them now and allow Svelte component\n\t\t\t\t\t\t// rendering to proceed normally below.\n\t\t\t\t\t\tthis._initLightRoot();\n\t\t\t\t\t\tthis._hydrateLightSlots();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Setup the wrapper now since we don't have to worry about hydration.\n\t\t\t\t\tthis._initLightRoot();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Watch for changes to slot elements and ensure they're reflected in the Svelte component.\n\t\t\tif (opts.shadow) {\n\t\t\t\tthis._observeSlots(true);\n\t\t\t} else {\n\t\t\t\tif (isLoading) {\n\t\t\t\t\t// Setup the mutation observer to watch content as parser progresses through the HTML and adds nodes under\n\t\t\t\t\t// this element. However, since this is only useful in light DOM elements *during* parsing, we should be sure\n\t\t\t\t\t// to stop observing once the HTML is fully parsed and loaded.\n\t\t\t\t\tthis._observeSlots(true);\n\t\t\t\t\tthis._onSlotsReady(() => {\n\t\t\t\t\t\tthis._observeSlots(false);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Now that we're connected to the DOM, we can render the component now.\n\t\t\tthis._queueForRender();\n\n\t\t\t// If we want to enable the current component as hydratable, add the flag now that it has been fully\n\t\t\t// rendered (now that slots have been located under the Svelte component). This attribute is important since\n\t\t\t// it allows us to know immediately that this component is capable of being hydrated (useful if compiled and\n\t\t\t// executed as IIFE/UMD).\n\t\t\tif (opts.hydratable) {\n\t\t\t\tthis.setAttribute('data-svelte-retag-hydratable', '');\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Removed from DOM (could be called inside another custom element that starts rendering after this one). In that\n\t\t * situation, the connectedCallback() will be executed again (most likely with constructor() as well, unfortunately).\n\t\t */\n\t\tdisconnectedCallback() {\n\t\t\tthis._debug('disconnectedCallback()');\n\n\t\t\t// Remove render flag (if present). This could happen in case the element is disconnected while waiting to render\n\t\t\t// (particularly if slotted under a light DOM parent).\n\t\t\tthis.removeAttribute('data-svelte-retag-render');\n\n\t\t\t// Remove hydration flag, if present. This component will be able to be rendered from scratch instead.\n\t\t\tthis.removeAttribute('data-svelte-retag-hydratable');\n\n\t\t\t// Disconnect slot mutation observer (if it's currently active).\n\t\t\tthis._observeSlots(false);\n\n\t\t\t// Double check that element has been initialized already. This could happen in case connectedCallback() hasn't\n\t\t\t// fully completed yet (e.g. if initialization is async)\n\t\t\tif (this.componentInstance) {\n\t\t\t\ttry {\n\t\t\t\t\t// Clean up: Destroy Svelte component when removed from DOM.\n\t\t\t\t\tthis.componentInstance.$destroy();\n\t\t\t\t\tdelete this.componentInstance;\n\t\t\t\t} catch(err) {\n\t\t\t\t\tconsole.error(`Error destroying Svelte component in '${this.tagName}'s disconnectedCallback(): ${err}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!opts.shadow) {\n\t\t\t\t// Restore slots back to the light DOM in case we're just being appended elsewhere (likely if we're nested under\n\t\t\t\t// another custom element that initializes after this custom element, thus causing *another* round of\n\t\t\t\t// construct/connectedCallback on this one).\n\t\t\t\tthis._restoreLightSlots();\n\n\t\t\t\t// Lastly, unwinding everything in reverse: Remove the \"light\" DOM root (the special wrapper) which\n\t\t\t\t// is only added during connectedCallback(), unlike shadow DOM which is attached in construct.\n\t\t\t\tthis.removeChild(this._root);\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Callback/hook for observedAttributes.\n\t\t *\n\t\t * @param {string} name\n\t\t * @param {string} oldValue\n\t\t * @param {string} newValue\n\t\t */\n\t\tattributeChangedCallback(name, oldValue, newValue) {\n\t\t\tthis._debug('attributes changed', { name, oldValue, newValue });\n\t\t\tthis.forwardAttributeToProp(name, newValue);\n\t\t}\n\n\t\t/**\n\t\t * Forward modifications to element attributes to the corresponding Svelte prop (if applicable).\n\t\t *\n\t\t * @param {string} name\n\t\t * @param {string} value\n\t\t */\n\t\tforwardAttributeToProp(name, value) {\n\t\t\tthis._debug('forwardAttributeToProp', { name, value });\n\n\t\t\t// If instance already available, pass it through immediately.\n\t\t\tif (this.componentInstance) {\n\t\t\t\tlet translatedName = this._translateAttribute(name);\n\t\t\t\tif (translatedName !== null) {\n\t\t\t\t\tthis.componentInstance.$set({ [translatedName]: value });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Setup a wrapper in the light DOM which can keep the rendered Svelte component separate from the default Slot\n\t\t * content, which is potentially being actively appended (at least while the browser parses during loading).\n\t\t */\n\t\t_initLightRoot() {\n\t\t\t// Recycle the existing light DOM root, if already present.\n\t\t\tlet existingRoot = this.querySelector('svelte-retag');\n\t\t\tif (existingRoot !== null && existingRoot.parentElement === this) {\n\t\t\t\tthis._debug('_initLightRoot(): Restore from existing light DOM root');\n\t\t\t\tthis._root = existingRoot;\n\t\t\t} else {\n\t\t\t\t// Setup new (first time).\n\t\t\t\tthis._root = document.createElement('svelte-retag');\n\t\t\t\tthis.prepend(this._root);\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Queues the provided callback to execute when we think all slots are fully loaded and available to fetch and\n\t\t * manipulate.\n\t\t *\n\t\t * @param {callback} callback\n\t\t */\n\t\t_onSlotsReady(callback) {\n\t\t\tdocument.addEventListener('readystatechange', () => {\n\t\t\t\tif (document.readyState === 'interactive') {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Converts the provided lowercase attribute name to the correct case-sensitive component prop name, if possible.\n\t\t *\n\t\t * @param {string} attributeName\n\t\t * @returns {string|null}\n\t\t */\n\t\t_translateAttribute(attributeName) {\n\t\t\t// In the unlikely scenario that a browser somewhere doesn't do this for us (or maybe we're in a quirks mode or something...)\n\t\t\tattributeName = attributeName.toLowerCase();\n\t\t\tif (this.propMap && this.propMap.has(attributeName)) {\n\t\t\t\treturn this.propMap.get(attributeName);\n\t\t\t} else {\n\t\t\t\t// Return it unchanged but only if it's not in our \"ignore attributes\" filter.\n\t\t\t\tif (!ignoreAttribFilter(attributeName)) {\n\t\t\t\t\tthis._debug(`_translateAttribute(): ${attributeName} not found on component, keeping unchanged`);\n\t\t\t\t\treturn attributeName;\n\t\t\t\t} else {\n\t\t\t\t\t// Ignored.\n\t\t\t\t\tthis._debug(`_translateAttribute(): ${attributeName} matched ignore filter, skipping entirely`);\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * To support context, this traverses the DOM to find potential parent elements (also managed by svelte-retag) which\n\t\t * may contain context necessary to render this component.\n\t\t *\n\t\t * See context functions at: https://svelte.dev/docs/svelte#setcontext\n\t\t *\n\t\t * @returns {Map|null}\n\t\t */\n\t\t_getAncestorContext() {\n\t\t\tlet node = this;\n\t\t\twhile(node.parentNode) {\n\t\t\t\tnode = node.parentNode;\n\t\t\t\tlet context = node?.componentInstance?.$$?.context;\n\t\t\t\tif (context instanceof Map) {\n\t\t\t\t\treturn context;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\t/**\n\t\t * Queue this element for render in the next animation frame. This offers the opportunity to render known available\n\t\t * elements all at once and, ideally, from the top down (to preserve context).\n\t\t */\n\t\t_queueForRender() {\n\t\t\t// No point if already disconnected. Attempting to hit the parent element will trigger an error.\n\t\t\tif (!this.isConnected) {\n\t\t\t\tthis._debug('queueForRender(): skipped, already disconnected');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip the queue if a parent is already queued for render, but for the light DOM only. This is because if it's in the\n\t\t\t// light DOM slot, it will be disconnected and reconnected again (which will then also trigger a need to render).\n\t\t\tif (this.parentElement.closest('[data-svelte-retag-render=\"light\"]') !== null) {\n\t\t\t\tthis._debug('queueForRender(): skipped, light DOM parent is queued for render');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// When queuing for render, it's also necessary to identify the DOM rendering type. This is necessary for child\n\t\t\t// components which are *underneath* a parent that is using light DOM rendering (see above). This helps to ensure\n\t\t\t// rendering is performed in the correct order (useful for things like context).\n\t\t\tthis.setAttribute('data-svelte-retag-render', opts.shadow ? 'shadow' : 'light');\n\t\t\trequestAnimationFrame(renderElements);\n\t\t}\n\n\t\t/**\n\t\t * Renders (or rerenders) the Svelte component into this custom element based on the latest properties and slots\n\t\t * (with slots initialized elsewhere).\n\t\t *\n\t\t * IMPORTANT:\n\t\t *\n\t\t * Despite the intuitive name, this method is private since its functionality requires a deeper understanding\n\t\t * of how it depends on current internal state and how it alters internal state. Be sure to study how it's called\n\t\t * before calling it yourself externally. (\"Yarrr! Here be dragons! 🔥🐉\")\n\t\t *\n\t\t * That said... this is currently the workflow:\n\t\t *\n\t\t * 1. Wait for connection to DOM\n\t\t * 2. Ensure slots are properly prepared (e.g. in case of hydration) or observed (in case actively parsing DOM, e.g.\n\t\t * IIFE/UMD or shadow DOM) in case there are any changes *after* this render\n\t\t * 3. _queueForRender(): Kick off to requestAnimationFrame() to queue render of the component (instead of rendering\n\t\t * immediately) to ensure that all currently connected and available components are taken into account (this is\n\t\t * necessary for properly supporting context to prevent from initializing components out of order).\n\t\t * 4. renderElements(): Renders through the DOM tree in document order and from the top down (parent to child),\n\t\t * reaching this element instantiating this component, ensuring context is preserved.\n\t\t *\n\t\t */\n\t\t_renderSvelteComponent() {\n\t\t\tthis._debug('renderSvelteComponent()');\n\n\t\t\t// Fetch the latest set of available slot elements to use in the render. For light DOM, this must be done prior\n\t\t\t// to clearing inner HTML below since the slots exist there.\n\t\t\tif (opts.shadow) {\n\t\t\t\tthis.slotEls = this._getShadowSlots();\n\t\t\t} else {\n\t\t\t\tthis.slotEls = this._getLightSlots();\n\t\t\t}\n\n\t\t\t// On each rerender, we have to reset our root container since Svelte will just append to our target.\n\t\t\tthis._root.innerHTML = '';\n\n\t\t\t// Prep context, which is an important dependency prior to ANY instantiation of the Svelte component.\n\t\t\tconst context = this._getAncestorContext() || new Map();\n\n\t\t\t// Props always passed to Svelte component constructor.\n\t\t\tlet props = {\n\t\t\t\t$$scope: {},\n\n\t\t\t\t// Convert our list of slots into Svelte-specific slot objects\n\t\t\t\t$$slots: createSvelteSlots(this.slotEls),\n\n\t\t\t\t// All other *initial* props are pulled dynamically from element attributes (see proxy below)...\n\t\t\t};\n\n\t\t\t// Conveying props while translating them FROM a case-insensitive form like attributes (which are forced\n\t\t\t// case-insensitive) TO a case-sensitive form (which is required by the component) can be very tricky. This is\n\t\t\t// because we really cannot know the correct case until AFTER the component is instantiated. Therefore, a proxy is\n\t\t\t// a great way to infer the correct case, since by design, all components attempt to access ALL their props when\n\t\t\t// instantiated. Once accessed the first time for a particular tag, we no longer need to proxy since we know for\n\t\t\t// certain that the same tag will be used for any particular component (whose props will not change).\n\t\t\tif (!propMapCache.has(this.tagName)) {\n\t\t\t\t// Initialize mapping of props for this tag for use later. This way, we can avoid proxying on every single\n\t\t\t\t// component render/instantiation but also for attributeChangedCallback().\n\t\t\t\tthis.propMap = new Map();\n\t\t\t\tpropMapCache.set(this.tagName, this.propMap);\n\n\t\t\t\tprops = new Proxy(props, {\n\t\t\t\t\tget: (target, prop) => {\n\t\t\t\t\t\t// Warm cache with prop translations from forced lowercase to their real case.\n\t\t\t\t\t\tlet propName = prop.toString();\n\t\t\t\t\t\tif (prop.indexOf('$$') === -1) {\n\t\t\t\t\t\t\tthis.propMap.set(propName.toLowerCase(), propName);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// While here, see if this attempted access matches an element attribute. Note, this lookup is\n\t\t\t\t\t\t// already case-insensitive, see: https://dom.spec.whatwg.org/#namednodemap\n\t\t\t\t\t\tlet attribValue = this.attributes.getNamedItem(propName);\n\t\t\t\t\t\tif (attribValue !== null) {\n\t\t\t\t\t\t\t// Before returning, ensure the prop is at least initialized on the target. This ensures that Vite HMR\n\t\t\t\t\t\t\t// will be aware that the prop exists when creating the proxied component (since it enumerates all props).\n\t\t\t\t\t\t\t// This prevents it from resetting back to the props default state during HMR reloads (the same as how it\n\t\t\t\t\t\t\t// works if the component were to have been defined inside of another Svelte component instead of as a\n\t\t\t\t\t\t\t// custom element here).\n\t\t\t\t\t\t\treturn target[propName] = attribValue.value;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// IMPORTANT: Unlike above, we SHOULD NOT be initializing target[propName] here, even though it could offer benefits\n\t\t\t\t\t\t\t// (like allowing the latest *evolved* prop value to be persisted after HMR updates). The reason is that\n\t\t\t\t\t\t\t// Svelte itself will *also* reset the prop to its default value after HMR updates *unless* the parent Svelte\n\t\t\t\t\t\t\t// component explicitly sets the prop. If we set it here, we would diverge from how Svelte handles undefined\n\t\t\t\t\t\t\t// props during HMR reloads.\n\n\t\t\t\t\t\t\t// Fail over to what would have otherwise been returned.\n\t\t\t\t\t\t\treturn target[prop];\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t} else {\n\t\t\t\t// Skip the proxying of props and just recycle the cached mapping to populate custom element attributes into the\n\t\t\t\t// props object with the correct case.\n\t\t\t\tthis.propMap = propMapCache.get(this.tagName);\n\t\t\t\tfor(let attr of [...this.attributes]) {\n\t\t\t\t\t// Note: Skip svelte-retag specific attributes (used for hydration purposes). This is not included in the ignored\n\t\t\t\t\t// attributes filter since it's a special case and cannot be overridden.\n\t\t\t\t\tif (attr.name.startsWith('data-svelte-retag')) continue;\n\t\t\t\t\tconst translatedName = this._translateAttribute(attr.name);\n\t\t\t\t\tif (translatedName !== null) {\n\t\t\t\t\t\tprops[translatedName] = attr.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Instantiate component into our root now, which is either the \"light DOM\" (i.e. directly under this element) or\n\t\t\t// in the shadow DOM.\n\t\t\tthis.componentInstance = new opts.component({ target: this._root, props: props, context });\n\n\t\t\t// Setup mutation observer to watch for changes to attributes on this element (if not already done) now that we\n\t\t\t// know the full set of component props. Only do this if configured and if the observer hasn't already been setup\n\t\t\t// (since we can render an element multiple times).\n\t\t\tif (opts.attributes === true && !this.attributesObserved) {\n\t\t\t\tthis.attributesObserved = true;\n\t\t\t\tif (this.propMap.size > 0) {\n\t\t\t\t\tattributeObserver.observe(this, {\n\t\t\t\t\t\tattributes: true, // implicit, but... 🤷‍♂️\n\t\t\t\t\t\tattributeFilter: [...this.propMap.keys()],\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// No props to observe, so no point in setting up the observer.\n\t\t\t\t\tthis._debug('renderSvelteComponent(): skipped attribute observer, no props');\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tthis._debug('renderSvelteComponent(): completed');\n\t\t}\n\n\t\t/**\n\t\t * Fetches slots from pre-rendered Svelte component HTML using special markers (either data attributes or custom\n\t\t * wrappers). Note that this will only work during initialization and only if the Svelte retag instance is\n\t\t * hydratable.\n\t\t */\n\t\t_hydrateLightSlots() {\n\t\t\t// Get the named slots inside the already rendered component by looking for our special data attribute.\n\t\t\tlet existingNamedSlots = this._root.querySelectorAll('[data-svelte-retag-slot]');\n\t\t\tfor(let slot of existingNamedSlots) {\n\t\t\t\t// Ensure we stick only to slots that belong to this element (avoid deeply nested components).\n\t\t\t\tlet slotParent = findSlotParent(slot);\n\t\t\t\tif (slotParent !== this._root) continue;\n\n\t\t\t\tlet slotName = slot.getAttribute('slot');\n\t\t\t\tthis.slotEls[slotName] = slot;\n\t\t\t}\n\n\t\t\t// If default slot content was used, it should still be wrapped in a special ,\n\t\t\t// which preserves all child nodes (including text nodes).\n\t\t\tlet existingDefaultSlot = this.querySelector('svelte-retag-default');\n\t\t\tif (existingDefaultSlot !== null) {\n\t\t\t\tthis.slotEls['default'] = existingDefaultSlot;\n\t\t\t}\n\n\t\t\t// Put all slots back to their original positions (including unwrapping default slot content) to\n\t\t\t// prepare for initial component render.\n\t\t\tthis._restoreLightSlots();\n\n\t\t\treturn true;\n\t\t}\n\n\t\t/**\n\t\t * Indicates if the provided element instance belongs to this custom element or not.\n\t\t *\n\t\t * @param {Element} slot\n\t\t * @returns {boolean}\n\t\t */\n\t\t_isOwnSlot(slot) {\n\t\t\tlet slotParent = findSlotParent(slot);\n\t\t\tif (slotParent === null) return false;\n\t\t\treturn (slotParent === this);\n\t\t}\n\n\t\t/**\n\t\t * Returns a map of slot names and the corresponding HTMLElement (named slots) or DocumentFragment (default slots).\n\t\t *\n\t\t * IMPORTANT: Since this custom element is the \"root\", these slots must be removed (which is done in THIS method).\n\t\t *\n\t\t * TODO: Problematic name. We are \"getting\" but we're also mangling/mutating state (which *is* necessary). \"Get\" may be confusing here; is there a better name?\n\t\t *\n\t\t * @returns {SlotList}\n\t\t */\n\t\t_getLightSlots() {\n\t\t\tthis._debug('_getLightSlots()');\n\t\t\tlet slots = {};\n\n\n\t\t\t/***************\n\t\t\t * NAMED SLOTS *\n\t\t\t ***************/\n\n\t\t\t// Look for named slots below this element. IMPORTANT: This may return slots nested deeper (see check in forEach below).\n\t\t\tconst queryNamedSlots = this.querySelectorAll('[slot]');\n\t\t\tfor(let candidate of queryNamedSlots) {\n\t\t\t\t// Skip this slot if it doesn't happen to belong to THIS custom element.\n\t\t\t\tif (!this._isOwnSlot(candidate)) continue;\n\n\t\t\t\tslots[candidate.slot] = candidate;\n\n\t\t\t\t// If this is a hydratable component, flag this slot so we can find it later once it has been relocated\n\t\t\t\t// under the fully rendered Svelte component (in the light DOM).\n\t\t\t\tif (opts.hydratable) {\n\t\t\t\t\tcandidate.setAttribute('data-svelte-retag-slot', '');\n\t\t\t\t}\n\n\t\t\t\t// TODO: Potentially problematic in edge cases where the browser may *oddly* return slots from query selector\n\t\t\t\t// above, yet their not actually a child of the current element. This seems to only happen if another\n\t\t\t\t// constructor() + connectedCallback() are BOTH called for this particular element again BEFORE a\n\t\t\t\t// disconnectedCallback() gets called (out of sync). Only experienced in Chrome when manually editing the HTML\n\t\t\t\t// when there were multiple other custom elements present inside the slot of another element (very edge case?)\n\t\t\t\tthis.removeChild(candidate);\n\t\t\t}\n\n\n\t\t\t/**************************\n\t\t\t * DEFAULT SLOT (UNNAMED) *\n\t\t\t **************************/\n\n\t\t\t// \"Unwrap\" the remainder of this tag by iterating through child nodes and placing them into a fragment which\n\t\t\t// we can use as our default slot. Importantly, we need to ensure we skip our special wrapper.\n\t\t\t// Here we use a special custom element that allows us to target it later in case we\n\t\t\t// need to hydrate it (e.g. tag was rendered via SSG/SSR and disconnectedCallback() was not run).\n\t\t\tlet fragment = document.createDocumentFragment();\n\n\t\t\t// For hydratable components, we have to nest these nodes under a tag that we can still recognize once\n\t\t\t// they're shifted inside of the fully rendered Svelte component, which could be anywhere.\n\t\t\tif (opts.hydratable) {\n\t\t\t\tfragment = document.createElement('svelte-retag-default');\n\t\t\t}\n\n\t\t\t// Important: The conversion of these children to an array is necessary since we are actually modifying the list by calling .appendChild().\n\t\t\tlet childNodes = [...this.childNodes];\n\t\t\tlet childHTML = '';\n\t\t\tfor(let childNode of childNodes) {\n\t\t\t\tif (childNode instanceof HTMLElement && childNode.tagName === 'SVELTE-RETAG') {\n\t\t\t\t\tthis._debug('_getLightSlots(): skipping container');\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Unfortunately, we must manually build HTML because DocumentFragment can be problematic with this:\n\t\t\t\t// 1. Deep clone is required in order to put it into another HTMLElement, might be slow\n\t\t\t\t// 2. Deep clone doesn't work in unit tests\n\t\t\t\tif (childNode instanceof Text) {\n\t\t\t\t\tchildHTML += childNode.textContent;\n\t\t\t\t} else if (childNode.outerHTML) {\n\t\t\t\t\tchildHTML += childNode.outerHTML;\n\t\t\t\t}\n\n\t\t\t\tfragment.appendChild(childNode);\n\t\t\t}\n\n\t\t\t// Now that we've rebuilt the default slot content, it could actually be empty (or just whitespace). So, we\n\t\t\t// have to check the HTML in the fragment to see if it has anything in it before trying to use it.\n\t\t\tif (childHTML.trim() !== '') {\n\t\t\t\t// Now that we've detected remaining content, we've got to make suer we don't already have an explicitly\n\t\t\t\t// named \"default\" slot. If one does exist, then we have a conflict.\n\t\t\t\tif (slots.default) {\n\t\t\t\t\t// Edge case: User has a named \"default\" as well as remaining HTML left over. Use same error as Svelte.\n\t\t\t\t\tconsole.error(`svelteRetag: '${this.tagName}': Found elements without slot attribute when using slot=\"default\"`);\n\t\t\t\t} else {\n\t\t\t\t\tslots.default = fragment;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn slots;\n\t\t}\n\n\t\t/**\n\t\t * Go through originally removed slots and restore back to the custom element.\n\t\t */\n\t\t_restoreLightSlots() {\n\t\t\tthis._debug('_restoreLightSlots:', this.slotEls);\n\n\t\t\tfor(let slotName in this.slotEls) {\n\t\t\t\tlet slotEl = this.slotEls[slotName];\n\n\t\t\t\t// Prepend back so that in case more default slot content has arrived, we can rebuild it in order. This is\n\t\t\t\t// important if we're executing during document.readyState === 'loading' (i.e. IIFE and not module).\n\t\t\t\tif (slotEl.tagName === 'SVELTE-RETAG-DEFAULT') {\n\t\t\t\t\tthis.prepend(unwrap(slotEl));\n\t\t\t\t} else {\n\t\t\t\t\tthis.prepend(slotEl);\n\n\t\t\t\t\t// If hydration was enabled for this particular element (not necessarily for the current context),\n\t\t\t\t\t// we should clean up hydration-specific attributes for consistency.\n\t\t\t\t\tif (slotEl instanceof HTMLElement && slotEl.hasAttribute('data-svelte-retag-slot')) {\n\t\t\t\t\t\tslotEl.removeAttribute('data-svelte-retag-slot');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Since the slots are back in the original element, we should clean up our reference to them. This is because,\n\t\t\t// symbolically and semantically at least, we think of this variable as a holding area ONCE they've been removed.\n\t\t\tthis.slotEls = {};\n\t\t}\n\n\t\t/**\n\t\t * Fetches and returns references to the existing shadow DOM slots. Left unmodified.\n\t\t *\n\t\t * @returns {SlotList}\n\t\t */\n\t\t_getShadowSlots() {\n\t\t\tthis._debug('_getShadowSlots()');\n\t\t\tconst namedSlots = this.querySelectorAll('[slot]');\n\t\t\tlet slots = {};\n\t\t\tlet htmlLength = this.innerHTML.length;\n\t\t\tnamedSlots.forEach(n => {\n\t\t\t\tslots[n.slot] = document.createElement('slot');\n\t\t\t\tslots[n.slot].setAttribute('name', n.slot);\n\t\t\t\thtmlLength -= n.outerHTML.length;\n\t\t\t});\n\t\t\tif (htmlLength > 0) {\n\t\t\t\tslots.default = document.createElement('slot');\n\t\t\t}\n\t\t\treturn slots;\n\t\t}\n\n\t\t/**\n\t\t * Toggle on/off the MutationObserver used to watch for changes in child slots.\n\t\t */\n\t\t_observeSlots(begin) {\n\t\t\t// While MutationObserver de-duplicates requests for us, this helps us with reducing noise while debugging.\n\t\t\tif (begin === this.slotObserverActive) return;\n\n\t\t\t// Setup our slot observer if not done already.\n\t\t\tif (!this.slotObserver) {\n\t\t\t\tthis.slotObserver = new MutationObserver((mutations) => {\n\t\t\t\t\tthis._processSlotMutations(mutations);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (begin) {\n\t\t\t\t// Subtree: Typically, slots (both default and named) are only ever added directly below. So, keeping\n\t\t\t\t// subtree false for now since this could be important for light DOM.\n\t\t\t\tthis.slotObserver.observe(this, { childList: true, subtree: false, attributes: false });\n\t\t\t\tthis._debug('_observeSlots: OBSERVE');\n\t\t\t} else {\n\t\t\t\tthis.slotObserver.disconnect();\n\t\t\t\tthis._debug('_observeSlots: DISCONNECT');\n\t\t\t}\n\n\t\t\tthis.slotObserverActive = begin;\n\t\t}\n\n\t\t/**\n\t\t * Watches for slot changes, specifically:\n\t\t *\n\t\t * 1. Shadow DOM: All slot changes will queue a rerender of the Svelte component\n\t\t *\n\t\t * 2. Light DOM: Only additions will be accounted for. This is particularly because currently we only support\n\t\t * watching for changes during document parsing (i.e. document.readyState === 'loading', prior to the\n\t\t * 'DOMContentLoaded' event.\n\t\t *\n\t\t * @param {MutationRecord[]} mutations\n\t\t */\n\t\t_processSlotMutations(mutations) {\n\t\t\tthis._debug('_processSlotMutations()', mutations);\n\n\t\t\t// Rerender if one of the mutations is of a child element.\n\t\t\tlet rerender = false;\n\t\t\tfor(let mutation of mutations) {\n\t\t\t\tif (mutation.type === 'childList') {\n\t\t\t\t\t// For shadow DOM, it's alright if it's a removal.\n\t\t\t\t\tif (opts.shadow) {\n\t\t\t\t\t\trerender = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// For light DOM, it only matters to rerender on newly added nodes. This is because we're only watching for\n\t\t\t\t\t\t// mutations during initial document parsing. Node removals can happen during the retrieval of light slots in\n\t\t\t\t\t\t// _getLightSlots(). These are necessary, but may cascade into an infinite loop if we're not very careful here.\n\t\t\t\t\t\tif (mutation.addedNodes.length > 0) {\n\t\t\t\t\t\t\trerender = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (rerender) {\n\t\t\t\tif (!opts.shadow) {\n\t\t\t\t\t// For light DOM, ensure original slots are available by prepending them back to the DOM so we can fetch the\n\t\t\t\t\t// latest content. This is important in case the newly visible nodes are part of default content (not just\n\t\t\t\t\t// named slots)\n\t\t\t\t\tthis._observeSlots(false);\n\t\t\t\t\tthis._restoreLightSlots();\n\t\t\t\t\tthis._observeSlots(true);\n\t\t\t\t}\n\n\t\t\t\t// Force a rerender now.\n\t\t\t\tthis._debug('_processMutations(): Queue rerender');\n\t\t\t\tthis._queueForRender();\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Pass through to console.log() but includes a reference to the custom element in the log for easier targeting for\n\t\t * debugging purposes.\n\t\t *\n\t\t * @param {...*}\n\t\t */\n\t\t_debug() {\n\t\t\tif (opts.debugMode) {\n\t\t\t\tif (opts.debugMode === 'cli') {\n\t\t\t\t\tconsole.log.apply(null, [performance.now(), this.tagName, ...arguments]);\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log.apply(null, [performance.now(), this, ...arguments]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}\n","/**\n * @internal\n * Sends an event to Plausible's API\n *\n * @param data - Event data to send\n * @param options - Event options\n */\nexport function sendEvent(eventName, data, options) {\n const isLocalhost = /^localhost$|^127(?:\\.[0-9]+){0,2}\\.[0-9]+$|^(?:0*:)*?:?0*1$/.test(location.hostname) || location.protocol === 'file:';\n if (!data.trackLocalhost && isLocalhost) {\n return console.warn('[Plausible] Ignoring event because website is running locally');\n }\n try {\n if (window.localStorage.plausible_ignore === 'true') {\n return console.warn('[Plausible] Ignoring event because \"plausible_ignore\" is set to \"true\" in localStorage');\n }\n }\n catch (e) {\n null;\n }\n const payload = {\n n: eventName,\n u: data.url,\n d: data.domain,\n r: data.referrer,\n w: data.deviceWidth,\n h: data.hashMode ? 1 : 0,\n p: options && options.props ? JSON.stringify(options.props) : undefined,\n };\n const req = new XMLHttpRequest();\n req.open('POST', `${data.apiHost}/api/event`, true);\n req.setRequestHeader('Content-Type', 'text/plain');\n req.send(JSON.stringify(payload));\n // eslint-disable-next-line functional/immutable-data\n req.onreadystatechange = () => {\n if (req.readyState !== 4)\n return;\n if (options && options.callback) {\n options.callback();\n }\n };\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvcmVxdWVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEyQkE7Ozs7OztHQU1HO0FBQ0gsTUFBTSxVQUFVLFNBQVMsQ0FDdkIsU0FBaUIsRUFDakIsSUFBZ0MsRUFDaEMsT0FBc0I7SUFFdEIsTUFBTSxXQUFXLEdBQ2YsNkRBQTZELENBQUMsSUFBSSxDQUNoRSxRQUFRLENBQUMsUUFBUSxDQUNsQixJQUFJLFFBQVEsQ0FBQyxRQUFRLEtBQUssT0FBTyxDQUFDO0lBRXJDLElBQUksQ0FBQyxJQUFJLENBQUMsY0FBYyxJQUFJLFdBQVcsRUFBRTtRQUN2QyxPQUFPLE9BQU8sQ0FBQyxJQUFJLENBQ2pCLCtEQUErRCxDQUNoRSxDQUFDO0tBQ0g7SUFFRCxJQUFJO1FBQ0YsSUFBSSxNQUFNLENBQUMsWUFBWSxDQUFDLGdCQUFnQixLQUFLLE1BQU0sRUFBRTtZQUNuRCxPQUFPLE9BQU8sQ0FBQyxJQUFJLENBQ2pCLHdGQUF3RixDQUN6RixDQUFDO1NBQ0g7S0FDRjtJQUFDLE9BQU8sQ0FBQyxFQUFFO1FBQ1YsSUFBSSxDQUFDO0tBQ047SUFFRCxNQUFNLE9BQU8sR0FBaUI7UUFDNUIsQ0FBQyxFQUFFLFNBQVM7UUFDWixDQUFDLEVBQUUsSUFBSSxDQUFDLEdBQUc7UUFDWCxDQUFDLEVBQUUsSUFBSSxDQUFDLE1BQU07UUFDZCxDQUFDLEVBQUUsSUFBSSxDQUFDLFFBQVE7UUFDaEIsQ0FBQyxFQUFFLElBQUksQ0FBQyxXQUFXO1FBQ25CLENBQUMsRUFBRSxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDeEIsQ0FBQyxFQUFFLE9BQU8sSUFBSSxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsU0FBUztLQUN4RSxDQUFDO0lBRUYsTUFBTSxHQUFHLEdBQUcsSUFBSSxjQUFjLEVBQUUsQ0FBQztJQUNqQyxHQUFHLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRSxHQUFHLElBQUksQ0FBQyxPQUFPLFlBQVksRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNwRCxHQUFHLENBQUMsZ0JBQWdCLENBQUMsY0FBYyxFQUFFLFlBQVksQ0FBQyxDQUFDO0lBQ25ELEdBQUcsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO0lBQ2xDLHFEQUFxRDtJQUNyRCxHQUFHLENBQUMsa0JBQWtCLEdBQUcsR0FBRyxFQUFFO1FBQzVCLElBQUksR0FBRyxDQUFDLFVBQVUsS0FBSyxDQUFDO1lBQUUsT0FBTztRQUNqQyxJQUFJLE9BQU8sSUFBSSxPQUFPLENBQUMsUUFBUSxFQUFFO1lBQy9CLE9BQU8sQ0FBQyxRQUFRLEVBQUUsQ0FBQztTQUNwQjtJQUNILENBQUMsQ0FBQztBQUNKLENBQUMifQ==","import { sendEvent } from './request';\n/**\n * Initializes the tracker with your default values.\n *\n * ### Example (es module)\n * ```js\n * import Plausible from 'plausible-tracker'\n *\n * const { enableAutoPageviews, trackEvent } = Plausible({\n * domain: 'my-app-domain.com',\n * hashMode: true\n * })\n *\n * enableAutoPageviews()\n *\n * function onUserRegister() {\n * trackEvent('register')\n * }\n * ```\n *\n * ### Example (commonjs)\n * ```js\n * var Plausible = require('plausible-tracker');\n *\n * var { enableAutoPageviews, trackEvent } = Plausible({\n * domain: 'my-app-domain.com',\n * hashMode: true\n * })\n *\n * enableAutoPageviews()\n *\n * function onUserRegister() {\n * trackEvent('register')\n * }\n * ```\n *\n * @param defaults - Default event parameters that will be applied to all requests.\n */\nexport default function Plausible(defaults) {\n const getConfig = () => ({\n hashMode: false,\n trackLocalhost: false,\n url: location.href,\n domain: location.hostname,\n referrer: document.referrer || null,\n deviceWidth: window.innerWidth,\n apiHost: 'https://plausible.io',\n ...defaults,\n });\n const trackEvent = (eventName, options, eventData) => {\n sendEvent(eventName, { ...getConfig(), ...eventData }, options);\n };\n const trackPageview = (eventData, options) => {\n trackEvent('pageview', options, eventData);\n };\n const enableAutoPageviews = () => {\n const page = () => trackPageview();\n // Attach pushState and popState listeners\n const originalPushState = history.pushState;\n if (originalPushState) {\n // eslint-disable-next-line functional/immutable-data\n history.pushState = function (data, title, url) {\n originalPushState.apply(this, [data, title, url]);\n page();\n };\n addEventListener('popstate', page);\n }\n // Attach hashchange listener\n if (defaults && defaults.hashMode) {\n addEventListener('hashchange', page);\n }\n // Trigger first page view\n trackPageview();\n return function cleanup() {\n if (originalPushState) {\n // eslint-disable-next-line functional/immutable-data\n history.pushState = originalPushState;\n removeEventListener('popstate', page);\n }\n if (defaults && defaults.hashMode) {\n removeEventListener('hashchange', page);\n }\n };\n };\n const enableAutoOutboundTracking = (targetNode = document, observerInit = {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['href'],\n }) => {\n function trackClick(event) {\n trackEvent('Outbound Link: Click', { props: { url: this.href } });\n /* istanbul ignore next */\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (!(typeof process !== 'undefined' &&\n process &&\n process.env.NODE_ENV === 'test')) {\n setTimeout(() => {\n // eslint-disable-next-line functional/immutable-data\n location.href = this.href;\n }, 150);\n }\n event.preventDefault();\n }\n // eslint-disable-next-line functional/prefer-readonly-type\n const tracked = new Set();\n function addNode(node) {\n if (node instanceof HTMLAnchorElement) {\n if (node.host !== location.host) {\n node.addEventListener('click', trackClick);\n tracked.add(node);\n }\n } /* istanbul ignore next */\n else if ('querySelectorAll' in node) {\n node.querySelectorAll('a').forEach(addNode);\n }\n }\n function removeNode(node) {\n if (node instanceof HTMLAnchorElement) {\n node.removeEventListener('click', trackClick);\n tracked.delete(node);\n } /* istanbul ignore next */\n else if ('querySelectorAll' in node) {\n node.querySelectorAll('a').forEach(removeNode);\n }\n }\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n if (mutation.type === 'attributes') {\n // Handle changed href\n removeNode(mutation.target);\n addNode(mutation.target);\n } /* istanbul ignore next */\n else if (mutation.type === 'childList') {\n // Handle added nodes\n mutation.addedNodes.forEach(addNode);\n // Handle removed nodes\n mutation.removedNodes.forEach(removeNode);\n }\n });\n });\n // Track existing nodes\n targetNode.querySelectorAll('a').forEach(addNode);\n // Observe mutations\n observer.observe(targetNode, observerInit);\n return function cleanup() {\n tracked.forEach((a) => {\n a.removeEventListener('click', trackClick);\n });\n tracked.clear();\n observer.disconnect();\n };\n };\n return {\n trackEvent,\n trackPageview,\n enableAutoPageviews,\n enableAutoOutboundTracking,\n };\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhY2tlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvdHJhY2tlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQWdCLFNBQVMsRUFBRSxNQUFNLFdBQVcsQ0FBQztBQXFMcEQ7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQW9DRztBQUNILE1BQU0sQ0FBQyxPQUFPLFVBQVUsU0FBUyxDQUMvQixRQUErQjtJQU8vQixNQUFNLFNBQVMsR0FBRyxHQUErQixFQUFFLENBQUMsQ0FBQztRQUNuRCxRQUFRLEVBQUUsS0FBSztRQUNmLGNBQWMsRUFBRSxLQUFLO1FBQ3JCLEdBQUcsRUFBRSxRQUFRLENBQUMsSUFBSTtRQUNsQixNQUFNLEVBQUUsUUFBUSxDQUFDLFFBQVE7UUFDekIsUUFBUSxFQUFFLFFBQVEsQ0FBQyxRQUFRLElBQUksSUFBSTtRQUNuQyxXQUFXLEVBQUUsTUFBTSxDQUFDLFVBQVU7UUFDOUIsT0FBTyxFQUFFLHNCQUFzQjtRQUMvQixHQUFHLFFBQVE7S0FDWixDQUFDLENBQUM7SUFFSCxNQUFNLFVBQVUsR0FBZSxDQUFDLFNBQVMsRUFBRSxPQUFPLEVBQUUsU0FBUyxFQUFFLEVBQUU7UUFDL0QsU0FBUyxDQUFDLFNBQVMsRUFBRSxFQUFFLEdBQUcsU0FBUyxFQUFFLEVBQUUsR0FBRyxTQUFTLEVBQUUsRUFBRSxPQUFPLENBQUMsQ0FBQztJQUNsRSxDQUFDLENBQUM7SUFFRixNQUFNLGFBQWEsR0FBa0IsQ0FBQyxTQUFTLEVBQUUsT0FBTyxFQUFFLEVBQUU7UUFDMUQsVUFBVSxDQUFDLFVBQVUsRUFBRSxPQUFPLEVBQUUsU0FBUyxDQUFDLENBQUM7SUFDN0MsQ0FBQyxDQUFDO0lBRUYsTUFBTSxtQkFBbUIsR0FBd0IsR0FBRyxFQUFFO1FBQ3BELE1BQU0sSUFBSSxHQUFHLEdBQUcsRUFBRSxDQUFDLGFBQWEsRUFBRSxDQUFDO1FBQ25DLDBDQUEwQztRQUMxQyxNQUFNLGlCQUFpQixHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUM7UUFDNUMsSUFBSSxpQkFBaUIsRUFBRTtZQUNyQixxREFBcUQ7WUFDckQsT0FBTyxDQUFDLFNBQVMsR0FBRyxVQUFVLElBQUksRUFBRSxLQUFLLEVBQUUsR0FBRztnQkFDNUMsaUJBQWlCLENBQUMsS0FBSyxDQUFDLElBQUksRUFBRSxDQUFDLElBQUksRUFBRSxLQUFLLEVBQUUsR0FBRyxDQUFDLENBQUMsQ0FBQztnQkFDbEQsSUFBSSxFQUFFLENBQUM7WUFDVCxDQUFDLENBQUM7WUFDRixnQkFBZ0IsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLENBQUM7U0FDcEM7UUFFRCw2QkFBNkI7UUFDN0IsSUFBSSxRQUFRLElBQUksUUFBUSxDQUFDLFFBQVEsRUFBRTtZQUNqQyxnQkFBZ0IsQ0FBQyxZQUFZLEVBQUUsSUFBSSxDQUFDLENBQUM7U0FDdEM7UUFFRCwwQkFBMEI7UUFDMUIsYUFBYSxFQUFFLENBQUM7UUFFaEIsT0FBTyxTQUFTLE9BQU87WUFDckIsSUFBSSxpQkFBaUIsRUFBRTtnQkFDckIscURBQXFEO2dCQUNyRCxPQUFPLENBQUMsU0FBUyxHQUFHLGlCQUFpQixDQUFDO2dCQUN0QyxtQkFBbUIsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLENBQUM7YUFDdkM7WUFDRCxJQUFJLFFBQVEsSUFBSSxRQUFRLENBQUMsUUFBUSxFQUFFO2dCQUNqQyxtQkFBbUIsQ0FBQyxZQUFZLEVBQUUsSUFBSSxDQUFDLENBQUM7YUFDekM7UUFDSCxDQUFDLENBQUM7SUFDSixDQUFDLENBQUM7SUFFRixNQUFNLDBCQUEwQixHQUErQixDQUM3RCxhQUFnQyxRQUFRLEVBQ3hDLGVBQXFDO1FBQ25DLE9BQU8sRUFBRSxJQUFJO1FBQ2IsU0FBUyxFQUFFLElBQUk7UUFDZixVQUFVLEVBQUUsSUFBSTtRQUNoQixlQUFlLEVBQUUsQ0FBQyxNQUFNLENBQUM7S0FDMUIsRUFDRCxFQUFFO1FBQ0YsU0FBUyxVQUFVLENBQTBCLEtBQWlCO1lBQzVELFVBQVUsQ0FBQyxzQkFBc0IsRUFBRSxFQUFFLEtBQUssRUFBRSxFQUFFLEdBQUcsRUFBRSxJQUFJLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxDQUFDO1lBRWxFLDBCQUEwQjtZQUMxQiw2REFBNkQ7WUFDN0QsYUFBYTtZQUNiLElBQ0UsQ0FBQyxDQUNDLE9BQU8sT0FBTyxLQUFLLFdBQVc7Z0JBQzlCLE9BQU87Z0JBQ1AsT0FBTyxDQUFDLEdBQUcsQ0FBQyxRQUFRLEtBQUssTUFBTSxDQUNoQyxFQUNEO2dCQUNBLFVBQVUsQ0FBQyxHQUFHLEVBQUU7b0JBQ2QscURBQXFEO29CQUNyRCxRQUFRLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUM7Z0JBQzVCLENBQUMsRUFBRSxHQUFHLENBQUMsQ0FBQzthQUNUO1lBRUQsS0FBSyxDQUFDLGNBQWMsRUFBRSxDQUFDO1FBQ3pCLENBQUM7UUFFRCwyREFBMkQ7UUFDM0QsTUFBTSxPQUFPLEdBQTJCLElBQUksR0FBRyxFQUFFLENBQUM7UUFFbEQsU0FBUyxPQUFPLENBQUMsSUFBdUI7WUFDdEMsSUFBSSxJQUFJLFlBQVksaUJBQWlCLEVBQUU7Z0JBQ3JDLElBQUksSUFBSSxDQUFDLElBQUksS0FBSyxRQUFRLENBQUMsSUFBSSxFQUFFO29CQUMvQixJQUFJLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxFQUFFLFVBQVUsQ0FBQyxDQUFDO29CQUMzQyxPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDO2lCQUNuQjthQUNGLENBQUMsMEJBQTBCO2lCQUFNLElBQUksa0JBQWtCLElBQUksSUFBSSxFQUFFO2dCQUNoRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsR0FBRyxDQUFDLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDO2FBQzdDO1FBQ0gsQ0FBQztRQUVELFNBQVMsVUFBVSxDQUFDLElBQXVCO1lBQ3pDLElBQUksSUFBSSxZQUFZLGlCQUFpQixFQUFFO2dCQUNyQyxJQUFJLENBQUMsbUJBQW1CLENBQUMsT0FBTyxFQUFFLFVBQVUsQ0FBQyxDQUFDO2dCQUM5QyxPQUFPLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxDQUFDO2FBQ3RCLENBQUMsMEJBQTBCO2lCQUFNLElBQUksa0JBQWtCLElBQUksSUFBSSxFQUFFO2dCQUNoRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsR0FBRyxDQUFDLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO2FBQ2hEO1FBQ0gsQ0FBQztRQUVELE1BQU0sUUFBUSxHQUFHLElBQUksZ0JBQWdCLENBQUMsQ0FBQyxTQUFTLEVBQUUsRUFBRTtZQUNsRCxTQUFTLENBQUMsT0FBTyxDQUFDLENBQUMsUUFBUSxFQUFFLEVBQUU7Z0JBQzdCLElBQUksUUFBUSxDQUFDLElBQUksS0FBSyxZQUFZLEVBQUU7b0JBQ2xDLHNCQUFzQjtvQkFDdEIsVUFBVSxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQztvQkFDNUIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQztpQkFDMUIsQ0FBQywwQkFBMEI7cUJBQU0sSUFBSSxRQUFRLENBQUMsSUFBSSxLQUFLLFdBQVcsRUFBRTtvQkFDbkUscUJBQXFCO29CQUNyQixRQUFRLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQztvQkFDckMsdUJBQXVCO29CQUN2QixRQUFRLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztpQkFDM0M7WUFDSCxDQUFDLENBQUMsQ0FBQztRQUNMLENBQUMsQ0FBQyxDQUFDO1FBRUgsdUJBQXVCO1FBQ3ZCLFVBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyxHQUFHLENBQUMsQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7UUFFbEQsb0JBQW9CO1FBQ3BCLFFBQVEsQ0FBQyxPQUFPLENBQUMsVUFBVSxFQUFFLFlBQVksQ0FBQyxDQUFDO1FBRTNDLE9BQU8sU0FBUyxPQUFPO1lBQ3JCLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRTtnQkFDcEIsQ0FBQyxDQUFDLG1CQUFtQixDQUFDLE9BQU8sRUFBRSxVQUFVLENBQUMsQ0FBQztZQUM3QyxDQUFDLENBQUMsQ0FBQztZQUNILE9BQU8sQ0FBQyxLQUFLLEVBQUUsQ0FBQztZQUNoQixRQUFRLENBQUMsVUFBVSxFQUFFLENBQUM7UUFDeEIsQ0FBQyxDQUFDO0lBQ0osQ0FBQyxDQUFDO0lBRUYsT0FBTztRQUNMLFVBQVU7UUFDVixhQUFhO1FBQ2IsbUJBQW1CO1FBQ25CLDBCQUEwQjtLQUMzQixDQUFDO0FBQ0osQ0FBQyJ9","import Plausible, { type EventOptions, type PlausibleOptions } from \"plausible-tracker\";\n\nconst plausible = Plausible({\n\tdomain: \"zryd-ag.ch\",\n});\n\nexport function trackPageview() {\n\ttry {\n\t\tplausible.trackPageview();\n\t} catch {}\n}\n\nexport function trackEvent(eventName: string, options?: EventOptions, eventData?: PlausibleOptions) {\n\ttry {\n\t\tplausible.trackEvent(eventName, options, eventData);\n\t} catch {}\n}\n","const ActiveClass = \"is-active\";\n\nexport class Tabs {\n\ttabs: HTMLElement[];\n\tcontents: HTMLElement[];\n\n\tconstructor(container: HTMLElement) {\n\t\tthis.tabs = Array.from(container.querySelectorAll(\".tabs li\"));\n\t\tthis.contents = Array.from(container.querySelectorAll(\".tab-content\"));\n\n\t\tcontainer.querySelector(\".tabs\")?.addEventListener(\"click\", this.handleTabsClick.bind(this));\n\n\t\tlet initialActiveTab = this.tabs.find(t => t.classList.contains(ActiveClass));\n\t\tif (initialActiveTab != null) {\n\t\t\tthis.activateTab(initialActiveTab);\n\t\t}\n\t}\n\n\thandleTabsClick(e: Event) {\n\t\tlet target = e.target as HTMLElement;\n\t\tlet tab = target?.closest(\"li\");\n\t\tif (tab == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.deactivateAll();\n\t\tthis.activateTab(tab);\n\t}\n\n\tdeactivateAll() {\n\t\tfor (let tab of this.tabs) {\n\t\t\ttab.classList.remove(ActiveClass);\n\t\t}\n\t\tfor (let content of this.contents) {\n\t\t\tcontent.classList.remove(ActiveClass);\n\t\t}\n\t};\n\n\tactivateTab(tab: HTMLElement) {\n\t\ttab.classList.add(ActiveClass);\n\n\t\tlet index = this.tabs.indexOf(tab);\n\t\tthis.contents[index].classList.add(ActiveClass);\n\t}\n}\n","/** @returns {void} */\nexport function noop() {}\n\nexport const identity = (x) => x;\n\n/**\n * @template T\n * @template S\n * @param {T} tar\n * @param {S} src\n * @returns {T & S}\n */\nexport function assign(tar, src) {\n\t// @ts-ignore\n\tfor (const k in src) tar[k] = src[k];\n\treturn /** @type {T & S} */ (tar);\n}\n\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\n/**\n * @param {any} value\n * @returns {value is PromiseLike}\n */\nexport function is_promise(value) {\n\treturn (\n\t\t!!value &&\n\t\t(typeof value === 'object' || typeof value === 'function') &&\n\t\ttypeof (/** @type {any} */ (value).then) === 'function'\n\t);\n}\n\n/** @returns {void} */\nexport function add_location(element, file, line, column, char) {\n\telement.__svelte_meta = {\n\t\tloc: { file, line, column, char }\n\t};\n}\n\nexport function run(fn) {\n\treturn fn();\n}\n\nexport function blank_object() {\n\treturn Object.create(null);\n}\n\n/**\n * @param {Function[]} fns\n * @returns {void}\n */\nexport function run_all(fns) {\n\tfns.forEach(run);\n}\n\n/**\n * @param {any} thing\n * @returns {thing is Function}\n */\nexport function is_function(thing) {\n\treturn typeof thing === 'function';\n}\n\n/** @returns {boolean} */\nexport function safe_not_equal(a, b) {\n\treturn a != a ? b == b : a !== b || (a && typeof a === 'object') || typeof a === 'function';\n}\n\nlet src_url_equal_anchor;\n\n/** @returns {boolean} */\nexport function src_url_equal(element_src, url) {\n\tif (!src_url_equal_anchor) {\n\t\tsrc_url_equal_anchor = document.createElement('a');\n\t}\n\tsrc_url_equal_anchor.href = url;\n\treturn element_src === src_url_equal_anchor.href;\n}\n\n/** @returns {boolean} */\nexport function not_equal(a, b) {\n\treturn a != a ? b == b : a !== b;\n}\n\n/** @returns {boolean} */\nexport function is_empty(obj) {\n\treturn Object.keys(obj).length === 0;\n}\n\n/** @returns {void} */\nexport function validate_store(store, name) {\n\tif (store != null && typeof store.subscribe !== 'function') {\n\t\tthrow new Error(`'${name}' is not a store with a 'subscribe' method`);\n\t}\n}\n\nexport function subscribe(store, ...callbacks) {\n\tif (store == null) {\n\t\tfor (const callback of callbacks) {\n\t\t\tcallback(undefined);\n\t\t}\n\t\treturn noop;\n\t}\n\tconst unsub = store.subscribe(...callbacks);\n\treturn unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\n\n/**\n * Get the current value from a store by subscribing and immediately unsubscribing.\n *\n * https://svelte.dev/docs/svelte-store#get\n * @template T\n * @param {import('../store/public.js').Readable} store\n * @returns {T}\n */\nexport function get_store_value(store) {\n\tlet value;\n\tsubscribe(store, (_) => (value = _))();\n\treturn value;\n}\n\n/** @returns {void} */\nexport function component_subscribe(component, store, callback) {\n\tcomponent.$$.on_destroy.push(subscribe(store, callback));\n}\n\nexport function create_slot(definition, ctx, $$scope, fn) {\n\tif (definition) {\n\t\tconst slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n\t\treturn definition[0](slot_ctx);\n\t}\n}\n\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n\treturn definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx;\n}\n\nexport function get_slot_changes(definition, $$scope, dirty, fn) {\n\tif (definition[2] && fn) {\n\t\tconst lets = definition[2](fn(dirty));\n\t\tif ($$scope.dirty === undefined) {\n\t\t\treturn lets;\n\t\t}\n\t\tif (typeof lets === 'object') {\n\t\t\tconst merged = [];\n\t\t\tconst len = Math.max($$scope.dirty.length, lets.length);\n\t\t\tfor (let i = 0; i < len; i += 1) {\n\t\t\t\tmerged[i] = $$scope.dirty[i] | lets[i];\n\t\t\t}\n\t\t\treturn merged;\n\t\t}\n\t\treturn $$scope.dirty | lets;\n\t}\n\treturn $$scope.dirty;\n}\n\n/** @returns {void} */\nexport function update_slot_base(\n\tslot,\n\tslot_definition,\n\tctx,\n\t$$scope,\n\tslot_changes,\n\tget_slot_context_fn\n) {\n\tif (slot_changes) {\n\t\tconst slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n\t\tslot.p(slot_context, slot_changes);\n\t}\n}\n\n/** @returns {void} */\nexport function update_slot(\n\tslot,\n\tslot_definition,\n\tctx,\n\t$$scope,\n\tdirty,\n\tget_slot_changes_fn,\n\tget_slot_context_fn\n) {\n\tconst slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n\tupdate_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);\n}\n\n/** @returns {any[] | -1} */\nexport function get_all_dirty_from_scope($$scope) {\n\tif ($$scope.ctx.length > 32) {\n\t\tconst dirty = [];\n\t\tconst length = $$scope.ctx.length / 32;\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tdirty[i] = -1;\n\t\t}\n\t\treturn dirty;\n\t}\n\treturn -1;\n}\n\n/** @returns {{}} */\nexport function exclude_internal_props(props) {\n\tconst result = {};\n\tfor (const k in props) if (k[0] !== '$') result[k] = props[k];\n\treturn result;\n}\n\n/** @returns {{}} */\nexport function compute_rest_props(props, keys) {\n\tconst rest = {};\n\tkeys = new Set(keys);\n\tfor (const k in props) if (!keys.has(k) && k[0] !== '$') rest[k] = props[k];\n\treturn rest;\n}\n\n/** @returns {{}} */\nexport function compute_slots(slots) {\n\tconst result = {};\n\tfor (const key in slots) {\n\t\tresult[key] = true;\n\t}\n\treturn result;\n}\n\n/** @returns {(this: any, ...args: any[]) => void} */\nexport function once(fn) {\n\tlet ran = false;\n\treturn function (...args) {\n\t\tif (ran) return;\n\t\tran = true;\n\t\tfn.call(this, ...args);\n\t};\n}\n\nexport function null_to_empty(value) {\n\treturn value == null ? '' : value;\n}\n\nexport function set_store_value(store, ret, value) {\n\tstore.set(value);\n\treturn ret;\n}\n\nexport const has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\n\nexport function action_destroyer(action_result) {\n\treturn action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\n\n/** @param {number | string} value\n * @returns {[number, string]}\n */\nexport function split_css_unit(value) {\n\tconst split = typeof value === 'string' && value.match(/^\\s*(-?[\\d.]+)([^\\s]*)\\s*$/);\n\treturn split ? [parseFloat(split[1]), split[2] || 'px'] : [/** @type {number} */ (value), 'px'];\n}\n\nexport const contenteditable_truthy_values = ['', true, 1, 'true', 'contenteditable'];\n","import { noop } from './utils.js';\n\nexport const is_client = typeof window !== 'undefined';\n\n/** @type {() => number} */\nexport let now = is_client ? () => window.performance.now() : () => Date.now();\n\nexport let raf = is_client ? (cb) => requestAnimationFrame(cb) : noop;\n\n// used internally for testing\n/** @returns {void} */\nexport function set_now(fn) {\n\tnow = fn;\n}\n\n/** @returns {void} */\nexport function set_raf(fn) {\n\traf = fn;\n}\n","import { raf } from './environment.js';\n\nconst tasks = new Set();\n\n/**\n * @param {number} now\n * @returns {void}\n */\nfunction run_tasks(now) {\n\ttasks.forEach((task) => {\n\t\tif (!task.c(now)) {\n\t\t\ttasks.delete(task);\n\t\t\ttask.f();\n\t\t}\n\t});\n\tif (tasks.size !== 0) raf(run_tasks);\n}\n\n/**\n * For testing purposes only!\n * @returns {void}\n */\nexport function clear_loops() {\n\ttasks.clear();\n}\n\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n * @param {import('./private.js').TaskCallback} callback\n * @returns {import('./private.js').Task}\n */\nexport function loop(callback) {\n\t/** @type {import('./private.js').TaskEntry} */\n\tlet task;\n\tif (tasks.size === 0) raf(run_tasks);\n\treturn {\n\t\tpromise: new Promise((fulfill) => {\n\t\t\ttasks.add((task = { c: callback, f: fulfill }));\n\t\t}),\n\t\tabort() {\n\t\t\ttasks.delete(task);\n\t\t}\n\t};\n}\n","import { ResizeObserverSingleton } from './ResizeObserverSingleton.js';\nimport { contenteditable_truthy_values, has_prop } from './utils.js';\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\n\n/**\n * @returns {void}\n */\nexport function start_hydrating() {\n\tis_hydrating = true;\n}\n\n/**\n * @returns {void}\n */\nexport function end_hydrating() {\n\tis_hydrating = false;\n}\n\n/**\n * @param {number} low\n * @param {number} high\n * @param {(index: number) => number} key\n * @param {number} value\n * @returns {number}\n */\nfunction upper_bound(low, high, key, value) {\n\t// Return first index of value larger than input value in the range [low, high)\n\twhile (low < high) {\n\t\tconst mid = low + ((high - low) >> 1);\n\t\tif (key(mid) <= value) {\n\t\t\tlow = mid + 1;\n\t\t} else {\n\t\t\thigh = mid;\n\t\t}\n\t}\n\treturn low;\n}\n\n/**\n * @param {NodeEx} target\n * @returns {void}\n */\nfunction init_hydrate(target) {\n\tif (target.hydrate_init) return;\n\ttarget.hydrate_init = true;\n\t// We know that all children have claim_order values since the unclaimed have been detached if target is not \n\n\tlet children = /** @type {ArrayLike} */ (target.childNodes);\n\t// If target is , there may be children without claim_order\n\tif (target.nodeName === 'HEAD') {\n\t\tconst myChildren = [];\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tconst node = children[i];\n\t\t\tif (node.claim_order !== undefined) {\n\t\t\t\tmyChildren.push(node);\n\t\t\t}\n\t\t}\n\t\tchildren = myChildren;\n\t}\n\t/*\n\t * Reorder claimed children optimally.\n\t * We can reorder claimed children optimally by finding the longest subsequence of\n\t * nodes that are already claimed in order and only moving the rest. The longest\n\t * subsequence of nodes that are claimed in order can be found by\n\t * computing the longest increasing subsequence of .claim_order values.\n\t *\n\t * This algorithm is optimal in generating the least amount of reorder operations\n\t * possible.\n\t *\n\t * Proof:\n\t * We know that, given a set of reordering operations, the nodes that do not move\n\t * always form an increasing subsequence, since they do not move among each other\n\t * meaning that they must be already ordered among each other. Thus, the maximal\n\t * set of nodes that do not move form a longest increasing subsequence.\n\t */\n\t// Compute longest increasing subsequence\n\t// m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n\tconst m = new Int32Array(children.length + 1);\n\t// Predecessor indices + 1\n\tconst p = new Int32Array(children.length);\n\tm[0] = -1;\n\tlet longest = 0;\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst current = children[i].claim_order;\n\t\t// Find the largest subsequence length such that it ends in a value less than our current value\n\t\t// upper_bound returns first greater value, so we subtract one\n\t\t// with fast path for when we are on the current longest subsequence\n\t\tconst seqLen =\n\t\t\t(longest > 0 && children[m[longest]].claim_order <= current\n\t\t\t\t? longest + 1\n\t\t\t\t: upper_bound(1, longest, (idx) => children[m[idx]].claim_order, current)) - 1;\n\t\tp[i] = m[seqLen] + 1;\n\t\tconst newLen = seqLen + 1;\n\t\t// We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n\t\tm[newLen] = i;\n\t\tlongest = Math.max(newLen, longest);\n\t}\n\t// The longest increasing subsequence of nodes (initially reversed)\n\n\t/**\n\t * @type {NodeEx2[]}\n\t */\n\tconst lis = [];\n\t// The rest of the nodes, nodes that will be moved\n\n\t/**\n\t * @type {NodeEx2[]}\n\t */\n\tconst toMove = [];\n\tlet last = children.length - 1;\n\tfor (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n\t\tlis.push(children[cur - 1]);\n\t\tfor (; last >= cur; last--) {\n\t\t\ttoMove.push(children[last]);\n\t\t}\n\t\tlast--;\n\t}\n\tfor (; last >= 0; last--) {\n\t\ttoMove.push(children[last]);\n\t}\n\tlis.reverse();\n\t// We sort the nodes being moved to guarantee that their insertion order matches the claim order\n\ttoMove.sort((a, b) => a.claim_order - b.claim_order);\n\t// Finally, we move the nodes\n\tfor (let i = 0, j = 0; i < toMove.length; i++) {\n\t\twhile (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {\n\t\t\tj++;\n\t\t}\n\t\tconst anchor = j < lis.length ? lis[j] : null;\n\t\ttarget.insertBefore(toMove[i], anchor);\n\t}\n}\n\n/**\n * @param {Node} target\n * @param {Node} node\n * @returns {void}\n */\nexport function append(target, node) {\n\ttarget.appendChild(node);\n}\n\n/**\n * @param {Node} target\n * @param {string} style_sheet_id\n * @param {string} styles\n * @returns {void}\n */\nexport function append_styles(target, style_sheet_id, styles) {\n\tconst append_styles_to = get_root_for_style(target);\n\tif (!append_styles_to.getElementById(style_sheet_id)) {\n\t\tconst style = element('style');\n\t\tstyle.id = style_sheet_id;\n\t\tstyle.textContent = styles;\n\t\tappend_stylesheet(append_styles_to, style);\n\t}\n}\n\n/**\n * @param {Node} node\n * @returns {ShadowRoot | Document}\n */\nexport function get_root_for_style(node) {\n\tif (!node) return document;\n\tconst root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n\tif (root && /** @type {ShadowRoot} */ (root).host) {\n\t\treturn /** @type {ShadowRoot} */ (root);\n\t}\n\treturn node.ownerDocument;\n}\n\n/**\n * @param {Node} node\n * @returns {CSSStyleSheet}\n */\nexport function append_empty_stylesheet(node) {\n\tconst style_element = element('style');\n\t// For transitions to work without 'style-src: unsafe-inline' Content Security Policy,\n\t// these empty tags need to be allowed with a hash as a workaround until we move to the Web Animations API.\n\t// Using the hash for the empty string (for an empty tag) works in all browsers except Safari.\n\t// So as a workaround for the workaround, when we append empty style tags we set their content to /* empty */.\n\t// The hash 'sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=' will then work even in Safari.\n\tstyle_element.textContent = '/* empty */';\n\tappend_stylesheet(get_root_for_style(node), style_element);\n\treturn style_element.sheet;\n}\n\n/**\n * @param {ShadowRoot | Document} node\n * @param {HTMLStyleElement} style\n * @returns {CSSStyleSheet}\n */\nfunction append_stylesheet(node, style) {\n\tappend(/** @type {Document} */ (node).head || node, style);\n\treturn style.sheet;\n}\n\n/**\n * @param {NodeEx} target\n * @param {NodeEx} node\n * @returns {void}\n */\nexport function append_hydration(target, node) {\n\tif (is_hydrating) {\n\t\tinit_hydrate(target);\n\t\tif (\n\t\t\ttarget.actual_end_child === undefined ||\n\t\t\t(target.actual_end_child !== null && target.actual_end_child.parentNode !== target)\n\t\t) {\n\t\t\ttarget.actual_end_child = target.firstChild;\n\t\t}\n\t\t// Skip nodes of undefined ordering\n\t\twhile (target.actual_end_child !== null && target.actual_end_child.claim_order === undefined) {\n\t\t\ttarget.actual_end_child = target.actual_end_child.nextSibling;\n\t\t}\n\t\tif (node !== target.actual_end_child) {\n\t\t\t// We only insert if the ordering of this node should be modified or the parent node is not target\n\t\t\tif (node.claim_order !== undefined || node.parentNode !== target) {\n\t\t\t\ttarget.insertBefore(node, target.actual_end_child);\n\t\t\t}\n\t\t} else {\n\t\t\ttarget.actual_end_child = node.nextSibling;\n\t\t}\n\t} else if (node.parentNode !== target || node.nextSibling !== null) {\n\t\ttarget.appendChild(node);\n\t}\n}\n\n/**\n * @param {Node} target\n * @param {Node} node\n * @param {Node} [anchor]\n * @returns {void}\n */\nexport function insert(target, node, anchor) {\n\ttarget.insertBefore(node, anchor || null);\n}\n\n/**\n * @param {NodeEx} target\n * @param {NodeEx} node\n * @param {NodeEx} [anchor]\n * @returns {void}\n */\nexport function insert_hydration(target, node, anchor) {\n\tif (is_hydrating && !anchor) {\n\t\tappend_hydration(target, node);\n\t} else if (node.parentNode !== target || node.nextSibling != anchor) {\n\t\ttarget.insertBefore(node, anchor || null);\n\t}\n}\n\n/**\n * @param {Node} node\n * @returns {void}\n */\nexport function detach(node) {\n\tif (node.parentNode) {\n\t\tnode.parentNode.removeChild(node);\n\t}\n}\n\n/**\n * @returns {void} */\nexport function destroy_each(iterations, detaching) {\n\tfor (let i = 0; i < iterations.length; i += 1) {\n\t\tif (iterations[i]) iterations[i].d(detaching);\n\t}\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap} K\n * @param {K} name\n * @returns {HTMLElementTagNameMap[K]}\n */\nexport function element(name) {\n\treturn document.createElement(name);\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap} K\n * @param {K} name\n * @param {string} is\n * @returns {HTMLElementTagNameMap[K]}\n */\nexport function element_is(name, is) {\n\treturn document.createElement(name, { is });\n}\n\n/**\n * @template T\n * @template {keyof T} K\n * @param {T} obj\n * @param {K[]} exclude\n * @returns {Pick>}\n */\nexport function object_without_properties(obj, exclude) {\n\tconst target = /** @type {Pick>} */ ({});\n\tfor (const k in obj) {\n\t\tif (\n\t\t\thas_prop(obj, k) &&\n\t\t\t// @ts-ignore\n\t\t\texclude.indexOf(k) === -1\n\t\t) {\n\t\t\t// @ts-ignore\n\t\t\ttarget[k] = obj[k];\n\t\t}\n\t}\n\treturn target;\n}\n\n/**\n * @template {keyof SVGElementTagNameMap} K\n * @param {K} name\n * @returns {SVGElement}\n */\nexport function svg_element(name) {\n\treturn document.createElementNS('http://www.w3.org/2000/svg', name);\n}\n\n/**\n * @param {string} data\n * @returns {Text}\n */\nexport function text(data) {\n\treturn document.createTextNode(data);\n}\n\n/**\n * @returns {Text} */\nexport function space() {\n\treturn text(' ');\n}\n\n/**\n * @returns {Text} */\nexport function empty() {\n\treturn text('');\n}\n\n/**\n * @param {string} content\n * @returns {Comment}\n */\nexport function comment(content) {\n\treturn document.createComment(content);\n}\n\n/**\n * @param {EventTarget} node\n * @param {string} event\n * @param {EventListenerOrEventListenerObject} handler\n * @param {boolean | AddEventListenerOptions | EventListenerOptions} [options]\n * @returns {() => void}\n */\nexport function listen(node, event, handler, options) {\n\tnode.addEventListener(event, handler, options);\n\treturn () => node.removeEventListener(event, handler, options);\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function prevent_default(fn) {\n\treturn function (event) {\n\t\tevent.preventDefault();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function stop_propagation(fn) {\n\treturn function (event) {\n\t\tevent.stopPropagation();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function stop_immediate_propagation(fn) {\n\treturn function (event) {\n\t\tevent.stopImmediatePropagation();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => void} */\nexport function self(fn) {\n\treturn function (event) {\n\t\t// @ts-ignore\n\t\tif (event.target === this) fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => void} */\nexport function trusted(fn) {\n\treturn function (event) {\n\t\t// @ts-ignore\n\t\tif (event.isTrusted) fn.call(this, event);\n\t};\n}\n\n/**\n * @param {Element} node\n * @param {string} attribute\n * @param {string} [value]\n * @returns {void}\n */\nexport function attr(node, attribute, value) {\n\tif (value == null) node.removeAttribute(attribute);\n\telse if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);\n}\n/**\n * List of attributes that should always be set through the attr method,\n * because updating them through the property setter doesn't work reliably.\n * In the example of `width`/`height`, the problem is that the setter only\n * accepts numeric values, but the attribute can also be set to a string like `50%`.\n * If this list becomes too big, rethink this approach.\n */\nconst always_set_through_set_attribute = ['width', 'height'];\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {{ [x: string]: string }} attributes\n * @returns {void}\n */\nexport function set_attributes(node, attributes) {\n\t// @ts-ignore\n\tconst descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n\tfor (const key in attributes) {\n\t\tif (attributes[key] == null) {\n\t\t\tnode.removeAttribute(key);\n\t\t} else if (key === 'style') {\n\t\t\tnode.style.cssText = attributes[key];\n\t\t} else if (key === '__value') {\n\t\t\t/** @type {any} */ (node).value = node[key] = attributes[key];\n\t\t} else if (\n\t\t\tdescriptors[key] &&\n\t\t\tdescriptors[key].set &&\n\t\t\talways_set_through_set_attribute.indexOf(key) === -1\n\t\t) {\n\t\t\tnode[key] = attributes[key];\n\t\t} else {\n\t\t\tattr(node, key, attributes[key]);\n\t\t}\n\t}\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {{ [x: string]: string }} attributes\n * @returns {void}\n */\nexport function set_svg_attributes(node, attributes) {\n\tfor (const key in attributes) {\n\t\tattr(node, key, attributes[key]);\n\t}\n}\n\n/**\n * @param {Record} data_map\n * @returns {void}\n */\nexport function set_custom_element_data_map(node, data_map) {\n\tObject.keys(data_map).forEach((key) => {\n\t\tset_custom_element_data(node, key, data_map[key]);\n\t});\n}\n\n/**\n * @returns {void} */\nexport function set_custom_element_data(node, prop, value) {\n\tif (prop in node) {\n\t\tnode[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n\t} else {\n\t\tattr(node, prop, value);\n\t}\n}\n\n/**\n * @param {string} tag\n */\nexport function set_dynamic_element_data(tag) {\n\treturn /-/.test(tag) ? set_custom_element_data_map : set_attributes;\n}\n\n/**\n * @returns {void}\n */\nexport function xlink_attr(node, attribute, value) {\n\tnode.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @returns {string}\n */\nexport function get_svelte_dataset(node) {\n\treturn node.dataset.svelteH;\n}\n\n/**\n * @returns {unknown[]} */\nexport function get_binding_group_value(group, __value, checked) {\n\tconst value = new Set();\n\tfor (let i = 0; i < group.length; i += 1) {\n\t\tif (group[i].checked) value.add(group[i].__value);\n\t}\n\tif (!checked) {\n\t\tvalue.delete(__value);\n\t}\n\treturn Array.from(value);\n}\n\n/**\n * @param {HTMLInputElement[]} group\n * @returns {{ p(...inputs: HTMLInputElement[]): void; r(): void; }}\n */\nexport function init_binding_group(group) {\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _inputs;\n\treturn {\n\t\t/* push */ p(...inputs) {\n\t\t\t_inputs = inputs;\n\t\t\t_inputs.forEach((input) => group.push(input));\n\t\t},\n\t\t/* remove */ r() {\n\t\t\t_inputs.forEach((input) => group.splice(group.indexOf(input), 1));\n\t\t}\n\t};\n}\n\n/**\n * @param {number[]} indexes\n * @returns {{ u(new_indexes: number[]): void; p(...inputs: HTMLInputElement[]): void; r: () => void; }}\n */\nexport function init_binding_group_dynamic(group, indexes) {\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _group = get_binding_group(group);\n\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _inputs;\n\n\tfunction get_binding_group(group) {\n\t\tfor (let i = 0; i < indexes.length; i++) {\n\t\t\tgroup = group[indexes[i]] = group[indexes[i]] || [];\n\t\t}\n\t\treturn group;\n\t}\n\n\t/**\n\t * @returns {void} */\n\tfunction push() {\n\t\t_inputs.forEach((input) => _group.push(input));\n\t}\n\n\t/**\n\t * @returns {void} */\n\tfunction remove() {\n\t\t_inputs.forEach((input) => _group.splice(_group.indexOf(input), 1));\n\t}\n\treturn {\n\t\t/* update */ u(new_indexes) {\n\t\t\tindexes = new_indexes;\n\t\t\tconst new_group = get_binding_group(group);\n\t\t\tif (new_group !== _group) {\n\t\t\t\tremove();\n\t\t\t\t_group = new_group;\n\t\t\t\tpush();\n\t\t\t}\n\t\t},\n\t\t/* push */ p(...inputs) {\n\t\t\t_inputs = inputs;\n\t\t\tpush();\n\t\t},\n\t\t/* remove */ r: remove\n\t};\n}\n\n/**\n * @returns {number} */\nexport function to_number(value) {\n\treturn value === '' ? null : +value;\n}\n\n/**\n * @returns {any[]} */\nexport function time_ranges_to_array(ranges) {\n\tconst array = [];\n\tfor (let i = 0; i < ranges.length; i += 1) {\n\t\tarray.push({ start: ranges.start(i), end: ranges.end(i) });\n\t}\n\treturn array;\n}\n\n/**\n * @param {Element} element\n * @returns {ChildNode[]}\n */\nexport function children(element) {\n\treturn Array.from(element.childNodes);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {void}\n */\nfunction init_claim_info(nodes) {\n\tif (nodes.claim_info === undefined) {\n\t\tnodes.claim_info = { last_index: 0, total_claimed: 0 };\n\t}\n}\n\n/**\n * @template {ChildNodeEx} R\n * @param {ChildNodeArray} nodes\n * @param {(node: ChildNodeEx) => node is R} predicate\n * @param {(node: ChildNodeEx) => ChildNodeEx | undefined} processNode\n * @param {() => R} createNode\n * @param {boolean} dontUpdateLastIndex\n * @returns {R}\n */\nfunction claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {\n\t// Try to find nodes in an order such that we lengthen the longest increasing subsequence\n\tinit_claim_info(nodes);\n\tconst resultNode = (() => {\n\t\t// We first try to find an element after the previous one\n\t\tfor (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n\t\t\tconst node = nodes[i];\n\t\t\tif (predicate(node)) {\n\t\t\t\tconst replacement = processNode(node);\n\t\t\t\tif (replacement === undefined) {\n\t\t\t\t\tnodes.splice(i, 1);\n\t\t\t\t} else {\n\t\t\t\t\tnodes[i] = replacement;\n\t\t\t\t}\n\t\t\t\tif (!dontUpdateLastIndex) {\n\t\t\t\t\tnodes.claim_info.last_index = i;\n\t\t\t\t}\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\t// Otherwise, we try to find one before\n\t\t// We iterate in reverse so that we don't go too far back\n\t\tfor (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n\t\t\tconst node = nodes[i];\n\t\t\tif (predicate(node)) {\n\t\t\t\tconst replacement = processNode(node);\n\t\t\t\tif (replacement === undefined) {\n\t\t\t\t\tnodes.splice(i, 1);\n\t\t\t\t} else {\n\t\t\t\t\tnodes[i] = replacement;\n\t\t\t\t}\n\t\t\t\tif (!dontUpdateLastIndex) {\n\t\t\t\t\tnodes.claim_info.last_index = i;\n\t\t\t\t} else if (replacement === undefined) {\n\t\t\t\t\t// Since we spliced before the last_index, we decrease it\n\t\t\t\t\tnodes.claim_info.last_index--;\n\t\t\t\t}\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\t// If we can't find any matching node, we create a new one\n\t\treturn createNode();\n\t})();\n\tresultNode.claim_order = nodes.claim_info.total_claimed;\n\tnodes.claim_info.total_claimed += 1;\n\treturn resultNode;\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @param {(name: string) => Element | SVGElement} create_element\n * @returns {Element | SVGElement}\n */\nfunction claim_element_base(nodes, name, attributes, create_element) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Element | SVGElement} */\n\t\t(node) => node.nodeName === name,\n\t\t/** @param {Element} node */\n\t\t(node) => {\n\t\t\tconst remove = [];\n\t\t\tfor (let j = 0; j < node.attributes.length; j++) {\n\t\t\t\tconst attribute = node.attributes[j];\n\t\t\t\tif (!attributes[attribute.name]) {\n\t\t\t\t\tremove.push(attribute.name);\n\t\t\t\t}\n\t\t\t}\n\t\t\tremove.forEach((v) => node.removeAttribute(v));\n\t\t\treturn undefined;\n\t\t},\n\t\t() => create_element(name)\n\t);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @returns {Element | SVGElement}\n */\nexport function claim_element(nodes, name, attributes) {\n\treturn claim_element_base(nodes, name, attributes, element);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @returns {Element | SVGElement}\n */\nexport function claim_svg_element(nodes, name, attributes) {\n\treturn claim_element_base(nodes, name, attributes, svg_element);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {Text}\n */\nexport function claim_text(nodes, data) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Text} */\n\t\t(node) => node.nodeType === 3,\n\t\t/** @param {Text} node */\n\t\t(node) => {\n\t\t\tconst dataStr = '' + data;\n\t\t\tif (node.data.startsWith(dataStr)) {\n\t\t\t\tif (node.data.length !== dataStr.length) {\n\t\t\t\t\treturn node.splitText(dataStr.length);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnode.data = dataStr;\n\t\t\t}\n\t\t},\n\t\t() => text(data),\n\t\ttrue // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n\t);\n}\n\n/**\n * @returns {Text} */\nexport function claim_space(nodes) {\n\treturn claim_text(nodes, ' ');\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {Comment}\n */\nexport function claim_comment(nodes, data) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Comment} */\n\t\t(node) => node.nodeType === 8,\n\t\t/** @param {Comment} node */\n\t\t(node) => {\n\t\t\tnode.data = '' + data;\n\t\t\treturn undefined;\n\t\t},\n\t\t() => comment(data),\n\t\ttrue\n\t);\n}\n\nfunction find_comment(nodes, text, start) {\n\tfor (let i = start; i < nodes.length; i += 1) {\n\t\tconst node = nodes[i];\n\t\tif (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn nodes.length;\n}\n\n/**\n * @param {boolean} is_svg\n * @returns {HtmlTagHydration}\n */\nexport function claim_html_tag(nodes, is_svg) {\n\t// find html opening tag\n\tconst start_index = find_comment(nodes, 'HTML_TAG_START', 0);\n\tconst end_index = find_comment(nodes, 'HTML_TAG_END', start_index);\n\tif (start_index === end_index) {\n\t\treturn new HtmlTagHydration(undefined, is_svg);\n\t}\n\tinit_claim_info(nodes);\n\tconst html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n\tdetach(html_tag_nodes[0]);\n\tdetach(html_tag_nodes[html_tag_nodes.length - 1]);\n\tconst claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n\tfor (const n of claimed_nodes) {\n\t\tn.claim_order = nodes.claim_info.total_claimed;\n\t\tnodes.claim_info.total_claimed += 1;\n\t}\n\treturn new HtmlTagHydration(claimed_nodes, is_svg);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @returns {void}\n */\nexport function set_data(text, data) {\n\tdata = '' + data;\n\tif (text.data === data) return;\n\ttext.data = /** @type {string} */ (data);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @returns {void}\n */\nexport function set_data_contenteditable(text, data) {\n\tdata = '' + data;\n\tif (text.wholeText === data) return;\n\ttext.data = /** @type {string} */ (data);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @param {string} attr_value\n * @returns {void}\n */\nexport function set_data_maybe_contenteditable(text, data, attr_value) {\n\tif (~contenteditable_truthy_values.indexOf(attr_value)) {\n\t\tset_data_contenteditable(text, data);\n\t} else {\n\t\tset_data(text, data);\n\t}\n}\n\n/**\n * @returns {void} */\nexport function set_input_value(input, value) {\n\tinput.value = value == null ? '' : value;\n}\n\n/**\n * @returns {void} */\nexport function set_input_type(input, type) {\n\ttry {\n\t\tinput.type = type;\n\t} catch (e) {\n\t\t// do nothing\n\t}\n}\n\n/**\n * @returns {void} */\nexport function set_style(node, key, value, important) {\n\tif (value == null) {\n\t\tnode.style.removeProperty(key);\n\t} else {\n\t\tnode.style.setProperty(key, value, important ? 'important' : '');\n\t}\n}\n\n/**\n * @returns {void} */\nexport function select_option(select, value, mounting) {\n\tfor (let i = 0; i < select.options.length; i += 1) {\n\t\tconst option = select.options[i];\n\t\tif (option.__value === value) {\n\t\t\toption.selected = true;\n\t\t\treturn;\n\t\t}\n\t}\n\tif (!mounting || value !== undefined) {\n\t\tselect.selectedIndex = -1; // no option should be selected\n\t}\n}\n\n/**\n * @returns {void} */\nexport function select_options(select, value) {\n\tfor (let i = 0; i < select.options.length; i += 1) {\n\t\tconst option = select.options[i];\n\t\toption.selected = ~value.indexOf(option.__value);\n\t}\n}\n\nexport function select_value(select) {\n\tconst selected_option = select.querySelector(':checked');\n\treturn selected_option && selected_option.__value;\n}\n\nexport function select_multiple_value(select) {\n\treturn [].map.call(select.querySelectorAll(':checked'), (option) => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\n\n/**\n * @type {boolean} */\nlet crossorigin;\n\n/**\n * @returns {boolean} */\nexport function is_crossorigin() {\n\tif (crossorigin === undefined) {\n\t\tcrossorigin = false;\n\t\ttry {\n\t\t\tif (typeof window !== 'undefined' && window.parent) {\n\t\t\t\tvoid window.parent.document;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tcrossorigin = true;\n\t\t}\n\t}\n\treturn crossorigin;\n}\n\n/**\n * @param {HTMLElement} node\n * @param {() => void} fn\n * @returns {() => void}\n */\nexport function add_iframe_resize_listener(node, fn) {\n\tconst computed_style = getComputedStyle(node);\n\tif (computed_style.position === 'static') {\n\t\tnode.style.position = 'relative';\n\t}\n\tconst iframe = element('iframe');\n\tiframe.setAttribute(\n\t\t'style',\n\t\t'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n\t\t\t'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;'\n\t);\n\tiframe.setAttribute('aria-hidden', 'true');\n\tiframe.tabIndex = -1;\n\tconst crossorigin = is_crossorigin();\n\n\t/**\n\t * @type {() => void}\n\t */\n\tlet unsubscribe;\n\tif (crossorigin) {\n\t\tiframe.src = \"data:text/html,\";\n\t\tunsubscribe = listen(\n\t\t\twindow,\n\t\t\t'message',\n\t\t\t/** @param {MessageEvent} event */ (event) => {\n\t\t\t\tif (event.source === iframe.contentWindow) fn();\n\t\t\t}\n\t\t);\n\t} else {\n\t\tiframe.src = 'about:blank';\n\t\tiframe.onload = () => {\n\t\t\tunsubscribe = listen(iframe.contentWindow, 'resize', fn);\n\t\t\t// make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)\n\t\t\t// see https://github.com/sveltejs/svelte/issues/4233\n\t\t\tfn();\n\t\t};\n\t}\n\tappend(node, iframe);\n\treturn () => {\n\t\tif (crossorigin) {\n\t\t\tunsubscribe();\n\t\t} else if (unsubscribe && iframe.contentWindow) {\n\t\t\tunsubscribe();\n\t\t}\n\t\tdetach(iframe);\n\t};\n}\nexport const resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'content-box'\n});\nexport const resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'border-box'\n});\nexport const resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton(\n\t{ box: 'device-pixel-content-box' }\n);\nexport { ResizeObserverSingleton };\n\n/**\n * @returns {void} */\nexport function toggle_class(element, name, toggle) {\n\t// The `!!` is required because an `undefined` flag means flipping the current state.\n\telement.classList.toggle(name, !!toggle);\n}\n\n/**\n * @template T\n * @param {string} type\n * @param {T} [detail]\n * @param {{ bubbles?: boolean, cancelable?: boolean }} [options]\n * @returns {CustomEvent}\n */\nexport function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n\treturn new CustomEvent(type, { detail, bubbles, cancelable });\n}\n\n/**\n * @param {string} selector\n * @param {HTMLElement} parent\n * @returns {ChildNodeArray}\n */\nexport function query_selector_all(selector, parent = document.body) {\n\treturn Array.from(parent.querySelectorAll(selector));\n}\n\n/**\n * @param {string} nodeId\n * @param {HTMLElement} head\n * @returns {any[]}\n */\nexport function head_selector(nodeId, head) {\n\tconst result = [];\n\tlet started = 0;\n\tfor (const node of head.childNodes) {\n\t\tif (node.nodeType === 8 /* comment node */) {\n\t\t\tconst comment = node.textContent.trim();\n\t\t\tif (comment === `HEAD_${nodeId}_END`) {\n\t\t\t\tstarted -= 1;\n\t\t\t\tresult.push(node);\n\t\t\t} else if (comment === `HEAD_${nodeId}_START`) {\n\t\t\t\tstarted += 1;\n\t\t\t\tresult.push(node);\n\t\t\t}\n\t\t} else if (started > 0) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\treturn result;\n}\n/** */\nexport class HtmlTag {\n\t/**\n\t * @private\n\t * @default false\n\t */\n\tis_svg = false;\n\t// parent for creating node\n\t/** */\n\te = undefined;\n\t// html tag nodes\n\t/** */\n\tn = undefined;\n\t// target\n\t/** */\n\tt = undefined;\n\t// anchor\n\t/** */\n\ta = undefined;\n\tconstructor(is_svg = false) {\n\t\tthis.is_svg = is_svg;\n\t\tthis.e = this.n = null;\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @returns {void}\n\t */\n\tc(html) {\n\t\tthis.h(html);\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @param {HTMLElement | SVGElement} target\n\t * @param {HTMLElement | SVGElement} anchor\n\t * @returns {void}\n\t */\n\tm(html, target, anchor = null) {\n\t\tif (!this.e) {\n\t\t\tif (this.is_svg)\n\t\t\t\tthis.e = svg_element(/** @type {keyof SVGElementTagNameMap} */ (target.nodeName));\n\t\t\t/** #7364 target for