From 94045233cfe355e9c6e97ecd6048c838ab6e8e33 Mon Sep 17 00:00:00 2001 From: Alexandr Chernyaev Date: Sat, 23 Nov 2024 05:32:30 +0300 Subject: [PATCH] ## 14.44.0 - 2024-11-23 --- CHANGELOG.md | 11 +++++++++++ public/js/orchid.js | 8 ++++---- public/mix-manifest.json | 2 +- src/Platform/Dashboard.php | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17da86130..1ca859c5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 14.44.0 - 2024-11-23 + +### Changed +- Remove default limits for 'Attach' field file size and quantity +- Use `whereLike` for case-insensitive search [#2924](https://github.com/orchidsoftware/platform/pull/2924) +- Allow mutation elocument model on `getContent` [#2923](https://github.com/orchidsoftware/platform/issues/2923) +- Refactored to modern PHP standards + +### Fixed +- Loading `csrf` token for `axios` after login + ## 14.43.1 - 2024-11-09 ### Changed diff --git a/public/js/orchid.js b/public/js/orchid.js index 518c56dfc..df4775829 100644 --- a/public/js/orchid.js +++ b/public/js/orchid.js @@ -1,5 +1,5 @@ /*! For license information please see orchid.js.LICENSE.txt */ -(self.webpackChunk=self.webpackChunk||[]).push([[303],{2891:(t,e,r)=>{"use strict";r.d(e,{lg:()=>X,xI:()=>ut});class n{constructor(t,e,r){this.eventTarget=t,this.eventName=e,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(t){this.unorderedBindings.add(t)}bindingDisconnected(t){this.unorderedBindings.delete(t)}handleEvent(t){const e=function(t){if("immediatePropagationStopped"in t)return t;{const{stopImmediatePropagation:e}=t;return Object.assign(t,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}(t);for(const t of this.bindings){if(e.immediatePropagationStopped)break;t.handleEvent(e)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort(((t,e)=>{const r=t.index,n=e.index;return rn?1:0}))}}class o{constructor(t){this.application=t,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach((t=>t.connect())))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach((t=>t.disconnect())))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((t,e)=>t.concat(Array.from(e.values()))),[])}bindingConnected(t){this.fetchEventListenerForBinding(t).bindingConnected(t)}bindingDisconnected(t,e=!1){this.fetchEventListenerForBinding(t).bindingDisconnected(t),e&&this.clearEventListenersForBinding(t)}handleError(t,e,r={}){this.application.handleError(t,`Error ${e}`,r)}clearEventListenersForBinding(t){const e=this.fetchEventListenerForBinding(t);e.hasBindings()||(e.disconnect(),this.removeMappedEventListenerFor(t))}removeMappedEventListenerFor(t){const{eventTarget:e,eventName:r,eventOptions:n}=t,o=this.fetchEventListenerMapForEventTarget(e),i=this.cacheKey(r,n);o.delete(i),0==o.size&&this.eventListenerMaps.delete(e)}fetchEventListenerForBinding(t){const{eventTarget:e,eventName:r,eventOptions:n}=t;return this.fetchEventListener(e,r,n)}fetchEventListener(t,e,r){const n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(e,r);let i=n.get(o);return i||(i=this.createEventListener(t,e,r),n.set(o,i)),i}createEventListener(t,e,r){const o=new n(t,e,r);return this.started&&o.connect(),o}fetchEventListenerMapForEventTarget(t){let e=this.eventListenerMaps.get(t);return e||(e=new Map,this.eventListenerMaps.set(t,e)),e}cacheKey(t,e){const r=[t];return Object.keys(e).sort().forEach((t=>{r.push(`${e[t]?"":"!"}${t}`)})),r.join(":")}}const i={stop:({event:t,value:e})=>(e&&t.stopPropagation(),!0),prevent:({event:t,value:e})=>(e&&t.preventDefault(),!0),self:({event:t,value:e,element:r})=>!e||r===t.target},s=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function a(t){return"window"==t?window:"document"==t?document:void 0}function c(t){return t.replace(/(?:[_-])([a-z0-9])/g,((t,e)=>e.toUpperCase()))}function u(t){return c(t.replace(/--/g,"-").replace(/__/g,"_"))}function l(t){return t.charAt(0).toUpperCase()+t.slice(1)}function f(t){return t.replace(/([A-Z])/g,((t,e)=>`-${e.toLowerCase()}`))}function h(t){return null!=t}function d(t,e){return Object.prototype.hasOwnProperty.call(t,e)}const p=["meta","ctrl","alt","shift"];class m{constructor(t,e,r,n){this.element=t,this.index=e,this.eventTarget=r.eventTarget||t,this.eventName=r.eventName||function(t){const e=t.tagName.toLowerCase();if(e in y)return y[e](t)}(t)||b("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||b("missing identifier"),this.methodName=r.methodName||b("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=n}static forToken(t,e){return new this(t.element,t.index,function(t){const e=t.trim().match(s)||[];let r=e[2],n=e[3];return n&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${n}`,n=""),{eventTarget:a(e[4]),eventName:r,eventOptions:e[7]?(o=e[7],o.split(":").reduce(((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)})),{})):{},identifier:e[5],methodName:e[6],keyFilter:e[1]||n};var o}(t.content),e)}toString(){const t=this.keyFilter?`.${this.keyFilter}`:"",e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${t}${e}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(t){if(!this.keyFilter)return!1;const e=this.keyFilter.split("+");if(this.keyFilterDissatisfied(t,e))return!0;const r=e.filter((t=>!p.includes(t)))[0];return!!r&&(d(this.keyMappings,r)||b(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[r].toLowerCase()!==t.key.toLowerCase())}shouldIgnoreMouseEvent(t){if(!this.keyFilter)return!1;const e=[this.keyFilter];return!!this.keyFilterDissatisfied(t,e)}get params(){const t={},e=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:r,value:n}of Array.from(this.element.attributes)){const o=r.match(e),i=o&&o[1];i&&(t[c(i)]=g(n))}return t}get eventTargetName(){return(t=this.eventTarget)==window?"window":t==document?"document":void 0;var t}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(t,e){const[r,n,o,i]=p.map((t=>e.includes(t)));return t.metaKey!==r||t.ctrlKey!==n||t.altKey!==o||t.shiftKey!==i}}const y={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:t=>"submit"==t.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function b(t){throw new Error(t)}function g(t){try{return JSON.parse(t)}catch(e){return t}}class v{constructor(t,e){this.context=t,this.action=e}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(t){const e=this.prepareActionEvent(t);this.willBeInvokedByEvent(t)&&this.applyEventModifiers(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){const t=this.controller[this.methodName];if("function"==typeof t)return t;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(t){const{element:e}=this.action,{actionDescriptorFilters:r}=this.context.application,{controller:n}=this.context;let o=!0;for(const[i,s]of Object.entries(this.eventOptions))if(i in r){const a=r[i];o=o&&a({name:i,value:s,event:t,element:e,controller:n})}return o}prepareActionEvent(t){return Object.assign(t,{params:this.action.params})}invokeWithEvent(t){const{target:e,currentTarget:r}=t;try{this.method.call(this.controller,t),this.context.logDebugActivity(this.methodName,{event:t,target:e,currentTarget:r,action:this.methodName})}catch(e){const{identifier:r,controller:n,element:o,index:i}=this,s={identifier:r,controller:n,element:o,index:i,event:t};this.context.handleError(e,`invoking action "${this.action}"`,s)}}willBeInvokedByEvent(t){const e=t.target;return!(t instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(t))&&(!(t instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(t))&&(this.element===e||(e instanceof Element&&this.element.contains(e)?this.scope.containsElement(e):this.scope.containsElement(this.action.element))))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class w{constructor(t,e){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver((t=>this.processMutations(t)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(t){this.started&&(this.mutationObserver.disconnect(),this.started=!1),t(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const t=new Set(this.matchElementsInTree());for(const e of Array.from(this.elements))t.has(e)||this.removeElement(e);for(const e of Array.from(t))this.addElement(e)}}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){"attributes"==t.type?this.processAttributeChange(t.target,t.attributeName):"childList"==t.type&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))}processAttributeChange(t,e){this.elements.has(t)?this.delegate.elementAttributeChanged&&this.matchElement(t)?this.delegate.elementAttributeChanged(t,e):this.removeElement(t):this.matchElement(t)&&this.addElement(t)}processRemovedNodes(t){for(const e of Array.from(t)){const t=this.elementFromNode(e);t&&this.processTree(t,this.removeElement)}}processAddedNodes(t){for(const e of Array.from(t)){const t=this.elementFromNode(e);t&&this.elementIsActive(t)&&this.processTree(t,this.addElement)}}matchElement(t){return this.delegate.matchElement(t)}matchElementsInTree(t=this.element){return this.delegate.matchElementsInTree(t)}processTree(t,e){for(const r of this.matchElementsInTree(t))e.call(this,r)}elementFromNode(t){if(t.nodeType==Node.ELEMENT_NODE)return t}elementIsActive(t){return t.isConnected==this.element.isConnected&&this.element.contains(t)}addElement(t){this.elements.has(t)||this.elementIsActive(t)&&(this.elements.add(t),this.delegate.elementMatched&&this.delegate.elementMatched(t))}removeElement(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(t))}}class A{constructor(t,e,r){this.attributeName=e,this.delegate=r,this.elementObserver=new w(t,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(t){return t.hasAttribute(this.attributeName)}matchElementsInTree(t){const e=this.matchElement(t)?[t]:[],r=Array.from(t.querySelectorAll(this.selector));return e.concat(r)}elementMatched(t){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(t,this.attributeName)}elementUnmatched(t){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(t,this.attributeName)}elementAttributeChanged(t,e){this.delegate.elementAttributeValueChanged&&this.attributeName==e&&this.delegate.elementAttributeValueChanged(t,e)}}function O(t,e,r){E(t,e).add(r)}function S(t,e,r){E(t,e).delete(r),function(t,e){const r=t.get(e);null!=r&&0==r.size&&t.delete(e)}(t,e)}function E(t,e){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r}class j{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce(((t,e)=>t.concat(Array.from(e))),[])}get size(){return Array.from(this.valuesByKey.values()).reduce(((t,e)=>t+e.size),0)}add(t,e){O(this.valuesByKey,t,e)}delete(t,e){S(this.valuesByKey,t,e)}has(t,e){const r=this.valuesByKey.get(t);return null!=r&&r.has(e)}hasKey(t){return this.valuesByKey.has(t)}hasValue(t){return Array.from(this.valuesByKey.values()).some((e=>e.has(t)))}getValuesForKey(t){const e=this.valuesByKey.get(t);return e?Array.from(e):[]}getKeysForValue(t){return Array.from(this.valuesByKey).filter((([e,r])=>r.has(t))).map((([t,e])=>t))}}class P{constructor(t,e,r,n){this._selector=e,this.details=n,this.elementObserver=new w(t,this),this.delegate=r,this.matchesByElement=new j}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(t){this._selector=t,this.refresh()}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(t){const{selector:e}=this;if(e){const r=t.matches(e);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(t,this.details):r}return!1}matchElementsInTree(t){const{selector:e}=this;if(e){const r=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(e)).filter((t=>this.matchElement(t)));return r.concat(n)}return[]}elementMatched(t){const{selector:e}=this;e&&this.selectorMatched(t,e)}elementUnmatched(t){const e=this.matchesByElement.getKeysForValue(t);for(const r of e)this.selectorUnmatched(t,r)}elementAttributeChanged(t,e){const{selector:r}=this;if(r){const e=this.matchElement(t),n=this.matchesByElement.has(r,t);e&&!n?this.selectorMatched(t,r):!e&&n&&this.selectorUnmatched(t,r)}}selectorMatched(t,e){this.delegate.selectorMatched(t,e,this.details),this.matchesByElement.add(e,t)}selectorUnmatched(t,e){this.delegate.selectorUnmatched(t,e,this.details),this.matchesByElement.delete(e,t)}}class T{constructor(t,e){this.element=t,this.delegate=e,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((t=>this.processMutations(t)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const t of this.knownAttributeNames)this.refreshAttribute(t,null)}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){const e=t.attributeName;e&&this.refreshAttribute(e,t.oldValue)}refreshAttribute(t,e){const r=this.delegate.getStringMapKeyForAttribute(t);if(null!=r){this.stringMap.has(t)||this.stringMapKeyAdded(r,t);const n=this.element.getAttribute(t);if(this.stringMap.get(t)!=n&&this.stringMapValueChanged(n,r,e),null==n){const e=this.stringMap.get(t);this.stringMap.delete(t),e&&this.stringMapKeyRemoved(r,t,e)}else this.stringMap.set(t,n)}}stringMapKeyAdded(t,e){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(t,e)}stringMapValueChanged(t,e,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(t,e,r)}stringMapKeyRemoved(t,e,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(t,e,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((t=>t.name))}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class _{constructor(t,e,r){this.attributeObserver=new A(t,e,this),this.delegate=r,this.tokensByElement=new j}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(t){this.attributeObserver.pause(t)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(t){this.tokensMatched(this.readTokensForElement(t))}elementAttributeValueChanged(t){const[e,r]=this.refreshTokensForElement(t);this.tokensUnmatched(e),this.tokensMatched(r)}elementUnmatchedAttribute(t){this.tokensUnmatched(this.tokensByElement.getValuesForKey(t))}tokensMatched(t){t.forEach((t=>this.tokenMatched(t)))}tokensUnmatched(t){t.forEach((t=>this.tokenUnmatched(t)))}tokenMatched(t){this.delegate.tokenMatched(t),this.tokensByElement.add(t.element,t)}tokenUnmatched(t){this.delegate.tokenUnmatched(t),this.tokensByElement.delete(t.element,t)}refreshTokensForElement(t){const e=this.tokensByElement.getValuesForKey(t),r=this.readTokensForElement(t),n=function(t,e){const r=Math.max(t.length,e.length);return Array.from({length:r},((r,n)=>[t[n],e[n]]))}(e,r).findIndex((([t,e])=>{return n=e,!((r=t)&&n&&r.index==n.index&&r.content==n.content);var r,n}));return-1==n?[[],[]]:[e.slice(n),r.slice(n)]}readTokensForElement(t){const e=this.attributeName;return function(t,e,r){return t.trim().split(/\s+/).filter((t=>t.length)).map(((t,n)=>({element:e,attributeName:r,content:t,index:n})))}(t.getAttribute(e)||"",t,e)}}class k{constructor(t,e,r){this.tokenListObserver=new _(t,e,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(t){const{element:e}=t,{value:r}=this.fetchParseResultForToken(t);r&&(this.fetchValuesByTokenForElement(e).set(t,r),this.delegate.elementMatchedValue(e,r))}tokenUnmatched(t){const{element:e}=t,{value:r}=this.fetchParseResultForToken(t);r&&(this.fetchValuesByTokenForElement(e).delete(t),this.delegate.elementUnmatchedValue(e,r))}fetchParseResultForToken(t){let e=this.parseResultsByToken.get(t);return e||(e=this.parseToken(t),this.parseResultsByToken.set(t,e)),e}fetchValuesByTokenForElement(t){let e=this.valuesByTokenByElement.get(t);return e||(e=new Map,this.valuesByTokenByElement.set(t,e)),e}parseToken(t){try{return{value:this.delegate.parseValueForToken(t)}}catch(t){return{error:t}}}}class x{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new k(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(t){const e=new v(this.context,t);this.bindingsByAction.set(t,e),this.delegate.bindingConnected(e)}disconnectAction(t){const e=this.bindingsByAction.get(t);e&&(this.bindingsByAction.delete(t),this.delegate.bindingDisconnected(e))}disconnectAllActions(){this.bindings.forEach((t=>this.delegate.bindingDisconnected(t,!0))),this.bindingsByAction.clear()}parseValueForToken(t){const e=m.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}}class L{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new T(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(t){if(t in this.valueDescriptorMap)return this.valueDescriptorMap[t].name}stringMapKeyAdded(t,e){const r=this.valueDescriptorMap[e];this.hasValue(t)||this.invokeChangedCallback(t,r.writer(this.receiver[t]),r.writer(r.defaultValue))}stringMapValueChanged(t,e,r){const n=this.valueDescriptorNameMap[e];null!==t&&(null===r&&(r=n.writer(n.defaultValue)),this.invokeChangedCallback(e,t,r))}stringMapKeyRemoved(t,e,r){const n=this.valueDescriptorNameMap[t];this.hasValue(t)?this.invokeChangedCallback(t,n.writer(this.receiver[t]),r):this.invokeChangedCallback(t,n.writer(n.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(const{key:t,name:e,defaultValue:r,writer:n}of this.valueDescriptors)null==r||this.controller.data.has(t)||this.invokeChangedCallback(e,n(r),void 0)}invokeChangedCallback(t,e,r){const n=`${t}Changed`,o=this.receiver[n];if("function"==typeof o){const n=this.valueDescriptorNameMap[t];try{const t=n.reader(e);let i=r;r&&(i=n.reader(r)),o.call(this.receiver,t,i)}catch(t){throw t instanceof TypeError&&(t.message=`Stimulus Value "${this.context.identifier}.${n.name}" - ${t.message}`),t}}}get valueDescriptors(){const{valueDescriptorMap:t}=this;return Object.keys(t).map((e=>t[e]))}get valueDescriptorNameMap(){const t={};return Object.keys(this.valueDescriptorMap).forEach((e=>{const r=this.valueDescriptorMap[e];t[r.name]=r})),t}hasValue(t){const e=`has${l(this.valueDescriptorNameMap[t].name)}`;return this.receiver[e]}}class R{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new j}start(){this.tokenListObserver||(this.tokenListObserver=new _(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:t,content:e}){this.scope.containsElement(t)&&this.connectTarget(t,e)}tokenUnmatched({element:t,content:e}){this.disconnectTarget(t,e)}connectTarget(t,e){var r;this.targetsByName.has(e,t)||(this.targetsByName.add(e,t),null===(r=this.tokenListObserver)||void 0===r||r.pause((()=>this.delegate.targetConnected(t,e))))}disconnectTarget(t,e){var r;this.targetsByName.has(e,t)&&(this.targetsByName.delete(e,t),null===(r=this.tokenListObserver)||void 0===r||r.pause((()=>this.delegate.targetDisconnected(t,e))))}disconnectAllTargets(){for(const t of this.targetsByName.keys)for(const e of this.targetsByName.getValuesForKey(t))this.disconnectTarget(e,t)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function N(t,e){const r=M(t);return Array.from(r.reduce(((t,r)=>(function(t,e){const r=t[e];return Array.isArray(r)?r:[]}(r,e).forEach((e=>t.add(e))),t)),new Set))}function C(t,e){return M(t).reduce(((t,r)=>(t.push(...function(t,e){const r=t[e];return r?Object.keys(r).map((t=>[t,r[t]])):[]}(r,e)),t)),[])}function M(t){const e=[];for(;t;)e.push(t),t=Object.getPrototypeOf(t);return e.reverse()}class B{constructor(t,e){this.started=!1,this.context=t,this.delegate=e,this.outletsByName=new j,this.outletElementsByName=new j,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach((t=>{this.setupSelectorObserverForOutlet(t),this.setupAttributeObserverForOutlet(t)})),this.started=!0,this.dependentContexts.forEach((t=>t.refresh())))}refresh(){this.selectorObserverMap.forEach((t=>t.refresh())),this.attributeObserverMap.forEach((t=>t.refresh()))}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach((t=>t.stop())),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach((t=>t.stop())),this.attributeObserverMap.clear())}selectorMatched(t,e,{outletName:r}){const n=this.getOutlet(t,r);n&&this.connectOutlet(n,t,r)}selectorUnmatched(t,e,{outletName:r}){const n=this.getOutletFromMap(t,r);n&&this.disconnectOutlet(n,t,r)}selectorMatchElement(t,{outletName:e}){const r=this.selector(e),n=this.hasOutlet(t,e),o=t.matches(`[${this.schema.controllerAttribute}~=${e}]`);return!!r&&(n&&o&&t.matches(r))}elementMatchedAttribute(t,e){const r=this.getOutletNameFromOutletAttributeName(e);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(t,e){const r=this.getOutletNameFromOutletAttributeName(e);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(t,e){const r=this.getOutletNameFromOutletAttributeName(e);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(t,e,r){var n;this.outletElementsByName.has(r,e)||(this.outletsByName.add(r,t),this.outletElementsByName.add(r,e),null===(n=this.selectorObserverMap.get(r))||void 0===n||n.pause((()=>this.delegate.outletConnected(t,e,r))))}disconnectOutlet(t,e,r){var n;this.outletElementsByName.has(r,e)&&(this.outletsByName.delete(r,t),this.outletElementsByName.delete(r,e),null===(n=this.selectorObserverMap.get(r))||void 0===n||n.pause((()=>this.delegate.outletDisconnected(t,e,r))))}disconnectAllOutlets(){for(const t of this.outletElementsByName.keys)for(const e of this.outletElementsByName.getValuesForKey(t))for(const r of this.outletsByName.getValuesForKey(t))this.disconnectOutlet(r,e,t)}updateSelectorObserverForOutlet(t){const e=this.selectorObserverMap.get(t);e&&(e.selector=this.selector(t))}setupSelectorObserverForOutlet(t){const e=this.selector(t),r=new P(document.body,e,this,{outletName:t});this.selectorObserverMap.set(t,r),r.start()}setupAttributeObserverForOutlet(t){const e=this.attributeNameForOutletName(t),r=new A(this.scope.element,e,this);this.attributeObserverMap.set(t,r),r.start()}selector(t){return this.scope.outlets.getSelectorForOutletName(t)}attributeNameForOutletName(t){return this.scope.schema.outletAttributeForScope(this.identifier,t)}getOutletNameFromOutletAttributeName(t){return this.outletDefinitions.find((e=>this.attributeNameForOutletName(e)===t))}get outletDependencies(){const t=new j;return this.router.modules.forEach((e=>{N(e.definition.controllerConstructor,"outlets").forEach((r=>t.add(r,e.identifier)))})),t}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const t=this.dependentControllerIdentifiers;return this.router.contexts.filter((e=>t.includes(e.identifier)))}hasOutlet(t,e){return!!this.getOutlet(t,e)||!!this.getOutletFromMap(t,e)}getOutlet(t,e){return this.application.getControllerForElementAndIdentifier(t,e)}getOutletFromMap(t,e){return this.outletsByName.getValuesForKey(e).find((e=>e.element===t))}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class I{constructor(t,e){this.logDebugActivity=(t,e={})=>{const{identifier:r,controller:n,element:o}=this;e=Object.assign({identifier:r,controller:n,element:o},e),this.application.logDebugActivity(this.identifier,t,e)},this.module=t,this.scope=e,this.controller=new t.controllerConstructor(this),this.bindingObserver=new x(this,this.dispatcher),this.valueObserver=new L(this,this.controller),this.targetObserver=new R(this,this),this.outletObserver=new B(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(t){this.handleError(t,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(t){this.handleError(t,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(t){this.handleError(t,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(t,e,r={}){const{identifier:n,controller:o,element:i}=this;r=Object.assign({identifier:n,controller:o,element:i},r),this.application.handleError(t,`Error ${e}`,r)}targetConnected(t,e){this.invokeControllerMethod(`${e}TargetConnected`,t)}targetDisconnected(t,e){this.invokeControllerMethod(`${e}TargetDisconnected`,t)}outletConnected(t,e,r){this.invokeControllerMethod(`${u(r)}OutletConnected`,t,e)}outletDisconnected(t,e,r){this.invokeControllerMethod(`${u(r)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){const r=this.controller;"function"==typeof r[t]&&r[t](...e)}}function F(t){return function(t,e){const r=q(t),n=function(t,e){return D(e).reduce(((r,n)=>{const o=function(t,e,r){const n=Object.getOwnPropertyDescriptor(t,r);if(!n||!("value"in n)){const t=Object.getOwnPropertyDescriptor(e,r).value;return n&&(t.get=n.get||t.get,t.set=n.set||t.set),t}}(t,e,n);return o&&Object.assign(r,{[n]:o}),r}),{})}(t.prototype,e);return Object.defineProperties(r.prototype,n),r}(t,function(t){const e=N(t,"blessings");return e.reduce(((e,r)=>{const n=r(t);for(const t in n){const r=e[t]||{};e[t]=Object.assign(r,n[t])}return e}),{})}(t))}const D="function"==typeof Object.getOwnPropertySymbols?t=>[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)]:Object.getOwnPropertyNames,q=(()=>{function t(t){function e(){return Reflect.construct(t,arguments,new.target)}return e.prototype=Object.create(t.prototype,{constructor:{value:e}}),Reflect.setPrototypeOf(e,t),e}try{return function(){const e=t((function(){this.a.call(this)}));e.prototype.a=function(){},new e}(),t}catch(t){return t=>class extends t{}}})();class V{constructor(t,e){this.application=t,this.definition=function(t){return{identifier:t.identifier,controllerConstructor:F(t.controllerConstructor)}}(e),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(t){const e=this.fetchContextForScope(t);this.connectedContexts.add(e),e.connect()}disconnectContextForScope(t){const e=this.contextsByScope.get(t);e&&(this.connectedContexts.delete(e),e.disconnect())}fetchContextForScope(t){let e=this.contextsByScope.get(t);return e||(e=new I(this,t),this.contextsByScope.set(t,e)),e}}class U{constructor(t){this.scope=t}has(t){return this.data.has(this.getDataKey(t))}get(t){return this.getAll(t)[0]}getAll(t){const e=this.data.get(this.getDataKey(t))||"";return e.match(/[^\s]+/g)||[]}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}}class H{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(t){const e=this.getAttributeNameForKey(t);return this.element.getAttribute(e)}set(t,e){const r=this.getAttributeNameForKey(t);return this.element.setAttribute(r,e),this.get(t)}has(t){const e=this.getAttributeNameForKey(t);return this.element.hasAttribute(e)}delete(t){if(this.has(t)){const e=this.getAttributeNameForKey(t);return this.element.removeAttribute(e),!0}return!1}getAttributeNameForKey(t){return`data-${this.identifier}-${f(t)}`}}class z{constructor(t){this.warnedKeysByObject=new WeakMap,this.logger=t}warn(t,e,r){let n=this.warnedKeysByObject.get(t);n||(n=new Set,this.warnedKeysByObject.set(t,n)),n.has(e)||(n.add(e),this.logger.warn(r,t))}}function W(t,e){return`[${t}~="${e}"]`}class ${constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return null!=this.find(t)}find(...t){return t.reduce(((t,e)=>t||this.findTarget(e)||this.findLegacyTarget(e)),void 0)}findAll(...t){return t.reduce(((t,e)=>[...t,...this.findAllTargets(e),...this.findAllLegacyTargets(e)]),[])}findTarget(t){const e=this.getSelectorForTargetName(t);return this.scope.findElement(e)}findAllTargets(t){const e=this.getSelectorForTargetName(t);return this.scope.findAllElements(e)}getSelectorForTargetName(t){return W(this.schema.targetAttributeForScope(this.identifier),t)}findLegacyTarget(t){const e=this.getLegacySelectorForTargetName(t);return this.deprecate(this.scope.findElement(e),t)}findAllLegacyTargets(t){const e=this.getLegacySelectorForTargetName(t);return this.scope.findAllElements(e).map((e=>this.deprecate(e,t)))}getLegacySelectorForTargetName(t){const e=`${this.identifier}.${t}`;return W(this.schema.targetAttribute,e)}deprecate(t,e){if(t){const{identifier:r}=this,n=this.schema.targetAttribute,o=this.schema.targetAttributeForScope(r);this.guide.warn(t,`target:${e}`,`Please replace ${n}="${r}.${e}" with ${o}="${e}". The ${n} attribute is deprecated and will be removed in a future version of Stimulus.`)}return t}get guide(){return this.scope.guide}}class K{constructor(t,e){this.scope=t,this.controllerElement=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return null!=this.find(t)}find(...t){return t.reduce(((t,e)=>t||this.findOutlet(e)),void 0)}findAll(...t){return t.reduce(((t,e)=>[...t,...this.findAllOutlets(e)]),[])}getSelectorForOutletName(t){const e=this.schema.outletAttributeForScope(this.identifier,t);return this.controllerElement.getAttribute(e)}findOutlet(t){const e=this.getSelectorForOutletName(t);if(e)return this.findElement(e,t)}findAllOutlets(t){const e=this.getSelectorForOutletName(t);return e?this.findAllElements(e,t):[]}findElement(t,e){return this.scope.queryElements(t).filter((r=>this.matchesElement(r,t,e)))[0]}findAllElements(t,e){return this.scope.queryElements(t).filter((r=>this.matchesElement(r,t,e)))}matchesElement(t,e,r){const n=t.getAttribute(this.scope.schema.controllerAttribute)||"";return t.matches(e)&&n.split(" ").includes(r)}}class Y{constructor(t,e,r,n){this.targets=new $(this),this.classes=new U(this),this.data=new H(this),this.containsElement=t=>t.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=r,this.guide=new z(n),this.outlets=new K(this.documentScope,e)}findElement(t){return this.element.matches(t)?this.element:this.queryElements(t).find(this.containsElement)}findAllElements(t){return[...this.element.matches(t)?[this.element]:[],...this.queryElements(t).filter(this.containsElement)]}queryElements(t){return Array.from(this.element.querySelectorAll(t))}get controllerSelector(){return W(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new Y(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class G{constructor(t,e,r){this.element=t,this.schema=e,this.delegate=r,this.valueListObserver=new k(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(t){const{element:e,content:r}=t;return this.parseValueForElementAndIdentifier(e,r)}parseValueForElementAndIdentifier(t,e){const r=this.fetchScopesByIdentifierForElement(t);let n=r.get(e);return n||(n=this.delegate.createScopeForElementAndIdentifier(t,e),r.set(e,n)),n}elementMatchedValue(t,e){const r=(this.scopeReferenceCounts.get(e)||0)+1;this.scopeReferenceCounts.set(e,r),1==r&&this.delegate.scopeConnected(e)}elementUnmatchedValue(t,e){const r=this.scopeReferenceCounts.get(e);r&&(this.scopeReferenceCounts.set(e,r-1),1==r&&this.delegate.scopeDisconnected(e))}fetchScopesByIdentifierForElement(t){let e=this.scopesByIdentifierByElement.get(t);return e||(e=new Map,this.scopesByIdentifierByElement.set(t,e)),e}}class J{constructor(t){this.application=t,this.scopeObserver=new G(this.element,this.schema,this),this.scopesByIdentifier=new j,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce(((t,e)=>t.concat(e.contexts)),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(t){this.unloadIdentifier(t.identifier);const e=new V(this.application,t);this.connectModule(e);const r=t.controllerConstructor.afterLoad;r&&r.call(t.controllerConstructor,t.identifier,this.application)}unloadIdentifier(t){const e=this.modulesByIdentifier.get(t);e&&this.disconnectModule(e)}getContextForElementAndIdentifier(t,e){const r=this.modulesByIdentifier.get(e);if(r)return r.contexts.find((e=>e.element==t))}proposeToConnectScopeForElementAndIdentifier(t,e){const r=this.scopeObserver.parseValueForElementAndIdentifier(t,e);r&&this.scopeObserver.elementMatchedValue(r.element,r)}handleError(t,e,r){this.application.handleError(t,e,r)}createScopeForElementAndIdentifier(t,e){return new Y(this.schema,t,e,this.logger)}scopeConnected(t){this.scopesByIdentifier.add(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.connectContextForScope(t)}scopeDisconnected(t){this.scopesByIdentifier.delete(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.disconnectContextForScope(t)}connectModule(t){this.modulesByIdentifier.set(t.identifier,t);this.scopesByIdentifier.getValuesForKey(t.identifier).forEach((e=>t.connectContextForScope(e)))}disconnectModule(t){this.modulesByIdentifier.delete(t.identifier);this.scopesByIdentifier.getValuesForKey(t.identifier).forEach((e=>t.disconnectContextForScope(e)))}}const Q={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:t=>`data-${t}-target`,outletAttributeForScope:(t,e)=>`data-${t}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},Z("abcdefghijklmnopqrstuvwxyz".split("").map((t=>[t,t])))),Z("0123456789".split("").map((t=>[t,t]))))};function Z(t){return t.reduce(((t,[e,r])=>Object.assign(Object.assign({},t),{[e]:r})),{})}class X{constructor(t=document.documentElement,e=Q){this.logger=console,this.debug=!1,this.logDebugActivity=(t,e,r={})=>{this.debug&&this.logFormattedMessage(t,e,r)},this.element=t,this.schema=e,this.dispatcher=new o(this),this.router=new J(this),this.actionDescriptorFilters=Object.assign({},i)}static start(t,e){const r=new this(t,e);return r.start(),r}async start(){await new Promise((t=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",(()=>t())):t()})),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(t,e){this.load({identifier:t,controllerConstructor:e})}registerActionOption(t,e){this.actionDescriptorFilters[t]=e}load(t,...e){(Array.isArray(t)?t:[t,...e]).forEach((t=>{t.controllerConstructor.shouldLoad&&this.router.loadDefinition(t)}))}unload(t,...e){(Array.isArray(t)?t:[t,...e]).forEach((t=>this.router.unloadIdentifier(t)))}get controllers(){return this.router.contexts.map((t=>t.controller))}getControllerForElementAndIdentifier(t,e){const r=this.router.getContextForElementAndIdentifier(t,e);return r?r.controller:null}handleError(t,e,r){var n;this.logger.error("%s\n\n%o\n\n%o",e,t,r),null===(n=window.onerror)||void 0===n||n.call(window,e,"",0,0,t)}logFormattedMessage(t,e,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${t} #${e}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}}function tt(t,e,r){return t.application.getControllerForElementAndIdentifier(e,r)}function et(t,e,r){let n=tt(t,e,r);return n||(t.application.router.proposeToConnectScopeForElementAndIdentifier(e,r),n=tt(t,e,r),n||void 0)}function rt([t,e],r){return function(t){const{token:e,typeDefinition:r}=t,n=`${f(e)}-value`,o=function(t){const{controller:e,token:r,typeDefinition:n}=t,o={controller:e,token:r,typeObject:n},i=function(t){const{controller:e,token:r,typeObject:n}=t,o=h(n.type),i=h(n.default),s=o&&i,a=o&&!i,c=!o&&i,u=nt(n.type),l=ot(t.typeObject.default);if(a)return u;if(c)return l;if(u!==l){throw new Error(`The specified default value for the Stimulus Value "${e?`${e}.${r}`:r}" must match the defined type "${u}". The provided default value of "${n.default}" is of type "${l}".`)}if(s)return u}(o),s=ot(n),a=nt(n),c=i||s||a;if(c)return c;const u=e?`${e}.${n}`:r;throw new Error(`Unknown value type "${u}" for "${r}" value`)}(t);return{type:o,key:n,name:c(n),get defaultValue(){return function(t){const e=nt(t);if(e)return it[e];const r=d(t,"default"),n=d(t,"type"),o=t;if(r)return o.default;if(n){const{type:t}=o,e=nt(t);if(e)return it[e]}return t}(r)},get hasCustomDefaultValue(){return void 0!==ot(r)},reader:st[o],writer:at[o]||at.default}}({controller:r,token:t,typeDefinition:e})}function nt(t){switch(t){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function ot(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(t)?"array":"[object Object]"===Object.prototype.toString.call(t)?"object":void 0}const it={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},st={array(t){const e=JSON.parse(t);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${t}" of type "${ot(e)}"`);return e},boolean:t=>!("0"==t||"false"==String(t).toLowerCase()),number:t=>Number(t.replace(/_/g,"")),object(t){const e=JSON.parse(t);if(null===e||"object"!=typeof e||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${t}" of type "${ot(e)}"`);return e},string:t=>t},at={default:function(t){return`${t}`},array:ct,object:ct};function ct(t){return JSON.stringify(t)}class ut{constructor(t){this.context=t}static get shouldLoad(){return!0}static afterLoad(t,e){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:r={},prefix:n=this.identifier,bubbles:o=!0,cancelable:i=!0}={}){const s=new CustomEvent(n?`${n}:${t}`:t,{detail:r,bubbles:o,cancelable:i});return e.dispatchEvent(s),s}}ut.blessings=[function(t){return N(t,"classes").reduce(((t,e)=>{return Object.assign(t,(r=e,{[`${r}Class`]:{get(){const{classes:t}=this;if(t.has(r))return t.get(r);{const e=t.getAttributeName(r);throw new Error(`Missing attribute "${e}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${l(r)}Class`]:{get(){return this.classes.has(r)}}}));var r}),{})},function(t){return N(t,"targets").reduce(((t,e)=>{return Object.assign(t,(r=e,{[`${r}Target`]:{get(){const t=this.targets.find(r);if(t)return t;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${l(r)}Target`]:{get(){return this.targets.has(r)}}}));var r}),{})},function(t){const e=C(t,"values"),r={valueDescriptorMap:{get(){return e.reduce(((t,e)=>{const r=rt(e,this.identifier),n=this.data.getAttributeNameForKey(r.key);return Object.assign(t,{[n]:r})}),{})}}};return e.reduce(((t,e)=>Object.assign(t,function(t,e){const r=rt(t,e),{key:n,name:o,reader:i,writer:s}=r;return{[o]:{get(){const t=this.data.get(n);return null!==t?i(t):r.defaultValue},set(t){void 0===t?this.data.delete(n):this.data.set(n,s(t))}},[`has${l(o)}`]:{get(){return this.data.has(n)||r.hasCustomDefaultValue}}}}(e))),r)},function(t){return N(t,"outlets").reduce(((t,e)=>Object.assign(t,function(t){const e=u(t);return{[`${e}Outlet`]:{get(){const e=this.outlets.find(t),r=this.outlets.getSelectorForOutletName(t);if(e){const r=et(this,e,t);if(r)return r;throw new Error(`The provided outlet element is missing an outlet controller "${t}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${t}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}Outlets`]:{get(){const e=this.outlets.findAll(t);return e.length>0?e.map((e=>{const r=et(this,e,t);if(r)return r})).filter((t=>t)):[]}},[`${e}OutletElement`]:{get(){const e=this.outlets.find(t),r=this.outlets.getSelectorForOutletName(t);if(e)return e;throw new Error(`Missing outlet element "${t}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(t)}},[`has${l(e)}Outlet`]:{get(){return this.outlets.has(t)}}}}(e))),{})}],ut.targets=[],ut.outlets=[],ut.values={}},89:(t,e,r)=>{"use strict";r.r(e),r.d(e,{FetchEnctype:()=>Q,FetchMethod:()=>G,FetchRequest:()=>Z,FetchResponse:()=>H,FrameElement:()=>s,FrameLoadingStyle:()=>i,FrameRenderer:()=>vt,PageRenderer:()=>pe,PageSnapshot:()=>kt,StreamActions:()=>qe,StreamElement:()=>Ve,StreamSourceElement:()=>Ue,cache:()=>Ee,clearCache:()=>Re,config:()=>C,connectStreamSource:()=>ke,disconnectStreamSource:()=>xe,fetch:()=>K,fetchEnctypeFromString:()=>J,fetchMethodFromString:()=>Y,isSafe:()=>X,navigator:()=>je,registerAdapter:()=>Te,renderStreamMessage:()=>Le,session:()=>Se,setConfirmMethod:()=>Ce,setFormMode:()=>Me,setProgressBarDelay:()=>Ne,start:()=>Pe,visit:()=>_e}),function(t){function e(t,e,r){throw new t("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+e+".",r)}"function"!=typeof t.requestSubmit&&(t.requestSubmit=function(t){t?(!function(t,r){t instanceof HTMLElement||e(TypeError,"parameter 1 is not of type 'HTMLElement'"),"submit"==t.type||e(TypeError,"The specified element is not a submit button"),t.form==r||e(DOMException,"The specified element is not owned by this form element","NotFoundError")}(t,this),t.click()):((t=document.createElement("input")).type="submit",t.hidden=!0,this.appendChild(t),t.click(),this.removeChild(t))})}(HTMLFormElement.prototype);const n=new WeakMap;function o(t){const e=function(t){const e=t instanceof Element?t:t instanceof Node?t.parentElement:null,r=e?e.closest("input, button"):null;return"submit"==r?.type?r:null}(t.target);e&&e.form&&n.set(e.form,e)}!function(){if("submitter"in Event.prototype)return;let t=window.Event.prototype;if("SubmitEvent"in window){const e=window.SubmitEvent.prototype;if(!/Apple Computer/.test(navigator.vendor)||"submitter"in e)return;t=e}addEventListener("click",o,!0),Object.defineProperty(t,"submitter",{get(){if("submit"==this.type&&this.target instanceof HTMLFormElement)return n.get(this.target)}})}();const i={eager:"eager",lazy:"lazy"};class s extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new s.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(t){"loading"==t?this.delegate.loadingStyleChanged():"src"==t?this.delegate.sourceURLChanged():"disabled"==t&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(t){t?this.setAttribute("refresh",t):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&"morph"===this.refresh}get loading(){return function(t){if("lazy"===t.toLowerCase())return i.lazy;return i.eager}(this.getAttribute("loading")||"")}set loading(t){t?this.setAttribute("loading",t):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(t){t?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}}const a={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function c(t){if("false"==t.getAttribute("data-turbo-eval"))return t;{const e=document.createElement("script"),r=j();return r&&(e.nonce=r),e.textContent=t.textContent,e.async=!1,function(t,e){for(const{name:r,value:n}of e.attributes)t.setAttribute(r,n)}(e,t),e}}function u(t,{target:e,cancelable:r,detail:n}={}){const o=new CustomEvent(t,{cancelable:r,bubbles:!0,composed:!0,detail:n});return e&&e.isConnected?e.dispatchEvent(o):document.documentElement.dispatchEvent(o),o}function l(t){t.preventDefault(),t.stopImmediatePropagation()}function f(){return"hidden"===document.visibilityState?d():h()}function h(){return new Promise((t=>requestAnimationFrame((()=>t()))))}function d(){return new Promise((t=>setTimeout((()=>t()),0)))}function p(t=""){return(new DOMParser).parseFromString(t,"text/html")}function m(t,...e){const r=function(t,e){return t.reduce(((t,r,n)=>t+r+(null==e[n]?"":e[n])),"")}(t,e).replace(/^\n/,"").split("\n"),n=r[0].match(/^\s+/),o=n?n[0].length:0;return r.map((t=>t.slice(o))).join("\n")}function y(){return Array.from({length:36}).map(((t,e)=>8==e||13==e||18==e||23==e?"-":14==e?"4":19==e?(Math.floor(4*Math.random())+8).toString(16):Math.floor(15*Math.random()).toString(16))).join("")}function b(t,...e){for(const r of e.map((e=>e?.getAttribute(t))))if("string"==typeof r)return r;return null}function g(...t){for(const e of t)"turbo-frame"==e.localName&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function v(...t){for(const e of t)"turbo-frame"==e.localName&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function w(t,e=2e3){return new Promise((r=>{const n=()=>{t.removeEventListener("error",n),t.removeEventListener("load",n),r()};t.addEventListener("load",n,{once:!0}),t.addEventListener("error",n,{once:!0}),setTimeout(r,e)}))}function A(t){switch(t){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function O(...t){const e=b("data-turbo-action",...t);return function(t){return"advance"==t||"replace"==t||"restore"==t}(e)?e:null}function S(t){return document.querySelector(`meta[name="${t}"]`)}function E(t){const e=S(t);return e&&e.content}function j(){const t=S("csp-nonce");if(t){const{nonce:e,content:r}=t;return""==e?r:e}}function P(t,e){if(t instanceof Element)return t.closest(e)||P(t.assignedSlot||t.getRootNode()?.host,e)}function T(t){return!!t&&null==t.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")&&"function"==typeof t.focus}function _(t){return Array.from(t.querySelectorAll("[autofocus]")).find(T)}function k(t){if("_blank"===t)return!1;if(t){for(const e of document.getElementsByName(t))if(e instanceof HTMLIFrameElement)return!1;return!0}return!0}function x(t){return P(t,"a[href]:not([target^=_]):not([download])")}function L(t){return M(t.getAttribute("href")||"")}const R={"aria-disabled":{beforeSubmit:t=>{t.setAttribute("aria-disabled","true"),t.addEventListener("click",l)},afterSubmit:t=>{t.removeAttribute("aria-disabled"),t.removeEventListener("click",l)}},disabled:{beforeSubmit:t=>t.disabled=!0,afterSubmit:t=>t.disabled=!1}};const N=new class{#t=null;constructor(t){Object.assign(this,t)}get submitter(){return this.#t}set submitter(t){this.#t=R[t]||t}}({mode:"on",submitter:"disabled"}),C={drive:a,forms:N};function M(t){return new URL(t.toString(),document.baseURI)}function B(t){let e;return t.hash?t.hash.slice(1):(e=t.href.match(/#(.*)$/))?e[1]:void 0}function I(t,e){return M(e?.getAttribute("formaction")||t.getAttribute("action")||t.action)}function F(t){return(function(t){return function(t){return t.pathname.split("/").slice(1)}(t).slice(-1)[0]}(t).match(/\.[^.]*$/)||[])[0]||""}function D(t,e){const r=function(t){return e=t.origin+t.pathname,e.endsWith("/")?e:e+"/";var e}(e);return t.href===M(r).href||t.href.startsWith(r)}function q(t,e){return D(t,e)&&!C.drive.unvisitableExtensions.has(F(t))}function V(t){const e=B(t);return null!=e?t.href.slice(0,-(e.length+1)):t.href}function U(t){return V(t)}class H{constructor(t){this.response=t}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return M(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(t){return this.response.headers.get(t)}}class z extends Set{constructor(t){super(),this.maxSize=t}add(t){if(this.size>=this.maxSize){const t=this.values().next().value;this.delete(t)}super.add(t)}}const W=new z(20),$=window.fetch;function K(t,e={}){const r=new Headers(e.headers||{}),n=y();return W.add(n),r.append("X-Turbo-Request-Id",n),$(t,{...e,headers:r})}function Y(t){switch(t.toLowerCase()){case"get":return G.get;case"post":return G.post;case"put":return G.put;case"patch":return G.patch;case"delete":return G.delete}}const G={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function J(t){switch(t.toLowerCase()){case Q.multipart:return Q.multipart;case Q.plain:return Q.plain;default:return Q.urlEncoded}}const Q={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"};class Z{abortController=new AbortController;#e=t=>{};constructor(t,e,r,n=new URLSearchParams,o=null,i=Q.urlEncoded){const[s,a]=tt(M(r),e,n,i);this.delegate=t,this.url=s,this.target=o,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:e.toUpperCase(),headers:{...this.defaultHeaders},body:a,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=i}get method(){return this.fetchOptions.method}set method(t){const e=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=Y(t)||G.get;this.url.search="";const[n,o]=tt(this.url,r,e,this.enctype);this.url=n,this.fetchOptions.body=o,this.fetchOptions.method=r.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(t){this.fetchOptions.headers=t}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(t){this.fetchOptions.body=t}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){const{fetchOptions:t}=this;this.delegate.prepareRequest(this);const e=await this.#r(t);try{this.delegate.requestStarted(this),e.detail.fetchRequest?this.response=e.detail.fetchRequest.response:this.response=K(this.url.href,t);const r=await this.response;return await this.receive(r)}catch(t){if("AbortError"!==t.name)throw this.#n(t)&&this.delegate.requestErrored(this,t),t}finally{this.delegate.requestFinished(this)}}async receive(t){const e=new H(t);return u("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:e},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,e):e.succeeded?this.delegate.requestSucceededWithResponse(this,e):this.delegate.requestFailedWithResponse(this,e),e}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return X(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(t){this.headers.Accept=[t,this.headers.Accept].join(", ")}async#r(t){const e=new Promise((t=>this.#e=t)),r=u("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:t,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await e,r}#n(t){return!u("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:t}}).defaultPrevented}}function X(t){return Y(t)==G.get}function tt(t,e,r,n){const o=Array.from(r).length>0?new URLSearchParams(et(r)):t.searchParams;return X(e)?[rt(t,o),null]:n==Q.urlEncoded?[t,o]:[t,r]}function et(t){const e=[];for(const[r,n]of t)n instanceof File||e.push([r,n]);return e}function rt(t,e){const r=new URLSearchParams(et(e));return t.search=r.toString(),t}class nt{started=!1;constructor(t,e){this.delegate=t,this.element=e,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=t=>{const e=t.slice(-1)[0];e?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}}class ot{static contentType="text/vnd.turbo-stream.html";static wrap(t){return"string"==typeof t?new this(function(t){const e=document.createElement("template");return e.innerHTML=t,e.content}(t)):t}constructor(t){this.fragment=function(t){for(const e of t.querySelectorAll("turbo-stream")){const t=document.importNode(e,!0);for(const e of t.templateElement.content.querySelectorAll("script"))e.replaceWith(c(e));e.replaceWith(t)}return t}(t)}}const it=new class{#o=null;#i=null;get(t){if(this.#i&&this.#i.url===t&&this.#i.expire>Date.now())return this.#i.request}setLater(t,e,r){this.clear(),this.#o=setTimeout((()=>{e.perform(),this.set(t,e,r),this.#o=null}),100)}set(t,e,r){this.#i={url:t,request:e,expire:new Date((new Date).getTime()+r)}}clear(){this.#o&&clearTimeout(this.#o),this.#i=null}},st={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"};class at{state=st.initialized;static confirmMethod(t){return Promise.resolve(confirm(t))}constructor(t,e,r,n=!1){const o=function(t,e){const r=e?.getAttribute("formmethod")||t.getAttribute("method")||"";return Y(r.toLowerCase())||G.get}(e,r),i=function(t,e){const r=M(t);X(e)&&(r.search="");return r}(function(t,e){const r="string"==typeof t.action?t.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":t.getAttribute("action")||r||""}(e,r),o),s=function(t,e){const r=new FormData(t),n=e?.getAttribute("name"),o=e?.getAttribute("value");n&&r.append(n,o||"");return r}(e,r),a=function(t,e){return J(e?.getAttribute("formenctype")||t.enctype)}(e,r);this.delegate=t,this.formElement=e,this.submitter=r,this.fetchRequest=new Z(this,o,i,s,e,a),this.mustRedirect=n}get method(){return this.fetchRequest.method}set method(t){this.fetchRequest.method=t}get action(){return this.fetchRequest.url.toString()}set action(t){this.fetchRequest.url=M(t)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){const{initialized:t,requesting:e}=st,r=b("data-turbo-confirm",this.submitter,this.formElement);if("string"==typeof r){const t="function"==typeof C.forms.confirm?C.forms.confirm:at.confirmMethod;if(!await t(r,this.formElement,this.submitter))return}if(this.state==t)return this.state=e,this.fetchRequest.perform()}stop(){const{stopping:t,stopped:e}=st;if(this.state!=t&&this.state!=e)return this.state=t,this.fetchRequest.cancel(),!0}prepareRequest(t){if(!t.isSafe){const e=function(t){if(null!=t){const e=(document.cookie?document.cookie.split("; "):[]).find((e=>e.startsWith(t)));if(e){const t=e.split("=").slice(1).join("=");return t?decodeURIComponent(t):void 0}}}(E("csrf-param"))||E("csrf-token");e&&(t.headers["X-CSRF-Token"]=e)}this.requestAcceptsTurboStreamResponse(t)&&t.acceptResponseType(ot.contentType)}requestStarted(t){this.state=st.waiting,this.submitter&&C.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),g(this.formElement),u("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(t,e){it.clear(),this.result={success:e.succeeded,fetchResponse:e}}requestSucceededWithResponse(t,e){if(e.clientError||e.serverError)this.delegate.formSubmissionFailedWithResponse(this,e);else if(it.clear(),this.requestMustRedirect(t)&&function(t){return 200==t.statusCode&&!t.redirected}(e)){const t=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,t)}else this.state=st.receiving,this.result={success:!0,fetchResponse:e},this.delegate.formSubmissionSucceededWithResponse(this,e)}requestFailedWithResponse(t,e){this.result={success:!1,fetchResponse:e},this.delegate.formSubmissionFailedWithResponse(this,e)}requestErrored(t,e){this.result={success:!1,error:e},this.delegate.formSubmissionErrored(this,e)}requestFinished(t){this.state=st.stopped,this.submitter&&C.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),v(this.formElement),u("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(this.submitter&&this.submitsWith)if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){const t=this.submitter;this.originalSubmitText=t.value,t.value=this.submitsWith}}resetSubmitterText(){if(this.submitter&&this.originalSubmitText)if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){this.submitter.value=this.originalSubmitText}}requestMustRedirect(t){return!t.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(t){return!t.isSafe||function(t,...e){return e.some((e=>e&&e.hasAttribute(t)))}("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}}class ct{constructor(t){this.element=t}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(t){return null!=this.getElementForAnchor(t)}getElementForAnchor(t){return t?this.element.querySelector(`[id='${t}'], a[name='${t}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return _(this.element)}get permanentElements(){return lt(this.element)}getPermanentElementById(t){return ut(this.element,t)}getPermanentElementMapForSnapshot(t){const e={};for(const r of this.permanentElements){const{id:n}=r,o=t.getPermanentElementById(n);o&&(e[n]=[r,o])}return e}}function ut(t,e){return t.querySelector(`#${e}[data-turbo-permanent]`)}function lt(t){return t.querySelectorAll("[id][data-turbo-permanent]")}class ft{started=!1;constructor(t,e){this.delegate=t,this.eventTarget=e}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=t=>{if(!t.defaultPrevented){const e=t.target instanceof HTMLFormElement?t.target:void 0,r=t.submitter||void 0;e&&function(t,e){const r=e?.getAttribute("formmethod")||t.getAttribute("method");return"dialog"!=r}(e,r)&&function(t,e){const r=e?.getAttribute("formtarget")||t.getAttribute("target");return k(r)}(e,r)&&this.delegate.willSubmitForm(e,r)&&(t.preventDefault(),t.stopImmediatePropagation(),this.delegate.formSubmitted(e,r))}}}class ht{#s=t=>{};#a=t=>{};constructor(t,e){this.delegate=t,this.element=e}scrollToAnchor(t){const e=this.snapshot.getElementForAnchor(t);e?(this.scrollToElement(e),this.focusElement(e)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(t){this.scrollToAnchor(B(t))}scrollToElement(t){t.scrollIntoView()}focusElement(t){t instanceof HTMLElement&&(t.hasAttribute("tabindex")?t.focus():(t.setAttribute("tabindex","-1"),t.focus(),t.removeAttribute("tabindex")))}scrollToPosition({x:t,y:e}){this.scrollRoot.scrollTo(t,e)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(t){const{isPreview:e,shouldRender:r,willRender:n,newSnapshot:o}=t,i=n;if(r)try{this.renderPromise=new Promise((t=>this.#s=t)),this.renderer=t,await this.prepareToRenderSnapshot(t);const r=new Promise((t=>this.#a=t)),n={resume:this.#a,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(o,n)||await r,await this.renderSnapshot(t),this.delegate.viewRenderedSnapshot(o,e,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(t)}finally{delete this.renderer,this.#s(void 0),delete this.renderPromise}else i&&this.invalidate(t.reloadReason)}invalidate(t){this.delegate.viewInvalidated(t)}async prepareToRenderSnapshot(t){this.markAsPreview(t.isPreview),await t.prepareToRender()}markAsPreview(t){t?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(t){this.element.setAttribute("data-turbo-visit-direction",t)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(t){await t.render()}finishRenderingSnapshot(t){t.finishRendering()}}class dt extends ht{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new ct(this.element)}}class pt{constructor(t,e){this.delegate=t,this.element=e}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=t=>{this.clickEventIsSignificant(t)?this.clickEvent=t:delete this.clickEvent};linkClicked=t=>{this.clickEvent&&this.clickEventIsSignificant(t)&&this.delegate.shouldInterceptLinkClick(t.target,t.detail.url,t.detail.originalEvent)&&(this.clickEvent.preventDefault(),t.preventDefault(),this.delegate.linkClickIntercepted(t.target,t.detail.url,t.detail.originalEvent)),delete this.clickEvent};willVisit=t=>{delete this.clickEvent};clickEventIsSignificant(t){const e=t.composed?t.target?.parentElement:t.target,r=x(e)||e;return r instanceof Element&&r.closest("turbo-frame, html")==this.element}}class mt{started=!1;constructor(t,e){this.delegate=t,this.eventTarget=e}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=t=>{if(t instanceof MouseEvent&&this.clickEventIsSignificant(t)){const e=x(t.composedPath&&t.composedPath()[0]||t.target);if(e&&k(e.target)){const r=L(e);this.delegate.willFollowLinkToLocation(e,r,t)&&(t.preventDefault(),this.delegate.followedLinkToLocation(e,r))}}};clickEventIsSignificant(t){return!(t.target&&t.target.isContentEditable||t.defaultPrevented||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)}}class yt{constructor(t,e){this.delegate=t,this.linkInterceptor=new mt(this,e)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(t,e){return!1}prefetchAndCacheRequestToLocation(t,e){}willFollowLinkToLocation(t,e,r){return this.delegate.willSubmitFormLinkToLocation(t,e,r)&&(t.hasAttribute("data-turbo-method")||t.hasAttribute("data-turbo-stream"))}followedLinkToLocation(t,e){const r=document.createElement("form");for(const[t,n]of e.searchParams)r.append(Object.assign(document.createElement("input"),{type:"hidden",name:t,value:n}));const n=Object.assign(e,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");const o=t.getAttribute("data-turbo-method");o&&r.setAttribute("method",o);const i=t.getAttribute("data-turbo-frame");i&&r.setAttribute("data-turbo-frame",i);const s=O(t);s&&r.setAttribute("data-turbo-action",s);const a=t.getAttribute("data-turbo-confirm");a&&r.setAttribute("data-turbo-confirm",a);t.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(t,e,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",(()=>r.remove()),{once:!0}),requestAnimationFrame((()=>r.requestSubmit()))}}class bt{static async preservingPermanentElements(t,e,r){const n=new this(t,e);n.enter(),await r(),n.leave()}constructor(t,e){this.delegate=t,this.permanentElementMap=e}enter(){for(const t in this.permanentElementMap){const[e,r]=this.permanentElementMap[t];this.delegate.enteringBardo(e,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(const t in this.permanentElementMap){const[e]=this.permanentElementMap[t];this.replaceCurrentPermanentElementWithClone(e),this.replacePlaceholderWithPermanentElement(e),this.delegate.leavingBardo(e)}}replaceNewPermanentElementWithPlaceholder(t){const e=function(t){const e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",t.id),e}(t);t.replaceWith(e)}replaceCurrentPermanentElementWithClone(t){const e=t.cloneNode(!0);t.replaceWith(e)}replacePlaceholderWithPermanentElement(t){const e=this.getPlaceholderById(t.id);e?.replaceWith(t)}getPlaceholderById(t){return this.placeholders.find((e=>e.content==t))}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}class gt{#c=null;static renderElement(t,e){}constructor(t,e,r,n=!0){this.currentSnapshot=t,this.newSnapshot=e,this.isPreview=r,this.willRender=n,this.renderElement=this.constructor.renderElement,this.promise=new Promise(((t,e)=>this.resolvingFunctions={resolve:t,reject:e}))}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(t){await bt.preservingPermanentElements(this,this.permanentElementMap,t)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){const t=this.connectedSnapshot.firstAutofocusableElement;t&&t.focus()}}enteringBardo(t){this.#c||t.contains(this.currentSnapshot.activeElement)&&(this.#c=this.currentSnapshot.activeElement)}leavingBardo(t){t.contains(this.#c)&&this.#c instanceof HTMLElement&&(this.#c.focus(),this.#c=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}}class vt extends gt{static renderElement(t,e){const r=document.createRange();r.selectNodeContents(t),r.deleteContents();const n=e,o=n.ownerDocument?.createRange();o&&(o.selectNodeContents(n),t.appendChild(o.extractContents()))}constructor(t,e,r,n,o,i=!0){super(e,r,n,o,i),this.delegate=t}get shouldRender(){return!0}async render(){await f(),this.preservingPermanentElements((()=>{this.loadFrameElement()})),this.scrollFrameIntoView(),await f(),this.focusFirstAutofocusableElement(),await f(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){const r=this.currentElement.firstElementChild,n=(t=this.currentElement.getAttribute("data-autoscroll-block"),e="end","end"==t||"start"==t||"center"==t||"nearest"==t?t:e),o=function(t,e){return"auto"==t||"smooth"==t?t:e}(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(r)return r.scrollIntoView({block:n,behavior:o}),!0}var t,e;return!1}activateScriptElements(){for(const t of this.newScriptElements){const e=c(t);t.replaceWith(e)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}var wt=function(){let t=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:u,afterNodeAdded:u,beforeNodeMorphed:u,afterNodeMorphed:u,beforeNodeRemoved:u,afterNodeRemoved:u,beforeAttributeUpdated:u},head:{style:"merge",shouldPreserve:function(t){return"true"===t.getAttribute("im-preserve")},shouldReAppend:function(t){return"true"===t.getAttribute("im-re-append")},shouldRemove:u,afterHeadMorphed:u}};function r(t,e,n){if(n.head.block){let o=t.querySelector("head"),i=e.querySelector("head");if(o&&i){let s=c(i,o,n);return void Promise.all(s).then((function(){r(t,e,Object.assign(n,{head:{block:!1,ignore:!0}}))}))}}if("innerHTML"===n.morphStyle)return i(e,t,n),t.children;if("outerHTML"===n.morphStyle||null==n.morphStyle){let r=function(t,e,r){let n;n=t.firstChild;let o=n,i=0;for(;n;){let t=m(n,e,r);t>i&&(o=n,i=t),n=n.nextSibling}return o}(e,t,n),i=r?.previousSibling,s=r?.nextSibling,a=o(t,r,n);return r?function(t,e,r){let n=[],o=[];for(;null!=t;)n.push(t),t=t.previousSibling;for(;n.length>0;){let t=n.pop();o.push(t),e.parentElement.insertBefore(t,e)}o.push(e);for(;null!=r;)n.push(r),o.push(r),r=r.nextSibling;for(;n.length>0;)e.parentElement.insertBefore(n.pop(),e.nextSibling);return o}(i,a,s):[]}throw"Do not understand how to morph style "+n.morphStyle}function n(t,e){return e.ignoreActiveValue&&t===document.activeElement&&t!==document.body}function o(t,e,r){if(!r.ignoreActive||t!==document.activeElement)return null==e?!1===r.callbacks.beforeNodeRemoved(t)?t:(t.remove(),r.callbacks.afterNodeRemoved(t),null):f(t,e)?(!1===r.callbacks.beforeNodeMorphed(t,e)||(t instanceof HTMLHeadElement&&r.head.ignore||(t instanceof HTMLHeadElement&&"morph"!==r.head.style?c(e,t,r):(!function(t,e,r){let o=t.nodeType;if(1===o){const n=t.attributes,o=e.attributes;for(const t of n)s(t.name,e,"update",r)||e.getAttribute(t.name)!==t.value&&e.setAttribute(t.name,t.value);for(let n=o.length-1;0<=n;n--){const i=o[n];s(i.name,e,"remove",r)||(t.hasAttribute(i.name)||e.removeAttribute(i.name))}}8!==o&&3!==o||e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue);n(e,r)||function(t,e,r){if(t instanceof HTMLInputElement&&e instanceof HTMLInputElement&&"file"!==t.type){let n=t.value,o=e.value;a(t,e,"checked",r),a(t,e,"disabled",r),t.hasAttribute("value")?n!==o&&(s("value",e,"update",r)||(e.setAttribute("value",n),e.value=n)):s("value",e,"remove",r)||(e.value="",e.removeAttribute("value"))}else if(t instanceof HTMLOptionElement)a(t,e,"selected",r);else if(t instanceof HTMLTextAreaElement&&e instanceof HTMLTextAreaElement){let n=t.value,o=e.value;if(s("value",e,"update",r))return;n!==o&&(e.value=n),e.firstChild&&e.firstChild.nodeValue!==n&&(e.firstChild.nodeValue=n)}}(t,e,r)}(e,t,r),n(t,r)||i(e,t,r))),r.callbacks.afterNodeMorphed(t,e)),t):!1===r.callbacks.beforeNodeRemoved(t)||!1===r.callbacks.beforeNodeAdded(e)?t:(t.parentElement.replaceChild(e,t),r.callbacks.afterNodeAdded(e),r.callbacks.afterNodeRemoved(t),e)}function i(t,e,r){let n,i=t.firstChild,s=e.firstChild;for(;i;){if(n=i,i=n.nextSibling,null==s){if(!1===r.callbacks.beforeNodeAdded(n))return;e.appendChild(n),r.callbacks.afterNodeAdded(n),v(r,n);continue}if(l(n,s,r)){o(s,n,r),s=s.nextSibling,v(r,n);continue}let a=d(t,e,n,s,r);if(a){s=h(s,a,r),o(a,n,r),v(r,n);continue}let c=p(t,e,n,s,r);if(c)s=h(s,c,r),o(c,n,r),v(r,n);else{if(!1===r.callbacks.beforeNodeAdded(n))return;e.insertBefore(n,s),r.callbacks.afterNodeAdded(n),v(r,n)}}for(;null!==s;){let t=s;s=s.nextSibling,y(t,r)}}function s(t,e,r,n){return!("value"!==t||!n.ignoreActiveValue||e!==document.activeElement)||!1===n.callbacks.beforeAttributeUpdated(t,e,r)}function a(t,e,r,n){if(t[r]!==e[r]){let o=s(r,e,"update",n);o||(e[r]=t[r]),t[r]?o||e.setAttribute(r,t[r]):s(r,e,"remove",n)||e.removeAttribute(r)}}function c(t,e,r){let n=[],o=[],i=[],s=[],a=r.head.style,c=new Map;for(const e of t.children)c.set(e.outerHTML,e);for(const t of e.children){let e=c.has(t.outerHTML),n=r.head.shouldReAppend(t),u=r.head.shouldPreserve(t);e||u?n?o.push(t):(c.delete(t.outerHTML),i.push(t)):"append"===a?n&&(o.push(t),s.push(t)):!1!==r.head.shouldRemove(t)&&o.push(t)}s.push(...c.values());let u=[];for(const t of s){let o=document.createRange().createContextualFragment(t.outerHTML).firstChild;if(!1!==r.callbacks.beforeNodeAdded(o)){if(o.href||o.src){let t=null,e=new Promise((function(e){t=e}));o.addEventListener("load",(function(){t()})),u.push(e)}e.appendChild(o),r.callbacks.afterNodeAdded(o),n.push(o)}}for(const t of o)!1!==r.callbacks.beforeNodeRemoved(t)&&(e.removeChild(t),r.callbacks.afterNodeRemoved(t));return r.head.afterHeadMorphed(e,{added:n,kept:i,removed:o}),u}function u(){}function l(t,e,r){return null!=t&&null!=e&&(t.nodeType===e.nodeType&&t.tagName===e.tagName&&(""!==t.id&&t.id===e.id||w(r,t,e)>0))}function f(t,e){return null!=t&&null!=e&&(t.nodeType===e.nodeType&&t.tagName===e.tagName)}function h(t,e,r){for(;t!==e;){let e=t;t=t.nextSibling,y(e,r)}return v(r,e),e.nextSibling}function d(t,e,r,n,o){let i=w(o,r,e);if(i>0){let e=n,s=0;for(;null!=e;){if(l(r,e,o))return e;if(s+=w(o,e,t),s>i)return null;e=e.nextSibling}}return null}function p(t,e,r,n,o){let i=n,s=r.nextSibling,a=0;for(;null!=i;){if(w(o,i,t)>0)return null;if(f(r,i))return i;if(f(s,i)&&(a++,s=s.nextSibling,a>=2))return null;i=i.nextSibling}return i}function m(t,e,r){return f(t,e)?.5+w(r,t,e):0}function y(t,e){v(e,t),!1!==e.callbacks.beforeNodeRemoved(t)&&(t.remove(),e.callbacks.afterNodeRemoved(t))}function b(t,e){return!t.deadIds.has(e)}function g(e,r,n){return(e.idMap.get(n)||t).has(r)}function v(e,r){let n=e.idMap.get(r)||t;for(const t of n)e.deadIds.add(t)}function w(e,r,n){let o=e.idMap.get(r)||t,i=0;for(const t of o)b(e,t)&&g(e,t,n)&&++i;return i}function A(t,e){let r=t.parentElement,n=t.querySelectorAll("[id]");for(const t of n){let n=t;for(;n!==r&&null!=n;){let r=e.get(n);null==r&&(r=new Set,e.set(n,r)),r.add(t.id),n=n.parentElement}}}function O(t,e){let r=new Map;return A(t,r),A(e,r),r}return{morph:function(t,n,o={}){t instanceof Document&&(t=t.documentElement),"string"==typeof n&&(n=function(t){let e=new DOMParser,r=t.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(r.match(/<\/html>/)||r.match(/<\/head>/)||r.match(/<\/body>/)){let n=e.parseFromString(t,"text/html");if(r.match(/<\/html>/))return n.generatedByIdiomorph=!0,n;{let t=n.firstChild;return t?(t.generatedByIdiomorph=!0,t):null}}{let r=e.parseFromString("","text/html").body.querySelector("template").content;return r.generatedByIdiomorph=!0,r}}(n));let i=function(t){if(null==t){return document.createElement("div")}if(t.generatedByIdiomorph)return t;if(t instanceof Node){const e=document.createElement("div");return e.append(t),e}{const e=document.createElement("div");for(const r of[...t])e.append(r);return e}}(n),s=function(t,r,n){return n=function(t){let r={};return Object.assign(r,e),Object.assign(r,t),r.callbacks={},Object.assign(r.callbacks,e.callbacks),Object.assign(r.callbacks,t.callbacks),r.head={},Object.assign(r.head,e.head),Object.assign(r.head,t.head),r}(n),{target:t,newContent:r,config:n,morphStyle:n.morphStyle,ignoreActive:n.ignoreActive,ignoreActiveValue:n.ignoreActiveValue,idMap:O(t,r),deadIds:new Set,callbacks:n.callbacks,head:n.head}}(t,i,o);return r(t,i,s)},defaults:e}}();function At(t,e,{callbacks:r,...n}={}){wt.morph(t,e,{...n,callbacks:new St(r)})}function Ot(t,e){At(t,e.children,{morphStyle:"innerHTML"})}class St{#u;constructor({beforeNodeMorphed:t}={}){this.#u=t||(()=>!0)}beforeNodeAdded=t=>!(t.id&&t.hasAttribute("data-turbo-permanent")&&document.getElementById(t.id));beforeNodeMorphed=(t,e)=>{if(t instanceof Element){if(!t.hasAttribute("data-turbo-permanent")&&this.#u(t,e)){return!u("turbo:before-morph-element",{cancelable:!0,target:t,detail:{currentElement:t,newElement:e}}).defaultPrevented}return!1}};beforeAttributeUpdated=(t,e,r)=>!u("turbo:before-morph-attribute",{cancelable:!0,target:e,detail:{attributeName:t,mutationType:r}}).defaultPrevented;beforeNodeRemoved=t=>this.beforeNodeMorphed(t);afterNodeMorphed=(t,e)=>{t instanceof Element&&u("turbo:morph-element",{target:t,detail:{currentElement:t,newElement:e}})}}class Et extends vt{static renderElement(t,e){u("turbo:before-frame-morph",{target:t,detail:{currentElement:t,newElement:e}}),Ot(t,e)}async preservingPermanentElements(t){return await t()}}class jt{static animationDuration=300;static get defaultCSS(){return m` +(self.webpackChunk=self.webpackChunk||[]).push([[303],{2891:(t,e,r)=>{"use strict";r.d(e,{lg:()=>X,xI:()=>ut});class n{constructor(t,e,r){this.eventTarget=t,this.eventName=e,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(t){this.unorderedBindings.add(t)}bindingDisconnected(t){this.unorderedBindings.delete(t)}handleEvent(t){const e=function(t){if("immediatePropagationStopped"in t)return t;{const{stopImmediatePropagation:e}=t;return Object.assign(t,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}(t);for(const t of this.bindings){if(e.immediatePropagationStopped)break;t.handleEvent(e)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort(((t,e)=>{const r=t.index,n=e.index;return rn?1:0}))}}class o{constructor(t){this.application=t,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach((t=>t.connect())))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach((t=>t.disconnect())))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((t,e)=>t.concat(Array.from(e.values()))),[])}bindingConnected(t){this.fetchEventListenerForBinding(t).bindingConnected(t)}bindingDisconnected(t,e=!1){this.fetchEventListenerForBinding(t).bindingDisconnected(t),e&&this.clearEventListenersForBinding(t)}handleError(t,e,r={}){this.application.handleError(t,`Error ${e}`,r)}clearEventListenersForBinding(t){const e=this.fetchEventListenerForBinding(t);e.hasBindings()||(e.disconnect(),this.removeMappedEventListenerFor(t))}removeMappedEventListenerFor(t){const{eventTarget:e,eventName:r,eventOptions:n}=t,o=this.fetchEventListenerMapForEventTarget(e),i=this.cacheKey(r,n);o.delete(i),0==o.size&&this.eventListenerMaps.delete(e)}fetchEventListenerForBinding(t){const{eventTarget:e,eventName:r,eventOptions:n}=t;return this.fetchEventListener(e,r,n)}fetchEventListener(t,e,r){const n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(e,r);let i=n.get(o);return i||(i=this.createEventListener(t,e,r),n.set(o,i)),i}createEventListener(t,e,r){const o=new n(t,e,r);return this.started&&o.connect(),o}fetchEventListenerMapForEventTarget(t){let e=this.eventListenerMaps.get(t);return e||(e=new Map,this.eventListenerMaps.set(t,e)),e}cacheKey(t,e){const r=[t];return Object.keys(e).sort().forEach((t=>{r.push(`${e[t]?"":"!"}${t}`)})),r.join(":")}}const i={stop:({event:t,value:e})=>(e&&t.stopPropagation(),!0),prevent:({event:t,value:e})=>(e&&t.preventDefault(),!0),self:({event:t,value:e,element:r})=>!e||r===t.target},s=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function a(t){return"window"==t?window:"document"==t?document:void 0}function c(t){return t.replace(/(?:[_-])([a-z0-9])/g,((t,e)=>e.toUpperCase()))}function u(t){return c(t.replace(/--/g,"-").replace(/__/g,"_"))}function l(t){return t.charAt(0).toUpperCase()+t.slice(1)}function f(t){return t.replace(/([A-Z])/g,((t,e)=>`-${e.toLowerCase()}`))}function h(t){return null!=t}function d(t,e){return Object.prototype.hasOwnProperty.call(t,e)}const p=["meta","ctrl","alt","shift"];class m{constructor(t,e,r,n){this.element=t,this.index=e,this.eventTarget=r.eventTarget||t,this.eventName=r.eventName||function(t){const e=t.tagName.toLowerCase();if(e in y)return y[e](t)}(t)||b("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||b("missing identifier"),this.methodName=r.methodName||b("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=n}static forToken(t,e){return new this(t.element,t.index,function(t){const e=t.trim().match(s)||[];let r=e[2],n=e[3];return n&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${n}`,n=""),{eventTarget:a(e[4]),eventName:r,eventOptions:e[7]?(o=e[7],o.split(":").reduce(((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)})),{})):{},identifier:e[5],methodName:e[6],keyFilter:e[1]||n};var o}(t.content),e)}toString(){const t=this.keyFilter?`.${this.keyFilter}`:"",e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${t}${e}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(t){if(!this.keyFilter)return!1;const e=this.keyFilter.split("+");if(this.keyFilterDissatisfied(t,e))return!0;const r=e.filter((t=>!p.includes(t)))[0];return!!r&&(d(this.keyMappings,r)||b(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[r].toLowerCase()!==t.key.toLowerCase())}shouldIgnoreMouseEvent(t){if(!this.keyFilter)return!1;const e=[this.keyFilter];return!!this.keyFilterDissatisfied(t,e)}get params(){const t={},e=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:r,value:n}of Array.from(this.element.attributes)){const o=r.match(e),i=o&&o[1];i&&(t[c(i)]=g(n))}return t}get eventTargetName(){return(t=this.eventTarget)==window?"window":t==document?"document":void 0;var t}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(t,e){const[r,n,o,i]=p.map((t=>e.includes(t)));return t.metaKey!==r||t.ctrlKey!==n||t.altKey!==o||t.shiftKey!==i}}const y={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:t=>"submit"==t.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function b(t){throw new Error(t)}function g(t){try{return JSON.parse(t)}catch(e){return t}}class v{constructor(t,e){this.context=t,this.action=e}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(t){const e=this.prepareActionEvent(t);this.willBeInvokedByEvent(t)&&this.applyEventModifiers(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){const t=this.controller[this.methodName];if("function"==typeof t)return t;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(t){const{element:e}=this.action,{actionDescriptorFilters:r}=this.context.application,{controller:n}=this.context;let o=!0;for(const[i,s]of Object.entries(this.eventOptions))if(i in r){const a=r[i];o=o&&a({name:i,value:s,event:t,element:e,controller:n})}return o}prepareActionEvent(t){return Object.assign(t,{params:this.action.params})}invokeWithEvent(t){const{target:e,currentTarget:r}=t;try{this.method.call(this.controller,t),this.context.logDebugActivity(this.methodName,{event:t,target:e,currentTarget:r,action:this.methodName})}catch(e){const{identifier:r,controller:n,element:o,index:i}=this,s={identifier:r,controller:n,element:o,index:i,event:t};this.context.handleError(e,`invoking action "${this.action}"`,s)}}willBeInvokedByEvent(t){const e=t.target;return!(t instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(t))&&(!(t instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(t))&&(this.element===e||(e instanceof Element&&this.element.contains(e)?this.scope.containsElement(e):this.scope.containsElement(this.action.element))))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class w{constructor(t,e){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver((t=>this.processMutations(t)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(t){this.started&&(this.mutationObserver.disconnect(),this.started=!1),t(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const t=new Set(this.matchElementsInTree());for(const e of Array.from(this.elements))t.has(e)||this.removeElement(e);for(const e of Array.from(t))this.addElement(e)}}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){"attributes"==t.type?this.processAttributeChange(t.target,t.attributeName):"childList"==t.type&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))}processAttributeChange(t,e){this.elements.has(t)?this.delegate.elementAttributeChanged&&this.matchElement(t)?this.delegate.elementAttributeChanged(t,e):this.removeElement(t):this.matchElement(t)&&this.addElement(t)}processRemovedNodes(t){for(const e of Array.from(t)){const t=this.elementFromNode(e);t&&this.processTree(t,this.removeElement)}}processAddedNodes(t){for(const e of Array.from(t)){const t=this.elementFromNode(e);t&&this.elementIsActive(t)&&this.processTree(t,this.addElement)}}matchElement(t){return this.delegate.matchElement(t)}matchElementsInTree(t=this.element){return this.delegate.matchElementsInTree(t)}processTree(t,e){for(const r of this.matchElementsInTree(t))e.call(this,r)}elementFromNode(t){if(t.nodeType==Node.ELEMENT_NODE)return t}elementIsActive(t){return t.isConnected==this.element.isConnected&&this.element.contains(t)}addElement(t){this.elements.has(t)||this.elementIsActive(t)&&(this.elements.add(t),this.delegate.elementMatched&&this.delegate.elementMatched(t))}removeElement(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(t))}}class A{constructor(t,e,r){this.attributeName=e,this.delegate=r,this.elementObserver=new w(t,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(t){return t.hasAttribute(this.attributeName)}matchElementsInTree(t){const e=this.matchElement(t)?[t]:[],r=Array.from(t.querySelectorAll(this.selector));return e.concat(r)}elementMatched(t){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(t,this.attributeName)}elementUnmatched(t){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(t,this.attributeName)}elementAttributeChanged(t,e){this.delegate.elementAttributeValueChanged&&this.attributeName==e&&this.delegate.elementAttributeValueChanged(t,e)}}function O(t,e,r){E(t,e).add(r)}function S(t,e,r){E(t,e).delete(r),function(t,e){const r=t.get(e);null!=r&&0==r.size&&t.delete(e)}(t,e)}function E(t,e){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r}class j{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce(((t,e)=>t.concat(Array.from(e))),[])}get size(){return Array.from(this.valuesByKey.values()).reduce(((t,e)=>t+e.size),0)}add(t,e){O(this.valuesByKey,t,e)}delete(t,e){S(this.valuesByKey,t,e)}has(t,e){const r=this.valuesByKey.get(t);return null!=r&&r.has(e)}hasKey(t){return this.valuesByKey.has(t)}hasValue(t){return Array.from(this.valuesByKey.values()).some((e=>e.has(t)))}getValuesForKey(t){const e=this.valuesByKey.get(t);return e?Array.from(e):[]}getKeysForValue(t){return Array.from(this.valuesByKey).filter((([e,r])=>r.has(t))).map((([t,e])=>t))}}class P{constructor(t,e,r,n){this._selector=e,this.details=n,this.elementObserver=new w(t,this),this.delegate=r,this.matchesByElement=new j}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(t){this._selector=t,this.refresh()}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(t){const{selector:e}=this;if(e){const r=t.matches(e);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(t,this.details):r}return!1}matchElementsInTree(t){const{selector:e}=this;if(e){const r=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(e)).filter((t=>this.matchElement(t)));return r.concat(n)}return[]}elementMatched(t){const{selector:e}=this;e&&this.selectorMatched(t,e)}elementUnmatched(t){const e=this.matchesByElement.getKeysForValue(t);for(const r of e)this.selectorUnmatched(t,r)}elementAttributeChanged(t,e){const{selector:r}=this;if(r){const e=this.matchElement(t),n=this.matchesByElement.has(r,t);e&&!n?this.selectorMatched(t,r):!e&&n&&this.selectorUnmatched(t,r)}}selectorMatched(t,e){this.delegate.selectorMatched(t,e,this.details),this.matchesByElement.add(e,t)}selectorUnmatched(t,e){this.delegate.selectorUnmatched(t,e,this.details),this.matchesByElement.delete(e,t)}}class T{constructor(t,e){this.element=t,this.delegate=e,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((t=>this.processMutations(t)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const t of this.knownAttributeNames)this.refreshAttribute(t,null)}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){const e=t.attributeName;e&&this.refreshAttribute(e,t.oldValue)}refreshAttribute(t,e){const r=this.delegate.getStringMapKeyForAttribute(t);if(null!=r){this.stringMap.has(t)||this.stringMapKeyAdded(r,t);const n=this.element.getAttribute(t);if(this.stringMap.get(t)!=n&&this.stringMapValueChanged(n,r,e),null==n){const e=this.stringMap.get(t);this.stringMap.delete(t),e&&this.stringMapKeyRemoved(r,t,e)}else this.stringMap.set(t,n)}}stringMapKeyAdded(t,e){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(t,e)}stringMapValueChanged(t,e,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(t,e,r)}stringMapKeyRemoved(t,e,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(t,e,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((t=>t.name))}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class _{constructor(t,e,r){this.attributeObserver=new A(t,e,this),this.delegate=r,this.tokensByElement=new j}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(t){this.attributeObserver.pause(t)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(t){this.tokensMatched(this.readTokensForElement(t))}elementAttributeValueChanged(t){const[e,r]=this.refreshTokensForElement(t);this.tokensUnmatched(e),this.tokensMatched(r)}elementUnmatchedAttribute(t){this.tokensUnmatched(this.tokensByElement.getValuesForKey(t))}tokensMatched(t){t.forEach((t=>this.tokenMatched(t)))}tokensUnmatched(t){t.forEach((t=>this.tokenUnmatched(t)))}tokenMatched(t){this.delegate.tokenMatched(t),this.tokensByElement.add(t.element,t)}tokenUnmatched(t){this.delegate.tokenUnmatched(t),this.tokensByElement.delete(t.element,t)}refreshTokensForElement(t){const e=this.tokensByElement.getValuesForKey(t),r=this.readTokensForElement(t),n=function(t,e){const r=Math.max(t.length,e.length);return Array.from({length:r},((r,n)=>[t[n],e[n]]))}(e,r).findIndex((([t,e])=>{return n=e,!((r=t)&&n&&r.index==n.index&&r.content==n.content);var r,n}));return-1==n?[[],[]]:[e.slice(n),r.slice(n)]}readTokensForElement(t){const e=this.attributeName;return function(t,e,r){return t.trim().split(/\s+/).filter((t=>t.length)).map(((t,n)=>({element:e,attributeName:r,content:t,index:n})))}(t.getAttribute(e)||"",t,e)}}class k{constructor(t,e,r){this.tokenListObserver=new _(t,e,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(t){const{element:e}=t,{value:r}=this.fetchParseResultForToken(t);r&&(this.fetchValuesByTokenForElement(e).set(t,r),this.delegate.elementMatchedValue(e,r))}tokenUnmatched(t){const{element:e}=t,{value:r}=this.fetchParseResultForToken(t);r&&(this.fetchValuesByTokenForElement(e).delete(t),this.delegate.elementUnmatchedValue(e,r))}fetchParseResultForToken(t){let e=this.parseResultsByToken.get(t);return e||(e=this.parseToken(t),this.parseResultsByToken.set(t,e)),e}fetchValuesByTokenForElement(t){let e=this.valuesByTokenByElement.get(t);return e||(e=new Map,this.valuesByTokenByElement.set(t,e)),e}parseToken(t){try{return{value:this.delegate.parseValueForToken(t)}}catch(t){return{error:t}}}}class x{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new k(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(t){const e=new v(this.context,t);this.bindingsByAction.set(t,e),this.delegate.bindingConnected(e)}disconnectAction(t){const e=this.bindingsByAction.get(t);e&&(this.bindingsByAction.delete(t),this.delegate.bindingDisconnected(e))}disconnectAllActions(){this.bindings.forEach((t=>this.delegate.bindingDisconnected(t,!0))),this.bindingsByAction.clear()}parseValueForToken(t){const e=m.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}}class L{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new T(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(t){if(t in this.valueDescriptorMap)return this.valueDescriptorMap[t].name}stringMapKeyAdded(t,e){const r=this.valueDescriptorMap[e];this.hasValue(t)||this.invokeChangedCallback(t,r.writer(this.receiver[t]),r.writer(r.defaultValue))}stringMapValueChanged(t,e,r){const n=this.valueDescriptorNameMap[e];null!==t&&(null===r&&(r=n.writer(n.defaultValue)),this.invokeChangedCallback(e,t,r))}stringMapKeyRemoved(t,e,r){const n=this.valueDescriptorNameMap[t];this.hasValue(t)?this.invokeChangedCallback(t,n.writer(this.receiver[t]),r):this.invokeChangedCallback(t,n.writer(n.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(const{key:t,name:e,defaultValue:r,writer:n}of this.valueDescriptors)null==r||this.controller.data.has(t)||this.invokeChangedCallback(e,n(r),void 0)}invokeChangedCallback(t,e,r){const n=`${t}Changed`,o=this.receiver[n];if("function"==typeof o){const n=this.valueDescriptorNameMap[t];try{const t=n.reader(e);let i=r;r&&(i=n.reader(r)),o.call(this.receiver,t,i)}catch(t){throw t instanceof TypeError&&(t.message=`Stimulus Value "${this.context.identifier}.${n.name}" - ${t.message}`),t}}}get valueDescriptors(){const{valueDescriptorMap:t}=this;return Object.keys(t).map((e=>t[e]))}get valueDescriptorNameMap(){const t={};return Object.keys(this.valueDescriptorMap).forEach((e=>{const r=this.valueDescriptorMap[e];t[r.name]=r})),t}hasValue(t){const e=`has${l(this.valueDescriptorNameMap[t].name)}`;return this.receiver[e]}}class R{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new j}start(){this.tokenListObserver||(this.tokenListObserver=new _(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:t,content:e}){this.scope.containsElement(t)&&this.connectTarget(t,e)}tokenUnmatched({element:t,content:e}){this.disconnectTarget(t,e)}connectTarget(t,e){var r;this.targetsByName.has(e,t)||(this.targetsByName.add(e,t),null===(r=this.tokenListObserver)||void 0===r||r.pause((()=>this.delegate.targetConnected(t,e))))}disconnectTarget(t,e){var r;this.targetsByName.has(e,t)&&(this.targetsByName.delete(e,t),null===(r=this.tokenListObserver)||void 0===r||r.pause((()=>this.delegate.targetDisconnected(t,e))))}disconnectAllTargets(){for(const t of this.targetsByName.keys)for(const e of this.targetsByName.getValuesForKey(t))this.disconnectTarget(e,t)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function N(t,e){const r=M(t);return Array.from(r.reduce(((t,r)=>(function(t,e){const r=t[e];return Array.isArray(r)?r:[]}(r,e).forEach((e=>t.add(e))),t)),new Set))}function C(t,e){return M(t).reduce(((t,r)=>(t.push(...function(t,e){const r=t[e];return r?Object.keys(r).map((t=>[t,r[t]])):[]}(r,e)),t)),[])}function M(t){const e=[];for(;t;)e.push(t),t=Object.getPrototypeOf(t);return e.reverse()}class B{constructor(t,e){this.started=!1,this.context=t,this.delegate=e,this.outletsByName=new j,this.outletElementsByName=new j,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach((t=>{this.setupSelectorObserverForOutlet(t),this.setupAttributeObserverForOutlet(t)})),this.started=!0,this.dependentContexts.forEach((t=>t.refresh())))}refresh(){this.selectorObserverMap.forEach((t=>t.refresh())),this.attributeObserverMap.forEach((t=>t.refresh()))}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach((t=>t.stop())),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach((t=>t.stop())),this.attributeObserverMap.clear())}selectorMatched(t,e,{outletName:r}){const n=this.getOutlet(t,r);n&&this.connectOutlet(n,t,r)}selectorUnmatched(t,e,{outletName:r}){const n=this.getOutletFromMap(t,r);n&&this.disconnectOutlet(n,t,r)}selectorMatchElement(t,{outletName:e}){const r=this.selector(e),n=this.hasOutlet(t,e),o=t.matches(`[${this.schema.controllerAttribute}~=${e}]`);return!!r&&(n&&o&&t.matches(r))}elementMatchedAttribute(t,e){const r=this.getOutletNameFromOutletAttributeName(e);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(t,e){const r=this.getOutletNameFromOutletAttributeName(e);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(t,e){const r=this.getOutletNameFromOutletAttributeName(e);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(t,e,r){var n;this.outletElementsByName.has(r,e)||(this.outletsByName.add(r,t),this.outletElementsByName.add(r,e),null===(n=this.selectorObserverMap.get(r))||void 0===n||n.pause((()=>this.delegate.outletConnected(t,e,r))))}disconnectOutlet(t,e,r){var n;this.outletElementsByName.has(r,e)&&(this.outletsByName.delete(r,t),this.outletElementsByName.delete(r,e),null===(n=this.selectorObserverMap.get(r))||void 0===n||n.pause((()=>this.delegate.outletDisconnected(t,e,r))))}disconnectAllOutlets(){for(const t of this.outletElementsByName.keys)for(const e of this.outletElementsByName.getValuesForKey(t))for(const r of this.outletsByName.getValuesForKey(t))this.disconnectOutlet(r,e,t)}updateSelectorObserverForOutlet(t){const e=this.selectorObserverMap.get(t);e&&(e.selector=this.selector(t))}setupSelectorObserverForOutlet(t){const e=this.selector(t),r=new P(document.body,e,this,{outletName:t});this.selectorObserverMap.set(t,r),r.start()}setupAttributeObserverForOutlet(t){const e=this.attributeNameForOutletName(t),r=new A(this.scope.element,e,this);this.attributeObserverMap.set(t,r),r.start()}selector(t){return this.scope.outlets.getSelectorForOutletName(t)}attributeNameForOutletName(t){return this.scope.schema.outletAttributeForScope(this.identifier,t)}getOutletNameFromOutletAttributeName(t){return this.outletDefinitions.find((e=>this.attributeNameForOutletName(e)===t))}get outletDependencies(){const t=new j;return this.router.modules.forEach((e=>{N(e.definition.controllerConstructor,"outlets").forEach((r=>t.add(r,e.identifier)))})),t}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const t=this.dependentControllerIdentifiers;return this.router.contexts.filter((e=>t.includes(e.identifier)))}hasOutlet(t,e){return!!this.getOutlet(t,e)||!!this.getOutletFromMap(t,e)}getOutlet(t,e){return this.application.getControllerForElementAndIdentifier(t,e)}getOutletFromMap(t,e){return this.outletsByName.getValuesForKey(e).find((e=>e.element===t))}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class I{constructor(t,e){this.logDebugActivity=(t,e={})=>{const{identifier:r,controller:n,element:o}=this;e=Object.assign({identifier:r,controller:n,element:o},e),this.application.logDebugActivity(this.identifier,t,e)},this.module=t,this.scope=e,this.controller=new t.controllerConstructor(this),this.bindingObserver=new x(this,this.dispatcher),this.valueObserver=new L(this,this.controller),this.targetObserver=new R(this,this),this.outletObserver=new B(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(t){this.handleError(t,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(t){this.handleError(t,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(t){this.handleError(t,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(t,e,r={}){const{identifier:n,controller:o,element:i}=this;r=Object.assign({identifier:n,controller:o,element:i},r),this.application.handleError(t,`Error ${e}`,r)}targetConnected(t,e){this.invokeControllerMethod(`${e}TargetConnected`,t)}targetDisconnected(t,e){this.invokeControllerMethod(`${e}TargetDisconnected`,t)}outletConnected(t,e,r){this.invokeControllerMethod(`${u(r)}OutletConnected`,t,e)}outletDisconnected(t,e,r){this.invokeControllerMethod(`${u(r)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){const r=this.controller;"function"==typeof r[t]&&r[t](...e)}}function F(t){return function(t,e){const r=q(t),n=function(t,e){return D(e).reduce(((r,n)=>{const o=function(t,e,r){const n=Object.getOwnPropertyDescriptor(t,r);if(!n||!("value"in n)){const t=Object.getOwnPropertyDescriptor(e,r).value;return n&&(t.get=n.get||t.get,t.set=n.set||t.set),t}}(t,e,n);return o&&Object.assign(r,{[n]:o}),r}),{})}(t.prototype,e);return Object.defineProperties(r.prototype,n),r}(t,function(t){const e=N(t,"blessings");return e.reduce(((e,r)=>{const n=r(t);for(const t in n){const r=e[t]||{};e[t]=Object.assign(r,n[t])}return e}),{})}(t))}const D="function"==typeof Object.getOwnPropertySymbols?t=>[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)]:Object.getOwnPropertyNames,q=(()=>{function t(t){function e(){return Reflect.construct(t,arguments,new.target)}return e.prototype=Object.create(t.prototype,{constructor:{value:e}}),Reflect.setPrototypeOf(e,t),e}try{return function(){const e=t((function(){this.a.call(this)}));e.prototype.a=function(){},new e}(),t}catch(t){return t=>class extends t{}}})();class V{constructor(t,e){this.application=t,this.definition=function(t){return{identifier:t.identifier,controllerConstructor:F(t.controllerConstructor)}}(e),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(t){const e=this.fetchContextForScope(t);this.connectedContexts.add(e),e.connect()}disconnectContextForScope(t){const e=this.contextsByScope.get(t);e&&(this.connectedContexts.delete(e),e.disconnect())}fetchContextForScope(t){let e=this.contextsByScope.get(t);return e||(e=new I(this,t),this.contextsByScope.set(t,e)),e}}class U{constructor(t){this.scope=t}has(t){return this.data.has(this.getDataKey(t))}get(t){return this.getAll(t)[0]}getAll(t){const e=this.data.get(this.getDataKey(t))||"";return e.match(/[^\s]+/g)||[]}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}}class H{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(t){const e=this.getAttributeNameForKey(t);return this.element.getAttribute(e)}set(t,e){const r=this.getAttributeNameForKey(t);return this.element.setAttribute(r,e),this.get(t)}has(t){const e=this.getAttributeNameForKey(t);return this.element.hasAttribute(e)}delete(t){if(this.has(t)){const e=this.getAttributeNameForKey(t);return this.element.removeAttribute(e),!0}return!1}getAttributeNameForKey(t){return`data-${this.identifier}-${f(t)}`}}class z{constructor(t){this.warnedKeysByObject=new WeakMap,this.logger=t}warn(t,e,r){let n=this.warnedKeysByObject.get(t);n||(n=new Set,this.warnedKeysByObject.set(t,n)),n.has(e)||(n.add(e),this.logger.warn(r,t))}}function W(t,e){return`[${t}~="${e}"]`}class ${constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return null!=this.find(t)}find(...t){return t.reduce(((t,e)=>t||this.findTarget(e)||this.findLegacyTarget(e)),void 0)}findAll(...t){return t.reduce(((t,e)=>[...t,...this.findAllTargets(e),...this.findAllLegacyTargets(e)]),[])}findTarget(t){const e=this.getSelectorForTargetName(t);return this.scope.findElement(e)}findAllTargets(t){const e=this.getSelectorForTargetName(t);return this.scope.findAllElements(e)}getSelectorForTargetName(t){return W(this.schema.targetAttributeForScope(this.identifier),t)}findLegacyTarget(t){const e=this.getLegacySelectorForTargetName(t);return this.deprecate(this.scope.findElement(e),t)}findAllLegacyTargets(t){const e=this.getLegacySelectorForTargetName(t);return this.scope.findAllElements(e).map((e=>this.deprecate(e,t)))}getLegacySelectorForTargetName(t){const e=`${this.identifier}.${t}`;return W(this.schema.targetAttribute,e)}deprecate(t,e){if(t){const{identifier:r}=this,n=this.schema.targetAttribute,o=this.schema.targetAttributeForScope(r);this.guide.warn(t,`target:${e}`,`Please replace ${n}="${r}.${e}" with ${o}="${e}". The ${n} attribute is deprecated and will be removed in a future version of Stimulus.`)}return t}get guide(){return this.scope.guide}}class K{constructor(t,e){this.scope=t,this.controllerElement=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return null!=this.find(t)}find(...t){return t.reduce(((t,e)=>t||this.findOutlet(e)),void 0)}findAll(...t){return t.reduce(((t,e)=>[...t,...this.findAllOutlets(e)]),[])}getSelectorForOutletName(t){const e=this.schema.outletAttributeForScope(this.identifier,t);return this.controllerElement.getAttribute(e)}findOutlet(t){const e=this.getSelectorForOutletName(t);if(e)return this.findElement(e,t)}findAllOutlets(t){const e=this.getSelectorForOutletName(t);return e?this.findAllElements(e,t):[]}findElement(t,e){return this.scope.queryElements(t).filter((r=>this.matchesElement(r,t,e)))[0]}findAllElements(t,e){return this.scope.queryElements(t).filter((r=>this.matchesElement(r,t,e)))}matchesElement(t,e,r){const n=t.getAttribute(this.scope.schema.controllerAttribute)||"";return t.matches(e)&&n.split(" ").includes(r)}}class Y{constructor(t,e,r,n){this.targets=new $(this),this.classes=new U(this),this.data=new H(this),this.containsElement=t=>t.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=r,this.guide=new z(n),this.outlets=new K(this.documentScope,e)}findElement(t){return this.element.matches(t)?this.element:this.queryElements(t).find(this.containsElement)}findAllElements(t){return[...this.element.matches(t)?[this.element]:[],...this.queryElements(t).filter(this.containsElement)]}queryElements(t){return Array.from(this.element.querySelectorAll(t))}get controllerSelector(){return W(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new Y(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class G{constructor(t,e,r){this.element=t,this.schema=e,this.delegate=r,this.valueListObserver=new k(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(t){const{element:e,content:r}=t;return this.parseValueForElementAndIdentifier(e,r)}parseValueForElementAndIdentifier(t,e){const r=this.fetchScopesByIdentifierForElement(t);let n=r.get(e);return n||(n=this.delegate.createScopeForElementAndIdentifier(t,e),r.set(e,n)),n}elementMatchedValue(t,e){const r=(this.scopeReferenceCounts.get(e)||0)+1;this.scopeReferenceCounts.set(e,r),1==r&&this.delegate.scopeConnected(e)}elementUnmatchedValue(t,e){const r=this.scopeReferenceCounts.get(e);r&&(this.scopeReferenceCounts.set(e,r-1),1==r&&this.delegate.scopeDisconnected(e))}fetchScopesByIdentifierForElement(t){let e=this.scopesByIdentifierByElement.get(t);return e||(e=new Map,this.scopesByIdentifierByElement.set(t,e)),e}}class J{constructor(t){this.application=t,this.scopeObserver=new G(this.element,this.schema,this),this.scopesByIdentifier=new j,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce(((t,e)=>t.concat(e.contexts)),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(t){this.unloadIdentifier(t.identifier);const e=new V(this.application,t);this.connectModule(e);const r=t.controllerConstructor.afterLoad;r&&r.call(t.controllerConstructor,t.identifier,this.application)}unloadIdentifier(t){const e=this.modulesByIdentifier.get(t);e&&this.disconnectModule(e)}getContextForElementAndIdentifier(t,e){const r=this.modulesByIdentifier.get(e);if(r)return r.contexts.find((e=>e.element==t))}proposeToConnectScopeForElementAndIdentifier(t,e){const r=this.scopeObserver.parseValueForElementAndIdentifier(t,e);r&&this.scopeObserver.elementMatchedValue(r.element,r)}handleError(t,e,r){this.application.handleError(t,e,r)}createScopeForElementAndIdentifier(t,e){return new Y(this.schema,t,e,this.logger)}scopeConnected(t){this.scopesByIdentifier.add(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.connectContextForScope(t)}scopeDisconnected(t){this.scopesByIdentifier.delete(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.disconnectContextForScope(t)}connectModule(t){this.modulesByIdentifier.set(t.identifier,t);this.scopesByIdentifier.getValuesForKey(t.identifier).forEach((e=>t.connectContextForScope(e)))}disconnectModule(t){this.modulesByIdentifier.delete(t.identifier);this.scopesByIdentifier.getValuesForKey(t.identifier).forEach((e=>t.disconnectContextForScope(e)))}}const Q={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:t=>`data-${t}-target`,outletAttributeForScope:(t,e)=>`data-${t}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},Z("abcdefghijklmnopqrstuvwxyz".split("").map((t=>[t,t])))),Z("0123456789".split("").map((t=>[t,t]))))};function Z(t){return t.reduce(((t,[e,r])=>Object.assign(Object.assign({},t),{[e]:r})),{})}class X{constructor(t=document.documentElement,e=Q){this.logger=console,this.debug=!1,this.logDebugActivity=(t,e,r={})=>{this.debug&&this.logFormattedMessage(t,e,r)},this.element=t,this.schema=e,this.dispatcher=new o(this),this.router=new J(this),this.actionDescriptorFilters=Object.assign({},i)}static start(t,e){const r=new this(t,e);return r.start(),r}async start(){await new Promise((t=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",(()=>t())):t()})),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(t,e){this.load({identifier:t,controllerConstructor:e})}registerActionOption(t,e){this.actionDescriptorFilters[t]=e}load(t,...e){(Array.isArray(t)?t:[t,...e]).forEach((t=>{t.controllerConstructor.shouldLoad&&this.router.loadDefinition(t)}))}unload(t,...e){(Array.isArray(t)?t:[t,...e]).forEach((t=>this.router.unloadIdentifier(t)))}get controllers(){return this.router.contexts.map((t=>t.controller))}getControllerForElementAndIdentifier(t,e){const r=this.router.getContextForElementAndIdentifier(t,e);return r?r.controller:null}handleError(t,e,r){var n;this.logger.error("%s\n\n%o\n\n%o",e,t,r),null===(n=window.onerror)||void 0===n||n.call(window,e,"",0,0,t)}logFormattedMessage(t,e,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${t} #${e}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}}function tt(t,e,r){return t.application.getControllerForElementAndIdentifier(e,r)}function et(t,e,r){let n=tt(t,e,r);return n||(t.application.router.proposeToConnectScopeForElementAndIdentifier(e,r),n=tt(t,e,r),n||void 0)}function rt([t,e],r){return function(t){const{token:e,typeDefinition:r}=t,n=`${f(e)}-value`,o=function(t){const{controller:e,token:r,typeDefinition:n}=t,o={controller:e,token:r,typeObject:n},i=function(t){const{controller:e,token:r,typeObject:n}=t,o=h(n.type),i=h(n.default),s=o&&i,a=o&&!i,c=!o&&i,u=nt(n.type),l=ot(t.typeObject.default);if(a)return u;if(c)return l;if(u!==l){throw new Error(`The specified default value for the Stimulus Value "${e?`${e}.${r}`:r}" must match the defined type "${u}". The provided default value of "${n.default}" is of type "${l}".`)}if(s)return u}(o),s=ot(n),a=nt(n),c=i||s||a;if(c)return c;const u=e?`${e}.${n}`:r;throw new Error(`Unknown value type "${u}" for "${r}" value`)}(t);return{type:o,key:n,name:c(n),get defaultValue(){return function(t){const e=nt(t);if(e)return it[e];const r=d(t,"default"),n=d(t,"type"),o=t;if(r)return o.default;if(n){const{type:t}=o,e=nt(t);if(e)return it[e]}return t}(r)},get hasCustomDefaultValue(){return void 0!==ot(r)},reader:st[o],writer:at[o]||at.default}}({controller:r,token:t,typeDefinition:e})}function nt(t){switch(t){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function ot(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(t)?"array":"[object Object]"===Object.prototype.toString.call(t)?"object":void 0}const it={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},st={array(t){const e=JSON.parse(t);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${t}" of type "${ot(e)}"`);return e},boolean:t=>!("0"==t||"false"==String(t).toLowerCase()),number:t=>Number(t.replace(/_/g,"")),object(t){const e=JSON.parse(t);if(null===e||"object"!=typeof e||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${t}" of type "${ot(e)}"`);return e},string:t=>t},at={default:function(t){return`${t}`},array:ct,object:ct};function ct(t){return JSON.stringify(t)}class ut{constructor(t){this.context=t}static get shouldLoad(){return!0}static afterLoad(t,e){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:r={},prefix:n=this.identifier,bubbles:o=!0,cancelable:i=!0}={}){const s=new CustomEvent(n?`${n}:${t}`:t,{detail:r,bubbles:o,cancelable:i});return e.dispatchEvent(s),s}}ut.blessings=[function(t){return N(t,"classes").reduce(((t,e)=>{return Object.assign(t,(r=e,{[`${r}Class`]:{get(){const{classes:t}=this;if(t.has(r))return t.get(r);{const e=t.getAttributeName(r);throw new Error(`Missing attribute "${e}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${l(r)}Class`]:{get(){return this.classes.has(r)}}}));var r}),{})},function(t){return N(t,"targets").reduce(((t,e)=>{return Object.assign(t,(r=e,{[`${r}Target`]:{get(){const t=this.targets.find(r);if(t)return t;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${l(r)}Target`]:{get(){return this.targets.has(r)}}}));var r}),{})},function(t){const e=C(t,"values"),r={valueDescriptorMap:{get(){return e.reduce(((t,e)=>{const r=rt(e,this.identifier),n=this.data.getAttributeNameForKey(r.key);return Object.assign(t,{[n]:r})}),{})}}};return e.reduce(((t,e)=>Object.assign(t,function(t,e){const r=rt(t,e),{key:n,name:o,reader:i,writer:s}=r;return{[o]:{get(){const t=this.data.get(n);return null!==t?i(t):r.defaultValue},set(t){void 0===t?this.data.delete(n):this.data.set(n,s(t))}},[`has${l(o)}`]:{get(){return this.data.has(n)||r.hasCustomDefaultValue}}}}(e))),r)},function(t){return N(t,"outlets").reduce(((t,e)=>Object.assign(t,function(t){const e=u(t);return{[`${e}Outlet`]:{get(){const e=this.outlets.find(t),r=this.outlets.getSelectorForOutletName(t);if(e){const r=et(this,e,t);if(r)return r;throw new Error(`The provided outlet element is missing an outlet controller "${t}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${t}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}Outlets`]:{get(){const e=this.outlets.findAll(t);return e.length>0?e.map((e=>{const r=et(this,e,t);if(r)return r})).filter((t=>t)):[]}},[`${e}OutletElement`]:{get(){const e=this.outlets.find(t),r=this.outlets.getSelectorForOutletName(t);if(e)return e;throw new Error(`Missing outlet element "${t}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(t)}},[`has${l(e)}Outlet`]:{get(){return this.outlets.has(t)}}}}(e))),{})}],ut.targets=[],ut.outlets=[],ut.values={}},89:(t,e,r)=>{"use strict";r.r(e),r.d(e,{FetchEnctype:()=>J,FetchMethod:()=>Y,FetchRequest:()=>Q,FetchResponse:()=>U,FrameElement:()=>s,FrameLoadingStyle:()=>i,FrameRenderer:()=>gt,PageRenderer:()=>de,PageSnapshot:()=>_t,StreamActions:()=>De,StreamElement:()=>qe,StreamSourceElement:()=>Ve,cache:()=>Se,clearCache:()=>Le,config:()=>N,connectStreamSource:()=>_e,disconnectStreamSource:()=>ke,fetch:()=>$,fetchEnctypeFromString:()=>G,fetchMethodFromString:()=>K,isSafe:()=>Z,navigator:()=>Ee,registerAdapter:()=>Pe,renderStreamMessage:()=>xe,session:()=>Oe,setConfirmMethod:()=>Ne,setFormMode:()=>Ce,setProgressBarDelay:()=>Re,start:()=>je,visit:()=>Te}),function(t){function e(t,e,r){throw new t("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+e+".",r)}"function"!=typeof t.requestSubmit&&(t.requestSubmit=function(t){t?(!function(t,r){t instanceof HTMLElement||e(TypeError,"parameter 1 is not of type 'HTMLElement'"),"submit"==t.type||e(TypeError,"The specified element is not a submit button"),t.form==r||e(DOMException,"The specified element is not owned by this form element","NotFoundError")}(t,this),t.click()):((t=document.createElement("input")).type="submit",t.hidden=!0,this.appendChild(t),t.click(),this.removeChild(t))})}(HTMLFormElement.prototype);const n=new WeakMap;function o(t){const e=function(t){const e=t instanceof Element?t:t instanceof Node?t.parentElement:null,r=e?e.closest("input, button"):null;return"submit"==r?.type?r:null}(t.target);e&&e.form&&n.set(e.form,e)}!function(){if("submitter"in Event.prototype)return;let t=window.Event.prototype;if("SubmitEvent"in window){const e=window.SubmitEvent.prototype;if(!/Apple Computer/.test(navigator.vendor)||"submitter"in e)return;t=e}addEventListener("click",o,!0),Object.defineProperty(t,"submitter",{get(){if("submit"==this.type&&this.target instanceof HTMLFormElement)return n.get(this.target)}})}();const i={eager:"eager",lazy:"lazy"};class s extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new s.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(t){"loading"==t?this.delegate.loadingStyleChanged():"src"==t?this.delegate.sourceURLChanged():"disabled"==t&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(t){t?this.setAttribute("refresh",t):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&"morph"===this.refresh}get loading(){return function(t){if("lazy"===t.toLowerCase())return i.lazy;return i.eager}(this.getAttribute("loading")||"")}set loading(t){t?this.setAttribute("loading",t):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(t){t?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}}const a={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function c(t){if("false"==t.getAttribute("data-turbo-eval"))return t;{const e=document.createElement("script"),r=E("csp-nonce");return r&&(e.nonce=r),e.textContent=t.textContent,e.async=!1,function(t,e){for(const{name:r,value:n}of e.attributes)t.setAttribute(r,n)}(e,t),e}}function u(t,{target:e,cancelable:r,detail:n}={}){const o=new CustomEvent(t,{cancelable:r,bubbles:!0,composed:!0,detail:n});return e&&e.isConnected?e.dispatchEvent(o):document.documentElement.dispatchEvent(o),o}function l(t){t.preventDefault(),t.stopImmediatePropagation()}function f(){return"hidden"===document.visibilityState?d():h()}function h(){return new Promise((t=>requestAnimationFrame((()=>t()))))}function d(){return new Promise((t=>setTimeout((()=>t()),0)))}function p(t=""){return(new DOMParser).parseFromString(t,"text/html")}function m(t,...e){const r=function(t,e){return t.reduce(((t,r,n)=>t+r+(null==e[n]?"":e[n])),"")}(t,e).replace(/^\n/,"").split("\n"),n=r[0].match(/^\s+/),o=n?n[0].length:0;return r.map((t=>t.slice(o))).join("\n")}function y(){return Array.from({length:36}).map(((t,e)=>8==e||13==e||18==e||23==e?"-":14==e?"4":19==e?(Math.floor(4*Math.random())+8).toString(16):Math.floor(15*Math.random()).toString(16))).join("")}function b(t,...e){for(const r of e.map((e=>e?.getAttribute(t))))if("string"==typeof r)return r;return null}function g(...t){for(const e of t)"turbo-frame"==e.localName&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function v(...t){for(const e of t)"turbo-frame"==e.localName&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function w(t,e=2e3){return new Promise((r=>{const n=()=>{t.removeEventListener("error",n),t.removeEventListener("load",n),r()};t.addEventListener("load",n,{once:!0}),t.addEventListener("error",n,{once:!0}),setTimeout(r,e)}))}function A(t){switch(t){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function O(...t){const e=b("data-turbo-action",...t);return function(t){return"advance"==t||"replace"==t||"restore"==t}(e)?e:null}function S(t){return document.querySelector(`meta[name="${t}"]`)}function E(t){const e=S(t);return e&&e.content}function j(t,e){if(t instanceof Element)return t.closest(e)||j(t.assignedSlot||t.getRootNode()?.host,e)}function P(t){return!!t&&null==t.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")&&"function"==typeof t.focus}function T(t){return Array.from(t.querySelectorAll("[autofocus]")).find(P)}function _(t){if("_blank"===t)return!1;if(t){for(const e of document.getElementsByName(t))if(e instanceof HTMLIFrameElement)return!1;return!0}return!0}function k(t){return j(t,"a[href]:not([target^=_]):not([download])")}function x(t){return C(t.getAttribute("href")||"")}const L={"aria-disabled":{beforeSubmit:t=>{t.setAttribute("aria-disabled","true"),t.addEventListener("click",l)},afterSubmit:t=>{t.removeAttribute("aria-disabled"),t.removeEventListener("click",l)}},disabled:{beforeSubmit:t=>t.disabled=!0,afterSubmit:t=>t.disabled=!1}};const R=new class{#t=null;constructor(t){Object.assign(this,t)}get submitter(){return this.#t}set submitter(t){this.#t=L[t]||t}}({mode:"on",submitter:"disabled"}),N={drive:a,forms:R};function C(t){return new URL(t.toString(),document.baseURI)}function M(t){let e;return t.hash?t.hash.slice(1):(e=t.href.match(/#(.*)$/))?e[1]:void 0}function B(t,e){return C(e?.getAttribute("formaction")||t.getAttribute("action")||t.action)}function I(t){return(function(t){return function(t){return t.pathname.split("/").slice(1)}(t).slice(-1)[0]}(t).match(/\.[^.]*$/)||[])[0]||""}function F(t,e){const r=function(t){return e=t.origin+t.pathname,e.endsWith("/")?e:e+"/";var e}(e);return t.href===C(r).href||t.href.startsWith(r)}function D(t,e){return F(t,e)&&!N.drive.unvisitableExtensions.has(I(t))}function q(t){const e=M(t);return null!=e?t.href.slice(0,-(e.length+1)):t.href}function V(t){return q(t)}class U{constructor(t){this.response=t}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return C(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(t){return this.response.headers.get(t)}}class H extends Set{constructor(t){super(),this.maxSize=t}add(t){if(this.size>=this.maxSize){const t=this.values().next().value;this.delete(t)}super.add(t)}}const z=new H(20),W=window.fetch;function $(t,e={}){const r=new Headers(e.headers||{}),n=y();return z.add(n),r.append("X-Turbo-Request-Id",n),W(t,{...e,headers:r})}function K(t){switch(t.toLowerCase()){case"get":return Y.get;case"post":return Y.post;case"put":return Y.put;case"patch":return Y.patch;case"delete":return Y.delete}}const Y={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function G(t){switch(t.toLowerCase()){case J.multipart:return J.multipart;case J.plain:return J.plain;default:return J.urlEncoded}}const J={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"};class Q{abortController=new AbortController;#e=t=>{};constructor(t,e,r,n=new URLSearchParams,o=null,i=J.urlEncoded){const[s,a]=X(C(r),e,n,i);this.delegate=t,this.url=s,this.target=o,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:e.toUpperCase(),headers:{...this.defaultHeaders},body:a,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=i}get method(){return this.fetchOptions.method}set method(t){const e=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=K(t)||Y.get;this.url.search="";const[n,o]=X(this.url,r,e,this.enctype);this.url=n,this.fetchOptions.body=o,this.fetchOptions.method=r.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(t){this.fetchOptions.headers=t}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(t){this.fetchOptions.body=t}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){const{fetchOptions:t}=this;this.delegate.prepareRequest(this);const e=await this.#r(t);try{this.delegate.requestStarted(this),e.detail.fetchRequest?this.response=e.detail.fetchRequest.response:this.response=$(this.url.href,t);const r=await this.response;return await this.receive(r)}catch(t){if("AbortError"!==t.name)throw this.#n(t)&&this.delegate.requestErrored(this,t),t}finally{this.delegate.requestFinished(this)}}async receive(t){const e=new U(t);return u("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:e},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,e):e.succeeded?this.delegate.requestSucceededWithResponse(this,e):this.delegate.requestFailedWithResponse(this,e),e}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return Z(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(t){this.headers.Accept=[t,this.headers.Accept].join(", ")}async#r(t){const e=new Promise((t=>this.#e=t)),r=u("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:t,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await e,r}#n(t){return!u("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:t}}).defaultPrevented}}function Z(t){return K(t)==Y.get}function X(t,e,r,n){const o=Array.from(r).length>0?new URLSearchParams(tt(r)):t.searchParams;return Z(e)?[et(t,o),null]:n==J.urlEncoded?[t,o]:[t,r]}function tt(t){const e=[];for(const[r,n]of t)n instanceof File||e.push([r,n]);return e}function et(t,e){const r=new URLSearchParams(tt(e));return t.search=r.toString(),t}class rt{started=!1;constructor(t,e){this.delegate=t,this.element=e,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=t=>{const e=t.slice(-1)[0];e?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}}class nt{static contentType="text/vnd.turbo-stream.html";static wrap(t){return"string"==typeof t?new this(function(t){const e=document.createElement("template");return e.innerHTML=t,e.content}(t)):t}constructor(t){this.fragment=function(t){for(const e of t.querySelectorAll("turbo-stream")){const t=document.importNode(e,!0);for(const e of t.templateElement.content.querySelectorAll("script"))e.replaceWith(c(e));e.replaceWith(t)}return t}(t)}}const ot=new class{#o=null;#i=null;get(t){if(this.#i&&this.#i.url===t&&this.#i.expire>Date.now())return this.#i.request}setLater(t,e,r){this.clear(),this.#o=setTimeout((()=>{e.perform(),this.set(t,e,r),this.#o=null}),100)}set(t,e,r){this.#i={url:t,request:e,expire:new Date((new Date).getTime()+r)}}clear(){this.#o&&clearTimeout(this.#o),this.#i=null}},it={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"};class st{state=it.initialized;static confirmMethod(t){return Promise.resolve(confirm(t))}constructor(t,e,r,n=!1){const o=function(t,e){const r=e?.getAttribute("formmethod")||t.getAttribute("method")||"";return K(r.toLowerCase())||Y.get}(e,r),i=function(t,e){const r=C(t);Z(e)&&(r.search="");return r}(function(t,e){const r="string"==typeof t.action?t.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":t.getAttribute("action")||r||""}(e,r),o),s=function(t,e){const r=new FormData(t),n=e?.getAttribute("name"),o=e?.getAttribute("value");n&&r.append(n,o||"");return r}(e,r),a=function(t,e){return G(e?.getAttribute("formenctype")||t.enctype)}(e,r);this.delegate=t,this.formElement=e,this.submitter=r,this.fetchRequest=new Q(this,o,i,s,e,a),this.mustRedirect=n}get method(){return this.fetchRequest.method}set method(t){this.fetchRequest.method=t}get action(){return this.fetchRequest.url.toString()}set action(t){this.fetchRequest.url=C(t)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){const{initialized:t,requesting:e}=it,r=b("data-turbo-confirm",this.submitter,this.formElement);if("string"==typeof r){const t="function"==typeof N.forms.confirm?N.forms.confirm:st.confirmMethod;if(!await t(r,this.formElement,this.submitter))return}if(this.state==t)return this.state=e,this.fetchRequest.perform()}stop(){const{stopping:t,stopped:e}=it;if(this.state!=t&&this.state!=e)return this.state=t,this.fetchRequest.cancel(),!0}prepareRequest(t){if(!t.isSafe){const e=function(t){if(null!=t){const e=(document.cookie?document.cookie.split("; "):[]).find((e=>e.startsWith(t)));if(e){const t=e.split("=").slice(1).join("=");return t?decodeURIComponent(t):void 0}}}(E("csrf-param"))||E("csrf-token");e&&(t.headers["X-CSRF-Token"]=e)}this.requestAcceptsTurboStreamResponse(t)&&t.acceptResponseType(nt.contentType)}requestStarted(t){this.state=it.waiting,this.submitter&&N.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),g(this.formElement),u("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(t,e){ot.clear(),this.result={success:e.succeeded,fetchResponse:e}}requestSucceededWithResponse(t,e){if(e.clientError||e.serverError)this.delegate.formSubmissionFailedWithResponse(this,e);else if(ot.clear(),this.requestMustRedirect(t)&&function(t){return 200==t.statusCode&&!t.redirected}(e)){const t=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,t)}else this.state=it.receiving,this.result={success:!0,fetchResponse:e},this.delegate.formSubmissionSucceededWithResponse(this,e)}requestFailedWithResponse(t,e){this.result={success:!1,fetchResponse:e},this.delegate.formSubmissionFailedWithResponse(this,e)}requestErrored(t,e){this.result={success:!1,error:e},this.delegate.formSubmissionErrored(this,e)}requestFinished(t){this.state=it.stopped,this.submitter&&N.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),v(this.formElement),u("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(this.submitter&&this.submitsWith)if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){const t=this.submitter;this.originalSubmitText=t.value,t.value=this.submitsWith}}resetSubmitterText(){if(this.submitter&&this.originalSubmitText)if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){this.submitter.value=this.originalSubmitText}}requestMustRedirect(t){return!t.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(t){return!t.isSafe||function(t,...e){return e.some((e=>e&&e.hasAttribute(t)))}("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}}class at{constructor(t){this.element=t}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(t){return null!=this.getElementForAnchor(t)}getElementForAnchor(t){return t?this.element.querySelector(`[id='${t}'], a[name='${t}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return T(this.element)}get permanentElements(){return ut(this.element)}getPermanentElementById(t){return ct(this.element,t)}getPermanentElementMapForSnapshot(t){const e={};for(const r of this.permanentElements){const{id:n}=r,o=t.getPermanentElementById(n);o&&(e[n]=[r,o])}return e}}function ct(t,e){return t.querySelector(`#${e}[data-turbo-permanent]`)}function ut(t){return t.querySelectorAll("[id][data-turbo-permanent]")}class lt{started=!1;constructor(t,e){this.delegate=t,this.eventTarget=e}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=t=>{if(!t.defaultPrevented){const e=t.target instanceof HTMLFormElement?t.target:void 0,r=t.submitter||void 0;e&&function(t,e){const r=e?.getAttribute("formmethod")||t.getAttribute("method");return"dialog"!=r}(e,r)&&function(t,e){const r=e?.getAttribute("formtarget")||t.getAttribute("target");return _(r)}(e,r)&&this.delegate.willSubmitForm(e,r)&&(t.preventDefault(),t.stopImmediatePropagation(),this.delegate.formSubmitted(e,r))}}}class ft{#s=t=>{};#a=t=>{};constructor(t,e){this.delegate=t,this.element=e}scrollToAnchor(t){const e=this.snapshot.getElementForAnchor(t);e?(this.scrollToElement(e),this.focusElement(e)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(t){this.scrollToAnchor(M(t))}scrollToElement(t){t.scrollIntoView()}focusElement(t){t instanceof HTMLElement&&(t.hasAttribute("tabindex")?t.focus():(t.setAttribute("tabindex","-1"),t.focus(),t.removeAttribute("tabindex")))}scrollToPosition({x:t,y:e}){this.scrollRoot.scrollTo(t,e)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(t){const{isPreview:e,shouldRender:r,willRender:n,newSnapshot:o}=t,i=n;if(r)try{this.renderPromise=new Promise((t=>this.#s=t)),this.renderer=t,await this.prepareToRenderSnapshot(t);const r=new Promise((t=>this.#a=t)),n={resume:this.#a,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(o,n)||await r,await this.renderSnapshot(t),this.delegate.viewRenderedSnapshot(o,e,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(t)}finally{delete this.renderer,this.#s(void 0),delete this.renderPromise}else i&&this.invalidate(t.reloadReason)}invalidate(t){this.delegate.viewInvalidated(t)}async prepareToRenderSnapshot(t){this.markAsPreview(t.isPreview),await t.prepareToRender()}markAsPreview(t){t?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(t){this.element.setAttribute("data-turbo-visit-direction",t)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(t){await t.render()}finishRenderingSnapshot(t){t.finishRendering()}}class ht extends ft{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new at(this.element)}}class dt{constructor(t,e){this.delegate=t,this.element=e}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=t=>{this.clickEventIsSignificant(t)?this.clickEvent=t:delete this.clickEvent};linkClicked=t=>{this.clickEvent&&this.clickEventIsSignificant(t)&&this.delegate.shouldInterceptLinkClick(t.target,t.detail.url,t.detail.originalEvent)&&(this.clickEvent.preventDefault(),t.preventDefault(),this.delegate.linkClickIntercepted(t.target,t.detail.url,t.detail.originalEvent)),delete this.clickEvent};willVisit=t=>{delete this.clickEvent};clickEventIsSignificant(t){const e=t.composed?t.target?.parentElement:t.target,r=k(e)||e;return r instanceof Element&&r.closest("turbo-frame, html")==this.element}}class pt{started=!1;constructor(t,e){this.delegate=t,this.eventTarget=e}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=t=>{if(t instanceof MouseEvent&&this.clickEventIsSignificant(t)){const e=k(t.composedPath&&t.composedPath()[0]||t.target);if(e&&_(e.target)){const r=x(e);this.delegate.willFollowLinkToLocation(e,r,t)&&(t.preventDefault(),this.delegate.followedLinkToLocation(e,r))}}};clickEventIsSignificant(t){return!(t.target&&t.target.isContentEditable||t.defaultPrevented||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)}}class mt{constructor(t,e){this.delegate=t,this.linkInterceptor=new pt(this,e)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(t,e){return!1}prefetchAndCacheRequestToLocation(t,e){}willFollowLinkToLocation(t,e,r){return this.delegate.willSubmitFormLinkToLocation(t,e,r)&&(t.hasAttribute("data-turbo-method")||t.hasAttribute("data-turbo-stream"))}followedLinkToLocation(t,e){const r=document.createElement("form");for(const[t,n]of e.searchParams)r.append(Object.assign(document.createElement("input"),{type:"hidden",name:t,value:n}));const n=Object.assign(e,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");const o=t.getAttribute("data-turbo-method");o&&r.setAttribute("method",o);const i=t.getAttribute("data-turbo-frame");i&&r.setAttribute("data-turbo-frame",i);const s=O(t);s&&r.setAttribute("data-turbo-action",s);const a=t.getAttribute("data-turbo-confirm");a&&r.setAttribute("data-turbo-confirm",a);t.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(t,e,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",(()=>r.remove()),{once:!0}),requestAnimationFrame((()=>r.requestSubmit()))}}class yt{static async preservingPermanentElements(t,e,r){const n=new this(t,e);n.enter(),await r(),n.leave()}constructor(t,e){this.delegate=t,this.permanentElementMap=e}enter(){for(const t in this.permanentElementMap){const[e,r]=this.permanentElementMap[t];this.delegate.enteringBardo(e,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(const t in this.permanentElementMap){const[e]=this.permanentElementMap[t];this.replaceCurrentPermanentElementWithClone(e),this.replacePlaceholderWithPermanentElement(e),this.delegate.leavingBardo(e)}}replaceNewPermanentElementWithPlaceholder(t){const e=function(t){const e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",t.id),e}(t);t.replaceWith(e)}replaceCurrentPermanentElementWithClone(t){const e=t.cloneNode(!0);t.replaceWith(e)}replacePlaceholderWithPermanentElement(t){const e=this.getPlaceholderById(t.id);e?.replaceWith(t)}getPlaceholderById(t){return this.placeholders.find((e=>e.content==t))}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}class bt{#c=null;static renderElement(t,e){}constructor(t,e,r,n=!0){this.currentSnapshot=t,this.newSnapshot=e,this.isPreview=r,this.willRender=n,this.renderElement=this.constructor.renderElement,this.promise=new Promise(((t,e)=>this.resolvingFunctions={resolve:t,reject:e}))}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(t){await yt.preservingPermanentElements(this,this.permanentElementMap,t)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){const t=this.connectedSnapshot.firstAutofocusableElement;t&&t.focus()}}enteringBardo(t){this.#c||t.contains(this.currentSnapshot.activeElement)&&(this.#c=this.currentSnapshot.activeElement)}leavingBardo(t){t.contains(this.#c)&&this.#c instanceof HTMLElement&&(this.#c.focus(),this.#c=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}}class gt extends bt{static renderElement(t,e){const r=document.createRange();r.selectNodeContents(t),r.deleteContents();const n=e,o=n.ownerDocument?.createRange();o&&(o.selectNodeContents(n),t.appendChild(o.extractContents()))}constructor(t,e,r,n,o,i=!0){super(e,r,n,o,i),this.delegate=t}get shouldRender(){return!0}async render(){await f(),this.preservingPermanentElements((()=>{this.loadFrameElement()})),this.scrollFrameIntoView(),await f(),this.focusFirstAutofocusableElement(),await f(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){const r=this.currentElement.firstElementChild,n=(t=this.currentElement.getAttribute("data-autoscroll-block"),e="end","end"==t||"start"==t||"center"==t||"nearest"==t?t:e),o=function(t,e){return"auto"==t||"smooth"==t?t:e}(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(r)return r.scrollIntoView({block:n,behavior:o}),!0}var t,e;return!1}activateScriptElements(){for(const t of this.newScriptElements){const e=c(t);t.replaceWith(e)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}var vt=function(){let t=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:u,afterNodeAdded:u,beforeNodeMorphed:u,afterNodeMorphed:u,beforeNodeRemoved:u,afterNodeRemoved:u,beforeAttributeUpdated:u},head:{style:"merge",shouldPreserve:function(t){return"true"===t.getAttribute("im-preserve")},shouldReAppend:function(t){return"true"===t.getAttribute("im-re-append")},shouldRemove:u,afterHeadMorphed:u}};function r(t,e,n){if(n.head.block){let o=t.querySelector("head"),i=e.querySelector("head");if(o&&i){let s=c(i,o,n);return void Promise.all(s).then((function(){r(t,e,Object.assign(n,{head:{block:!1,ignore:!0}}))}))}}if("innerHTML"===n.morphStyle)return i(e,t,n),t.children;if("outerHTML"===n.morphStyle||null==n.morphStyle){let r=function(t,e,r){let n;n=t.firstChild;let o=n,i=0;for(;n;){let t=m(n,e,r);t>i&&(o=n,i=t),n=n.nextSibling}return o}(e,t,n),i=r?.previousSibling,s=r?.nextSibling,a=o(t,r,n);return r?function(t,e,r){let n=[],o=[];for(;null!=t;)n.push(t),t=t.previousSibling;for(;n.length>0;){let t=n.pop();o.push(t),e.parentElement.insertBefore(t,e)}o.push(e);for(;null!=r;)n.push(r),o.push(r),r=r.nextSibling;for(;n.length>0;)e.parentElement.insertBefore(n.pop(),e.nextSibling);return o}(i,a,s):[]}throw"Do not understand how to morph style "+n.morphStyle}function n(t,e){return e.ignoreActiveValue&&t===document.activeElement&&t!==document.body}function o(t,e,r){if(!r.ignoreActive||t!==document.activeElement)return null==e?!1===r.callbacks.beforeNodeRemoved(t)?t:(t.remove(),r.callbacks.afterNodeRemoved(t),null):f(t,e)?(!1===r.callbacks.beforeNodeMorphed(t,e)||(t instanceof HTMLHeadElement&&r.head.ignore||(t instanceof HTMLHeadElement&&"morph"!==r.head.style?c(e,t,r):(!function(t,e,r){let o=t.nodeType;if(1===o){const n=t.attributes,o=e.attributes;for(const t of n)s(t.name,e,"update",r)||e.getAttribute(t.name)!==t.value&&e.setAttribute(t.name,t.value);for(let n=o.length-1;0<=n;n--){const i=o[n];s(i.name,e,"remove",r)||(t.hasAttribute(i.name)||e.removeAttribute(i.name))}}8!==o&&3!==o||e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue);n(e,r)||function(t,e,r){if(t instanceof HTMLInputElement&&e instanceof HTMLInputElement&&"file"!==t.type){let n=t.value,o=e.value;a(t,e,"checked",r),a(t,e,"disabled",r),t.hasAttribute("value")?n!==o&&(s("value",e,"update",r)||(e.setAttribute("value",n),e.value=n)):s("value",e,"remove",r)||(e.value="",e.removeAttribute("value"))}else if(t instanceof HTMLOptionElement)a(t,e,"selected",r);else if(t instanceof HTMLTextAreaElement&&e instanceof HTMLTextAreaElement){let n=t.value,o=e.value;if(s("value",e,"update",r))return;n!==o&&(e.value=n),e.firstChild&&e.firstChild.nodeValue!==n&&(e.firstChild.nodeValue=n)}}(t,e,r)}(e,t,r),n(t,r)||i(e,t,r))),r.callbacks.afterNodeMorphed(t,e)),t):!1===r.callbacks.beforeNodeRemoved(t)||!1===r.callbacks.beforeNodeAdded(e)?t:(t.parentElement.replaceChild(e,t),r.callbacks.afterNodeAdded(e),r.callbacks.afterNodeRemoved(t),e)}function i(t,e,r){let n,i=t.firstChild,s=e.firstChild;for(;i;){if(n=i,i=n.nextSibling,null==s){if(!1===r.callbacks.beforeNodeAdded(n))return;e.appendChild(n),r.callbacks.afterNodeAdded(n),v(r,n);continue}if(l(n,s,r)){o(s,n,r),s=s.nextSibling,v(r,n);continue}let a=d(t,e,n,s,r);if(a){s=h(s,a,r),o(a,n,r),v(r,n);continue}let c=p(t,e,n,s,r);if(c)s=h(s,c,r),o(c,n,r),v(r,n);else{if(!1===r.callbacks.beforeNodeAdded(n))return;e.insertBefore(n,s),r.callbacks.afterNodeAdded(n),v(r,n)}}for(;null!==s;){let t=s;s=s.nextSibling,y(t,r)}}function s(t,e,r,n){return!("value"!==t||!n.ignoreActiveValue||e!==document.activeElement)||!1===n.callbacks.beforeAttributeUpdated(t,e,r)}function a(t,e,r,n){if(t[r]!==e[r]){let o=s(r,e,"update",n);o||(e[r]=t[r]),t[r]?o||e.setAttribute(r,t[r]):s(r,e,"remove",n)||e.removeAttribute(r)}}function c(t,e,r){let n=[],o=[],i=[],s=[],a=r.head.style,c=new Map;for(const e of t.children)c.set(e.outerHTML,e);for(const t of e.children){let e=c.has(t.outerHTML),n=r.head.shouldReAppend(t),u=r.head.shouldPreserve(t);e||u?n?o.push(t):(c.delete(t.outerHTML),i.push(t)):"append"===a?n&&(o.push(t),s.push(t)):!1!==r.head.shouldRemove(t)&&o.push(t)}s.push(...c.values());let u=[];for(const t of s){let o=document.createRange().createContextualFragment(t.outerHTML).firstChild;if(!1!==r.callbacks.beforeNodeAdded(o)){if(o.href||o.src){let t=null,e=new Promise((function(e){t=e}));o.addEventListener("load",(function(){t()})),u.push(e)}e.appendChild(o),r.callbacks.afterNodeAdded(o),n.push(o)}}for(const t of o)!1!==r.callbacks.beforeNodeRemoved(t)&&(e.removeChild(t),r.callbacks.afterNodeRemoved(t));return r.head.afterHeadMorphed(e,{added:n,kept:i,removed:o}),u}function u(){}function l(t,e,r){return null!=t&&null!=e&&(t.nodeType===e.nodeType&&t.tagName===e.tagName&&(""!==t.id&&t.id===e.id||w(r,t,e)>0))}function f(t,e){return null!=t&&null!=e&&(t.nodeType===e.nodeType&&t.tagName===e.tagName)}function h(t,e,r){for(;t!==e;){let e=t;t=t.nextSibling,y(e,r)}return v(r,e),e.nextSibling}function d(t,e,r,n,o){let i=w(o,r,e);if(i>0){let e=n,s=0;for(;null!=e;){if(l(r,e,o))return e;if(s+=w(o,e,t),s>i)return null;e=e.nextSibling}}return null}function p(t,e,r,n,o){let i=n,s=r.nextSibling,a=0;for(;null!=i;){if(w(o,i,t)>0)return null;if(f(r,i))return i;if(f(s,i)&&(a++,s=s.nextSibling,a>=2))return null;i=i.nextSibling}return i}function m(t,e,r){return f(t,e)?.5+w(r,t,e):0}function y(t,e){v(e,t),!1!==e.callbacks.beforeNodeRemoved(t)&&(t.remove(),e.callbacks.afterNodeRemoved(t))}function b(t,e){return!t.deadIds.has(e)}function g(e,r,n){return(e.idMap.get(n)||t).has(r)}function v(e,r){let n=e.idMap.get(r)||t;for(const t of n)e.deadIds.add(t)}function w(e,r,n){let o=e.idMap.get(r)||t,i=0;for(const t of o)b(e,t)&&g(e,t,n)&&++i;return i}function A(t,e){let r=t.parentElement,n=t.querySelectorAll("[id]");for(const t of n){let n=t;for(;n!==r&&null!=n;){let r=e.get(n);null==r&&(r=new Set,e.set(n,r)),r.add(t.id),n=n.parentElement}}}function O(t,e){let r=new Map;return A(t,r),A(e,r),r}return{morph:function(t,n,o={}){t instanceof Document&&(t=t.documentElement),"string"==typeof n&&(n=function(t){let e=new DOMParser,r=t.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(r.match(/<\/html>/)||r.match(/<\/head>/)||r.match(/<\/body>/)){let n=e.parseFromString(t,"text/html");if(r.match(/<\/html>/))return n.generatedByIdiomorph=!0,n;{let t=n.firstChild;return t?(t.generatedByIdiomorph=!0,t):null}}{let r=e.parseFromString("","text/html").body.querySelector("template").content;return r.generatedByIdiomorph=!0,r}}(n));let i=function(t){if(null==t){return document.createElement("div")}if(t.generatedByIdiomorph)return t;if(t instanceof Node){const e=document.createElement("div");return e.append(t),e}{const e=document.createElement("div");for(const r of[...t])e.append(r);return e}}(n),s=function(t,r,n){return n=function(t){let r={};return Object.assign(r,e),Object.assign(r,t),r.callbacks={},Object.assign(r.callbacks,e.callbacks),Object.assign(r.callbacks,t.callbacks),r.head={},Object.assign(r.head,e.head),Object.assign(r.head,t.head),r}(n),{target:t,newContent:r,config:n,morphStyle:n.morphStyle,ignoreActive:n.ignoreActive,ignoreActiveValue:n.ignoreActiveValue,idMap:O(t,r),deadIds:new Set,callbacks:n.callbacks,head:n.head}}(t,i,o);return r(t,i,s)},defaults:e}}();function wt(t,e,{callbacks:r,...n}={}){vt.morph(t,e,{...n,callbacks:new Ot(r)})}function At(t,e){wt(t,e.children,{morphStyle:"innerHTML"})}class Ot{#u;constructor({beforeNodeMorphed:t}={}){this.#u=t||(()=>!0)}beforeNodeAdded=t=>!(t.id&&t.hasAttribute("data-turbo-permanent")&&document.getElementById(t.id));beforeNodeMorphed=(t,e)=>{if(t instanceof Element){if(!t.hasAttribute("data-turbo-permanent")&&this.#u(t,e)){return!u("turbo:before-morph-element",{cancelable:!0,target:t,detail:{currentElement:t,newElement:e}}).defaultPrevented}return!1}};beforeAttributeUpdated=(t,e,r)=>!u("turbo:before-morph-attribute",{cancelable:!0,target:e,detail:{attributeName:t,mutationType:r}}).defaultPrevented;beforeNodeRemoved=t=>this.beforeNodeMorphed(t);afterNodeMorphed=(t,e)=>{t instanceof Element&&u("turbo:morph-element",{target:t,detail:{currentElement:t,newElement:e}})}}class St extends gt{static renderElement(t,e){u("turbo:before-frame-morph",{target:t,detail:{currentElement:t,newElement:e}}),At(t,e)}async preservingPermanentElements(t){return await t()}}class Et{static animationDuration=300;static get defaultCSS(){return m` .turbo-progress-bar { position: fixed; display: block; @@ -9,8 +9,8 @@ background: #0076ff; z-index: 2147483647; transition: - width ${jt.animationDuration}ms ease-out, - opacity ${jt.animationDuration/2}ms ${jt.animationDuration/2}ms ease-in; + width ${Et.animationDuration}ms ease-out, + opacity ${Et.animationDuration/2}ms ${Et.animationDuration/2}ms ease-in; transform: translate3d(0, 0, 0); } - `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement((()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1})))}setValue(t){this.value=t,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(t){this.progressElement.style.opacity="0",setTimeout(t,1.5*jt.animationDuration)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,jt.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame((()=>{this.progressElement.style.width=10+90*this.value+"%"}))}createStylesheetElement(){const t=document.createElement("style");t.type="text/css",t.textContent=jt.defaultCSS;const e=j();return e&&(t.nonce=e),t}createProgressElement(){const t=document.createElement("div");return t.className="turbo-progress-bar",t}}class Pt extends ct{detailsByOuterHTML=this.children.filter((t=>!function(t){const e=t.localName;return"noscript"==e}(t))).map((t=>function(t){t.hasAttribute("nonce")&&t.setAttribute("nonce","");return t}(t))).reduce(((t,e)=>{const{outerHTML:r}=e,n=r in t?t[r]:{type:Tt(e),tracked:_t(e),elements:[]};return{...t,[r]:{...n,elements:[...n.elements,e]}}}),{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter((t=>this.detailsByOuterHTML[t].tracked)).join("")}getScriptElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("script",t)}getStylesheetElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",t)}getElementsMatchingTypeNotInSnapshot(t,e){return Object.keys(this.detailsByOuterHTML).filter((t=>!(t in e.detailsByOuterHTML))).map((t=>this.detailsByOuterHTML[t])).filter((({type:e})=>e==t)).map((({elements:[t]})=>t))}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce(((t,e)=>{const{type:r,tracked:n,elements:o}=this.detailsByOuterHTML[e];return null!=r||n?o.length>1?[...t,...o.slice(1)]:t:[...t,...o]}),[])}getMetaValue(t){const e=this.findMetaElementByName(t);return e?e.getAttribute("content"):null}findMetaElementByName(t){return Object.keys(this.detailsByOuterHTML).reduce(((e,r)=>{const{elements:[n]}=this.detailsByOuterHTML[r];return function(t,e){const r=t.localName;return"meta"==r&&t.getAttribute("name")==e}(n,t)?n:e}),0)}}function Tt(t){return function(t){const e=t.localName;return"script"==e}(t)?"script":function(t){const e=t.localName;return"style"==e||"link"==e&&"stylesheet"==t.getAttribute("rel")}(t)?"stylesheet":void 0}function _t(t){return"reload"==t.getAttribute("data-turbo-track")}class kt extends ct{static fromHTMLString(t=""){return this.fromDocument(p(t))}static fromElement(t){return this.fromDocument(t.ownerDocument)}static fromDocument({documentElement:t,body:e,head:r}){return new this(t,e,new Pt(r))}constructor(t,e,r){super(e),this.documentElement=t,this.headSnapshot=r}clone(){const t=this.element.cloneNode(!0),e=this.element.querySelectorAll("select"),r=t.querySelectorAll("select");for(const[t,n]of e.entries()){const e=r[t];for(const t of e.selectedOptions)t.selected=!1;for(const t of n.selectedOptions)e.options[t.index].selected=!0}for(const e of t.querySelectorAll('input[type="password"]'))e.value="";return new kt(this.documentElement,t,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){return M(this.getSetting("root")??"/")}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return"no-preview"!=this.cacheControlValue}get isCacheable(){return"no-cache"!=this.cacheControlValue}get isVisitable(){return"reload"!=this.getSetting("visit-control")}get prefersViewTransitions(){return"same-origin"===this.headSnapshot.getMetaValue("view-transition")}get shouldMorphPage(){return"morph"===this.getSetting("refresh-method")}get shouldPreserveScrollPosition(){return"preserve"===this.getSetting("refresh-scroll")}getSetting(t){return this.headSnapshot.getMetaValue(`turbo-${t}`)}}class xt{#l=!1;#f=Promise.resolve();renderChange(t,e){return t&&this.viewTransitionsAvailable&&!this.#l?(this.#l=!0,this.#f=this.#f.then((async()=>{await document.startViewTransition(e).finished}))):this.#f=this.#f.then(e),this.#f}get viewTransitionsAvailable(){return document.startViewTransition}}const Lt={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},Rt="visitStart",Nt="requestStart",Ct="requestEnd",Mt="visitEnd",Bt="initialized",It="started",Ft="canceled",Dt="failed",qt="completed",Vt=0,Ut=-1,Ht=-2,zt={advance:"forward",restore:"back",replace:"none"};class Wt{identifier=y();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=Bt;viewTransitioner=new xt;constructor(t,e,r,n={}){this.delegate=t,this.location=e,this.restorationIdentifier=r||y();const{action:o,historyChanged:i,referrer:s,snapshot:a,snapshotHTML:c,response:u,visitCachedSnapshot:l,willRender:f,updateHistory:h,shouldCacheSnapshot:d,acceptsStreamResponse:p,direction:m}={...Lt,...n};this.action=o,this.historyChanged=i,this.referrer=s,this.snapshot=a,this.snapshotHTML=c,this.response=u,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=l,this.willRender=f,this.updateHistory=h,this.scrolled=!f,this.shouldCacheSnapshot=d,this.acceptsStreamResponse=p,this.direction=m||zt[o]}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==Bt&&(this.recordTimingMetric(Rt),this.state=It,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==It&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=Ft)}complete(){this.state==It&&(this.recordTimingMetric(Mt),this.adapter.visitCompleted(this),this.state=qt,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==It&&(this.state=Dt,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){const t=A(this.location.href===this.referrer?.href?"replace":this.action);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Z(this,G.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Nt),this.adapter.visitRequestStarted(this)}recordResponse(t=this.response){if(this.response=t,t){const{statusCode:e}=t;$t(e)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,e)}}finishRequest(){this.recordTimingMetric(Ct),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){const{statusCode:t,responseHTML:e}=this.response;this.render((async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,$t(t)&&null!=e){const t=kt.fromHTMLString(e);await this.renderPageSnapshot(t,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(kt.fromHTMLString(e),this),this.adapter.visitRendered(this),this.fail()}))}}getCachedSnapshot(){const t=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(t&&(!B(this.location)||t.hasAnchor(B(this.location)))&&("restore"==this.action||t.isPreviewable))return t}getPreloadedSnapshot(){if(this.snapshotHTML)return kt.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return null!=this.getCachedSnapshot()}loadCachedSnapshot(){const t=this.getCachedSnapshot();if(t){const e=this.shouldIssueRequest();this.render((async()=>{this.cacheSnapshot(),this.isSamePage||this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(t,e),this.adapter.visitRendered(this),e||this.complete())}))}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render((async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)}))}prepareRequest(t){this.acceptsStreamResponse&&t.acceptResponseType(ot.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(t,e){}async requestSucceededWithResponse(t,e){const r=await e.responseHTML,{redirected:n,statusCode:o}=e;null==r?this.recordResponse({statusCode:Ht,redirected:n}):(this.redirectedToLocation=e.redirected?e.location:void 0,this.recordResponse({statusCode:o,responseHTML:r,redirected:n}))}async requestFailedWithResponse(t,e){const r=await e.responseHTML,{redirected:n,statusCode:o}=e;null==r?this.recordResponse({statusCode:Ht,redirected:n}):this.recordResponse({statusCode:o,responseHTML:r,redirected:n})}requestErrored(t,e){this.recordResponse({statusCode:Vt,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){this.scrolled||this.view.forceReloaded||this.view.shouldPreserveScrollPosition(this)||("restore"==this.action?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){const{scrollPosition:t}=this.restorationData;if(t)return this.view.scrollToPosition(t),!0}scrollToAnchor(){const t=B(this.location);if(null!=t)return this.view.scrollToAnchor(t),!0}recordTimingMetric(t){this.timingMetrics[t]=(new Date).getTime()}getTimingMetrics(){return{...this.timingMetrics}}getHistoryMethodForAction(t){switch(t){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return"object"==typeof this.response}shouldIssueRequest(){return!this.isSamePage&&("restore"==this.action?!this.hasCachedSnapshot():this.willRender)}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then((t=>t&&this.visitCachedSnapshot(t))),this.snapshotCached=!0)}async render(t){this.cancelRender(),await new Promise((t=>{this.frame="hidden"===document.visibilityState?setTimeout((()=>t()),0):requestAnimationFrame((()=>t()))})),await t(),delete this.frame}async renderPageSnapshot(t,e){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(t),(async()=>{await this.view.renderPage(t,e,this.willRender,this),this.performScroll()}))}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}}function $t(t){return t>=200&&t<300}class Kt{progressBar=new jt;constructor(t){this.session=t}visitProposedToLocation(t,e){q(t,this.navigator.rootLocation)?this.navigator.startVisit(t,e?.restorationIdentifier||y(),e):window.location.href=t.toString()}visitStarted(t){this.location=t.location,t.loadCachedSnapshot(),t.issueRequest(),t.goToSamePageAnchor()}visitRequestStarted(t){this.progressBar.setValue(0),t.hasCachedSnapshot()||"restore"!=t.action?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(t){t.loadResponse()}visitRequestFailedWithStatusCode(t,e){switch(e){case Vt:case Ut:case Ht:return this.reload({reason:"request_failed",context:{statusCode:e}});default:return t.loadResponse()}}visitRequestFinished(t){}visitCompleted(t){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(t){this.reload(t)}visitFailed(t){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(t){}formSubmissionStarted(t){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(t){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),null!=this.visitProgressBarTimeout&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){null==this.formProgressBarTimeout&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),null!=this.formProgressBarTimeout&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(t){u("turbo:reload",{detail:t}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}}class Yt{selector="[data-turbo-temporary]";deprecatedSelector="[data-turbo-cache=false]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=t=>{for(const t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){const t=document.querySelectorAll(this.deprecatedSelector);return t.length,[...t]}}class Gt{constructor(t,e){this.session=t,this.element=e,this.linkInterceptor=new pt(this,e),this.formSubmitObserver=new ft(this,e)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(t,e,r){return this.#h(t)}linkClickIntercepted(t,e,r){const n=this.#d(t);n&&n.delegate.linkClickIntercepted(t,e,r)}willSubmitForm(t,e){return null==t.closest("turbo-frame")&&this.#p(t,e)&&this.#h(t,e)}formSubmitted(t,e){const r=this.#d(t,e);r&&r.delegate.formSubmitted(t,e)}#p(t,e){const r=I(t,e),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),o=M(n?.content??"/");return this.#h(t,e)&&q(r,o)}#h(t,e){if(t instanceof HTMLFormElement?this.session.submissionIsNavigatable(t,e):this.session.elementIsNavigatable(t)){const r=this.#d(t,e);return!!r&&r!=t.closest("turbo-frame")}return!1}#d(t,e){const r=e?.getAttribute("data-turbo-frame")||t.getAttribute("data-turbo-frame");if(r&&"_top"!=r){const t=this.element.querySelector(`#${r}:not([disabled])`);if(t instanceof s)return t}}}class Jt{location;restorationIdentifier=y();restorationData={};started=!1;pageLoaded=!1;currentIndex=0;constructor(t){this.delegate=t}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(t,e){this.update(history.pushState,t,e)}replace(t,e){this.update(history.replaceState,t,e)}update(t,e,r=y()){t===history.pushState&&++this.currentIndex;const n={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};t.call(history,n,"",e.href),this.location=e,this.restorationIdentifier=r}getRestorationDataForIdentifier(t){return this.restorationData[t]||{}}updateRestorationData(t){const{restorationIdentifier:e}=this,r=this.restorationData[e];this.restorationData[e]={...r,...t}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=t=>{if(this.shouldHandlePopState()){const{turbo:e}=t.state||{};if(e){this.location=new URL(window.location.href);const{restorationIdentifier:t,restorationIndex:r}=e;this.restorationIdentifier=t;const n=r>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,t,n),this.currentIndex=r}}};onPageLoad=async t=>{await Promise.resolve(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||"complete"==document.readyState}}class Qt{started=!1;#m=null;constructor(t,e){this.delegate=t,this.eventTarget=e}start(){this.started||("loading"===this.eventTarget.readyState?this.eventTarget.addEventListener("DOMContentLoaded",this.#y,{once:!0}):this.#y())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#b,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#g,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#v,!0),this.started=!1)}#y=()=>{this.eventTarget.addEventListener("mouseenter",this.#b,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#g,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#v,!0),this.started=!0};#b=t=>{if("false"===E("turbo-prefetch"))return;const e=t.target;if(e.matches&&e.matches("a[href]:not([target^=_]):not([download])")&&this.#w(e)){const t=e,r=L(t);if(this.delegate.canPrefetchRequestToLocation(t,r)){this.#m=t;const n=new Z(this,G.get,r,new URLSearchParams,e);it.setLater(r.toString(),n,this.#A)}}};#g=t=>{t.target===this.#m&&this.#O()};#O=()=>{it.clear(),this.#m=null};#v=t=>{if("FORM"!==t.target.tagName&&"GET"===t.detail.fetchOptions.method){const e=it.get(t.detail.url.toString());e&&(t.detail.fetchRequest=e),it.clear()}};prepareRequest(t){const e=t.target;t.headers["X-Sec-Purpose"]="prefetch";const r=e.closest("turbo-frame"),n=e.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;n&&"_top"!==n&&(t.headers["Turbo-Frame"]=n)}requestSucceededWithResponse(){}requestStarted(t){}requestErrored(t){}requestFinished(t){}requestPreventedHandlingResponse(t,e){}requestFailedWithResponse(t,e){}get#A(){return Number(E("turbo-prefetch-cache-time"))||1e4}#w(t){return!!t.getAttribute("href")&&(!Zt(t)&&(!Xt(t)&&(!te(t)&&(!ee(t)&&!ne(t)))))}}const Zt=t=>t.origin!==document.location.origin||!["http:","https:"].includes(t.protocol)||t.hasAttribute("target"),Xt=t=>t.pathname+t.search===document.location.pathname+document.location.search||t.href.startsWith("#"),te=t=>{if("false"===t.getAttribute("data-turbo-prefetch"))return!0;if("false"===t.getAttribute("data-turbo"))return!0;const e=P(t,"[data-turbo-prefetch]");return!(!e||"false"!==e.getAttribute("data-turbo-prefetch"))},ee=t=>{const e=t.getAttribute("data-turbo-method");return!(!e||"get"===e.toLowerCase())||(!!re(t)||(!!t.hasAttribute("data-turbo-confirm")||!!t.hasAttribute("data-turbo-stream")))},re=t=>t.hasAttribute("data-remote")||t.hasAttribute("data-behavior")||t.hasAttribute("data-confirm")||t.hasAttribute("data-method"),ne=t=>u("turbo:before-prefetch",{target:t,cancelable:!0}).defaultPrevented;class oe{constructor(t){this.delegate=t}proposeVisit(t,e={}){this.delegate.allowsVisitingLocationWithAction(t,e.action)&&this.delegate.visitProposedToLocation(t,e)}startVisit(t,e,r={}){this.stop(),this.currentVisit=new Wt(this,M(t),e,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(t,e){this.stop(),this.formSubmission=new at(this,t,e,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(t){"function"==typeof this.adapter.formSubmissionStarted&&this.adapter.formSubmissionStarted(t)}async formSubmissionSucceededWithResponse(t,e){if(t==this.formSubmission){const r=await e.responseHTML;if(r){const n=t.isSafe;n||this.view.clearSnapshotCache();const{statusCode:o,redirected:i}=e,s={action:this.#S(t,e),shouldCacheSnapshot:n,response:{statusCode:o,responseHTML:r,redirected:i}};this.proposeVisit(e.location,s)}}}async formSubmissionFailedWithResponse(t,e){const r=await e.responseHTML;if(r){const t=kt.fromHTMLString(r);e.serverError?await this.view.renderError(t,this.currentVisit):await this.view.renderPage(t,!1,!0,this.currentVisit),t.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(t,e){}formSubmissionFinished(t){"function"==typeof this.adapter.formSubmissionFinished&&this.adapter.formSubmissionFinished(t)}visitStarted(t){this.delegate.visitStarted(t)}visitCompleted(t){this.delegate.visitCompleted(t),delete this.currentVisit}locationWithActionIsSamePage(t,e){const r=B(t),n=B(this.view.lastRenderedLocation),o="restore"===e&&void 0===r;return"replace"!==e&&V(t)===V(this.view.lastRenderedLocation)&&(o||null!=r&&r!==n)}visitScrolledToSamePageLocation(t,e){this.delegate.visitScrolledToSamePageLocation(t,e)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#S(t,e){const{submitter:r,formElement:n}=t;return O(r,n)||this.#E(e)}#E(t){return t.redirected&&t.location.href===this.location?.href?"replace":"advance"}}const ie=0,se=1,ae=2,ce=3;class ue{stage=ie;started=!1;constructor(t){this.delegate=t}start(){this.started||(this.stage==ie&&(this.stage=se),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{const{readyState:t}=this;"interactive"==t?this.pageIsInteractive():"complete"==t&&this.pageIsComplete()};pageIsInteractive(){this.stage==se&&(this.stage=ae,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==ae&&(this.stage=ce,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}}class le{started=!1;constructor(t){this.delegate=t}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(t){this.delegate.scrollPositionChanged(t)}}class fe{render({fragment:t}){bt.preservingPermanentElements(this,function(t){const e=lt(document.documentElement),r={};for(const n of e){const{id:e}=n;for(const o of t.querySelectorAll("turbo-stream")){const t=ut(o.templateElement.content,e);t&&(r[e]=[n,t])}}return r}(t),(()=>{!async function(t,e){const r=`turbo-stream-autofocus-${y()}`,n=t.querySelectorAll("turbo-stream"),o=function(t){for(const e of t){const t=_(e.templateElement.content);if(t)return t}return null}(n);let i=null;o&&(i=o.id?o.id:r,o.id=i);e(),await f();if((null==document.activeElement||document.activeElement==document.body)&&i){const t=document.getElementById(i);T(t)&&t.focus(),t&&t.id==r&&t.removeAttribute("id")}}(t,(()=>{!async function(t){const[e,r]=await async function(t,e){const r=e();return t(),await h(),[r,e()]}(t,(()=>document.activeElement)),n=e&&e.id;if(n){const t=document.getElementById(n);T(t)&&t!=r&&t.focus()}}((()=>{document.documentElement.appendChild(t)}))}))}))}enteringBardo(t,e){e.replaceWith(t.cloneNode(!0))}leavingBardo(){}}class he{sources=new Set;#j=!1;constructor(t){this.delegate=t}start(){this.#j||(this.#j=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#j&&(this.#j=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(t){this.streamSourceIsConnected(t)||(this.sources.add(t),t.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(t){this.streamSourceIsConnected(t)&&(this.sources.delete(t),t.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(t){return this.sources.has(t)}inspectFetchResponse=t=>{const e=function(t){const e=t.detail?.fetchResponse;if(e instanceof H)return e}(t);e&&function(t){const e=t.contentType??"";return e.startsWith(ot.contentType)}(e)&&(t.preventDefault(),this.receiveMessageResponse(e))};receiveMessageEvent=t=>{this.#j&&"string"==typeof t.data&&this.receiveMessageHTML(t.data)};async receiveMessageResponse(t){const e=await t.responseHTML;e&&this.receiveMessageHTML(e)}receiveMessageHTML(t){this.delegate.receivedMessageFromStream(ot.wrap(t))}}class de extends gt{static renderElement(t,e){const{documentElement:r,body:n}=document;r.replaceChild(e,n)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){const{documentElement:t,head:e}=document;t.replaceChild(this.newHead,e),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(const t of this.scriptElements){const e=t.parentNode;if(e){const r=c(t);e.replaceChild(r,t)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}class pe extends gt{static renderElement(t,e){document.body&&e instanceof HTMLBodyElement?document.body.replaceWith(e):document.documentElement.appendChild(e)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){return this.newSnapshot.isVisitable?this.trackedElementsAreIdentical?void 0:{reason:"tracked_element_mismatch"}:{reason:"turbo_visit_control_is_reload"}}async prepareToRender(){this.#P(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#P(){const{documentElement:t}=this.currentSnapshot,{lang:e}=this.newSnapshot;e?t.setAttribute("lang",e):t.removeAttribute("lang")}async mergeHead(){const t=this.mergeProvisionalElements(),e=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await t,await e,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements((async()=>{this.activateNewBody(),await this.assignNewBody()}))}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){const t=[];for(const e of this.newHeadStylesheetElements)t.push(w(e)),document.head.appendChild(e);await Promise.all(t)}copyNewHeadScriptElements(){for(const t of this.newHeadScriptElements)document.head.appendChild(c(t))}removeUnusedDynamicStylesheetElements(){for(const t of this.unusedDynamicStylesheetElements)document.head.removeChild(t)}async mergeProvisionalElements(){const t=[...this.newHeadProvisionalElements];for(const e of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(e,t)||document.head.removeChild(e);for(const e of t)document.head.appendChild(e)}isCurrentElementInElementList(t,e){for(const[r,n]of e.entries()){if("TITLE"==t.tagName){if("TITLE"!=n.tagName)continue;if(t.innerHTML==n.innerHTML)return e.splice(r,1),!0}if(n.isEqualNode(t))return e.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(const t of this.currentHeadProvisionalElements)document.head.removeChild(t)}copyNewHeadProvisionalElements(){for(const t of this.newHeadProvisionalElements)document.head.appendChild(t)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(const t of this.newBodyScriptElements){const e=c(t);t.replaceWith(e)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter((t=>"dynamic"===t.getAttribute("data-turbo-track")))}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}}class me extends pe{static renderElement(t,e){At(t,e,{callbacks:{beforeNodeMorphed:t=>!ye(t)}});for(const e of t.querySelectorAll("turbo-frame"))ye(e)&&e.reload();u("turbo:morph",{detail:{currentElement:t,newElement:e}})}async preservingPermanentElements(t){return await t()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}}function ye(t){return t instanceof s&&t.src&&"morph"===t.refresh&&!t.closest("[data-turbo-permanent]")}class be{keys=[];snapshots={};constructor(t){this.size=t}has(t){return U(t)in this.snapshots}get(t){if(this.has(t)){const e=this.read(t);return this.touch(t),e}}put(t,e){return this.write(t,e),this.touch(t),e}clear(){this.snapshots={}}read(t){return this.snapshots[U(t)]}write(t,e){this.snapshots[U(t)]=e}touch(t){const e=U(t),r=this.keys.indexOf(e);r>-1&&this.keys.splice(r,1),this.keys.unshift(e),this.trim()}trim(){for(const t of this.keys.splice(this.size))delete this.snapshots[t]}}class ge extends ht{snapshotCache=new be(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(t){return this.snapshot.prefersViewTransitions&&t.prefersViewTransitions}renderPage(t,e=!1,r=!0,n){const o=new(this.isPageRefresh(n)&&this.snapshot.shouldMorphPage?me:pe)(this.snapshot,t,e,r);return o.shouldRender?n?.changeHistory():this.forceReloaded=!0,this.render(o)}renderError(t,e){e?.changeHistory();const r=new de(this.snapshot,t,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(t=this.snapshot){if(t.isCacheable){this.delegate.viewWillCacheSnapshot();const{lastRenderedLocation:e}=this;await d();const r=t.clone();return this.snapshotCache.put(e,r),r}}getCachedSnapshotForLocation(t){return this.snapshotCache.get(t)}isPageRefresh(t){return!t||this.lastRenderedLocation.pathname===t.location.pathname&&"replace"===t.action}shouldPreserveScrollPosition(t){return this.isPageRefresh(t)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return kt.fromElement(this.element)}}class ve{selector="a[data-turbo-preload]";constructor(t,e){this.delegate=t,this.snapshotCache=e}start(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.#T):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#T)}preloadOnLoadLinksForView(t){for(const e of t.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(e)&&this.preloadURL(e)}async preloadURL(t){const e=new URL(t.href);if(this.snapshotCache.has(e))return;const r=new Z(this,G.get,e,new URLSearchParams,t);await r.perform()}prepareRequest(t){t.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(t,e){try{const r=await e.responseHTML,n=kt.fromHTMLString(r);this.snapshotCache.put(t.url,n)}catch(t){}}requestStarted(t){}requestErrored(t){}requestFinished(t){}requestPreventedHandlingResponse(t,e){}requestFailedWithResponse(t,e){}#T=()=>{this.preloadOnLoadLinksForView(document.body)}}class we{constructor(t){this.session=t}clear(){this.session.clearCache()}resetCacheControl(){this.#_("")}exemptPageFromCache(){this.#_("no-cache")}exemptPageFromPreview(){this.#_("no-preview")}#_(t){!function(t,e){let r=S(t);r||(r=document.createElement("meta"),r.setAttribute("name",t),document.head.appendChild(r)),r.setAttribute("content",e)}("turbo-cache-control",t)}}function Ae(t){Object.defineProperties(t,Oe)}const Oe={absoluteURL:{get(){return this.toString()}}},Se=new class{navigator=new oe(this);history=new Jt(this);view=new ge(this,document.documentElement);adapter=new Kt(this);pageObserver=new ue(this);cacheObserver=new Yt;linkPrefetchObserver=new Qt(this,document);linkClickObserver=new mt(this,window);formSubmitObserver=new ft(this,document);scrollObserver=new le(this);streamObserver=new he(this);formLinkClickObserver=new yt(this,document.documentElement);frameRedirector=new Gt(this,document.documentElement);streamMessageRenderer=new fe;cache=new we(this);enabled=!0;started=!1;#k=150;constructor(t){this.recentRequests=t,this.preloader=new ve(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(t){this.adapter=t}visit(t,e={}){const r=e.frame?document.getElementById(e.frame):null;if(r instanceof s){const n=e.action||O(r);r.delegate.proposeVisitIfNavigatedWithAction(r,n),r.src=t.toString()}else this.navigator.proposeVisit(M(t),e)}refresh(t,e){e&&this.recentRequests.has(e)||this.navigator.currentVisit||this.visit(t,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(t){this.streamObserver.connectStreamSource(t)}disconnectStreamSource(t){this.streamObserver.disconnectStreamSource(t)}renderStreamMessage(t){this.streamMessageRenderer.render(ot.wrap(t))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(t){this.progressBarDelay=t}set progressBarDelay(t){C.drive.progressBarDelay=t}get progressBarDelay(){return C.drive.progressBarDelay}set drive(t){C.drive.enabled=t}get drive(){return C.drive.enabled}set formMode(t){C.forms.mode=t}get formMode(){return C.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#k}set pageRefreshDebouncePeriod(t){this.refresh=function(t,e){let r=null;return(...n)=>{clearTimeout(r),r=setTimeout((()=>t.apply(this,n)),e)}}(this.debouncedRefresh.bind(this),t),this.#k=t}shouldPreloadLink(t){const e=t.hasAttribute("data-turbo-method"),r=t.hasAttribute("data-turbo-stream"),n=t.getAttribute("data-turbo-frame"),o="_top"==n?null:document.getElementById(n)||P(t,"turbo-frame:not([disabled])");if(e||r||o instanceof s)return!1;{const e=new URL(t.href);return this.elementIsNavigatable(t)&&q(e,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(t,e,r){this.enabled?this.navigator.startVisit(t,e,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(t){this.history.updateRestorationData({scrollPosition:t})}willSubmitFormLinkToLocation(t,e){return this.elementIsNavigatable(t)&&q(e,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(t,e){return this.elementIsNavigatable(t)&&q(e,this.snapshot.rootLocation)}willFollowLinkToLocation(t,e,r){return this.elementIsNavigatable(t)&&q(e,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(t,e,r)}followedLinkToLocation(t,e){const r=this.getActionForLink(t),n=t.hasAttribute("data-turbo-stream");this.visit(e.href,{action:r,acceptsStreamResponse:n})}allowsVisitingLocationWithAction(t,e){return this.locationWithActionIsSamePage(t,e)||this.applicationAllowsVisitingLocation(t)}visitProposedToLocation(t,e){Ae(t),this.adapter.visitProposedToLocation(t,e)}visitStarted(t){t.acceptsStreamResponse||(g(document.documentElement),this.view.markVisitDirection(t.direction)),Ae(t.location),t.silent||this.notifyApplicationAfterVisitingLocation(t.location,t.action)}visitCompleted(t){this.view.unmarkVisitDirection(),v(document.documentElement),this.notifyApplicationAfterPageLoad(t.getTimingMetrics())}locationWithActionIsSamePage(t,e){return this.navigator.locationWithActionIsSamePage(t,e)}visitScrolledToSamePageLocation(t,e){this.notifyApplicationAfterVisitingSamePageLocation(t,e)}willSubmitForm(t,e){const r=I(t,e);return this.submissionIsNavigatable(t,e)&&q(M(r),this.snapshot.rootLocation)}formSubmitted(t,e){this.navigator.submitForm(t,e)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(t){this.renderStreamMessage(t)}viewWillCacheSnapshot(){this.navigator.currentVisit?.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:t},e){const r=this.notifyApplicationBeforeRender(t,e),{defaultPrevented:n,detail:{render:o}}=r;return this.view.renderer&&o&&(this.view.renderer.renderElement=o),!n}viewRenderedSnapshot(t,e,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(t){this.preloader.preloadOnLoadLinksForView(t)}viewInvalidated(t){this.adapter.pageInvalidated(t)}frameLoaded(t){this.notifyApplicationAfterFrameLoad(t)}frameRendered(t,e){this.notifyApplicationAfterFrameRender(t,e)}applicationAllowsFollowingLinkToLocation(t,e,r){return!this.notifyApplicationAfterClickingLinkToLocation(t,e,r).defaultPrevented}applicationAllowsVisitingLocation(t){return!this.notifyApplicationBeforeVisitingLocation(t).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(t,e,r){return u("turbo:click",{target:t,detail:{url:e.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(t){return u("turbo:before-visit",{detail:{url:t.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(t,e){return u("turbo:visit",{detail:{url:t.href,action:e}})}notifyApplicationBeforeCachingSnapshot(){return u("turbo:before-cache")}notifyApplicationBeforeRender(t,e){return u("turbo:before-render",{detail:{newBody:t,...e},cancelable:!0})}notifyApplicationAfterRender(t){return u("turbo:render",{detail:{renderMethod:t}})}notifyApplicationAfterPageLoad(t={}){return u("turbo:load",{detail:{url:this.location.href,timing:t}})}notifyApplicationAfterVisitingSamePageLocation(t,e){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:t.toString(),newURL:e.toString()}))}notifyApplicationAfterFrameLoad(t){return u("turbo:frame-load",{target:t})}notifyApplicationAfterFrameRender(t,e){return u("turbo:frame-render",{detail:{fetchResponse:t},target:e,cancelable:!0})}submissionIsNavigatable(t,e){if("off"==C.forms.mode)return!1;{const r=!e||this.elementIsNavigatable(e);return"optin"==C.forms.mode?r&&null!=t.closest('[data-turbo="true"]'):r&&this.elementIsNavigatable(t)}}elementIsNavigatable(t){const e=P(t,"[data-turbo]"),r=P(t,"turbo-frame");return C.drive.enabled||r?!e||"false"!=e.getAttribute("data-turbo"):!!e&&"true"==e.getAttribute("data-turbo")}getActionForLink(t){return O(t)||"advance"}get snapshot(){return this.view.snapshot}}(W),{cache:Ee,navigator:je}=Se;function Pe(){Se.start()}function Te(t){Se.registerAdapter(t)}function _e(t,e){Se.visit(t,e)}function ke(t){Se.connectStreamSource(t)}function xe(t){Se.disconnectStreamSource(t)}function Le(t){Se.renderStreamMessage(t)}function Re(){Se.clearCache()}function Ne(t){C.drive.progressBarDelay=t}function Ce(t){C.forms.confirm=t}function Me(t){C.forms.mode=t}var Be=Object.freeze({__proto__:null,navigator:je,session:Se,cache:Ee,PageRenderer:pe,PageSnapshot:kt,FrameRenderer:vt,fetch:K,config:C,start:Pe,registerAdapter:Te,visit:_e,connectStreamSource:ke,disconnectStreamSource:xe,renderStreamMessage:Le,clearCache:Re,setProgressBarDelay:Ne,setConfirmMethod:Ce,setFormMode:Me});class Ie extends Error{}function Fe(t){if(null!=t){const e=document.getElementById(t);if(e instanceof s)return e}}function De(t,e){if(t){const n=t.getAttribute("src");if(null!=n&&null!=e&&(r=e,M(n).href==M(r).href))throw new Error(`Matching element has a source URL which references itself`);if(t.ownerDocument!==document&&(t=document.importNode(t,!0)),t instanceof s)return t.connectedCallback(),t.disconnectedCallback(),t}var r}const qe={after(){this.targetElements.forEach((t=>t.parentElement?.insertBefore(this.templateContent,t.nextSibling)))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach((t=>t.append(this.templateContent)))},before(){this.targetElements.forEach((t=>t.parentElement?.insertBefore(this.templateContent,t)))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach((t=>t.prepend(this.templateContent)))},remove(){this.targetElements.forEach((t=>t.remove()))},replace(){const t=this.getAttribute("method");this.targetElements.forEach((e=>{"morph"===t?At(e,this.templateContent):e.replaceWith(this.templateContent)}))},update(){const t=this.getAttribute("method");this.targetElements.forEach((e=>{"morph"===t?Ot(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))}))},refresh(){Se.refresh(this.baseURI,this.requestId)}};class Ve extends HTMLElement{static async renderElement(t){await t.performAction()}async connectedCallback(){try{await this.render()}catch(t){}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{const t=this.beforeRenderEvent;this.dispatchEvent(t)&&(await f(),await t.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach((t=>t.remove()))}get duplicateChildren(){const t=this.targetElements.flatMap((t=>[...t.children])).filter((t=>!!t.id)),e=[...this.templateContent?.children||[]].filter((t=>!!t.id)).map((t=>t.id));return t.filter((t=>e.includes(t.id)))}get performAction(){if(this.action){const t=qe[this.action];if(t)return t;this.#x("unknown action")}this.#x("action attribute is missing")}get targetElements(){return this.target?this.targetElementsById:this.targets?this.targetElementsByQuery:void this.#x("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(null===this.firstElementChild){const t=this.ownerDocument.createElement("template");return this.appendChild(t),t}if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#x("first child element must be a