{"version":3,"file":"application-CAJrI_H2.js","names":["src_default","modifierValue","module_default","isRadio","ownKeys","src_default","module_default","src_default","module_default","src_default","module_default","$","track","queue","i","started","start","on"],"sources":["../../../node_modules/@alpinejs/collapse/dist/module.esm.js","../../../node_modules/@alpinejs/focus/dist/module.esm.js","../../../node_modules/@alpinejs/intersect/dist/module.esm.js","../../../node_modules/@alpinejs/persist/dist/module.esm.js","../../../node_modules/ahoy.js/dist/ahoy.esm.js","../../../node_modules/alpinejs/dist/module.esm.js","../../../node_modules/trix/dist/trix.esm.min.js","../../../node_modules/@rails/actiontext/app/assets/javascripts/actiontext.esm.js","../../../node_modules/trix-tools/lib/code.js","../../../node_modules/trix-tools/lib/images.js","../../../node_modules/trix-tools/lib/twitter.js","../../../node_modules/trix-tools/lib/youtube.js","../../../node_modules/trix-tools/index.js","../../../app/frontend/entrypoints/application.ts"],"sourcesContent":["// packages/collapse/src/index.js\nfunction src_default(Alpine) {\n Alpine.directive(\"collapse\", collapse);\n collapse.inline = (el, { modifiers }) => {\n if (!modifiers.includes(\"min\"))\n return;\n el._x_doShow = () => {\n };\n el._x_doHide = () => {\n };\n };\n function collapse(el, { modifiers }) {\n let duration = modifierValue(modifiers, \"duration\", 250) / 1e3;\n let floor = modifierValue(modifiers, \"min\", 0);\n let fullyHide = !modifiers.includes(\"min\");\n if (!el._x_isShown)\n el.style.height = `${floor}px`;\n if (!el._x_isShown && fullyHide)\n el.hidden = true;\n if (!el._x_isShown)\n el.style.overflow = \"hidden\";\n let setFunction = (el2, styles) => {\n let revertFunction = Alpine.setStyles(el2, styles);\n return styles.height ? () => {\n } : revertFunction;\n };\n let transitionStyles = {\n transitionProperty: \"height\",\n transitionDuration: `${duration}s`,\n transitionTimingFunction: \"cubic-bezier(0.4, 0.0, 0.2, 1)\"\n };\n el._x_transition = {\n in(before = () => {\n }, after = () => {\n }) {\n if (fullyHide)\n el.hidden = false;\n if (fullyHide)\n el.style.display = null;\n let current = el.getBoundingClientRect().height;\n el.style.height = \"auto\";\n let full = el.getBoundingClientRect().height;\n if (current === full) {\n current = floor;\n }\n Alpine.transition(el, Alpine.setStyles, {\n during: transitionStyles,\n start: { height: current + \"px\" },\n end: { height: full + \"px\" }\n }, () => el._x_isShown = true, () => {\n if (Math.abs(el.getBoundingClientRect().height - full) < 1) {\n el.style.overflow = null;\n }\n });\n },\n out(before = () => {\n }, after = () => {\n }) {\n let full = el.getBoundingClientRect().height;\n Alpine.transition(el, setFunction, {\n during: transitionStyles,\n start: { height: full + \"px\" },\n end: { height: floor + \"px\" }\n }, () => el.style.overflow = \"hidden\", () => {\n el._x_isShown = false;\n if (el.style.height == `${floor}px` && fullyHide) {\n el.style.display = \"none\";\n el.hidden = true;\n }\n });\n }\n };\n }\n}\nfunction modifierValue(modifiers, key, fallback) {\n if (modifiers.indexOf(key) === -1)\n return fallback;\n const rawValue = modifiers[modifiers.indexOf(key) + 1];\n if (!rawValue)\n return fallback;\n if (key === \"duration\") {\n let match = rawValue.match(/([0-9]+)ms/);\n if (match)\n return match[1];\n }\n if (key === \"min\") {\n let match = rawValue.match(/([0-9]+)px/);\n if (match)\n return match[1];\n }\n return rawValue;\n}\n\n// packages/collapse/builds/module.js\nvar module_default = src_default;\nexport {\n src_default as collapse,\n module_default as default\n};\n","// node_modules/tabbable/dist/index.esm.js\nvar candidateSelectors = [\"input\", \"select\", \"textarea\", \"a[href]\", \"button\", \"[tabindex]:not(slot)\", \"audio[controls]\", \"video[controls]\", '[contenteditable]:not([contenteditable=\"false\"])', \"details>summary:first-of-type\", \"details\"];\nvar candidateSelector = /* @__PURE__ */ candidateSelectors.join(\",\");\nvar NoElement = typeof Element === \"undefined\";\nvar matches = NoElement ? function() {\n} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;\nvar getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {\n return element.getRootNode();\n} : function(element) {\n return element.ownerDocument;\n};\nvar getCandidates = function getCandidates2(el, includeContainer, filter) {\n var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));\n if (includeContainer && matches.call(el, candidateSelector)) {\n candidates.unshift(el);\n }\n candidates = candidates.filter(filter);\n return candidates;\n};\nvar getCandidatesIteratively = function getCandidatesIteratively2(elements, includeContainer, options) {\n var candidates = [];\n var elementsToCheck = Array.from(elements);\n while (elementsToCheck.length) {\n var element = elementsToCheck.shift();\n if (element.tagName === \"SLOT\") {\n var assigned = element.assignedElements();\n var content = assigned.length ? assigned : element.children;\n var nestedCandidates = getCandidatesIteratively2(content, true, options);\n if (options.flatten) {\n candidates.push.apply(candidates, nestedCandidates);\n } else {\n candidates.push({\n scope: element,\n candidates: nestedCandidates\n });\n }\n } else {\n var validCandidate = matches.call(element, candidateSelector);\n if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {\n candidates.push(element);\n }\n var shadowRoot = element.shadowRoot || // check for an undisclosed shadow\n typeof options.getShadowRoot === \"function\" && options.getShadowRoot(element);\n var validShadowRoot = !options.shadowRootFilter || options.shadowRootFilter(element);\n if (shadowRoot && validShadowRoot) {\n var _nestedCandidates = getCandidatesIteratively2(shadowRoot === true ? element.children : shadowRoot.children, true, options);\n if (options.flatten) {\n candidates.push.apply(candidates, _nestedCandidates);\n } else {\n candidates.push({\n scope: element,\n candidates: _nestedCandidates\n });\n }\n } else {\n elementsToCheck.unshift.apply(elementsToCheck, element.children);\n }\n }\n }\n return candidates;\n};\nvar getTabindex = function getTabindex2(node, isScope) {\n if (node.tabIndex < 0) {\n if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute(\"tabindex\"), 10))) {\n return 0;\n }\n }\n return node.tabIndex;\n};\nvar sortOrderedTabbables = function sortOrderedTabbables2(a, b) {\n return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;\n};\nvar isInput = function isInput2(node) {\n return node.tagName === \"INPUT\";\n};\nvar isHiddenInput = function isHiddenInput2(node) {\n return isInput(node) && node.type === \"hidden\";\n};\nvar isDetailsWithSummary = function isDetailsWithSummary2(node) {\n var r = node.tagName === \"DETAILS\" && Array.prototype.slice.apply(node.children).some(function(child) {\n return child.tagName === \"SUMMARY\";\n });\n return r;\n};\nvar getCheckedRadio = function getCheckedRadio2(nodes, form) {\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].checked && nodes[i].form === form) {\n return nodes[i];\n }\n }\n};\nvar isTabbableRadio = function isTabbableRadio2(node) {\n if (!node.name) {\n return true;\n }\n var radioScope = node.form || getRootNode(node);\n var queryRadios = function queryRadios2(name) {\n return radioScope.querySelectorAll('input[type=\"radio\"][name=\"' + name + '\"]');\n };\n var radioSet;\n if (typeof window !== \"undefined\" && typeof window.CSS !== \"undefined\" && typeof window.CSS.escape === \"function\") {\n radioSet = queryRadios(window.CSS.escape(node.name));\n } else {\n try {\n radioSet = queryRadios(node.name);\n } catch (err) {\n console.error(\"Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s\", err.message);\n return false;\n }\n }\n var checked = getCheckedRadio(radioSet, node.form);\n return !checked || checked === node;\n};\nvar isRadio = function isRadio2(node) {\n return isInput(node) && node.type === \"radio\";\n};\nvar isNonTabbableRadio = function isNonTabbableRadio2(node) {\n return isRadio(node) && !isTabbableRadio(node);\n};\nvar isZeroArea = function isZeroArea2(node) {\n var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;\n return width === 0 && height === 0;\n};\nvar isHidden = function isHidden2(node, _ref) {\n var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;\n if (getComputedStyle(node).visibility === \"hidden\") {\n return true;\n }\n var isDirectSummary = matches.call(node, \"details>summary:first-of-type\");\n var nodeUnderDetails = isDirectSummary ? node.parentElement : node;\n if (matches.call(nodeUnderDetails, \"details:not([open]) *\")) {\n return true;\n }\n var nodeRootHost = getRootNode(node).host;\n var nodeIsAttached = (nodeRootHost === null || nodeRootHost === void 0 ? void 0 : nodeRootHost.ownerDocument.contains(nodeRootHost)) || node.ownerDocument.contains(node);\n if (!displayCheck || displayCheck === \"full\") {\n if (typeof getShadowRoot === \"function\") {\n var originalNode = node;\n while (node) {\n var parentElement = node.parentElement;\n var rootNode = getRootNode(node);\n if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) {\n return isZeroArea(node);\n } else if (node.assignedSlot) {\n node = node.assignedSlot;\n } else if (!parentElement && rootNode !== node.ownerDocument) {\n node = rootNode.host;\n } else {\n node = parentElement;\n }\n }\n node = originalNode;\n }\n if (nodeIsAttached) {\n return !node.getClientRects().length;\n }\n } else if (displayCheck === \"non-zero-area\") {\n return isZeroArea(node);\n }\n return false;\n};\nvar isDisabledFromFieldset = function isDisabledFromFieldset2(node) {\n if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {\n var parentNode = node.parentElement;\n while (parentNode) {\n if (parentNode.tagName === \"FIELDSET\" && parentNode.disabled) {\n for (var i = 0; i < parentNode.children.length; i++) {\n var child = parentNode.children.item(i);\n if (child.tagName === \"LEGEND\") {\n return matches.call(parentNode, \"fieldset[disabled] *\") ? true : !child.contains(node);\n }\n }\n return true;\n }\n parentNode = parentNode.parentElement;\n }\n }\n return false;\n};\nvar isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {\n if (node.disabled || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus\n isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {\n return false;\n }\n return true;\n};\nvar isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {\n if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {\n return false;\n }\n return true;\n};\nvar isValidShadowRootTabbable = function isValidShadowRootTabbable2(shadowHostNode) {\n var tabIndex = parseInt(shadowHostNode.getAttribute(\"tabindex\"), 10);\n if (isNaN(tabIndex) || tabIndex >= 0) {\n return true;\n }\n return false;\n};\nvar sortByOrder = function sortByOrder2(candidates) {\n var regularTabbables = [];\n var orderedTabbables = [];\n candidates.forEach(function(item, i) {\n var isScope = !!item.scope;\n var element = isScope ? item.scope : item;\n var candidateTabindex = getTabindex(element, isScope);\n var elements = isScope ? sortByOrder2(item.candidates) : element;\n if (candidateTabindex === 0) {\n isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);\n } else {\n orderedTabbables.push({\n documentOrder: i,\n tabIndex: candidateTabindex,\n item,\n isScope,\n content: elements\n });\n }\n });\n return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) {\n sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);\n return acc;\n }, []).concat(regularTabbables);\n};\nvar tabbable = function tabbable2(el, options) {\n options = options || {};\n var candidates;\n if (options.getShadowRoot) {\n candidates = getCandidatesIteratively([el], options.includeContainer, {\n filter: isNodeMatchingSelectorTabbable.bind(null, options),\n flatten: false,\n getShadowRoot: options.getShadowRoot,\n shadowRootFilter: isValidShadowRootTabbable\n });\n } else {\n candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));\n }\n return sortByOrder(candidates);\n};\nvar focusable = function focusable2(el, options) {\n options = options || {};\n var candidates;\n if (options.getShadowRoot) {\n candidates = getCandidatesIteratively([el], options.includeContainer, {\n filter: isNodeMatchingSelectorFocusable.bind(null, options),\n flatten: true,\n getShadowRoot: options.getShadowRoot\n });\n } else {\n candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));\n }\n return candidates;\n};\nvar isTabbable = function isTabbable2(node, options) {\n options = options || {};\n if (!node) {\n throw new Error(\"No node provided\");\n }\n if (matches.call(node, candidateSelector) === false) {\n return false;\n }\n return isNodeMatchingSelectorTabbable(options, node);\n};\nvar focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat(\"iframe\").join(\",\");\nvar isFocusable = function isFocusable2(node, options) {\n options = options || {};\n if (!node) {\n throw new Error(\"No node provided\");\n }\n if (matches.call(node, focusableCandidateSelector) === false) {\n return false;\n }\n return isNodeMatchingSelectorFocusable(options, node);\n};\n\n// node_modules/focus-trap/dist/focus-trap.esm.js\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function(sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n return keys;\n}\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), true).forEach(function(key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n return target;\n}\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nvar activeFocusTraps = function() {\n var trapQueue = [];\n return {\n activateTrap: function activateTrap(trap) {\n if (trapQueue.length > 0) {\n var activeTrap = trapQueue[trapQueue.length - 1];\n if (activeTrap !== trap) {\n activeTrap.pause();\n }\n }\n var trapIndex = trapQueue.indexOf(trap);\n if (trapIndex === -1) {\n trapQueue.push(trap);\n } else {\n trapQueue.splice(trapIndex, 1);\n trapQueue.push(trap);\n }\n },\n deactivateTrap: function deactivateTrap(trap) {\n var trapIndex = trapQueue.indexOf(trap);\n if (trapIndex !== -1) {\n trapQueue.splice(trapIndex, 1);\n }\n if (trapQueue.length > 0) {\n trapQueue[trapQueue.length - 1].unpause();\n }\n }\n };\n}();\nvar isSelectableInput = function isSelectableInput2(node) {\n return node.tagName && node.tagName.toLowerCase() === \"input\" && typeof node.select === \"function\";\n};\nvar isEscapeEvent = function isEscapeEvent2(e) {\n return e.key === \"Escape\" || e.key === \"Esc\" || e.keyCode === 27;\n};\nvar isTabEvent = function isTabEvent2(e) {\n return e.key === \"Tab\" || e.keyCode === 9;\n};\nvar delay = function delay2(fn) {\n return setTimeout(fn, 0);\n};\nvar findIndex = function findIndex2(arr, fn) {\n var idx = -1;\n arr.every(function(value, i) {\n if (fn(value)) {\n idx = i;\n return false;\n }\n return true;\n });\n return idx;\n};\nvar valueOrHandler = function valueOrHandler2(value) {\n for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n params[_key - 1] = arguments[_key];\n }\n return typeof value === \"function\" ? value.apply(void 0, params) : value;\n};\nvar getActualTarget = function getActualTarget2(event) {\n return event.target.shadowRoot && typeof event.composedPath === \"function\" ? event.composedPath()[0] : event.target;\n};\nvar createFocusTrap = function createFocusTrap2(elements, userOptions) {\n var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;\n var config = _objectSpread2({\n returnFocusOnDeactivate: true,\n escapeDeactivates: true,\n delayInitialFocus: true\n }, userOptions);\n var state = {\n // containers given to createFocusTrap()\n // @type {Array}\n containers: [],\n // list of objects identifying tabbable nodes in `containers` in the trap\n // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap\n // is active, but the trap should never get to a state where there isn't at least one group\n // with at least one tabbable node in it (that would lead to an error condition that would\n // result in an error being thrown)\n // @type {Array<{\n // container: HTMLElement,\n // tabbableNodes: Array, // empty if none\n // focusableNodes: Array, // empty if none\n // firstTabbableNode: HTMLElement|null,\n // lastTabbableNode: HTMLElement|null,\n // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined\n // }>}\n containerGroups: [],\n // same order/length as `containers` list\n // references to objects in `containerGroups`, but only those that actually have\n // tabbable nodes in them\n // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__\n // the same length\n tabbableGroups: [],\n nodeFocusedBeforeActivation: null,\n mostRecentlyFocusedNode: null,\n active: false,\n paused: false,\n // timer ID for when delayInitialFocus is true and initial focus in this trap\n // has been delayed during activation\n delayInitialFocusTimer: void 0\n };\n var trap;\n var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) {\n return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName];\n };\n var findContainerIndex = function findContainerIndex2(element) {\n return state.containerGroups.findIndex(function(_ref) {\n var container = _ref.container, tabbableNodes = _ref.tabbableNodes;\n return container.contains(element) || // fall back to explicit tabbable search which will take into consideration any\n // web components if the `tabbableOptions.getShadowRoot` option was used for\n // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't\n // look inside web components even if open)\n tabbableNodes.find(function(node) {\n return node === element;\n });\n });\n };\n var getNodeForOption = function getNodeForOption2(optionName) {\n var optionValue = config[optionName];\n if (typeof optionValue === \"function\") {\n for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n params[_key2 - 1] = arguments[_key2];\n }\n optionValue = optionValue.apply(void 0, params);\n }\n if (optionValue === true) {\n optionValue = void 0;\n }\n if (!optionValue) {\n if (optionValue === void 0 || optionValue === false) {\n return optionValue;\n }\n throw new Error(\"`\".concat(optionName, \"` was specified but was not a node, or did not return a node\"));\n }\n var node = optionValue;\n if (typeof optionValue === \"string\") {\n node = doc.querySelector(optionValue);\n if (!node) {\n throw new Error(\"`\".concat(optionName, \"` as selector refers to no known node\"));\n }\n }\n return node;\n };\n var getInitialFocusNode = function getInitialFocusNode2() {\n var node = getNodeForOption(\"initialFocus\");\n if (node === false) {\n return false;\n }\n if (node === void 0) {\n if (findContainerIndex(doc.activeElement) >= 0) {\n node = doc.activeElement;\n } else {\n var firstTabbableGroup = state.tabbableGroups[0];\n var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;\n node = firstTabbableNode || getNodeForOption(\"fallbackFocus\");\n }\n }\n if (!node) {\n throw new Error(\"Your focus-trap needs to have at least one focusable element\");\n }\n return node;\n };\n var updateTabbableNodes = function updateTabbableNodes2() {\n state.containerGroups = state.containers.map(function(container) {\n var tabbableNodes = tabbable(container, config.tabbableOptions);\n var focusableNodes = focusable(container, config.tabbableOptions);\n return {\n container,\n tabbableNodes,\n focusableNodes,\n firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,\n lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,\n /**\n * Finds the __tabbable__ node that follows the given node in the specified direction,\n * in this container, if any.\n * @param {HTMLElement} node\n * @param {boolean} [forward] True if going in forward tab order; false if going\n * in reverse.\n * @returns {HTMLElement|undefined} The next tabbable node, if any.\n */\n nextTabbableNode: function nextTabbableNode(node) {\n var forward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;\n var nodeIdx = focusableNodes.findIndex(function(n) {\n return n === node;\n });\n if (nodeIdx < 0) {\n return void 0;\n }\n if (forward) {\n return focusableNodes.slice(nodeIdx + 1).find(function(n) {\n return isTabbable(n, config.tabbableOptions);\n });\n }\n return focusableNodes.slice(0, nodeIdx).reverse().find(function(n) {\n return isTabbable(n, config.tabbableOptions);\n });\n }\n };\n });\n state.tabbableGroups = state.containerGroups.filter(function(group) {\n return group.tabbableNodes.length > 0;\n });\n if (state.tabbableGroups.length <= 0 && !getNodeForOption(\"fallbackFocus\")) {\n throw new Error(\"Your focus-trap must have at least one container with at least one tabbable node in it at all times\");\n }\n };\n var tryFocus = function tryFocus2(node) {\n if (node === false) {\n return;\n }\n if (node === doc.activeElement) {\n return;\n }\n if (!node || !node.focus) {\n tryFocus2(getInitialFocusNode());\n return;\n }\n node.focus({\n preventScroll: !!config.preventScroll\n });\n state.mostRecentlyFocusedNode = node;\n if (isSelectableInput(node)) {\n node.select();\n }\n };\n var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {\n var node = getNodeForOption(\"setReturnFocus\", previousActiveElement);\n return node ? node : node === false ? false : previousActiveElement;\n };\n var checkPointerDown = function checkPointerDown2(e) {\n var target = getActualTarget(e);\n if (findContainerIndex(target) >= 0) {\n return;\n }\n if (valueOrHandler(config.clickOutsideDeactivates, e)) {\n trap.deactivate({\n // if, on deactivation, we should return focus to the node originally-focused\n // when the trap was activated (or the configured `setReturnFocus` node),\n // then assume it's also OK to return focus to the outside node that was\n // just clicked, causing deactivation, as long as that node is focusable;\n // if it isn't focusable, then return focus to the original node focused\n // on activation (or the configured `setReturnFocus` node)\n // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,\n // which will result in the outside click setting focus to the node\n // that was clicked, whether it's focusable or not; by setting\n // `returnFocus: true`, we'll attempt to re-focus the node originally-focused\n // on activation (or the configured `setReturnFocus` node)\n returnFocus: config.returnFocusOnDeactivate && !isFocusable(target, config.tabbableOptions)\n });\n return;\n }\n if (valueOrHandler(config.allowOutsideClick, e)) {\n return;\n }\n e.preventDefault();\n };\n var checkFocusIn = function checkFocusIn2(e) {\n var target = getActualTarget(e);\n var targetContained = findContainerIndex(target) >= 0;\n if (targetContained || target instanceof Document) {\n if (targetContained) {\n state.mostRecentlyFocusedNode = target;\n }\n } else {\n e.stopImmediatePropagation();\n tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());\n }\n };\n var checkTab = function checkTab2(e) {\n var target = getActualTarget(e);\n updateTabbableNodes();\n var destinationNode = null;\n if (state.tabbableGroups.length > 0) {\n var containerIndex = findContainerIndex(target);\n var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : void 0;\n if (containerIndex < 0) {\n if (e.shiftKey) {\n destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;\n } else {\n destinationNode = state.tabbableGroups[0].firstTabbableNode;\n }\n } else if (e.shiftKey) {\n var startOfGroupIndex = findIndex(state.tabbableGroups, function(_ref2) {\n var firstTabbableNode = _ref2.firstTabbableNode;\n return target === firstTabbableNode;\n });\n if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {\n startOfGroupIndex = containerIndex;\n }\n if (startOfGroupIndex >= 0) {\n var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;\n var destinationGroup = state.tabbableGroups[destinationGroupIndex];\n destinationNode = destinationGroup.lastTabbableNode;\n }\n } else {\n var lastOfGroupIndex = findIndex(state.tabbableGroups, function(_ref3) {\n var lastTabbableNode = _ref3.lastTabbableNode;\n return target === lastTabbableNode;\n });\n if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {\n lastOfGroupIndex = containerIndex;\n }\n if (lastOfGroupIndex >= 0) {\n var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;\n var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];\n destinationNode = _destinationGroup.firstTabbableNode;\n }\n }\n } else {\n destinationNode = getNodeForOption(\"fallbackFocus\");\n }\n if (destinationNode) {\n e.preventDefault();\n tryFocus(destinationNode);\n }\n };\n var checkKey = function checkKey2(e) {\n if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates, e) !== false) {\n e.preventDefault();\n trap.deactivate();\n return;\n }\n if (isTabEvent(e)) {\n checkTab(e);\n return;\n }\n };\n var checkClick = function checkClick2(e) {\n var target = getActualTarget(e);\n if (findContainerIndex(target) >= 0) {\n return;\n }\n if (valueOrHandler(config.clickOutsideDeactivates, e)) {\n return;\n }\n if (valueOrHandler(config.allowOutsideClick, e)) {\n return;\n }\n e.preventDefault();\n e.stopImmediatePropagation();\n };\n var addListeners = function addListeners2() {\n if (!state.active) {\n return;\n }\n activeFocusTraps.activateTrap(trap);\n state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function() {\n tryFocus(getInitialFocusNode());\n }) : tryFocus(getInitialFocusNode());\n doc.addEventListener(\"focusin\", checkFocusIn, true);\n doc.addEventListener(\"mousedown\", checkPointerDown, {\n capture: true,\n passive: false\n });\n doc.addEventListener(\"touchstart\", checkPointerDown, {\n capture: true,\n passive: false\n });\n doc.addEventListener(\"click\", checkClick, {\n capture: true,\n passive: false\n });\n doc.addEventListener(\"keydown\", checkKey, {\n capture: true,\n passive: false\n });\n return trap;\n };\n var removeListeners = function removeListeners2() {\n if (!state.active) {\n return;\n }\n doc.removeEventListener(\"focusin\", checkFocusIn, true);\n doc.removeEventListener(\"mousedown\", checkPointerDown, true);\n doc.removeEventListener(\"touchstart\", checkPointerDown, true);\n doc.removeEventListener(\"click\", checkClick, true);\n doc.removeEventListener(\"keydown\", checkKey, true);\n return trap;\n };\n trap = {\n get active() {\n return state.active;\n },\n get paused() {\n return state.paused;\n },\n activate: function activate(activateOptions) {\n if (state.active) {\n return this;\n }\n var onActivate = getOption(activateOptions, \"onActivate\");\n var onPostActivate = getOption(activateOptions, \"onPostActivate\");\n var checkCanFocusTrap = getOption(activateOptions, \"checkCanFocusTrap\");\n if (!checkCanFocusTrap) {\n updateTabbableNodes();\n }\n state.active = true;\n state.paused = false;\n state.nodeFocusedBeforeActivation = doc.activeElement;\n if (onActivate) {\n onActivate();\n }\n var finishActivation = function finishActivation2() {\n if (checkCanFocusTrap) {\n updateTabbableNodes();\n }\n addListeners();\n if (onPostActivate) {\n onPostActivate();\n }\n };\n if (checkCanFocusTrap) {\n checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);\n return this;\n }\n finishActivation();\n return this;\n },\n deactivate: function deactivate(deactivateOptions) {\n if (!state.active) {\n return this;\n }\n var options = _objectSpread2({\n onDeactivate: config.onDeactivate,\n onPostDeactivate: config.onPostDeactivate,\n checkCanReturnFocus: config.checkCanReturnFocus\n }, deactivateOptions);\n clearTimeout(state.delayInitialFocusTimer);\n state.delayInitialFocusTimer = void 0;\n removeListeners();\n state.active = false;\n state.paused = false;\n activeFocusTraps.deactivateTrap(trap);\n var onDeactivate = getOption(options, \"onDeactivate\");\n var onPostDeactivate = getOption(options, \"onPostDeactivate\");\n var checkCanReturnFocus = getOption(options, \"checkCanReturnFocus\");\n var returnFocus = getOption(options, \"returnFocus\", \"returnFocusOnDeactivate\");\n if (onDeactivate) {\n onDeactivate();\n }\n var finishDeactivation = function finishDeactivation2() {\n delay(function() {\n if (returnFocus) {\n tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));\n }\n if (onPostDeactivate) {\n onPostDeactivate();\n }\n });\n };\n if (returnFocus && checkCanReturnFocus) {\n checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);\n return this;\n }\n finishDeactivation();\n return this;\n },\n pause: function pause() {\n if (state.paused || !state.active) {\n return this;\n }\n state.paused = true;\n removeListeners();\n return this;\n },\n unpause: function unpause() {\n if (!state.paused || !state.active) {\n return this;\n }\n state.paused = false;\n updateTabbableNodes();\n addListeners();\n return this;\n },\n updateContainerElements: function updateContainerElements(containerElements) {\n var elementsAsArray = [].concat(containerElements).filter(Boolean);\n state.containers = elementsAsArray.map(function(element) {\n return typeof element === \"string\" ? doc.querySelector(element) : element;\n });\n if (state.active) {\n updateTabbableNodes();\n }\n return this;\n }\n };\n trap.updateContainerElements(elements);\n return trap;\n};\n\n// packages/focus/src/index.js\nfunction src_default(Alpine) {\n let lastFocused;\n let currentFocused;\n window.addEventListener(\"focusin\", () => {\n lastFocused = currentFocused;\n currentFocused = document.activeElement;\n });\n Alpine.magic(\"focus\", (el) => {\n let within = el;\n return {\n __noscroll: false,\n __wrapAround: false,\n within(el2) {\n within = el2;\n return this;\n },\n withoutScrolling() {\n this.__noscroll = true;\n return this;\n },\n noscroll() {\n this.__noscroll = true;\n return this;\n },\n withWrapAround() {\n this.__wrapAround = true;\n return this;\n },\n wrap() {\n return this.withWrapAround();\n },\n focusable(el2) {\n return isFocusable(el2);\n },\n previouslyFocused() {\n return lastFocused;\n },\n lastFocused() {\n return lastFocused;\n },\n focused() {\n return currentFocused;\n },\n focusables() {\n if (Array.isArray(within))\n return within;\n return focusable(within, { displayCheck: \"none\" });\n },\n all() {\n return this.focusables();\n },\n isFirst(el2) {\n let els = this.all();\n return els[0] && els[0].isSameNode(el2);\n },\n isLast(el2) {\n let els = this.all();\n return els.length && els.slice(-1)[0].isSameNode(el2);\n },\n getFirst() {\n return this.all()[0];\n },\n getLast() {\n return this.all().slice(-1)[0];\n },\n getNext() {\n let list = this.all();\n let current = document.activeElement;\n if (list.indexOf(current) === -1)\n return;\n if (this.__wrapAround && list.indexOf(current) === list.length - 1) {\n return list[0];\n }\n return list[list.indexOf(current) + 1];\n },\n getPrevious() {\n let list = this.all();\n let current = document.activeElement;\n if (list.indexOf(current) === -1)\n return;\n if (this.__wrapAround && list.indexOf(current) === 0) {\n return list.slice(-1)[0];\n }\n return list[list.indexOf(current) - 1];\n },\n first() {\n this.focus(this.getFirst());\n },\n last() {\n this.focus(this.getLast());\n },\n next() {\n this.focus(this.getNext());\n },\n previous() {\n this.focus(this.getPrevious());\n },\n prev() {\n return this.previous();\n },\n focus(el2) {\n if (!el2)\n return;\n setTimeout(() => {\n if (!el2.hasAttribute(\"tabindex\"))\n el2.setAttribute(\"tabindex\", \"0\");\n el2.focus({ preventScroll: this.__noscroll });\n });\n }\n };\n });\n Alpine.directive(\"trap\", Alpine.skipDuringClone(\n (el, { expression, modifiers }, { effect, evaluateLater, cleanup }) => {\n let evaluator = evaluateLater(expression);\n let oldValue = false;\n let options = {\n escapeDeactivates: false,\n allowOutsideClick: true,\n fallbackFocus: () => el\n };\n if (modifiers.includes(\"noautofocus\")) {\n options.initialFocus = false;\n } else {\n let autofocusEl = el.querySelector(\"[autofocus]\");\n if (autofocusEl)\n options.initialFocus = autofocusEl;\n }\n let trap = createFocusTrap(el, options);\n let undoInert = () => {\n };\n let undoDisableScrolling = () => {\n };\n const releaseFocus = () => {\n undoInert();\n undoInert = () => {\n };\n undoDisableScrolling();\n undoDisableScrolling = () => {\n };\n trap.deactivate({\n returnFocus: !modifiers.includes(\"noreturn\")\n });\n };\n effect(() => evaluator((value) => {\n if (oldValue === value)\n return;\n if (value && !oldValue) {\n if (modifiers.includes(\"noscroll\"))\n undoDisableScrolling = disableScrolling();\n if (modifiers.includes(\"inert\"))\n undoInert = setInert(el);\n setTimeout(() => {\n trap.activate();\n }, 15);\n }\n if (!value && oldValue) {\n releaseFocus();\n }\n oldValue = !!value;\n }));\n cleanup(releaseFocus);\n },\n // When cloning, we only want to add aria-hidden attributes to the\n // DOM and not try to actually trap, as trapping can mess with the\n // live DOM and isn't just isolated to the cloned DOM.\n (el, { expression, modifiers }, { evaluate }) => {\n if (modifiers.includes(\"inert\") && evaluate(expression))\n setInert(el);\n }\n ));\n}\nfunction setInert(el) {\n let undos = [];\n crawlSiblingsUp(el, (sibling) => {\n let cache = sibling.hasAttribute(\"aria-hidden\");\n sibling.setAttribute(\"aria-hidden\", \"true\");\n undos.push(() => cache || sibling.removeAttribute(\"aria-hidden\"));\n });\n return () => {\n while (undos.length)\n undos.pop()();\n };\n}\nfunction crawlSiblingsUp(el, callback) {\n if (el.isSameNode(document.body) || !el.parentNode)\n return;\n Array.from(el.parentNode.children).forEach((sibling) => {\n if (sibling.isSameNode(el)) {\n crawlSiblingsUp(el.parentNode, callback);\n } else {\n callback(sibling);\n }\n });\n}\nfunction disableScrolling() {\n let overflow = document.documentElement.style.overflow;\n let paddingRight = document.documentElement.style.paddingRight;\n let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n document.documentElement.style.overflow = \"hidden\";\n document.documentElement.style.paddingRight = `${scrollbarWidth}px`;\n return () => {\n document.documentElement.style.overflow = overflow;\n document.documentElement.style.paddingRight = paddingRight;\n };\n}\n\n// packages/focus/builds/module.js\nvar module_default = src_default;\nexport {\n module_default as default,\n src_default as focus\n};\n/*! Bundled license information:\n\ntabbable/dist/index.esm.js:\n (*!\n * tabbable 5.3.3\n * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE\n *)\n\nfocus-trap/dist/focus-trap.esm.js:\n (*!\n * focus-trap 6.9.4\n * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE\n *)\n*/\n","// packages/intersect/src/index.js\nfunction src_default(Alpine) {\n Alpine.directive(\"intersect\", Alpine.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater, cleanup }) => {\n let evaluate = evaluateLater(expression);\n let options = {\n rootMargin: getRootMargin(modifiers),\n threshold: getThreshold(modifiers)\n };\n let observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting === (value === \"leave\"))\n return;\n evaluate();\n modifiers.includes(\"once\") && observer.disconnect();\n });\n }, options);\n observer.observe(el);\n cleanup(() => {\n observer.disconnect();\n });\n }));\n}\nfunction getThreshold(modifiers) {\n if (modifiers.includes(\"full\"))\n return 0.99;\n if (modifiers.includes(\"half\"))\n return 0.5;\n if (!modifiers.includes(\"threshold\"))\n return 0;\n let threshold = modifiers[modifiers.indexOf(\"threshold\") + 1];\n if (threshold === \"100\")\n return 1;\n if (threshold === \"0\")\n return 0;\n return Number(`.${threshold}`);\n}\nfunction getLengthValue(rawValue) {\n let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/);\n return match ? match[1] + (match[2] || \"px\") : void 0;\n}\nfunction getRootMargin(modifiers) {\n const key = \"margin\";\n const fallback = \"0px 0px 0px 0px\";\n const index = modifiers.indexOf(key);\n if (index === -1)\n return fallback;\n let values = [];\n for (let i = 1; i < 5; i++) {\n values.push(getLengthValue(modifiers[index + i] || \"\"));\n }\n values = values.filter((v) => v !== void 0);\n return values.length ? values.join(\" \").trim() : fallback;\n}\n\n// packages/intersect/builds/module.js\nvar module_default = src_default;\nexport {\n module_default as default,\n src_default as intersect\n};\n","// packages/persist/src/index.js\nfunction src_default(Alpine) {\n let persist = () => {\n let alias;\n let storage;\n try {\n storage = localStorage;\n } catch (e) {\n console.error(e);\n console.warn(\"Alpine: $persist is using temporary storage since localStorage is unavailable.\");\n let dummy = /* @__PURE__ */ new Map();\n storage = {\n getItem: dummy.get.bind(dummy),\n setItem: dummy.set.bind(dummy)\n };\n }\n return Alpine.interceptor((initialValue, getter, setter, path, key) => {\n let lookup = alias || `_x_${path}`;\n let initial = storageHas(lookup, storage) ? storageGet(lookup, storage) : initialValue;\n setter(initial);\n Alpine.effect(() => {\n let value = getter();\n storageSet(lookup, value, storage);\n setter(value);\n });\n return initial;\n }, (func) => {\n func.as = (key) => {\n alias = key;\n return func;\n }, func.using = (target) => {\n storage = target;\n return func;\n };\n });\n };\n Object.defineProperty(Alpine, \"$persist\", { get: () => persist() });\n Alpine.magic(\"persist\", persist);\n Alpine.persist = (key, { get, set }, storage = localStorage) => {\n let initial = storageHas(key, storage) ? storageGet(key, storage) : get();\n set(initial);\n Alpine.effect(() => {\n let value = get();\n storageSet(key, value, storage);\n set(value);\n });\n };\n}\nfunction storageHas(key, storage) {\n return storage.getItem(key) !== null;\n}\nfunction storageGet(key, storage) {\n let value = storage.getItem(key, storage);\n if (value === void 0)\n return;\n return JSON.parse(value);\n}\nfunction storageSet(key, value, storage) {\n storage.setItem(key, JSON.stringify(value));\n}\n\n// packages/persist/builds/module.js\nvar module_default = src_default;\nexport {\n module_default as default,\n src_default as persist\n};\n","/*!\n * Ahoy.js v0.4.4\n * Simple, powerful JavaScript analytics\n * https://github.com/ankane/ahoy.js\n * MIT License\n */\n\n// https://www.quirksmode.org/js/cookies.html\n\nvar Cookies = {\n set: function (name, value, ttl, domain) {\n var expires = \"\";\n var cookieDomain = \"\";\n if (ttl) {\n var date = new Date();\n date.setTime(date.getTime() + (ttl * 60 * 1000));\n expires = \"; expires=\" + date.toGMTString();\n }\n if (domain) {\n cookieDomain = \"; domain=\" + domain;\n }\n document.cookie = name + \"=\" + escape(value) + expires + cookieDomain + \"; path=/; samesite=lax\";\n },\n get: function (name) {\n var i, c;\n var nameEQ = name + \"=\";\n var ca = document.cookie.split(';');\n for (i = 0; i < ca.length; i++) {\n c = ca[i];\n while (c.charAt(0) === ' ') {\n c = c.substring(1, c.length);\n }\n if (c.indexOf(nameEQ) === 0) {\n return unescape(c.substring(nameEQ.length, c.length));\n }\n }\n return null;\n }\n};\n\nvar config = {\n urlPrefix: \"\",\n visitsUrl: \"/ahoy/visits\",\n eventsUrl: \"/ahoy/events\",\n page: null,\n platform: \"Web\",\n useBeacon: true,\n startOnReady: true,\n trackVisits: true,\n cookies: true,\n cookieDomain: null,\n headers: {},\n visitParams: {},\n withCredentials: false,\n visitDuration: 4 * 60, // default 4 hours\n visitorDuration: 2 * 365 * 24 * 60 // default 2 years\n};\n\nvar ahoy = window.ahoy || window.Ahoy || {};\n\nahoy.configure = function (options) {\n for (var key in options) {\n if (Object.prototype.hasOwnProperty.call(options, key)) {\n config[key] = options[key];\n }\n }\n};\n\n// legacy\nahoy.configure(ahoy);\n\nvar $ = window.jQuery || window.Zepto || window.$;\nvar visitId, visitorId, track;\nvar isReady = false;\nvar queue = [];\nvar canStringify = typeof(JSON) !== \"undefined\" && typeof(JSON.stringify) !== \"undefined\";\nvar eventQueue = [];\n\nfunction visitsUrl() {\n return config.urlPrefix + config.visitsUrl;\n}\n\nfunction eventsUrl() {\n return config.urlPrefix + config.eventsUrl;\n}\n\nfunction isEmpty(obj) {\n return Object.keys(obj).length === 0;\n}\n\nfunction canTrackNow() {\n return (config.useBeacon || config.trackNow) && isEmpty(config.headers) && canStringify && typeof(window.navigator.sendBeacon) !== \"undefined\" && !config.withCredentials;\n}\n\nfunction serialize(object) {\n var data = new FormData();\n for (var key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n data.append(key, object[key]);\n }\n }\n return data;\n}\n\n// cookies\n\nfunction setCookie(name, value, ttl) {\n Cookies.set(name, value, ttl, config.cookieDomain || config.domain);\n}\n\nfunction getCookie(name) {\n return Cookies.get(name);\n}\n\nfunction destroyCookie(name) {\n Cookies.set(name, \"\", -1);\n}\n\nfunction log(message) {\n if (getCookie(\"ahoy_debug\")) {\n window.console.log(message);\n }\n}\n\nfunction setReady() {\n var callback;\n while ((callback = queue.shift())) {\n callback();\n }\n isReady = true;\n}\n\nahoy.ready = function (callback) {\n if (isReady) {\n callback();\n } else {\n queue.push(callback);\n }\n};\n\nfunction matchesSelector(element, selector) {\n var matches = element.matches ||\n element.matchesSelector ||\n element.mozMatchesSelector ||\n element.msMatchesSelector ||\n element.oMatchesSelector ||\n element.webkitMatchesSelector;\n\n if (matches) {\n if (matches.apply(element, [selector])) {\n return element;\n } else if (element.parentElement) {\n return matchesSelector(element.parentElement, selector);\n }\n return null;\n } else {\n log(\"Unable to match\");\n return null;\n }\n}\n\nfunction onEvent(eventName, selector, callback) {\n document.addEventListener(eventName, function (e) {\n var matchedElement = matchesSelector(e.target, selector);\n if (matchedElement) {\n var skip = getClosest(matchedElement, \"data-ahoy-skip\");\n if (skip !== null && skip !== \"false\") { return; }\n\n callback.call(matchedElement, e);\n }\n });\n}\n\n// http://beeker.io/jquery-document-ready-equivalent-vanilla-javascript\nfunction documentReady(callback) {\n if (document.readyState === \"interactive\" || document.readyState === \"complete\") {\n setTimeout(callback, 0);\n } else {\n document.addEventListener(\"DOMContentLoaded\", callback);\n }\n}\n\n// https://stackoverflow.com/a/2117523/1177228\nfunction generateId() {\n if (window.crypto && window.crypto.randomUUID) {\n return window.crypto.randomUUID();\n }\n\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0;\n var v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n}\n\nfunction saveEventQueue() {\n if (config.cookies && canStringify) {\n setCookie(\"ahoy_events\", JSON.stringify(eventQueue), 1);\n }\n}\n\n// from rails-ujs\n\nfunction csrfToken() {\n var meta = document.querySelector(\"meta[name=csrf-token]\");\n return meta && meta.content;\n}\n\nfunction csrfParam() {\n var meta = document.querySelector(\"meta[name=csrf-param]\");\n return meta && meta.content;\n}\n\nfunction CSRFProtection(xhr) {\n var token = csrfToken();\n if (token) { xhr.setRequestHeader(\"X-CSRF-Token\", token); }\n}\n\nfunction sendRequest(url, data, success) {\n if (canStringify) {\n if ($ && $.ajax) {\n $.ajax({\n type: \"POST\",\n url: url,\n data: JSON.stringify(data),\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n beforeSend: CSRFProtection,\n success: success,\n headers: config.headers,\n xhrFields: {\n withCredentials: config.withCredentials\n }\n });\n } else {\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", url, true);\n xhr.withCredentials = config.withCredentials;\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n for (var header in config.headers) {\n if (Object.prototype.hasOwnProperty.call(config.headers, header)) {\n xhr.setRequestHeader(header, config.headers[header]);\n }\n }\n xhr.onload = function () {\n if (xhr.status === 200) {\n success();\n }\n };\n CSRFProtection(xhr);\n xhr.send(JSON.stringify(data));\n }\n }\n}\n\nfunction eventData(event) {\n var data = {\n events: [event]\n };\n if (config.cookies) {\n data.visit_token = event.visit_token;\n data.visitor_token = event.visitor_token;\n }\n delete event.visit_token;\n delete event.visitor_token;\n return data;\n}\n\nfunction trackEvent(event) {\n ahoy.ready(function () {\n sendRequest(eventsUrl(), eventData(event), function () {\n // remove from queue\n for (var i = 0; i < eventQueue.length; i++) {\n if (eventQueue[i].id === event.id) {\n eventQueue.splice(i, 1);\n break;\n }\n }\n saveEventQueue();\n });\n });\n}\n\nfunction trackEventNow(event) {\n ahoy.ready(function () {\n var data = eventData(event);\n var param = csrfParam();\n var token = csrfToken();\n if (param && token) { data[param] = token; }\n // stringify so we keep the type\n data.events_json = JSON.stringify(data.events);\n delete data.events;\n window.navigator.sendBeacon(eventsUrl(), serialize(data));\n });\n}\n\nfunction page() {\n return config.page || window.location.pathname;\n}\n\nfunction presence(str) {\n return (str && str.length > 0) ? str : null;\n}\n\nfunction cleanObject(obj) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n if (obj[key] === null) {\n delete obj[key];\n }\n }\n }\n return obj;\n}\n\nfunction eventProperties() {\n return cleanObject({\n tag: this.tagName.toLowerCase(),\n id: presence(this.id),\n \"class\": presence(this.className),\n page: page(),\n section: getClosest(this, \"data-section\")\n });\n}\n\nfunction getClosest(element, attribute) {\n for (; element && element !== document; element = element.parentNode) {\n if (element.hasAttribute(attribute)) {\n return element.getAttribute(attribute);\n }\n }\n\n return null;\n}\n\nfunction createVisit() {\n isReady = false;\n\n visitId = ahoy.getVisitId();\n visitorId = ahoy.getVisitorId();\n track = getCookie(\"ahoy_track\");\n\n if (config.cookies === false || config.trackVisits === false) {\n log(\"Visit tracking disabled\");\n setReady();\n } else if (visitId && visitorId && !track) {\n // TODO keep visit alive?\n log(\"Active visit\");\n setReady();\n } else {\n if (!visitId) {\n visitId = generateId();\n setCookie(\"ahoy_visit\", visitId, config.visitDuration);\n }\n\n // make sure cookies are enabled\n if (getCookie(\"ahoy_visit\")) {\n log(\"Visit started\");\n\n if (!visitorId) {\n visitorId = generateId();\n setCookie(\"ahoy_visitor\", visitorId, config.visitorDuration);\n }\n\n var data = {\n visit_token: visitId,\n visitor_token: visitorId,\n platform: config.platform,\n landing_page: window.location.href,\n screen_width: window.screen.width,\n screen_height: window.screen.height,\n js: true\n };\n\n // referrer\n if (document.referrer.length > 0) {\n data.referrer = document.referrer;\n }\n\n for (var key in config.visitParams) {\n if (Object.prototype.hasOwnProperty.call(config.visitParams, key)) {\n data[key] = config.visitParams[key];\n }\n }\n\n log(data);\n\n sendRequest(visitsUrl(), data, function () {\n // wait until successful to destroy\n destroyCookie(\"ahoy_track\");\n setReady();\n });\n } else {\n log(\"Cookies disabled\");\n setReady();\n }\n }\n}\n\nahoy.getVisitId = ahoy.getVisitToken = function () {\n return getCookie(\"ahoy_visit\");\n};\n\nahoy.getVisitorId = ahoy.getVisitorToken = function () {\n return getCookie(\"ahoy_visitor\");\n};\n\nahoy.reset = function () {\n destroyCookie(\"ahoy_visit\");\n destroyCookie(\"ahoy_visitor\");\n destroyCookie(\"ahoy_events\");\n destroyCookie(\"ahoy_track\");\n return true;\n};\n\nahoy.debug = function (enabled) {\n if (enabled === false) {\n destroyCookie(\"ahoy_debug\");\n } else {\n setCookie(\"ahoy_debug\", \"t\", 365 * 24 * 60); // 1 year\n }\n return true;\n};\n\nahoy.track = function (name, properties) {\n // generate unique id\n var event = {\n name: name,\n properties: properties || {},\n time: (new Date()).getTime() / 1000.0,\n id: generateId(),\n js: true\n };\n\n ahoy.ready(function () {\n if (config.cookies && !ahoy.getVisitId()) {\n createVisit();\n }\n\n ahoy.ready(function () {\n log(event);\n\n event.visit_token = ahoy.getVisitId();\n event.visitor_token = ahoy.getVisitorId();\n\n if (canTrackNow()) {\n trackEventNow(event);\n } else {\n eventQueue.push(event);\n saveEventQueue();\n\n // wait in case navigating to reduce duplicate events\n setTimeout(function () {\n trackEvent(event);\n }, 1000);\n }\n });\n });\n\n return true;\n};\n\nahoy.trackView = function (additionalProperties) {\n var properties = {\n url: window.location.href,\n title: document.title,\n page: page()\n };\n\n if (additionalProperties) {\n for (var propName in additionalProperties) {\n if (Object.prototype.hasOwnProperty.call(additionalProperties, propName)) {\n properties[propName] = additionalProperties[propName];\n }\n }\n }\n ahoy.track(\"$view\", properties);\n};\n\nahoy.trackClicks = function (selector) {\n if (selector === undefined) {\n throw new Error(\"Missing selector\");\n }\n onEvent(\"click\", selector, function (e) {\n var properties = eventProperties.call(this, e);\n properties.text = properties.tag === \"input\" ? this.value : (this.textContent || this.innerText || this.innerHTML).replace(/[\\s\\r\\n]+/g, \" \").trim();\n properties.href = this.href;\n ahoy.track(\"$click\", properties);\n });\n};\n\nahoy.trackSubmits = function (selector) {\n if (selector === undefined) {\n throw new Error(\"Missing selector\");\n }\n onEvent(\"submit\", selector, function (e) {\n var properties = eventProperties.call(this, e);\n ahoy.track(\"$submit\", properties);\n });\n};\n\nahoy.trackChanges = function (selector) {\n log(\"trackChanges is deprecated and will be removed in 0.5.0\");\n if (selector === undefined) {\n throw new Error(\"Missing selector\");\n }\n onEvent(\"change\", selector, function (e) {\n var properties = eventProperties.call(this, e);\n ahoy.track(\"$change\", properties);\n });\n};\n\n// push events from queue\ntry {\n eventQueue = JSON.parse(getCookie(\"ahoy_events\") || \"[]\");\n} catch (e) {\n // do nothing\n}\n\nfor (var i = 0; i < eventQueue.length; i++) {\n trackEvent(eventQueue[i]);\n}\n\nahoy.start = function () {\n createVisit();\n\n ahoy.start = function () {};\n};\n\ndocumentReady(function () {\n if (config.startOnReady) {\n ahoy.start();\n }\n});\n\nexport { ahoy as default };\n","// packages/alpinejs/src/scheduler.js\nvar flushPending = false;\nvar flushing = false;\nvar queue = [];\nvar lastFlushedIndex = -1;\nfunction scheduler(callback) {\n queueJob(callback);\n}\nfunction queueJob(job) {\n if (!queue.includes(job))\n queue.push(job);\n queueFlush();\n}\nfunction dequeueJob(job) {\n let index = queue.indexOf(job);\n if (index !== -1 && index > lastFlushedIndex)\n queue.splice(index, 1);\n}\nfunction queueFlush() {\n if (!flushing && !flushPending) {\n flushPending = true;\n queueMicrotask(flushJobs);\n }\n}\nfunction flushJobs() {\n flushPending = false;\n flushing = true;\n for (let i = 0; i < queue.length; i++) {\n queue[i]();\n lastFlushedIndex = i;\n }\n queue.length = 0;\n lastFlushedIndex = -1;\n flushing = false;\n}\n\n// packages/alpinejs/src/reactivity.js\nvar reactive;\nvar effect;\nvar release;\nvar raw;\nvar shouldSchedule = true;\nfunction disableEffectScheduling(callback) {\n shouldSchedule = false;\n callback();\n shouldSchedule = true;\n}\nfunction setReactivityEngine(engine) {\n reactive = engine.reactive;\n release = engine.release;\n effect = (callback) => engine.effect(callback, { scheduler: (task) => {\n if (shouldSchedule) {\n scheduler(task);\n } else {\n task();\n }\n } });\n raw = engine.raw;\n}\nfunction overrideEffect(override) {\n effect = override;\n}\nfunction elementBoundEffect(el) {\n let cleanup2 = () => {\n };\n let wrappedEffect = (callback) => {\n let effectReference = effect(callback);\n if (!el._x_effects) {\n el._x_effects = /* @__PURE__ */ new Set();\n el._x_runEffects = () => {\n el._x_effects.forEach((i) => i());\n };\n }\n el._x_effects.add(effectReference);\n cleanup2 = () => {\n if (effectReference === void 0)\n return;\n el._x_effects.delete(effectReference);\n release(effectReference);\n };\n return effectReference;\n };\n return [wrappedEffect, () => {\n cleanup2();\n }];\n}\nfunction watch(getter, callback) {\n let firstTime = true;\n let oldValue;\n let effectReference = effect(() => {\n let value = getter();\n JSON.stringify(value);\n if (!firstTime) {\n queueMicrotask(() => {\n callback(value, oldValue);\n oldValue = value;\n });\n } else {\n oldValue = value;\n }\n firstTime = false;\n });\n return () => release(effectReference);\n}\n\n// packages/alpinejs/src/mutation.js\nvar onAttributeAddeds = [];\nvar onElRemoveds = [];\nvar onElAddeds = [];\nfunction onElAdded(callback) {\n onElAddeds.push(callback);\n}\nfunction onElRemoved(el, callback) {\n if (typeof callback === \"function\") {\n if (!el._x_cleanups)\n el._x_cleanups = [];\n el._x_cleanups.push(callback);\n } else {\n callback = el;\n onElRemoveds.push(callback);\n }\n}\nfunction onAttributesAdded(callback) {\n onAttributeAddeds.push(callback);\n}\nfunction onAttributeRemoved(el, name, callback) {\n if (!el._x_attributeCleanups)\n el._x_attributeCleanups = {};\n if (!el._x_attributeCleanups[name])\n el._x_attributeCleanups[name] = [];\n el._x_attributeCleanups[name].push(callback);\n}\nfunction cleanupAttributes(el, names) {\n if (!el._x_attributeCleanups)\n return;\n Object.entries(el._x_attributeCleanups).forEach(([name, value]) => {\n if (names === void 0 || names.includes(name)) {\n value.forEach((i) => i());\n delete el._x_attributeCleanups[name];\n }\n });\n}\nfunction cleanupElement(el) {\n el._x_effects?.forEach(dequeueJob);\n while (el._x_cleanups?.length)\n el._x_cleanups.pop()();\n}\nvar observer = new MutationObserver(onMutate);\nvar currentlyObserving = false;\nfunction startObservingMutations() {\n observer.observe(document, { subtree: true, childList: true, attributes: true, attributeOldValue: true });\n currentlyObserving = true;\n}\nfunction stopObservingMutations() {\n flushObserver();\n observer.disconnect();\n currentlyObserving = false;\n}\nvar queuedMutations = [];\nfunction flushObserver() {\n let records = observer.takeRecords();\n queuedMutations.push(() => records.length > 0 && onMutate(records));\n let queueLengthWhenTriggered = queuedMutations.length;\n queueMicrotask(() => {\n if (queuedMutations.length === queueLengthWhenTriggered) {\n while (queuedMutations.length > 0)\n queuedMutations.shift()();\n }\n });\n}\nfunction mutateDom(callback) {\n if (!currentlyObserving)\n return callback();\n stopObservingMutations();\n let result = callback();\n startObservingMutations();\n return result;\n}\nvar isCollecting = false;\nvar deferredMutations = [];\nfunction deferMutations() {\n isCollecting = true;\n}\nfunction flushAndStopDeferringMutations() {\n isCollecting = false;\n onMutate(deferredMutations);\n deferredMutations = [];\n}\nfunction onMutate(mutations) {\n if (isCollecting) {\n deferredMutations = deferredMutations.concat(mutations);\n return;\n }\n let addedNodes = [];\n let removedNodes = /* @__PURE__ */ new Set();\n let addedAttributes = /* @__PURE__ */ new Map();\n let removedAttributes = /* @__PURE__ */ new Map();\n for (let i = 0; i < mutations.length; i++) {\n if (mutations[i].target._x_ignoreMutationObserver)\n continue;\n if (mutations[i].type === \"childList\") {\n mutations[i].removedNodes.forEach((node) => {\n if (node.nodeType !== 1)\n return;\n if (!node._x_marker)\n return;\n removedNodes.add(node);\n });\n mutations[i].addedNodes.forEach((node) => {\n if (node.nodeType !== 1)\n return;\n if (removedNodes.has(node)) {\n removedNodes.delete(node);\n return;\n }\n if (node._x_marker)\n return;\n addedNodes.push(node);\n });\n }\n if (mutations[i].type === \"attributes\") {\n let el = mutations[i].target;\n let name = mutations[i].attributeName;\n let oldValue = mutations[i].oldValue;\n let add2 = () => {\n if (!addedAttributes.has(el))\n addedAttributes.set(el, []);\n addedAttributes.get(el).push({ name, value: el.getAttribute(name) });\n };\n let remove = () => {\n if (!removedAttributes.has(el))\n removedAttributes.set(el, []);\n removedAttributes.get(el).push(name);\n };\n if (el.hasAttribute(name) && oldValue === null) {\n add2();\n } else if (el.hasAttribute(name)) {\n remove();\n add2();\n } else {\n remove();\n }\n }\n }\n removedAttributes.forEach((attrs, el) => {\n cleanupAttributes(el, attrs);\n });\n addedAttributes.forEach((attrs, el) => {\n onAttributeAddeds.forEach((i) => i(el, attrs));\n });\n for (let node of removedNodes) {\n if (addedNodes.some((i) => i.contains(node)))\n continue;\n onElRemoveds.forEach((i) => i(node));\n }\n for (let node of addedNodes) {\n if (!node.isConnected)\n continue;\n onElAddeds.forEach((i) => i(node));\n }\n addedNodes = null;\n removedNodes = null;\n addedAttributes = null;\n removedAttributes = null;\n}\n\n// packages/alpinejs/src/scope.js\nfunction scope(node) {\n return mergeProxies(closestDataStack(node));\n}\nfunction addScopeToNode(node, data2, referenceNode) {\n node._x_dataStack = [data2, ...closestDataStack(referenceNode || node)];\n return () => {\n node._x_dataStack = node._x_dataStack.filter((i) => i !== data2);\n };\n}\nfunction closestDataStack(node) {\n if (node._x_dataStack)\n return node._x_dataStack;\n if (typeof ShadowRoot === \"function\" && node instanceof ShadowRoot) {\n return closestDataStack(node.host);\n }\n if (!node.parentNode) {\n return [];\n }\n return closestDataStack(node.parentNode);\n}\nfunction mergeProxies(objects) {\n return new Proxy({ objects }, mergeProxyTrap);\n}\nvar mergeProxyTrap = {\n ownKeys({ objects }) {\n return Array.from(\n new Set(objects.flatMap((i) => Object.keys(i)))\n );\n },\n has({ objects }, name) {\n if (name == Symbol.unscopables)\n return false;\n return objects.some(\n (obj) => Object.prototype.hasOwnProperty.call(obj, name) || Reflect.has(obj, name)\n );\n },\n get({ objects }, name, thisProxy) {\n if (name == \"toJSON\")\n return collapseProxies;\n return Reflect.get(\n objects.find(\n (obj) => Reflect.has(obj, name)\n ) || {},\n name,\n thisProxy\n );\n },\n set({ objects }, name, value, thisProxy) {\n const target = objects.find(\n (obj) => Object.prototype.hasOwnProperty.call(obj, name)\n ) || objects[objects.length - 1];\n const descriptor = Object.getOwnPropertyDescriptor(target, name);\n if (descriptor?.set && descriptor?.get)\n return descriptor.set.call(thisProxy, value) || true;\n return Reflect.set(target, name, value);\n }\n};\nfunction collapseProxies() {\n let keys = Reflect.ownKeys(this);\n return keys.reduce((acc, key) => {\n acc[key] = Reflect.get(this, key);\n return acc;\n }, {});\n}\n\n// packages/alpinejs/src/interceptor.js\nfunction initInterceptors(data2) {\n let isObject2 = (val) => typeof val === \"object\" && !Array.isArray(val) && val !== null;\n let recurse = (obj, basePath = \"\") => {\n Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, { value, enumerable }]) => {\n if (enumerable === false || value === void 0)\n return;\n if (typeof value === \"object\" && value !== null && value.__v_skip)\n return;\n let path = basePath === \"\" ? key : `${basePath}.${key}`;\n if (typeof value === \"object\" && value !== null && value._x_interceptor) {\n obj[key] = value.initialize(data2, path, key);\n } else {\n if (isObject2(value) && value !== obj && !(value instanceof Element)) {\n recurse(value, path);\n }\n }\n });\n };\n return recurse(data2);\n}\nfunction interceptor(callback, mutateObj = () => {\n}) {\n let obj = {\n initialValue: void 0,\n _x_interceptor: true,\n initialize(data2, path, key) {\n return callback(this.initialValue, () => get(data2, path), (value) => set(data2, path, value), path, key);\n }\n };\n mutateObj(obj);\n return (initialValue) => {\n if (typeof initialValue === \"object\" && initialValue !== null && initialValue._x_interceptor) {\n let initialize = obj.initialize.bind(obj);\n obj.initialize = (data2, path, key) => {\n let innerValue = initialValue.initialize(data2, path, key);\n obj.initialValue = innerValue;\n return initialize(data2, path, key);\n };\n } else {\n obj.initialValue = initialValue;\n }\n return obj;\n };\n}\nfunction get(obj, path) {\n return path.split(\".\").reduce((carry, segment) => carry[segment], obj);\n}\nfunction set(obj, path, value) {\n if (typeof path === \"string\")\n path = path.split(\".\");\n if (path.length === 1)\n obj[path[0]] = value;\n else if (path.length === 0)\n throw error;\n else {\n if (obj[path[0]])\n return set(obj[path[0]], path.slice(1), value);\n else {\n obj[path[0]] = {};\n return set(obj[path[0]], path.slice(1), value);\n }\n }\n}\n\n// packages/alpinejs/src/magics.js\nvar magics = {};\nfunction magic(name, callback) {\n magics[name] = callback;\n}\nfunction injectMagics(obj, el) {\n let memoizedUtilities = getUtilities(el);\n Object.entries(magics).forEach(([name, callback]) => {\n Object.defineProperty(obj, `$${name}`, {\n get() {\n return callback(el, memoizedUtilities);\n },\n enumerable: false\n });\n });\n return obj;\n}\nfunction getUtilities(el) {\n let [utilities, cleanup2] = getElementBoundUtilities(el);\n let utils = { interceptor, ...utilities };\n onElRemoved(el, cleanup2);\n return utils;\n}\n\n// packages/alpinejs/src/utils/error.js\nfunction tryCatch(el, expression, callback, ...args) {\n try {\n return callback(...args);\n } catch (e) {\n handleError(e, el, expression);\n }\n}\nfunction handleError(error2, el, expression = void 0) {\n error2 = Object.assign(\n error2 ?? { message: \"No error message given.\" },\n { el, expression }\n );\n console.warn(`Alpine Expression Error: ${error2.message}\n\n${expression ? 'Expression: \"' + expression + '\"\\n\\n' : \"\"}`, el);\n setTimeout(() => {\n throw error2;\n }, 0);\n}\n\n// packages/alpinejs/src/evaluator.js\nvar shouldAutoEvaluateFunctions = true;\nfunction dontAutoEvaluateFunctions(callback) {\n let cache = shouldAutoEvaluateFunctions;\n shouldAutoEvaluateFunctions = false;\n let result = callback();\n shouldAutoEvaluateFunctions = cache;\n return result;\n}\nfunction evaluate(el, expression, extras = {}) {\n let result;\n evaluateLater(el, expression)((value) => result = value, extras);\n return result;\n}\nfunction evaluateLater(...args) {\n return theEvaluatorFunction(...args);\n}\nvar theEvaluatorFunction = normalEvaluator;\nfunction setEvaluator(newEvaluator) {\n theEvaluatorFunction = newEvaluator;\n}\nfunction normalEvaluator(el, expression) {\n let overriddenMagics = {};\n injectMagics(overriddenMagics, el);\n let dataStack = [overriddenMagics, ...closestDataStack(el)];\n let evaluator = typeof expression === \"function\" ? generateEvaluatorFromFunction(dataStack, expression) : generateEvaluatorFromString(dataStack, expression, el);\n return tryCatch.bind(null, el, expression, evaluator);\n}\nfunction generateEvaluatorFromFunction(dataStack, func) {\n return (receiver = () => {\n }, { scope: scope2 = {}, params = [] } = {}) => {\n let result = func.apply(mergeProxies([scope2, ...dataStack]), params);\n runIfTypeOfFunction(receiver, result);\n };\n}\nvar evaluatorMemo = {};\nfunction generateFunctionFromString(expression, el) {\n if (evaluatorMemo[expression]) {\n return evaluatorMemo[expression];\n }\n let AsyncFunction = Object.getPrototypeOf(async function() {\n }).constructor;\n let rightSideSafeExpression = /^[\\n\\s]*if.*\\(.*\\)/.test(expression.trim()) || /^(let|const)\\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression;\n const safeAsyncFunction = () => {\n try {\n let func2 = new AsyncFunction(\n [\"__self\", \"scope\"],\n `with (scope) { __self.result = ${rightSideSafeExpression} }; __self.finished = true; return __self.result;`\n );\n Object.defineProperty(func2, \"name\", {\n value: `[Alpine] ${expression}`\n });\n return func2;\n } catch (error2) {\n handleError(error2, el, expression);\n return Promise.resolve();\n }\n };\n let func = safeAsyncFunction();\n evaluatorMemo[expression] = func;\n return func;\n}\nfunction generateEvaluatorFromString(dataStack, expression, el) {\n let func = generateFunctionFromString(expression, el);\n return (receiver = () => {\n }, { scope: scope2 = {}, params = [] } = {}) => {\n func.result = void 0;\n func.finished = false;\n let completeScope = mergeProxies([scope2, ...dataStack]);\n if (typeof func === \"function\") {\n let promise = func(func, completeScope).catch((error2) => handleError(error2, el, expression));\n if (func.finished) {\n runIfTypeOfFunction(receiver, func.result, completeScope, params, el);\n func.result = void 0;\n } else {\n promise.then((result) => {\n runIfTypeOfFunction(receiver, result, completeScope, params, el);\n }).catch((error2) => handleError(error2, el, expression)).finally(() => func.result = void 0);\n }\n }\n };\n}\nfunction runIfTypeOfFunction(receiver, value, scope2, params, el) {\n if (shouldAutoEvaluateFunctions && typeof value === \"function\") {\n let result = value.apply(scope2, params);\n if (result instanceof Promise) {\n result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value));\n } else {\n receiver(result);\n }\n } else if (typeof value === \"object\" && value instanceof Promise) {\n value.then((i) => receiver(i));\n } else {\n receiver(value);\n }\n}\n\n// packages/alpinejs/src/directives.js\nvar prefixAsString = \"x-\";\nfunction prefix(subject = \"\") {\n return prefixAsString + subject;\n}\nfunction setPrefix(newPrefix) {\n prefixAsString = newPrefix;\n}\nvar directiveHandlers = {};\nfunction directive(name, callback) {\n directiveHandlers[name] = callback;\n return {\n before(directive2) {\n if (!directiveHandlers[directive2]) {\n console.warn(String.raw`Cannot find directive \\`${directive2}\\`. \\`${name}\\` will use the default order of execution`);\n return;\n }\n const pos = directiveOrder.indexOf(directive2);\n directiveOrder.splice(pos >= 0 ? pos : directiveOrder.indexOf(\"DEFAULT\"), 0, name);\n }\n };\n}\nfunction directiveExists(name) {\n return Object.keys(directiveHandlers).includes(name);\n}\nfunction directives(el, attributes, originalAttributeOverride) {\n attributes = Array.from(attributes);\n if (el._x_virtualDirectives) {\n let vAttributes = Object.entries(el._x_virtualDirectives).map(([name, value]) => ({ name, value }));\n let staticAttributes = attributesOnly(vAttributes);\n vAttributes = vAttributes.map((attribute) => {\n if (staticAttributes.find((attr) => attr.name === attribute.name)) {\n return {\n name: `x-bind:${attribute.name}`,\n value: `\"${attribute.value}\"`\n };\n }\n return attribute;\n });\n attributes = attributes.concat(vAttributes);\n }\n let transformedAttributeMap = {};\n let directives2 = attributes.map(toTransformedAttributes((newName, oldName) => transformedAttributeMap[newName] = oldName)).filter(outNonAlpineAttributes).map(toParsedDirectives(transformedAttributeMap, originalAttributeOverride)).sort(byPriority);\n return directives2.map((directive2) => {\n return getDirectiveHandler(el, directive2);\n });\n}\nfunction attributesOnly(attributes) {\n return Array.from(attributes).map(toTransformedAttributes()).filter((attr) => !outNonAlpineAttributes(attr));\n}\nvar isDeferringHandlers = false;\nvar directiveHandlerStacks = /* @__PURE__ */ new Map();\nvar currentHandlerStackKey = Symbol();\nfunction deferHandlingDirectives(callback) {\n isDeferringHandlers = true;\n let key = Symbol();\n currentHandlerStackKey = key;\n directiveHandlerStacks.set(key, []);\n let flushHandlers = () => {\n while (directiveHandlerStacks.get(key).length)\n directiveHandlerStacks.get(key).shift()();\n directiveHandlerStacks.delete(key);\n };\n let stopDeferring = () => {\n isDeferringHandlers = false;\n flushHandlers();\n };\n callback(flushHandlers);\n stopDeferring();\n}\nfunction getElementBoundUtilities(el) {\n let cleanups = [];\n let cleanup2 = (callback) => cleanups.push(callback);\n let [effect3, cleanupEffect] = elementBoundEffect(el);\n cleanups.push(cleanupEffect);\n let utilities = {\n Alpine: alpine_default,\n effect: effect3,\n cleanup: cleanup2,\n evaluateLater: evaluateLater.bind(evaluateLater, el),\n evaluate: evaluate.bind(evaluate, el)\n };\n let doCleanup = () => cleanups.forEach((i) => i());\n return [utilities, doCleanup];\n}\nfunction getDirectiveHandler(el, directive2) {\n let noop = () => {\n };\n let handler4 = directiveHandlers[directive2.type] || noop;\n let [utilities, cleanup2] = getElementBoundUtilities(el);\n onAttributeRemoved(el, directive2.original, cleanup2);\n let fullHandler = () => {\n if (el._x_ignore || el._x_ignoreSelf)\n return;\n handler4.inline && handler4.inline(el, directive2, utilities);\n handler4 = handler4.bind(handler4, el, directive2, utilities);\n isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler4) : handler4();\n };\n fullHandler.runCleanups = cleanup2;\n return fullHandler;\n}\nvar startingWith = (subject, replacement) => ({ name, value }) => {\n if (name.startsWith(subject))\n name = name.replace(subject, replacement);\n return { name, value };\n};\nvar into = (i) => i;\nfunction toTransformedAttributes(callback = () => {\n}) {\n return ({ name, value }) => {\n let { name: newName, value: newValue } = attributeTransformers.reduce((carry, transform) => {\n return transform(carry);\n }, { name, value });\n if (newName !== name)\n callback(newName, name);\n return { name: newName, value: newValue };\n };\n}\nvar attributeTransformers = [];\nfunction mapAttributes(callback) {\n attributeTransformers.push(callback);\n}\nfunction outNonAlpineAttributes({ name }) {\n return alpineAttributeRegex().test(name);\n}\nvar alpineAttributeRegex = () => new RegExp(`^${prefixAsString}([^:^.]+)\\\\b`);\nfunction toParsedDirectives(transformedAttributeMap, originalAttributeOverride) {\n return ({ name, value }) => {\n let typeMatch = name.match(alpineAttributeRegex());\n let valueMatch = name.match(/:([a-zA-Z0-9\\-_:]+)/);\n let modifiers = name.match(/\\.[^.\\]]+(?=[^\\]]*$)/g) || [];\n let original = originalAttributeOverride || transformedAttributeMap[name] || name;\n return {\n type: typeMatch ? typeMatch[1] : null,\n value: valueMatch ? valueMatch[1] : null,\n modifiers: modifiers.map((i) => i.replace(\".\", \"\")),\n expression: value,\n original\n };\n };\n}\nvar DEFAULT = \"DEFAULT\";\nvar directiveOrder = [\n \"ignore\",\n \"ref\",\n \"data\",\n \"id\",\n \"anchor\",\n \"bind\",\n \"init\",\n \"for\",\n \"model\",\n \"modelable\",\n \"transition\",\n \"show\",\n \"if\",\n DEFAULT,\n \"teleport\"\n];\nfunction byPriority(a, b) {\n let typeA = directiveOrder.indexOf(a.type) === -1 ? DEFAULT : a.type;\n let typeB = directiveOrder.indexOf(b.type) === -1 ? DEFAULT : b.type;\n return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB);\n}\n\n// packages/alpinejs/src/utils/dispatch.js\nfunction dispatch(el, name, detail = {}) {\n el.dispatchEvent(\n new CustomEvent(name, {\n detail,\n bubbles: true,\n // Allows events to pass the shadow DOM barrier.\n composed: true,\n cancelable: true\n })\n );\n}\n\n// packages/alpinejs/src/utils/walk.js\nfunction walk(el, callback) {\n if (typeof ShadowRoot === \"function\" && el instanceof ShadowRoot) {\n Array.from(el.children).forEach((el2) => walk(el2, callback));\n return;\n }\n let skip = false;\n callback(el, () => skip = true);\n if (skip)\n return;\n let node = el.firstElementChild;\n while (node) {\n walk(node, callback, false);\n node = node.nextElementSibling;\n }\n}\n\n// packages/alpinejs/src/utils/warn.js\nfunction warn(message, ...args) {\n console.warn(`Alpine Warning: ${message}`, ...args);\n}\n\n// packages/alpinejs/src/lifecycle.js\nvar started = false;\nfunction start() {\n if (started)\n warn(\"Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems.\");\n started = true;\n if (!document.body)\n warn(\"Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `