plutonium 0.12.8 → 0.12.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/plutonium.css +1 -1
- data/app/assets/plutonium.js +24 -1
- data/app/assets/plutonium.js.map +3 -3
- data/app/assets/plutonium.min.js +5 -5
- data/app/assets/plutonium.min.js.map +4 -4
- data/app/views/components/form/form_component.html.erb +1 -3
- data/app/views/components/interactive_action_form/interactive_action_form_component.html.erb +5 -7
- data/app/views/components/nested_resource_form_fields/nested_resource_form_fields_component.html.erb +2 -2
- data/app/views/components/sidebar/sidebar_component.html.erb +1 -1
- data/app/views/components/sidebar/sidebar_component.rb +2 -2
- data/app/views/components/sidebar_menu_item/sidebar_menu_item_component.html.erb +6 -6
- data/app/views/components/sidebar_menu_item/sidebar_menu_item_component.rb +14 -4
- data/app/views/components/table_search_input/table_search_input_component.html.erb +8 -2
- data/app/views/resource/_interactive_resource_action_form.html.erb +1 -1
- data/app/views/resource/_resource_details.html.erb +9 -2
- data/app/views/resource/_resource_table.html.erb +9 -1
- data/lib/generators/pu/core/assets/templates/tailwind.config.js +2 -0
- data/lib/generators/pu/core/install/install_generator.rb +1 -1
- data/lib/generators/pu/core/install/templates/config/initializers/plutonium.rb +4 -0
- data/lib/generators/pu/eject/layout/layout_generator.rb +3 -2
- data/lib/generators/pu/eject/shell/shell_generator.rb +3 -2
- data/lib/generators/pu/field/input/input_generator.rb +32 -0
- data/lib/generators/pu/field/input/templates/.keep +0 -0
- data/lib/generators/pu/field/input/templates/input.rb.tt +15 -0
- data/lib/generators/pu/field/renderer/renderer_generator.rb +32 -0
- data/lib/generators/pu/field/renderer/templates/.keep +0 -0
- data/lib/generators/pu/field/renderer/templates/renderer.rb.tt +9 -0
- data/lib/plutonium/core/actions/interactive_action.rb +2 -2
- data/lib/plutonium/core/associations/renderers/base.rb +77 -0
- data/lib/plutonium/core/associations/renderers/factory.rb +0 -2
- data/lib/plutonium/core/associations/renderers/has_many_renderer.rb +6 -4
- data/lib/plutonium/core/controllers/crud_actions.rb +1 -1
- data/lib/plutonium/core/controllers/presentable.rb +3 -3
- data/lib/plutonium/core/definers/field_definer.rb +4 -4
- data/lib/plutonium/core/definers/{input_definer.rb → field_input_definer.rb} +4 -4
- data/lib/plutonium/core/definers/{renderer_definer.rb → field_renderer_definer.rb} +10 -10
- data/lib/plutonium/core/fields/inputs/attachment_input.rb +2 -2
- data/lib/plutonium/core/fields/inputs/base.rb +76 -10
- data/lib/plutonium/core/fields/inputs/checkbox_input.rb +3 -1
- data/lib/plutonium/core/fields/inputs/date_time_input.rb +3 -1
- data/lib/plutonium/core/fields/inputs/nested_input.rb +36 -21
- data/lib/plutonium/core/fields/inputs/noop_input.rb +1 -4
- data/lib/plutonium/core/fields/inputs/polymorphic_belongs_to_association_input.rb +8 -7
- data/lib/plutonium/core/fields/inputs/simple_form_association_input.rb +4 -5
- data/lib/plutonium/core/fields/inputs/simple_form_input.rb +2 -3
- data/lib/plutonium/core/fields/renderers/association_renderer.rb +11 -5
- data/lib/plutonium/core/fields/renderers/attachment_renderer.rb +3 -10
- data/lib/plutonium/core/fields/renderers/base.rb +83 -0
- data/lib/plutonium/core/fields/renderers/basic_renderer.rb +3 -17
- data/lib/plutonium/core/fields/renderers/factory.rb +0 -1
- data/lib/plutonium/core/renderable.rb +20 -0
- data/lib/plutonium/helpers/display_helper.rb +1 -1
- data/lib/plutonium/resource/controller.rb +1 -1
- data/lib/plutonium/resource/policy.rb +1 -1
- data/lib/plutonium/resource/presenter.rb +3 -3
- data/lib/plutonium/resource/query_object.rb +4 -4
- data/lib/plutonium/resource/record.rb +1 -1
- data/lib/plutonium/simple_form/attachment_component.rb +1 -1
- data/lib/plutonium/version.rb +1 -1
- data/package.json +1 -1
- data/src/js/controllers/register_controllers.js +2 -0
- data/src/js/controllers/resource_collapse_controller.js +30 -0
- data/src/js/controllers/resource_drop_down_controller.js +1 -1
- metadata +14 -5
- data/lib/plutonium/core/associations/renderers/basic_renderer.rb +0 -28
data/app/assets/plutonium.min.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
(()=>{var so=Object.create;var xs=Object.defineProperty;var no=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var ao=Object.getPrototypeOf,lo=Object.prototype.hasOwnProperty;var co=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var ho=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of oo(e))!lo.call(r,s)&&s!==t&&xs(r,s,{get:()=>e[s],enumerable:!(i=no(e,s))||i.enumerable});return r};var uo=(r,e,t)=>(t=r!=null?so(ao(r)):{},ho(e||!r||!r.__esModule?xs(t,"default",{value:r,enumerable:!0}):t,r));var $s=co((kh,zs)=>{var ra="Expected a function",js=NaN,ia="[object Symbol]",sa=/^\s+|\s+$/g,na=/^[-+]0x[0-9a-f]+$/i,oa=/^0b[01]+$/i,aa=/^0o[0-7]+$/i,la=parseInt,ca=typeof global=="object"&&global&&global.Object===Object&&global,ha=typeof self=="object"&&self&&self.Object===Object&&self,da=ca||ha||Function("return this")(),ua=Object.prototype,fa=ua.toString,pa=Math.max,ma=Math.min,bi=function(){return da.Date.now()};function ga(r,e,t){var i,s,n,o,a,d,f=0,u=!1,_=!1,E=!0;if(typeof r!="function")throw new TypeError(ra);e=Ws(e)||0,yi(t)&&(u=!!t.leading,_="maxWait"in t,n=_?pa(Ws(t.maxWait)||0,e):n,E="trailing"in t?!!t.trailing:E);function y(v){var k=i,P=s;return i=s=void 0,f=v,o=r.apply(P,k),o}function O(v){return f=v,a=setTimeout(x,e),u?y(v):o}function T(v){var k=v-d,P=v-f,F=e-k;return _?ma(F,n-P):F}function S(v){var k=v-d,P=v-f;return d===void 0||k>=e||k<0||_&&P>=n}function x(){var v=bi();if(S(v))return I(v);a=setTimeout(x,T(v))}function I(v){return a=void 0,E&&i?y(v):(i=s=void 0,o)}function M(){a!==void 0&&clearTimeout(a),f=0,i=d=s=a=void 0}function L(){return a===void 0?o:I(bi())}function C(){var v=bi(),k=S(v);if(i=arguments,s=this,d=v,k){if(a===void 0)return O(d);if(_)return a=setTimeout(x,e),y(d)}return a===void 0&&(a=setTimeout(x,e)),o}return C.cancel=M,C.flush=L,C}function yi(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function va(r){return!!r&&typeof r=="object"}function ba(r){return typeof r=="symbol"||va(r)&&fa.call(r)==ia}function Ws(r){if(typeof r=="number")return r;if(ba(r))return js;if(yi(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=yi(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(sa,"");var t=oa.test(r);return t||aa.test(r)?la(r.slice(2),t?2:8):na.test(r)?js:+r}zs.exports=ga});var Xr=class{constructor(e,t,i){this.eventTarget=e,this.eventName=t,this.eventOptions=i,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=fo(e);for(let i of this.bindings){if(t.immediatePropagationStopped)break;i.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let i=e.index,s=t.index;return i<s?-1:i>s?1:0})}};function fo(r){if("immediatePropagationStopped"in r)return r;{let{stopImmediatePropagation:e}=r;return Object.assign(r,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var Yr=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,i={}){this.application.handleError(e,`Error ${t}`,i)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:i,eventOptions:s}=e,n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(i,s);n.delete(o),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:i,eventOptions:s}=e;return this.fetchEventListener(t,i,s)}fetchEventListener(e,t,i){let s=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,i),o=s.get(n);return o||(o=this.createEventListener(e,t,i),s.set(n,o)),o}createEventListener(e,t,i){let s=new Xr(e,t,i);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let i=[e];return Object.keys(t).sort().forEach(s=>{i.push(`${t[s]?"":"!"}${s}`)}),i.join(":")}},po={stop({event:r,value:e}){return e&&r.stopPropagation(),!0},prevent({event:r,value:e}){return e&&r.preventDefault(),!0},self({event:r,value:e,element:t}){return e?t===r.target:!0}},mo=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function go(r){let t=r.trim().match(mo)||[],i=t[2],s=t[3];return s&&!["keydown","keyup","keypress"].includes(i)&&(i+=`.${s}`,s=""),{eventTarget:vo(t[4]),eventName:i,eventOptions:t[7]?bo(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||s}}function vo(r){if(r=="window")return window;if(r=="document")return document}function bo(r){return r.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function yo(r){if(r==window)return"window";if(r==document)return"document"}function vi(r){return r.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Jr(r){return vi(r.replace(/--/g,"-").replace(/__/g,"_"))}function Et(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Hs(r){return r.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function wo(r){return r.match(/[^\s]+/g)||[]}function ks(r){return r!=null}function Gr(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var Os=["meta","ctrl","alt","shift"],Qr=class{constructor(e,t,i,s){this.element=e,this.index=t,this.eventTarget=i.eventTarget||e,this.eventName=i.eventName||Eo(e)||Dt("missing event name"),this.eventOptions=i.eventOptions||{},this.identifier=i.identifier||Dt("missing identifier"),this.methodName=i.methodName||Dt("missing method name"),this.keyFilter=i.keyFilter||"",this.schema=s}static forToken(e,t){return new this(e.element,e.index,go(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let i=t.filter(s=>!Os.includes(s))[0];return i?(Gr(this.keyMappings,i)||Dt(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[i].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:i,value:s}of Array.from(this.element.attributes)){let n=i.match(t),o=n&&n[1];o&&(e[vi(o)]=_o(s))}return e}get eventTargetName(){return yo(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[i,s,n,o]=Os.map(a=>t.includes(a));return e.metaKey!==i||e.ctrlKey!==s||e.altKey!==n||e.shiftKey!==o}},Is={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:r=>r.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Eo(r){let e=r.tagName.toLowerCase();if(e in Is)return Is[e](r)}function Dt(r){throw new Error(r)}function _o(r){try{return JSON.parse(r)}catch{return r}}var Zr=class{constructor(e,t){this.context=e,this.action=t}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(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:i}=this.context.application,{controller:s}=this.context,n=!0;for(let[o,a]of Object.entries(this.eventOptions))if(o in i){let d=i[o];n=n&&d({name:o,value:a,event:e,element:t,controller:s})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:i}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:i,action:this.methodName})}catch(s){let{identifier:n,controller:o,element:a,index:d}=this,f={identifier:n,controller:o,element:a,index:d,event:e};this.context.handleError(s,`invoking action "${this.action}"`,f)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):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}},Ht=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(i=>this.processMutations(i))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),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){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let i=this.elementFromNode(t);i&&this.processTree(i,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let i=this.elementFromNode(t);i&&this.elementIsActive(i)&&this.processTree(i,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let i of this.matchElementsInTree(e))t.call(this,i)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},qt=class{constructor(e,t,i){this.attributeName=t,this.delegate=i,this.elementObserver=new Ht(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],i=Array.from(e.querySelectorAll(this.selector));return t.concat(i)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function So(r,e,t){qs(r,e).add(t)}function Ao(r,e,t){qs(r,e).delete(t),Lo(r,e)}function qs(r,e){let t=r.get(e);return t||(t=new Set,r.set(e,t)),t}function Lo(r,e){let t=r.get(e);t!=null&&t.size==0&&r.delete(e)}var me=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,i)=>t.concat(Array.from(i)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,i)=>t+i.size,0)}add(e,t){So(this.valuesByKey,e,t)}delete(e,t){Ao(this.valuesByKey,e,t)}has(e,t){let i=this.valuesByKey.get(e);return i!=null&&i.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(i=>i.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,i])=>i.has(e)).map(([t,i])=>t)}};var ei=class{constructor(e,t,i,s){this._selector=t,this.details=s,this.elementObserver=new Ht(e,this),this.delegate=i,this.matchesByElement=new me}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let i=e.matches(t);return this.delegate.selectorMatchElement?i&&this.delegate.selectorMatchElement(e,this.details):i}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let i=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return i.concat(s)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let i of t)this.selectorUnmatched(e,i)}elementAttributeChanged(e,t){let{selector:i}=this;if(i){let s=this.matchElement(e),n=this.matchesByElement.has(i,e);s&&!n?this.selectorMatched(e,i):!s&&n&&this.selectorUnmatched(e,i)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},ti=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(i=>this.processMutations(i))}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(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let i=this.delegate.getStringMapKeyForAttribute(e);if(i!=null){this.stringMap.has(e)||this.stringMapKeyAdded(i,e);let s=this.element.getAttribute(e);if(this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,i,t),s==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(i,e,n)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,i){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,i)}stringMapKeyRemoved(e,t,i){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,i)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},Nt=class{constructor(e,t,i){this.attributeObserver=new qt(e,t,this),this.delegate=i,this.tokensByElement=new me}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,i]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(i)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),i=this.readTokensForElement(e),s=Co(t,i).findIndex(([n,o])=>!xo(n,o));return s==-1?[[],[]]:[t.slice(s),i.slice(s)]}readTokensForElement(e){let t=this.attributeName,i=e.getAttribute(t)||"";return To(i,e,t)}};function To(r,e,t){return r.trim().split(/\s+/).filter(i=>i.length).map((i,s)=>({element:e,attributeName:t,content:i,index:s}))}function Co(r,e){let t=Math.max(r.length,e.length);return Array.from({length:t},(i,s)=>[r[s],e[s]])}function xo(r,e){return r&&e&&r.index==e.index&&r.content==e.content}var Vt=class{constructor(e,t,i){this.tokenListObserver=new Nt(e,t,this),this.delegate=i,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(e){let{element:t}=e,{value:i}=this.fetchParseResultForToken(e);i&&(this.fetchValuesByTokenForElement(t).set(e,i),this.delegate.elementMatchedValue(t,i))}tokenUnmatched(e){let{element:t}=e,{value:i}=this.fetchParseResultForToken(e);i&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,i))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},ri=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new Vt(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(e){let t=new Zr(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=Qr.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},ii=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new ti(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(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let i=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,i.writer(this.receiver[e]),i.writer(i.defaultValue))}stringMapValueChanged(e,t,i){let s=this.valueDescriptorNameMap[t];e!==null&&(i===null&&(i=s.writer(s.defaultValue)),this.invokeChangedCallback(t,e,i))}stringMapKeyRemoved(e,t,i){let s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),i):this.invokeChangedCallback(e,s.writer(s.defaultValue),i)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:i,writer:s}of this.valueDescriptors)i!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,s(i),void 0)}invokeChangedCallback(e,t,i){let s=`${e}Changed`,n=this.receiver[s];if(typeof n=="function"){let o=this.valueDescriptorNameMap[e];try{let a=o.reader(t),d=i;i&&(d=o.reader(i)),n.call(this.receiver,a,d)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let i=this.valueDescriptorMap[t];e[i.name]=i}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],i=`has${Et(t.name)}`;return this.receiver[i]}},si=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new me}start(){this.tokenListObserver||(this.tokenListObserver=new Nt(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var i;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(i=this.tokenListObserver)===null||i===void 0||i.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var i;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(i=this.tokenListObserver)===null||i===void 0||i.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function _t(r,e){let t=Ns(r);return Array.from(t.reduce((i,s)=>(Oo(s,e).forEach(n=>i.add(n)),i),new Set))}function ko(r,e){return Ns(r).reduce((i,s)=>(i.push(...Io(s,e)),i),[])}function Ns(r){let e=[];for(;r;)e.push(r),r=Object.getPrototypeOf(r);return e.reverse()}function Oo(r,e){let t=r[e];return Array.isArray(t)?t:[]}function Io(r,e){let t=r[e];return t?Object.keys(t).map(i=>[i,t[i]]):[]}var ni=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new me,this.outletElementsByName=new me,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:i}){let s=this.getOutlet(e,i);s&&this.connectOutlet(s,e,i)}selectorUnmatched(e,t,{outletName:i}){let s=this.getOutletFromMap(e,i);s&&this.disconnectOutlet(s,e,i)}selectorMatchElement(e,{outletName:t}){let i=this.selector(t),s=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return i?s&&n&&e.matches(i):!1}elementMatchedAttribute(e,t){let i=this.getOutletNameFromOutletAttributeName(t);i&&this.updateSelectorObserverForOutlet(i)}elementAttributeValueChanged(e,t){let i=this.getOutletNameFromOutletAttributeName(t);i&&this.updateSelectorObserverForOutlet(i)}elementUnmatchedAttribute(e,t){let i=this.getOutletNameFromOutletAttributeName(t);i&&this.updateSelectorObserverForOutlet(i)}connectOutlet(e,t,i){var s;this.outletElementsByName.has(i,t)||(this.outletsByName.add(i,e),this.outletElementsByName.add(i,t),(s=this.selectorObserverMap.get(i))===null||s===void 0||s.pause(()=>this.delegate.outletConnected(e,t,i)))}disconnectOutlet(e,t,i){var s;this.outletElementsByName.has(i,t)&&(this.outletsByName.delete(i,e),this.outletElementsByName.delete(i,t),(s=this.selectorObserverMap.get(i))===null||s===void 0||s.pause(()=>this.delegate.outletDisconnected(e,t,i)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let i of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(i,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),i=new ei(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,i),i.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),i=new qt(this.scope.element,t,this);this.attributeObserverMap.set(e,i),i.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new me;return this.router.modules.forEach(t=>{let i=t.definition.controllerConstructor;_t(i,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(i=>i.element===e)}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}},oi=class{constructor(e,t){this.logDebugActivity=(i,s={})=>{let{identifier:n,controller:o,element:a}=this;s=Object.assign({identifier:n,controller:o,element:a},s),this.application.logDebugActivity(this.identifier,i,s)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new ri(this,this.dispatcher),this.valueObserver=new ii(this,this.controller),this.targetObserver=new si(this,this),this.outletObserver=new ni(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(i){this.handleError(i,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"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(e,t,i={}){let{identifier:s,controller:n,element:o}=this;i=Object.assign({identifier:s,controller:n,element:o},i),this.application.handleError(e,`Error ${t}`,i)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,i){this.invokeControllerMethod(`${Jr(i)}OutletConnected`,e,t)}outletDisconnected(e,t,i){this.invokeControllerMethod(`${Jr(i)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let i=this.controller;typeof i[e]=="function"&&i[e](...t)}};function Mo(r){return Po(r,Ro(r))}function Po(r,e){let t=Ho(r),i=Fo(r.prototype,e);return Object.defineProperties(t.prototype,i),t}function Ro(r){return _t(r,"blessings").reduce((t,i)=>{let s=i(r);for(let n in s){let o=t[n]||{};t[n]=Object.assign(o,s[n])}return t},{})}function Fo(r,e){return Do(e).reduce((t,i)=>{let s=Bo(r,e,i);return s&&Object.assign(t,{[i]:s}),t},{})}function Bo(r,e,t){let i=Object.getOwnPropertyDescriptor(r,t);if(!(i&&"value"in i)){let n=Object.getOwnPropertyDescriptor(e,t).value;return i&&(n.get=i.get||n.get,n.set=i.set||n.set),n}}var Do=typeof Object.getOwnPropertySymbols=="function"?r=>[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)]:Object.getOwnPropertyNames,Ho=(()=>{function r(t){function i(){return Reflect.construct(t,arguments,new.target)}return i.prototype=Object.create(t.prototype,{constructor:{value:i}}),Reflect.setPrototypeOf(i,t),i}function e(){let i=r(function(){this.a.call(this)});return i.prototype.a=function(){},new i}try{return e(),r}catch{return i=>class extends i{}}})();function qo(r){return{identifier:r.identifier,controllerConstructor:Mo(r.controllerConstructor)}}var ai=class{constructor(e,t){this.application=e,this.definition=qo(t),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(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new oi(this,e),this.contextsByScope.set(e,t)),t}},li=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return wo(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},ci=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let i=this.getAttributeNameForKey(e);return this.element.setAttribute(i,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${Hs(e)}`}},hi=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,i){let s=this.warnedKeysByObject.get(e);s||(s=new Set,this.warnedKeysByObject.set(e,s)),s.has(t)||(s.add(t),this.logger.warn(i,e))}};function di(r,e){return`[${r}~="${e}"]`}var ui=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,i)=>t||this.findTarget(i)||this.findLegacyTarget(i),void 0)}findAll(...e){return e.reduce((t,i)=>[...t,...this.findAllTargets(i),...this.findAllLegacyTargets(i)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return di(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(i=>this.deprecate(i,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return di(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:i}=this,s=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(i);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${i}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},fi=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,i)=>t||this.findOutlet(i),void 0)}findAll(...e){return e.reduce((t,i)=>[...t,...this.findAllOutlets(i)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))}matchesElement(e,t,i){let s=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&s.split(" ").includes(i)}},pi=class r{constructor(e,t,i,s){this.targets=new ui(this),this.classes=new li(this),this.data=new ci(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=i,this.guide=new hi(s),this.outlets=new fi(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return di(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new r(this.schema,document.documentElement,this.identifier,this.guide.logger)}},mi=class{constructor(e,t,i){this.element=e,this.schema=t,this.delegate=i,this.valueListObserver=new Vt(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(e){let{element:t,content:i}=e;return this.parseValueForElementAndIdentifier(t,i)}parseValueForElementAndIdentifier(e,t){let i=this.fetchScopesByIdentifierForElement(e),s=i.get(t);return s||(s=this.delegate.createScopeForElementAndIdentifier(e,t),i.set(t,s)),s}elementMatchedValue(e,t){let i=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,i),i==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let i=this.scopeReferenceCounts.get(t);i&&(this.scopeReferenceCounts.set(t,i-1),i==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},gi=class{constructor(e){this.application=e,this.scopeObserver=new mi(this.element,this.schema,this),this.scopesByIdentifier=new me,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((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new ai(this.application,e);this.connectModule(t);let i=e.controllerConstructor.afterLoad;i&&i.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let i=this.modulesByIdentifier.get(t);if(i)return i.contexts.find(s=>s.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let i=this.scopeObserver.parseValueForElementAndIdentifier(e,t);i?this.scopeObserver.elementMatchedValue(i.element,i):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,i){this.application.handleError(e,t,i)}createScopeForElementAndIdentifier(e,t){return new pi(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(i=>e.connectContextForScope(i))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(i=>e.disconnectContextForScope(i))}},No={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:r=>`data-${r}-target`,outletAttributeForScope:(r,e)=>`data-${r}-${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"},Ms("abcdefghijklmnopqrstuvwxyz".split("").map(r=>[r,r]))),Ms("0123456789".split("").map(r=>[r,r])))};function Ms(r){return r.reduce((e,[t,i])=>Object.assign(Object.assign({},e),{[t]:i}),{})}var jt=class{constructor(e=document.documentElement,t=No){this.logger=console,this.debug=!1,this.logDebugActivity=(i,s,n={})=>{this.debug&&this.logFormattedMessage(i,s,n)},this.element=e,this.schema=t,this.dispatcher=new Yr(this),this.router=new gi(this),this.actionDescriptorFilters=Object.assign({},po)}static start(e,t){let i=new this(e,t);return i.start(),i}async start(){await Vo(),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(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>{s.controllerConstructor.shouldLoad&&this.router.loadDefinition(s)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>this.router.unloadIdentifier(s))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let i=this.router.getContextForElementAndIdentifier(e,t);return i?i.controller:null}handleError(e,t,i){var s;this.logger.error(`%s
|
1
|
+
(()=>{var oo=Object.create;var Os=Object.defineProperty;var ao=Object.getOwnPropertyDescriptor;var lo=Object.getOwnPropertyNames;var co=Object.getPrototypeOf,ho=Object.prototype.hasOwnProperty;var uo=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var fo=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of lo(e))!ho.call(r,s)&&s!==t&&Os(r,s,{get:()=>e[s],enumerable:!(i=ao(e,s))||i.enumerable});return r};var po=(r,e,t)=>(t=r!=null?oo(co(r)):{},fo(e||!r||!r.__esModule?Os(t,"default",{value:r,enumerable:!0}):t,r));var Ks=uo((Ih,Us)=>{var sa="Expected a function",zs=NaN,na="[object Symbol]",oa=/^\s+|\s+$/g,aa=/^[-+]0x[0-9a-f]+$/i,la=/^0b[01]+$/i,ca=/^0o[0-7]+$/i,ha=parseInt,da=typeof global=="object"&&global&&global.Object===Object&&global,ua=typeof self=="object"&&self&&self.Object===Object&&self,fa=da||ua||Function("return this")(),pa=Object.prototype,ma=pa.toString,ga=Math.max,va=Math.min,wi=function(){return fa.Date.now()};function ba(r,e,t){var i,s,n,o,a,d,f=0,u=!1,_=!1,E=!0;if(typeof r!="function")throw new TypeError(sa);e=$s(e)||0,Ei(t)&&(u=!!t.leading,_="maxWait"in t,n=_?ga($s(t.maxWait)||0,e):n,E="trailing"in t?!!t.trailing:E);function w(v){var k=i,P=s;return i=s=void 0,f=v,o=r.apply(P,k),o}function O(v){return f=v,a=setTimeout(x,e),u?w(v):o}function C(v){var k=v-d,P=v-f,F=e-k;return _?va(F,n-P):F}function S(v){var k=v-d,P=v-f;return d===void 0||k>=e||k<0||_&&P>=n}function x(){var v=wi();if(S(v))return I(v);a=setTimeout(x,C(v))}function I(v){return a=void 0,E&&i?w(v):(i=s=void 0,o)}function M(){a!==void 0&&clearTimeout(a),f=0,i=d=s=a=void 0}function L(){return a===void 0?o:I(wi())}function T(){var v=wi(),k=S(v);if(i=arguments,s=this,d=v,k){if(a===void 0)return O(d);if(_)return a=setTimeout(x,e),w(d)}return a===void 0&&(a=setTimeout(x,e)),o}return T.cancel=M,T.flush=L,T}function Ei(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function ya(r){return!!r&&typeof r=="object"}function wa(r){return typeof r=="symbol"||ya(r)&&ma.call(r)==na}function $s(r){if(typeof r=="number")return r;if(wa(r))return zs;if(Ei(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Ei(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(oa,"");var t=la.test(r);return t||ca.test(r)?ha(r.slice(2),t?2:8):aa.test(r)?zs:+r}Us.exports=ba});var Jr=class{constructor(e,t,i){this.eventTarget=e,this.eventName=t,this.eventOptions=i,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=mo(e);for(let i of this.bindings){if(t.immediatePropagationStopped)break;i.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let i=e.index,s=t.index;return i<s?-1:i>s?1:0})}};function mo(r){if("immediatePropagationStopped"in r)return r;{let{stopImmediatePropagation:e}=r;return Object.assign(r,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var Gr=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,i={}){this.application.handleError(e,`Error ${t}`,i)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:i,eventOptions:s}=e,n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(i,s);n.delete(o),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:i,eventOptions:s}=e;return this.fetchEventListener(t,i,s)}fetchEventListener(e,t,i){let s=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,i),o=s.get(n);return o||(o=this.createEventListener(e,t,i),s.set(n,o)),o}createEventListener(e,t,i){let s=new Jr(e,t,i);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let i=[e];return Object.keys(t).sort().forEach(s=>{i.push(`${t[s]?"":"!"}${s}`)}),i.join(":")}},go={stop({event:r,value:e}){return e&&r.stopPropagation(),!0},prevent({event:r,value:e}){return e&&r.preventDefault(),!0},self({event:r,value:e,element:t}){return e?t===r.target:!0}},vo=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function bo(r){let t=r.trim().match(vo)||[],i=t[2],s=t[3];return s&&!["keydown","keyup","keypress"].includes(i)&&(i+=`.${s}`,s=""),{eventTarget:yo(t[4]),eventName:i,eventOptions:t[7]?wo(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||s}}function yo(r){if(r=="window")return window;if(r=="document")return document}function wo(r){return r.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function Eo(r){if(r==window)return"window";if(r==document)return"document"}function yi(r){return r.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Qr(r){return yi(r.replace(/--/g,"-").replace(/__/g,"_"))}function Et(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Ns(r){return r.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function _o(r){return r.match(/[^\s]+/g)||[]}function Is(r){return r!=null}function Zr(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var Ms=["meta","ctrl","alt","shift"],ei=class{constructor(e,t,i,s){this.element=e,this.index=t,this.eventTarget=i.eventTarget||e,this.eventName=i.eventName||So(e)||Dt("missing event name"),this.eventOptions=i.eventOptions||{},this.identifier=i.identifier||Dt("missing identifier"),this.methodName=i.methodName||Dt("missing method name"),this.keyFilter=i.keyFilter||"",this.schema=s}static forToken(e,t){return new this(e.element,e.index,bo(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let i=t.filter(s=>!Ms.includes(s))[0];return i?(Zr(this.keyMappings,i)||Dt(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[i].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:i,value:s}of Array.from(this.element.attributes)){let n=i.match(t),o=n&&n[1];o&&(e[yi(o)]=Ao(s))}return e}get eventTargetName(){return Eo(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[i,s,n,o]=Ms.map(a=>t.includes(a));return e.metaKey!==i||e.ctrlKey!==s||e.altKey!==n||e.shiftKey!==o}},Ps={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:r=>r.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function So(r){let e=r.tagName.toLowerCase();if(e in Ps)return Ps[e](r)}function Dt(r){throw new Error(r)}function Ao(r){try{return JSON.parse(r)}catch{return r}}var ti=class{constructor(e,t){this.context=e,this.action=t}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(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:i}=this.context.application,{controller:s}=this.context,n=!0;for(let[o,a]of Object.entries(this.eventOptions))if(o in i){let d=i[o];n=n&&d({name:o,value:a,event:e,element:t,controller:s})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:i}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:i,action:this.methodName})}catch(s){let{identifier:n,controller:o,element:a,index:d}=this,f={identifier:n,controller:o,element:a,index:d,event:e};this.context.handleError(s,`invoking action "${this.action}"`,f)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):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}},Ht=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(i=>this.processMutations(i))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),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){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let i=this.elementFromNode(t);i&&this.processTree(i,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let i=this.elementFromNode(t);i&&this.elementIsActive(i)&&this.processTree(i,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let i of this.matchElementsInTree(e))t.call(this,i)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},qt=class{constructor(e,t,i){this.attributeName=t,this.delegate=i,this.elementObserver=new Ht(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],i=Array.from(e.querySelectorAll(this.selector));return t.concat(i)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function Lo(r,e,t){Vs(r,e).add(t)}function Co(r,e,t){Vs(r,e).delete(t),To(r,e)}function Vs(r,e){let t=r.get(e);return t||(t=new Set,r.set(e,t)),t}function To(r,e){let t=r.get(e);t!=null&&t.size==0&&r.delete(e)}var me=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,i)=>t.concat(Array.from(i)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,i)=>t+i.size,0)}add(e,t){Lo(this.valuesByKey,e,t)}delete(e,t){Co(this.valuesByKey,e,t)}has(e,t){let i=this.valuesByKey.get(e);return i!=null&&i.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(i=>i.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,i])=>i.has(e)).map(([t,i])=>t)}};var ri=class{constructor(e,t,i,s){this._selector=t,this.details=s,this.elementObserver=new Ht(e,this),this.delegate=i,this.matchesByElement=new me}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let i=e.matches(t);return this.delegate.selectorMatchElement?i&&this.delegate.selectorMatchElement(e,this.details):i}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let i=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return i.concat(s)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let i of t)this.selectorUnmatched(e,i)}elementAttributeChanged(e,t){let{selector:i}=this;if(i){let s=this.matchElement(e),n=this.matchesByElement.has(i,e);s&&!n?this.selectorMatched(e,i):!s&&n&&this.selectorUnmatched(e,i)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},ii=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(i=>this.processMutations(i))}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(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let i=this.delegate.getStringMapKeyForAttribute(e);if(i!=null){this.stringMap.has(e)||this.stringMapKeyAdded(i,e);let s=this.element.getAttribute(e);if(this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,i,t),s==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(i,e,n)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,i){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,i)}stringMapKeyRemoved(e,t,i){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,i)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},Nt=class{constructor(e,t,i){this.attributeObserver=new qt(e,t,this),this.delegate=i,this.tokensByElement=new me}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,i]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(i)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),i=this.readTokensForElement(e),s=ko(t,i).findIndex(([n,o])=>!Oo(n,o));return s==-1?[[],[]]:[t.slice(s),i.slice(s)]}readTokensForElement(e){let t=this.attributeName,i=e.getAttribute(t)||"";return xo(i,e,t)}};function xo(r,e,t){return r.trim().split(/\s+/).filter(i=>i.length).map((i,s)=>({element:e,attributeName:t,content:i,index:s}))}function ko(r,e){let t=Math.max(r.length,e.length);return Array.from({length:t},(i,s)=>[r[s],e[s]])}function Oo(r,e){return r&&e&&r.index==e.index&&r.content==e.content}var Vt=class{constructor(e,t,i){this.tokenListObserver=new Nt(e,t,this),this.delegate=i,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(e){let{element:t}=e,{value:i}=this.fetchParseResultForToken(e);i&&(this.fetchValuesByTokenForElement(t).set(e,i),this.delegate.elementMatchedValue(t,i))}tokenUnmatched(e){let{element:t}=e,{value:i}=this.fetchParseResultForToken(e);i&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,i))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},si=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new Vt(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(e){let t=new ti(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=ei.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},ni=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new ii(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(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let i=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,i.writer(this.receiver[e]),i.writer(i.defaultValue))}stringMapValueChanged(e,t,i){let s=this.valueDescriptorNameMap[t];e!==null&&(i===null&&(i=s.writer(s.defaultValue)),this.invokeChangedCallback(t,e,i))}stringMapKeyRemoved(e,t,i){let s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),i):this.invokeChangedCallback(e,s.writer(s.defaultValue),i)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:i,writer:s}of this.valueDescriptors)i!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,s(i),void 0)}invokeChangedCallback(e,t,i){let s=`${e}Changed`,n=this.receiver[s];if(typeof n=="function"){let o=this.valueDescriptorNameMap[e];try{let a=o.reader(t),d=i;i&&(d=o.reader(i)),n.call(this.receiver,a,d)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let i=this.valueDescriptorMap[t];e[i.name]=i}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],i=`has${Et(t.name)}`;return this.receiver[i]}},oi=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new me}start(){this.tokenListObserver||(this.tokenListObserver=new Nt(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var i;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(i=this.tokenListObserver)===null||i===void 0||i.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var i;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(i=this.tokenListObserver)===null||i===void 0||i.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function _t(r,e){let t=js(r);return Array.from(t.reduce((i,s)=>(Mo(s,e).forEach(n=>i.add(n)),i),new Set))}function Io(r,e){return js(r).reduce((i,s)=>(i.push(...Po(s,e)),i),[])}function js(r){let e=[];for(;r;)e.push(r),r=Object.getPrototypeOf(r);return e.reverse()}function Mo(r,e){let t=r[e];return Array.isArray(t)?t:[]}function Po(r,e){let t=r[e];return t?Object.keys(t).map(i=>[i,t[i]]):[]}var ai=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new me,this.outletElementsByName=new me,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:i}){let s=this.getOutlet(e,i);s&&this.connectOutlet(s,e,i)}selectorUnmatched(e,t,{outletName:i}){let s=this.getOutletFromMap(e,i);s&&this.disconnectOutlet(s,e,i)}selectorMatchElement(e,{outletName:t}){let i=this.selector(t),s=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return i?s&&n&&e.matches(i):!1}elementMatchedAttribute(e,t){let i=this.getOutletNameFromOutletAttributeName(t);i&&this.updateSelectorObserverForOutlet(i)}elementAttributeValueChanged(e,t){let i=this.getOutletNameFromOutletAttributeName(t);i&&this.updateSelectorObserverForOutlet(i)}elementUnmatchedAttribute(e,t){let i=this.getOutletNameFromOutletAttributeName(t);i&&this.updateSelectorObserverForOutlet(i)}connectOutlet(e,t,i){var s;this.outletElementsByName.has(i,t)||(this.outletsByName.add(i,e),this.outletElementsByName.add(i,t),(s=this.selectorObserverMap.get(i))===null||s===void 0||s.pause(()=>this.delegate.outletConnected(e,t,i)))}disconnectOutlet(e,t,i){var s;this.outletElementsByName.has(i,t)&&(this.outletsByName.delete(i,e),this.outletElementsByName.delete(i,t),(s=this.selectorObserverMap.get(i))===null||s===void 0||s.pause(()=>this.delegate.outletDisconnected(e,t,i)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let i of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(i,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),i=new ri(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,i),i.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),i=new qt(this.scope.element,t,this);this.attributeObserverMap.set(e,i),i.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new me;return this.router.modules.forEach(t=>{let i=t.definition.controllerConstructor;_t(i,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(i=>i.element===e)}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}},li=class{constructor(e,t){this.logDebugActivity=(i,s={})=>{let{identifier:n,controller:o,element:a}=this;s=Object.assign({identifier:n,controller:o,element:a},s),this.application.logDebugActivity(this.identifier,i,s)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new si(this,this.dispatcher),this.valueObserver=new ni(this,this.controller),this.targetObserver=new oi(this,this),this.outletObserver=new ai(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(i){this.handleError(i,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"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(e,t,i={}){let{identifier:s,controller:n,element:o}=this;i=Object.assign({identifier:s,controller:n,element:o},i),this.application.handleError(e,`Error ${t}`,i)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,i){this.invokeControllerMethod(`${Qr(i)}OutletConnected`,e,t)}outletDisconnected(e,t,i){this.invokeControllerMethod(`${Qr(i)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let i=this.controller;typeof i[e]=="function"&&i[e](...t)}};function Ro(r){return Fo(r,Bo(r))}function Fo(r,e){let t=No(r),i=Do(r.prototype,e);return Object.defineProperties(t.prototype,i),t}function Bo(r){return _t(r,"blessings").reduce((t,i)=>{let s=i(r);for(let n in s){let o=t[n]||{};t[n]=Object.assign(o,s[n])}return t},{})}function Do(r,e){return qo(e).reduce((t,i)=>{let s=Ho(r,e,i);return s&&Object.assign(t,{[i]:s}),t},{})}function Ho(r,e,t){let i=Object.getOwnPropertyDescriptor(r,t);if(!(i&&"value"in i)){let n=Object.getOwnPropertyDescriptor(e,t).value;return i&&(n.get=i.get||n.get,n.set=i.set||n.set),n}}var qo=typeof Object.getOwnPropertySymbols=="function"?r=>[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)]:Object.getOwnPropertyNames,No=(()=>{function r(t){function i(){return Reflect.construct(t,arguments,new.target)}return i.prototype=Object.create(t.prototype,{constructor:{value:i}}),Reflect.setPrototypeOf(i,t),i}function e(){let i=r(function(){this.a.call(this)});return i.prototype.a=function(){},new i}try{return e(),r}catch{return i=>class extends i{}}})();function Vo(r){return{identifier:r.identifier,controllerConstructor:Ro(r.controllerConstructor)}}var ci=class{constructor(e,t){this.application=e,this.definition=Vo(t),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(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new li(this,e),this.contextsByScope.set(e,t)),t}},hi=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return _o(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},di=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let i=this.getAttributeNameForKey(e);return this.element.setAttribute(i,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${Ns(e)}`}},ui=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,i){let s=this.warnedKeysByObject.get(e);s||(s=new Set,this.warnedKeysByObject.set(e,s)),s.has(t)||(s.add(t),this.logger.warn(i,e))}};function fi(r,e){return`[${r}~="${e}"]`}var pi=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,i)=>t||this.findTarget(i)||this.findLegacyTarget(i),void 0)}findAll(...e){return e.reduce((t,i)=>[...t,...this.findAllTargets(i),...this.findAllLegacyTargets(i)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return fi(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(i=>this.deprecate(i,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return fi(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:i}=this,s=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(i);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${i}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},mi=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,i)=>t||this.findOutlet(i),void 0)}findAll(...e){return e.reduce((t,i)=>[...t,...this.findAllOutlets(i)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))}matchesElement(e,t,i){let s=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&s.split(" ").includes(i)}},gi=class r{constructor(e,t,i,s){this.targets=new pi(this),this.classes=new hi(this),this.data=new di(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=i,this.guide=new ui(s),this.outlets=new mi(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return fi(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new r(this.schema,document.documentElement,this.identifier,this.guide.logger)}},vi=class{constructor(e,t,i){this.element=e,this.schema=t,this.delegate=i,this.valueListObserver=new Vt(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(e){let{element:t,content:i}=e;return this.parseValueForElementAndIdentifier(t,i)}parseValueForElementAndIdentifier(e,t){let i=this.fetchScopesByIdentifierForElement(e),s=i.get(t);return s||(s=this.delegate.createScopeForElementAndIdentifier(e,t),i.set(t,s)),s}elementMatchedValue(e,t){let i=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,i),i==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let i=this.scopeReferenceCounts.get(t);i&&(this.scopeReferenceCounts.set(t,i-1),i==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},bi=class{constructor(e){this.application=e,this.scopeObserver=new vi(this.element,this.schema,this),this.scopesByIdentifier=new me,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((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new ci(this.application,e);this.connectModule(t);let i=e.controllerConstructor.afterLoad;i&&i.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let i=this.modulesByIdentifier.get(t);if(i)return i.contexts.find(s=>s.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let i=this.scopeObserver.parseValueForElementAndIdentifier(e,t);i?this.scopeObserver.elementMatchedValue(i.element,i):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,i){this.application.handleError(e,t,i)}createScopeForElementAndIdentifier(e,t){return new gi(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(i=>e.connectContextForScope(i))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(i=>e.disconnectContextForScope(i))}},jo={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:r=>`data-${r}-target`,outletAttributeForScope:(r,e)=>`data-${r}-${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"},Rs("abcdefghijklmnopqrstuvwxyz".split("").map(r=>[r,r]))),Rs("0123456789".split("").map(r=>[r,r])))};function Rs(r){return r.reduce((e,[t,i])=>Object.assign(Object.assign({},e),{[t]:i}),{})}var jt=class{constructor(e=document.documentElement,t=jo){this.logger=console,this.debug=!1,this.logDebugActivity=(i,s,n={})=>{this.debug&&this.logFormattedMessage(i,s,n)},this.element=e,this.schema=t,this.dispatcher=new Gr(this),this.router=new bi(this),this.actionDescriptorFilters=Object.assign({},go)}static start(e,t){let i=new this(e,t);return i.start(),i}async start(){await Wo(),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(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>{s.controllerConstructor.shouldLoad&&this.router.loadDefinition(s)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>this.router.unloadIdentifier(s))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let i=this.router.getContextForElementAndIdentifier(e,t);return i?i.controller:null}handleError(e,t,i){var s;this.logger.error(`%s
|
2
2
|
|
3
3
|
%o
|
4
4
|
|
5
|
-
%o`,t,e,i),(s=window.onerror)===null||s===void 0||s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,i={}){i=Object.assign({application:this},i),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},i)),this.logger.groupEnd()}};function Vo(){return new Promise(r=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>r()):r()})}function jo(r){return _t(r,"classes").reduce((t,i)=>Object.assign(t,Wo(i)),{})}function Wo(r){return{[`${r}Class`]:{get(){let{classes:e}=this;if(e.has(r))return e.get(r);{let t=e.getAttributeName(r);throw new Error(`Missing attribute "${t}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${Et(r)}Class`]:{get(){return this.classes.has(r)}}}}function zo(r){return _t(r,"outlets").reduce((t,i)=>Object.assign(t,$o(i)),{})}function Ps(r,e,t){return r.application.getControllerForElementAndIdentifier(e,t)}function Rs(r,e,t){let i=Ps(r,e,t);if(i||(r.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),i=Ps(r,e,t),i))return i}function $o(r){let e=Jr(r);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(r),i=this.outlets.getSelectorForOutletName(r);if(t){let s=Rs(this,t,r);if(s)return s;throw new Error(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${i}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(r);return t.length>0?t.map(i=>{let s=Rs(this,i,r);if(s)return s;console.warn(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`,i)}).filter(i=>i):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(r),i=this.outlets.getSelectorForOutletName(r);if(t)return t;throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${i}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(r)}},[`has${Et(e)}Outlet`]:{get(){return this.outlets.has(r)}}}}function Uo(r){return _t(r,"targets").reduce((t,i)=>Object.assign(t,Ko(i)),{})}function Ko(r){return{[`${r}Target`]:{get(){let e=this.targets.find(r);if(e)return e;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${Et(r)}Target`]:{get(){return this.targets.has(r)}}}}function Xo(r){let e=ko(r,"values"),t={valueDescriptorMap:{get(){return e.reduce((i,s)=>{let n=Vs(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(i,{[o]:n})},{})}}};return e.reduce((i,s)=>Object.assign(i,Yo(s)),t)}function Yo(r,e){let t=Vs(r,e),{key:i,name:s,reader:n,writer:o}=t;return{[s]:{get(){let a=this.data.get(i);return a!==null?n(a):t.defaultValue},set(a){a===void 0?this.data.delete(i):this.data.set(i,o(a))}},[`has${Et(s)}`]:{get(){return this.data.has(i)||t.hasCustomDefaultValue}}}}function Vs([r,e],t){return Zo({controller:t,token:r,typeDefinition:e})}function Wt(r){switch(r){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function wt(r){switch(typeof r){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(r))return"array";if(Object.prototype.toString.call(r)==="[object Object]")return"object"}function Jo(r){let{controller:e,token:t,typeObject:i}=r,s=ks(i.type),n=ks(i.default),o=s&&n,a=s&&!n,d=!s&&n,f=Wt(i.type),u=wt(r.typeObject.default);if(a)return f;if(d)return u;if(f!==u){let _=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${_}" must match the defined type "${f}". The provided default value of "${i.default}" is of type "${u}".`)}if(o)return f}function Go(r){let{controller:e,token:t,typeDefinition:i}=r,n=Jo({controller:e,token:t,typeObject:i}),o=wt(i),a=Wt(i),d=n||o||a;if(d)return d;let f=e?`${e}.${i}`:t;throw new Error(`Unknown value type "${f}" for "${t}" value`)}function Qo(r){let e=Wt(r);if(e)return Fs[e];let t=Gr(r,"default"),i=Gr(r,"type"),s=r;if(t)return s.default;if(i){let{type:n}=s,o=Wt(n);if(o)return Fs[o]}return r}function Zo(r){let{token:e,typeDefinition:t}=r,i=`${Hs(e)}-value`,s=Go(r);return{type:s,key:i,name:vi(i),get defaultValue(){return Qo(t)},get hasCustomDefaultValue(){return wt(t)!==void 0},reader:ea[s],writer:Bs[s]||Bs.default}}var Fs={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},ea={array(r){let e=JSON.parse(r);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${r}" of type "${wt(e)}"`);return e},boolean(r){return!(r=="0"||String(r).toLowerCase()=="false")},number(r){return Number(r.replace(/_/g,""))},object(r){let e=JSON.parse(r);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${r}" of type "${wt(e)}"`);return e},string(r){return r}},Bs={default:ta,array:Ds,object:Ds};function Ds(r){return JSON.stringify(r)}function ta(r){return`${r}`}var w=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}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(e,{target:t=this.element,detail:i={},prefix:s=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let a=s?`${s}:${e}`:e,d=new CustomEvent(a,{detail:i,bubbles:n,cancelable:o});return t.dispatchEvent(d),d}};w.blessings=[jo,Uo,Xo,zo];w.targets=[];w.outlets=[];w.values={};var zt=class extends w{connect(){console.log(`resource-layout connected: ${this.element}`)}};var $t=class extends w{connect(){console.log(`nav-grid-menu-item connected: ${this.element}`)}};var Ut=class extends w{connect(){console.log(`nav-grid-menu connected: ${this.element}`)}};var Kt=class extends w{connect(){console.log(`nav-user-section connected: ${this.element}`)}};var Xt=class extends w{connect(){console.log(`nav-user-link connected: ${this.element}`)}};var Yt=class extends w{connect(){console.log(`nav-user connected: ${this.element}`)}};var Jt=class extends w{connect(){console.log(`resource-header connected: ${this.element}`)}};var Gt=class extends w{connect(){console.log(`sidebar-menu-item connected: ${this.element}`)}};var Qt=class extends w{connect(){console.log(`sidebar-menu connected: ${this.element}`)}};var Zt=class extends w{connect(){console.log(`has-many-panel connected: ${this.element}`)}};var er=class extends w{static targets=["target","template","addButton"];static values={wrapperSelector:{type:String,default:".nested-resource-form-fields"},limit:Number};connect(){this.updateState()}add(r){r.preventDefault();let e=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",e);let t=new CustomEvent("nested-resource-form-fields:add",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}remove(r){r.preventDefault();let e=r.target.closest(this.wrapperSelectorValue);if(e.dataset.newRecord==="true")e.remove();else{e.style.display="none";let i=e.querySelector("input[name*='_destroy']");i.value="1"}let t=new CustomEvent("nested-resource-form-fields:remove",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}updateState(){!this.hasAddButtonTarget||this.limitValue==0||(this.childCount>=this.limitValue?this.addButtonTarget.style.display="none":this.addButtonTarget.style.display="initial")}get childCount(){return this.element.querySelectorAll(this.wrapperSelectorValue).length}};var tr=class extends w{connect(){console.log(`toolbar connected: ${this.element}`)}};var rr=class extends w{connect(){console.log(`table-search-input connected: ${this.element}`)}};var ir=class extends w{connect(){console.log(`table-toolbar connected: ${this.element}`)}};var sr=class extends w{connect(){console.log(`table connected: ${this.element}`)}};var Ih=uo($s(),1),nr=class extends w{connect(){console.log(`form connected: ${this.element}`)}submit(){this.element.requestSubmit()}};var ya=function(){function r(e,t){t===void 0&&(t=[]),this._eventType=e,this._eventFunctions=t}return r.prototype.init=function(){var e=this;this._eventFunctions.forEach(function(t){typeof window<"u"&&window.addEventListener(e._eventType,t)})},r}(),Us=ya;var wa=function(){function r(){this._instances={Accordion:{},Carousel:{},Collapse:{},Dial:{},Dismiss:{},Drawer:{},Dropdown:{},Modal:{},Popover:{},Tabs:{},Tooltip:{},InputCounter:{},CopyClipboard:{}}}return r.prototype.addInstance=function(e,t,i,s){if(s===void 0&&(s=!1),!this._instances[e])return console.warn("Flowbite: Component ".concat(e," does not exist.")),!1;if(this._instances[e][i]&&!s){console.warn("Flowbite: Instance with ID ".concat(i," already exists."));return}s&&this._instances[e][i]&&this._instances[e][i].destroyAndRemoveInstance(),this._instances[e][i||this._generateRandomId()]=t},r.prototype.getAllInstances=function(){return this._instances},r.prototype.getInstances=function(e){return this._instances[e]?this._instances[e]:(console.warn("Flowbite: Component ".concat(e," does not exist.")),!1)},r.prototype.getInstance=function(e,t){if(this._componentAndInstanceCheck(e,t)){if(!this._instances[e][t]){console.warn("Flowbite: Instance with ID ".concat(t," does not exist."));return}return this._instances[e][t]}},r.prototype.destroyAndRemoveInstance=function(e,t){this._componentAndInstanceCheck(e,t)&&(this.destroyInstanceObject(e,t),this.removeInstance(e,t))},r.prototype.removeInstance=function(e,t){this._componentAndInstanceCheck(e,t)&&delete this._instances[e][t]},r.prototype.destroyInstanceObject=function(e,t){this._componentAndInstanceCheck(e,t)&&this._instances[e][t].destroy()},r.prototype.instanceExists=function(e,t){return!(!this._instances[e]||!this._instances[e][t])},r.prototype._generateRandomId=function(){return Math.random().toString(36).substr(2,9)},r.prototype._componentAndInstanceCheck=function(e,t){return this._instances[e]?this._instances[e][t]?!0:(console.warn("Flowbite: Instance with ID ".concat(t," does not exist.")),!1):(console.warn("Flowbite: Component ".concat(e," does not exist.")),!1)},r}(),Ks=new wa,b=Ks;typeof window<"u"&&(window.FlowbiteInstances=Ks);var or=function(){return or=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},or.apply(this,arguments)},ar={alwaysOpen:!1,activeClasses:"bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white",inactiveClasses:"text-gray-500 dark:text-gray-400",onOpen:function(){},onClose:function(){},onToggle:function(){}},Ea={id:null,override:!0},Xs=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=[]),i===void 0&&(i=ar),s===void 0&&(s=Ea),this._instanceId=s.id?s.id:e.id,this._accordionEl=e,this._items=t,this._options=or(or({},ar),i),this._initialized=!1,this.init(),b.addInstance("Accordion",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._items.length&&!this._initialized&&(this._items.forEach(function(t){t.active&&e.open(t.id);var i=function(){e.toggle(t.id)};t.triggerEl.addEventListener("click",i),t.clickHandler=i}),this._initialized=!0)},r.prototype.destroy=function(){this._items.length&&this._initialized&&(this._items.forEach(function(e){e.triggerEl.removeEventListener("click",e.clickHandler),delete e.clickHandler}),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Accordion",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.getItem=function(e){return this._items.filter(function(t){return t.id===e})[0]},r.prototype.open=function(e){var t,i,s=this,n=this.getItem(e);this._options.alwaysOpen||this._items.map(function(o){var a,d;o!==n&&((a=o.triggerEl.classList).remove.apply(a,s._options.activeClasses.split(" ")),(d=o.triggerEl.classList).add.apply(d,s._options.inactiveClasses.split(" ")),o.targetEl.classList.add("hidden"),o.triggerEl.setAttribute("aria-expanded","false"),o.active=!1,o.iconEl&&o.iconEl.classList.add("rotate-180"))}),(t=n.triggerEl.classList).add.apply(t,this._options.activeClasses.split(" ")),(i=n.triggerEl.classList).remove.apply(i,this._options.inactiveClasses.split(" ")),n.triggerEl.setAttribute("aria-expanded","true"),n.targetEl.classList.remove("hidden"),n.active=!0,n.iconEl&&n.iconEl.classList.remove("rotate-180"),this._options.onOpen(this,n)},r.prototype.toggle=function(e){var t=this.getItem(e);t.active?this.close(e):this.open(e),this._options.onToggle(this,t)},r.prototype.close=function(e){var t,i,s=this.getItem(e);(t=s.triggerEl.classList).remove.apply(t,this._options.activeClasses.split(" ")),(i=s.triggerEl.classList).add.apply(i,this._options.inactiveClasses.split(" ")),s.targetEl.classList.add("hidden"),s.triggerEl.setAttribute("aria-expanded","false"),s.active=!1,s.iconEl&&s.iconEl.classList.add("rotate-180"),this._options.onClose(this,s)},r.prototype.updateOnOpen=function(e){this._options.onOpen=e},r.prototype.updateOnClose=function(e){this._options.onClose=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function Ke(){document.querySelectorAll("[data-accordion]").forEach(function(r){var e=r.getAttribute("data-accordion"),t=r.getAttribute("data-active-classes"),i=r.getAttribute("data-inactive-classes"),s=[];r.querySelectorAll("[data-accordion-target]").forEach(function(n){if(n.closest("[data-accordion]")===r){var o={id:n.getAttribute("data-accordion-target"),triggerEl:n,targetEl:document.querySelector(n.getAttribute("data-accordion-target")),iconEl:n.querySelector("[data-accordion-icon]"),active:n.getAttribute("aria-expanded")==="true"};s.push(o)}}),new Xs(r,s,{alwaysOpen:e==="open",activeClasses:t||ar.activeClasses,inactiveClasses:i||ar.inactiveClasses})})}typeof window<"u"&&(window.Accordion=Xs,window.initAccordions=Ke);var lr=function(){return lr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},lr.apply(this,arguments)},Ys={onCollapse:function(){},onExpand:function(){},onToggle:function(){}},_a={id:null,override:!0},wi=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=Ys),s===void 0&&(s=_a),this._instanceId=s.id?s.id:e.id,this._targetEl=e,this._triggerEl=t,this._options=lr(lr({},Ys),i),this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Collapse",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._triggerEl&&this._targetEl&&!this._initialized&&(this._triggerEl.hasAttribute("aria-expanded")?this._visible=this._triggerEl.getAttribute("aria-expanded")==="true":this._visible=!this._targetEl.classList.contains("hidden"),this._clickHandler=function(){e.toggle()},this._triggerEl.addEventListener("click",this._clickHandler),this._initialized=!0)},r.prototype.destroy=function(){this._triggerEl&&this._initialized&&(this._triggerEl.removeEventListener("click",this._clickHandler),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Collapse",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.collapse=function(){this._targetEl.classList.add("hidden"),this._triggerEl&&this._triggerEl.setAttribute("aria-expanded","false"),this._visible=!1,this._options.onCollapse(this)},r.prototype.expand=function(){this._targetEl.classList.remove("hidden"),this._triggerEl&&this._triggerEl.setAttribute("aria-expanded","true"),this._visible=!0,this._options.onExpand(this)},r.prototype.toggle=function(){this._visible?this.collapse():this.expand(),this._options.onToggle(this)},r.prototype.updateOnCollapse=function(e){this._options.onCollapse=e},r.prototype.updateOnExpand=function(e){this._options.onExpand=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function Xe(){document.querySelectorAll("[data-collapse-toggle]").forEach(function(r){var e=r.getAttribute("data-collapse-toggle"),t=document.getElementById(e);t?b.instanceExists("Collapse",t.getAttribute("id"))?new wi(t,r,{},{id:t.getAttribute("id")+"_"+b._generateRandomId()}):new wi(t,r):console.error('The target element with id "'.concat(e,'" does not exist. Please check the data-collapse-toggle attribute.'))})}typeof window<"u"&&(window.Collapse=wi,window.initCollapses=Xe);var Ie=function(){return Ie=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Ie.apply(this,arguments)},cr={defaultPosition:0,indicators:{items:[],activeClasses:"bg-white dark:bg-gray-800",inactiveClasses:"bg-white/50 dark:bg-gray-800/50 hover:bg-white dark:hover:bg-gray-800"},interval:3e3,onNext:function(){},onPrev:function(){},onChange:function(){}},Sa={id:null,override:!0},Js=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=[]),i===void 0&&(i=cr),s===void 0&&(s=Sa),this._instanceId=s.id?s.id:e.id,this._carouselEl=e,this._items=t,this._options=Ie(Ie(Ie({},cr),i),{indicators:Ie(Ie({},cr.indicators),i.indicators)}),this._activeItem=this.getItem(this._options.defaultPosition),this._indicators=this._options.indicators.items,this._intervalDuration=this._options.interval,this._intervalInstance=null,this._initialized=!1,this.init(),b.addInstance("Carousel",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._items.length&&!this._initialized&&(this._items.map(function(t){t.el.classList.add("absolute","inset-0","transition-transform","transform")}),this.getActiveItem()?this.slideTo(this.getActiveItem().position):this.slideTo(0),this._indicators.map(function(t,i){t.el.addEventListener("click",function(){e.slideTo(i)})}),this._initialized=!0)},r.prototype.destroy=function(){this._initialized&&(this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Carousel",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.getItem=function(e){return this._items[e]},r.prototype.slideTo=function(e){var t=this._items[e],i={left:t.position===0?this._items[this._items.length-1]:this._items[t.position-1],middle:t,right:t.position===this._items.length-1?this._items[0]:this._items[t.position+1]};this._rotate(i),this._setActiveItem(t),this._intervalInstance&&(this.pause(),this.cycle()),this._options.onChange(this)},r.prototype.next=function(){var e=this.getActiveItem(),t=null;e.position===this._items.length-1?t=this._items[0]:t=this._items[e.position+1],this.slideTo(t.position),this._options.onNext(this)},r.prototype.prev=function(){var e=this.getActiveItem(),t=null;e.position===0?t=this._items[this._items.length-1]:t=this._items[e.position-1],this.slideTo(t.position),this._options.onPrev(this)},r.prototype._rotate=function(e){if(this._items.map(function(t){t.el.classList.add("hidden")}),this._items.length===1){e.middle.el.classList.remove("-translate-x-full","translate-x-full","translate-x-0","hidden","z-10"),e.middle.el.classList.add("translate-x-0","z-20");return}e.left.el.classList.remove("-translate-x-full","translate-x-full","translate-x-0","hidden","z-20"),e.left.el.classList.add("-translate-x-full","z-10"),e.middle.el.classList.remove("-translate-x-full","translate-x-full","translate-x-0","hidden","z-10"),e.middle.el.classList.add("translate-x-0","z-30"),e.right.el.classList.remove("-translate-x-full","translate-x-full","translate-x-0","hidden","z-30"),e.right.el.classList.add("translate-x-full","z-20")},r.prototype.cycle=function(){var e=this;typeof window<"u"&&(this._intervalInstance=window.setInterval(function(){e.next()},this._intervalDuration))},r.prototype.pause=function(){clearInterval(this._intervalInstance)},r.prototype.getActiveItem=function(){return this._activeItem},r.prototype._setActiveItem=function(e){var t,i,s=this;this._activeItem=e;var n=e.position;this._indicators.length&&(this._indicators.map(function(o){var a,d;o.el.setAttribute("aria-current","false"),(a=o.el.classList).remove.apply(a,s._options.indicators.activeClasses.split(" ")),(d=o.el.classList).add.apply(d,s._options.indicators.inactiveClasses.split(" "))}),(t=this._indicators[n].el.classList).add.apply(t,this._options.indicators.activeClasses.split(" ")),(i=this._indicators[n].el.classList).remove.apply(i,this._options.indicators.inactiveClasses.split(" ")),this._indicators[n].el.setAttribute("aria-current","true"))},r.prototype.updateOnNext=function(e){this._options.onNext=e},r.prototype.updateOnPrev=function(e){this._options.onPrev=e},r.prototype.updateOnChange=function(e){this._options.onChange=e},r}();function Ye(){document.querySelectorAll("[data-carousel]").forEach(function(r){var e=r.getAttribute("data-carousel-interval"),t=r.getAttribute("data-carousel")==="slide",i=[],s=0;r.querySelectorAll("[data-carousel-item]").length&&Array.from(r.querySelectorAll("[data-carousel-item]")).map(function(f,u){i.push({position:u,el:f}),f.getAttribute("data-carousel-item")==="active"&&(s=u)});var n=[];r.querySelectorAll("[data-carousel-slide-to]").length&&Array.from(r.querySelectorAll("[data-carousel-slide-to]")).map(function(f){n.push({position:parseInt(f.getAttribute("data-carousel-slide-to")),el:f})});var o=new Js(r,i,{defaultPosition:s,indicators:{items:n},interval:e||cr.interval});t&&o.cycle();var a=r.querySelector("[data-carousel-next]"),d=r.querySelector("[data-carousel-prev]");a&&a.addEventListener("click",function(){o.next()}),d&&d.addEventListener("click",function(){o.prev()})})}typeof window<"u"&&(window.Carousel=Js,window.initCarousels=Ye);var hr=function(){return hr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},hr.apply(this,arguments)},Gs={transition:"transition-opacity",duration:300,timing:"ease-out",onHide:function(){}},Aa={id:null,override:!0},Ei=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=Gs),s===void 0&&(s=Aa),this._instanceId=s.id?s.id:e.id,this._targetEl=e,this._triggerEl=t,this._options=hr(hr({},Gs),i),this._initialized=!1,this.init(),b.addInstance("Dismiss",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._triggerEl&&this._targetEl&&!this._initialized&&(this._clickHandler=function(){e.hide()},this._triggerEl.addEventListener("click",this._clickHandler),this._initialized=!0)},r.prototype.destroy=function(){this._triggerEl&&this._initialized&&(this._triggerEl.removeEventListener("click",this._clickHandler),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Dismiss",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.hide=function(){var e=this;this._targetEl.classList.add(this._options.transition,"duration-".concat(this._options.duration),this._options.timing,"opacity-0"),setTimeout(function(){e._targetEl.classList.add("hidden")},this._options.duration),this._options.onHide(this,this._targetEl)},r.prototype.updateOnHide=function(e){this._options.onHide=e},r}();function Je(){document.querySelectorAll("[data-dismiss-target]").forEach(function(r){var e=r.getAttribute("data-dismiss-target"),t=document.querySelector(e);t?new Ei(t,r):console.error('The dismiss element with id "'.concat(e,'" does not exist. Please check the data-dismiss-target attribute.'))})}typeof window<"u"&&(window.Dismiss=Ei,window.initDismisses=Je);var _i=Ei;var N="top",U="bottom",z="right",W="left",dr="auto",we=[N,U,z,W],ge="start",Me="end",Qs="clippingParents",ur="viewport",Ge="popper",Zs="reference",Si=we.reduce(function(r,e){return r.concat([e+"-"+ge,e+"-"+Me])},[]),fr=[].concat(we,[dr]).reduce(function(r,e){return r.concat([e,e+"-"+ge,e+"-"+Me])},[]),La="beforeRead",Ta="read",Ca="afterRead",xa="beforeMain",ka="main",Oa="afterMain",Ia="beforeWrite",Ma="write",Pa="afterWrite",en=[La,Ta,Ca,xa,ka,Oa,Ia,Ma,Pa];function Y(r){return r?(r.nodeName||"").toLowerCase():null}function D(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function ie(r){var e=D(r).Element;return r instanceof e||r instanceof Element}function K(r){var e=D(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function Qe(r){if(typeof ShadowRoot>"u")return!1;var e=D(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function Ra(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},s=e.attributes[t]||{},n=e.elements[t];!K(n)||!Y(n)||(Object.assign(n.style,i),Object.keys(s).forEach(function(o){var a=s[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function Fa(r){var e=r.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var s=e.elements[i],n=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(d,f){return d[f]="",d},{});!K(s)||!Y(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(d){s.removeAttribute(d)}))})}}var tn={name:"applyStyles",enabled:!0,phase:"write",fn:Ra,effect:Fa,requires:["computeStyles"]};function J(r){return r.split("-")[0]}var le=Math.max,Pe=Math.min,ve=Math.round;function Ze(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function St(){return!/^((?!chrome|android).)*safari/i.test(Ze())}function se(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=r.getBoundingClientRect(),s=1,n=1;e&&K(r)&&(s=r.offsetWidth>0&&ve(i.width)/r.offsetWidth||1,n=r.offsetHeight>0&&ve(i.height)/r.offsetHeight||1);var o=ie(r)?D(r):window,a=o.visualViewport,d=!St()&&t,f=(i.left+(d&&a?a.offsetLeft:0))/s,u=(i.top+(d&&a?a.offsetTop:0))/n,_=i.width/s,E=i.height/n;return{width:_,height:E,top:u,right:f+_,bottom:u+E,left:f,x:f,y:u}}function Re(r){var e=se(r),t=r.offsetWidth,i=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:i}}function At(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&Qe(t)){var i=e;do{if(i&&r.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function Z(r){return D(r).getComputedStyle(r)}function Ai(r){return["table","td","th"].indexOf(Y(r))>=0}function Q(r){return((ie(r)?r.ownerDocument:r.document)||window.document).documentElement}function be(r){return Y(r)==="html"?r:r.assignedSlot||r.parentNode||(Qe(r)?r.host:null)||Q(r)}function rn(r){return!K(r)||Z(r).position==="fixed"?null:r.offsetParent}function Ba(r){var e=/firefox/i.test(Ze()),t=/Trident/i.test(Ze());if(t&&K(r)){var i=Z(r);if(i.position==="fixed")return null}var s=be(r);for(Qe(s)&&(s=s.host);K(s)&&["html","body"].indexOf(Y(s))<0;){var n=Z(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function ce(r){for(var e=D(r),t=rn(r);t&&Ai(t)&&Z(t).position==="static";)t=rn(t);return t&&(Y(t)==="html"||Y(t)==="body"&&Z(t).position==="static")?e:t||Ba(r)||e}function Fe(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function Be(r,e,t){return le(r,Pe(e,t))}function sn(r,e,t){var i=Be(r,e,t);return i>t?t:i}function Lt(){return{top:0,right:0,bottom:0,left:0}}function Tt(r){return Object.assign({},Lt(),r)}function Ct(r,e){return e.reduce(function(t,i){return t[i]=r,t},{})}var Da=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Tt(typeof e!="number"?e:Ct(e,we))};function Ha(r){var e,t=r.state,i=r.name,s=r.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=J(t.placement),d=Fe(a),f=[W,z].indexOf(a)>=0,u=f?"height":"width";if(!(!n||!o)){var _=Da(s.padding,t),E=Re(n),y=d==="y"?N:W,O=d==="y"?U:z,T=t.rects.reference[u]+t.rects.reference[d]-o[d]-t.rects.popper[u],S=o[d]-t.rects.reference[d],x=ce(n),I=x?d==="y"?x.clientHeight||0:x.clientWidth||0:0,M=T/2-S/2,L=_[y],C=I-E[u]-_[O],v=I/2-E[u]/2+M,k=Be(L,v,C),P=d;t.modifiersData[i]=(e={},e[P]=k,e.centerOffset=k-v,e)}}function qa(r){var e=r.state,t=r.options,i=t.element,s=i===void 0?"[data-popper-arrow]":i;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||At(e.elements.popper,s)&&(e.elements.arrow=s))}var nn={name:"arrow",enabled:!0,phase:"main",fn:Ha,effect:qa,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ne(r){return r.split("-")[1]}var Na={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Va(r,e){var t=r.x,i=r.y,s=e.devicePixelRatio||1;return{x:ve(t*s)/s||0,y:ve(i*s)/s||0}}function on(r){var e,t=r.popper,i=r.popperRect,s=r.placement,n=r.variation,o=r.offsets,a=r.position,d=r.gpuAcceleration,f=r.adaptive,u=r.roundOffsets,_=r.isFixed,E=o.x,y=E===void 0?0:E,O=o.y,T=O===void 0?0:O,S=typeof u=="function"?u({x:y,y:T}):{x:y,y:T};y=S.x,T=S.y;var x=o.hasOwnProperty("x"),I=o.hasOwnProperty("y"),M=W,L=N,C=window;if(f){var v=ce(t),k="clientHeight",P="clientWidth";if(v===D(t)&&(v=Q(t),Z(v).position!=="static"&&a==="absolute"&&(k="scrollHeight",P="scrollWidth")),v=v,s===N||(s===W||s===z)&&n===Me){L=U;var F=_&&v===C&&C.visualViewport?C.visualViewport.height:v[k];T-=F-i.height,T*=d?1:-1}if(s===W||(s===N||s===U)&&n===Me){M=z;var V=_&&v===C&&C.visualViewport?C.visualViewport.width:v[P];y-=V-i.width,y*=d?1:-1}}var X=Object.assign({position:a},f&&Na),$=u===!0?Va({x:y,y:T},D(t)):{x:y,y:T};if(y=$.x,T=$.y,d){var j;return Object.assign({},X,(j={},j[L]=I?"0":"",j[M]=x?"0":"",j.transform=(C.devicePixelRatio||1)<=1?"translate("+y+"px, "+T+"px)":"translate3d("+y+"px, "+T+"px, 0)",j))}return Object.assign({},X,(e={},e[L]=I?T+"px":"",e[M]=x?y+"px":"",e.transform="",e))}function ja(r){var e=r.state,t=r.options,i=t.gpuAcceleration,s=i===void 0?!0:i,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,d=a===void 0?!0:a,f={placement:J(e.placement),variation:ne(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,on(Object.assign({},f,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:d})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,on(Object.assign({},f,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var an={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:ja,data:{}};var pr={passive:!0};function Wa(r){var e=r.state,t=r.instance,i=r.options,s=i.scroll,n=s===void 0?!0:s,o=i.resize,a=o===void 0?!0:o,d=D(e.elements.popper),f=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&f.forEach(function(u){u.addEventListener("scroll",t.update,pr)}),a&&d.addEventListener("resize",t.update,pr),function(){n&&f.forEach(function(u){u.removeEventListener("scroll",t.update,pr)}),a&&d.removeEventListener("resize",t.update,pr)}}var ln={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Wa,data:{}};var za={left:"right",right:"left",bottom:"top",top:"bottom"};function et(r){return r.replace(/left|right|bottom|top/g,function(e){return za[e]})}var $a={start:"end",end:"start"};function mr(r){return r.replace(/start|end/g,function(e){return $a[e]})}function De(r){var e=D(r),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function He(r){return se(Q(r)).left+De(r).scrollLeft}function Li(r,e){var t=D(r),i=Q(r),s=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,d=0;if(s){n=s.width,o=s.height;var f=St();(f||!f&&e==="fixed")&&(a=s.offsetLeft,d=s.offsetTop)}return{width:n,height:o,x:a+He(r),y:d}}function Ti(r){var e,t=Q(r),i=De(r),s=(e=r.ownerDocument)==null?void 0:e.body,n=le(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=le(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-i.scrollLeft+He(r),d=-i.scrollTop;return Z(s||t).direction==="rtl"&&(a+=le(t.clientWidth,s?s.clientWidth:0)-n),{width:n,height:o,x:a,y:d}}function qe(r){var e=Z(r),t=e.overflow,i=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+i)}function gr(r){return["html","body","#document"].indexOf(Y(r))>=0?r.ownerDocument.body:K(r)&&qe(r)?r:gr(be(r))}function Ee(r,e){var t;e===void 0&&(e=[]);var i=gr(r),s=i===((t=r.ownerDocument)==null?void 0:t.body),n=D(i),o=s?[n].concat(n.visualViewport||[],qe(i)?i:[]):i,a=e.concat(o);return s?a:a.concat(Ee(be(o)))}function tt(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function Ua(r,e){var t=se(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function cn(r,e,t){return e===ur?tt(Li(r,t)):ie(e)?Ua(e,t):tt(Ti(Q(r)))}function Ka(r){var e=Ee(be(r)),t=["absolute","fixed"].indexOf(Z(r).position)>=0,i=t&&K(r)?ce(r):r;return ie(i)?e.filter(function(s){return ie(s)&&At(s,i)&&Y(s)!=="body"}):[]}function Ci(r,e,t,i){var s=e==="clippingParents"?Ka(r):[].concat(e),n=[].concat(s,[t]),o=n[0],a=n.reduce(function(d,f){var u=cn(r,f,i);return d.top=le(u.top,d.top),d.right=Pe(u.right,d.right),d.bottom=Pe(u.bottom,d.bottom),d.left=le(u.left,d.left),d},cn(r,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function xt(r){var e=r.reference,t=r.element,i=r.placement,s=i?J(i):null,n=i?ne(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,d;switch(s){case N:d={x:o,y:e.y-t.height};break;case U:d={x:o,y:e.y+e.height};break;case z:d={x:e.x+e.width,y:a};break;case W:d={x:e.x-t.width,y:a};break;default:d={x:e.x,y:e.y}}var f=s?Fe(s):null;if(f!=null){var u=f==="y"?"height":"width";switch(n){case ge:d[f]=d[f]-(e[u]/2-t[u]/2);break;case Me:d[f]=d[f]+(e[u]/2-t[u]/2);break;default:}}return d}function he(r,e){e===void 0&&(e={});var t=e,i=t.placement,s=i===void 0?r.placement:i,n=t.strategy,o=n===void 0?r.strategy:n,a=t.boundary,d=a===void 0?Qs:a,f=t.rootBoundary,u=f===void 0?ur:f,_=t.elementContext,E=_===void 0?Ge:_,y=t.altBoundary,O=y===void 0?!1:y,T=t.padding,S=T===void 0?0:T,x=Tt(typeof S!="number"?S:Ct(S,we)),I=E===Ge?Zs:Ge,M=r.rects.popper,L=r.elements[O?I:E],C=Ci(ie(L)?L:L.contextElement||Q(r.elements.popper),d,u,o),v=se(r.elements.reference),k=xt({reference:v,element:M,strategy:"absolute",placement:s}),P=tt(Object.assign({},M,k)),F=E===Ge?P:v,V={top:C.top-F.top+x.top,bottom:F.bottom-C.bottom+x.bottom,left:C.left-F.left+x.left,right:F.right-C.right+x.right},X=r.modifiersData.offset;if(E===Ge&&X){var $=X[s];Object.keys(V).forEach(function(j){var ue=[z,U].indexOf(j)>=0?1:-1,pe=[N,U].indexOf(j)>=0?"y":"x";V[j]+=$[pe]*ue})}return V}function xi(r,e){e===void 0&&(e={});var t=e,i=t.placement,s=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,d=t.allowedAutoPlacements,f=d===void 0?fr:d,u=ne(i),_=u?a?Si:Si.filter(function(O){return ne(O)===u}):we,E=_.filter(function(O){return f.indexOf(O)>=0});E.length===0&&(E=_);var y=E.reduce(function(O,T){return O[T]=he(r,{placement:T,boundary:s,rootBoundary:n,padding:o})[J(T)],O},{});return Object.keys(y).sort(function(O,T){return y[O]-y[T]})}function Xa(r){if(J(r)===dr)return[];var e=et(r);return[mr(r),e,mr(e)]}function Ya(r){var e=r.state,t=r.options,i=r.name;if(!e.modifiersData[i]._skip){for(var s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!0:o,d=t.fallbackPlacements,f=t.padding,u=t.boundary,_=t.rootBoundary,E=t.altBoundary,y=t.flipVariations,O=y===void 0?!0:y,T=t.allowedAutoPlacements,S=e.options.placement,x=J(S),I=x===S,M=d||(I||!O?[et(S)]:Xa(S)),L=[S].concat(M).reduce(function(ee,ae){return ee.concat(J(ae)===dr?xi(e,{placement:ae,boundary:u,rootBoundary:_,padding:f,flipVariations:O,allowedAutoPlacements:T}):ae)},[]),C=e.rects.reference,v=e.rects.popper,k=new Map,P=!0,F=L[0],V=0;V<L.length;V++){var X=L[V],$=J(X),j=ne(X)===ge,ue=[N,U].indexOf($)>=0,pe=ue?"width":"height",l=he(e,{placement:X,boundary:u,rootBoundary:_,altBoundary:E,padding:f}),c=ue?j?z:W:j?U:N;C[pe]>v[pe]&&(c=et(c));var h=et(c),p=[];if(n&&p.push(l[$]<=0),a&&p.push(l[c]<=0,l[h]<=0),p.every(function(ee){return ee})){F=X,P=!1;break}k.set(X,p)}if(P)for(var m=O?3:1,g=function(ae){var R=L.find(function(te){var re=k.get(te);if(re)return re.slice(0,ae).every(function(ke){return ke})});if(R)return F=R,"break"},A=m;A>0;A--){var B=g(A);if(B==="break")break}e.placement!==F&&(e.modifiersData[i]._skip=!0,e.placement=F,e.reset=!0)}}var hn={name:"flip",enabled:!0,phase:"main",fn:Ya,requiresIfExists:["offset"],data:{_skip:!1}};function dn(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function un(r){return[N,z,U,W].some(function(e){return r[e]>=0})}function Ja(r){var e=r.state,t=r.name,i=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,o=he(e,{elementContext:"reference"}),a=he(e,{altBoundary:!0}),d=dn(o,i),f=dn(a,s,n),u=un(d),_=un(f);e.modifiersData[t]={referenceClippingOffsets:d,popperEscapeOffsets:f,isReferenceHidden:u,hasPopperEscaped:_},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":_})}var fn={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Ja};function Ga(r,e,t){var i=J(r),s=[W,N].indexOf(i)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*s,[W,z].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function Qa(r){var e=r.state,t=r.options,i=r.name,s=t.offset,n=s===void 0?[0,0]:s,o=fr.reduce(function(u,_){return u[_]=Ga(_,e.rects,n),u},{}),a=o[e.placement],d=a.x,f=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=d,e.modifiersData.popperOffsets.y+=f),e.modifiersData[i]=o}var pn={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Qa};function Za(r){var e=r.state,t=r.name;e.modifiersData[t]=xt({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var mn={name:"popperOffsets",enabled:!0,phase:"read",fn:Za,data:{}};function ki(r){return r==="x"?"y":"x"}function el(r){var e=r.state,t=r.options,i=r.name,s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!1:o,d=t.boundary,f=t.rootBoundary,u=t.altBoundary,_=t.padding,E=t.tether,y=E===void 0?!0:E,O=t.tetherOffset,T=O===void 0?0:O,S=he(e,{boundary:d,rootBoundary:f,padding:_,altBoundary:u}),x=J(e.placement),I=ne(e.placement),M=!I,L=Fe(x),C=ki(L),v=e.modifiersData.popperOffsets,k=e.rects.reference,P=e.rects.popper,F=typeof T=="function"?T(Object.assign({},e.rects,{placement:e.placement})):T,V=typeof F=="number"?{mainAxis:F,altAxis:F}:Object.assign({mainAxis:0,altAxis:0},F),X=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,$={x:0,y:0};if(v){if(n){var j,ue=L==="y"?N:W,pe=L==="y"?U:z,l=L==="y"?"height":"width",c=v[L],h=c+S[ue],p=c-S[pe],m=y?-P[l]/2:0,g=I===ge?k[l]:P[l],A=I===ge?-P[l]:-k[l],B=e.elements.arrow,ee=y&&B?Re(B):{width:0,height:0},ae=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Lt(),R=ae[ue],te=ae[pe],re=Be(0,k[l],ee[l]),ke=M?k[l]/2-m-re-R-V.mainAxis:g-re-R-V.mainAxis,$r=M?-k[l]/2+m+re+te+V.mainAxis:A+re+te+V.mainAxis,Ur=e.elements.arrow&&ce(e.elements.arrow),Zn=Ur?L==="y"?Ur.clientTop||0:Ur.clientLeft||0:0,ys=(j=X?.[L])!=null?j:0,eo=c+ke-ys-Zn,to=c+$r-ys,ws=Be(y?Pe(h,eo):h,c,y?le(p,to):p);v[L]=ws,$[L]=ws-c}if(a){var Es,ro=L==="x"?N:W,io=L==="x"?U:z,Oe=v[C],Bt=C==="y"?"height":"width",_s=Oe+S[ro],Ss=Oe-S[io],Kr=[N,W].indexOf(x)!==-1,As=(Es=X?.[C])!=null?Es:0,Ls=Kr?_s:Oe-k[Bt]-P[Bt]-As+V.altAxis,Ts=Kr?Oe+k[Bt]+P[Bt]-As-V.altAxis:Ss,Cs=y&&Kr?sn(Ls,Oe,Ts):Be(y?Ls:_s,Oe,y?Ts:Ss);v[C]=Cs,$[C]=Cs-Oe}e.modifiersData[i]=$}}var gn={name:"preventOverflow",enabled:!0,phase:"main",fn:el,requiresIfExists:["offset"]};function Oi(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function Ii(r){return r===D(r)||!K(r)?De(r):Oi(r)}function tl(r){var e=r.getBoundingClientRect(),t=ve(e.width)/r.offsetWidth||1,i=ve(e.height)/r.offsetHeight||1;return t!==1||i!==1}function Mi(r,e,t){t===void 0&&(t=!1);var i=K(e),s=K(e)&&tl(e),n=Q(e),o=se(r,s,t),a={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(i||!i&&!t)&&((Y(e)!=="body"||qe(n))&&(a=Ii(e)),K(e)?(d=se(e,!0),d.x+=e.clientLeft,d.y+=e.clientTop):n&&(d.x=He(n))),{x:o.left+a.scrollLeft-d.x,y:o.top+a.scrollTop-d.y,width:o.width,height:o.height}}function rl(r){var e=new Map,t=new Set,i=[];r.forEach(function(n){e.set(n.name,n)});function s(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var d=e.get(a);d&&s(d)}}),i.push(n)}return r.forEach(function(n){t.has(n.name)||s(n)}),i}function Pi(r){var e=rl(r);return en.reduce(function(t,i){return t.concat(e.filter(function(s){return s.phase===i}))},[])}function Ri(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function Fi(r){var e=r.reduce(function(t,i){var s=t[i.name];return t[i.name]=s?Object.assign({},s,i,{options:Object.assign({},s.options,i.options),data:Object.assign({},s.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var vn={placement:"bottom",modifiers:[],strategy:"absolute"};function bn(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function yn(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,i=t===void 0?[]:t,s=e.defaultOptions,n=s===void 0?vn:s;return function(a,d,f){f===void 0&&(f=n);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},vn,n),modifiersData:{},elements:{reference:a,popper:d},attributes:{},styles:{}},_=[],E=!1,y={state:u,setOptions:function(x){var I=typeof x=="function"?x(u.options):x;T(),u.options=Object.assign({},n,u.options,I),u.scrollParents={reference:ie(a)?Ee(a):a.contextElement?Ee(a.contextElement):[],popper:Ee(d)};var M=Pi(Fi([].concat(i,u.options.modifiers)));return u.orderedModifiers=M.filter(function(L){return L.enabled}),O(),y.update()},forceUpdate:function(){if(!E){var x=u.elements,I=x.reference,M=x.popper;if(bn(I,M)){u.rects={reference:Mi(I,ce(M),u.options.strategy==="fixed"),popper:Re(M)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(V){return u.modifiersData[V.name]=Object.assign({},V.data)});for(var L=0;L<u.orderedModifiers.length;L++){if(u.reset===!0){u.reset=!1,L=-1;continue}var C=u.orderedModifiers[L],v=C.fn,k=C.options,P=k===void 0?{}:k,F=C.name;typeof v=="function"&&(u=v({state:u,options:P,name:F,instance:y})||u)}}}},update:Ri(function(){return new Promise(function(S){y.forceUpdate(),S(u)})}),destroy:function(){T(),E=!0}};if(!bn(a,d))return y;y.setOptions(f).then(function(S){!E&&f.onFirstUpdate&&f.onFirstUpdate(S)});function O(){u.orderedModifiers.forEach(function(S){var x=S.name,I=S.options,M=I===void 0?{}:I,L=S.effect;if(typeof L=="function"){var C=L({state:u,name:x,instance:y,options:M}),v=function(){};_.push(C||v)}})}function T(){_.forEach(function(S){return S()}),_=[]}return y}}var il=[ln,mn,an,tn,pn,hn,gn,nn,fn],Ne=yn({defaultModifiers:il});var _e=function(){return _e=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},_e.apply(this,arguments)},vr=function(r,e,t){if(t||arguments.length===2)for(var i=0,s=e.length,n;i<s;i++)(n||!(i in e))&&(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return r.concat(n||Array.prototype.slice.call(e))},Se={placement:"bottom",triggerType:"click",offsetSkidding:0,offsetDistance:10,delay:300,ignoreClickOutsideClass:!1,onShow:function(){},onHide:function(){},onToggle:function(){}},sl={id:null,override:!0},Bi=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=Se),s===void 0&&(s=sl),this._instanceId=s.id?s.id:e.id,this._targetEl=e,this._triggerEl=t,this._options=_e(_e({},Se),i),this._popperInstance=null,this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Dropdown",this,this._instanceId,s.override)}return r.prototype.init=function(){this._triggerEl&&this._targetEl&&!this._initialized&&(this._popperInstance=this._createPopperInstance(),this._setupEventListeners(),this._initialized=!0)},r.prototype.destroy=function(){var e=this,t=this._getTriggerEvents();this._options.triggerType==="click"&&t.showEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._clickHandler)}),this._options.triggerType==="hover"&&(t.showEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._hoverShowTriggerElHandler),e._targetEl.removeEventListener(i,e._hoverShowTargetElHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._hoverHideHandler),e._targetEl.removeEventListener(i,e._hoverHideHandler)})),this._popperInstance.destroy(),this._initialized=!1},r.prototype.removeInstance=function(){b.removeInstance("Dropdown",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype._setupEventListeners=function(){var e=this,t=this._getTriggerEvents();this._clickHandler=function(){e.toggle()},this._options.triggerType==="click"&&t.showEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._clickHandler)}),this._hoverShowTriggerElHandler=function(i){i.type==="click"?e.toggle():setTimeout(function(){e.show()},e._options.delay)},this._hoverShowTargetElHandler=function(){e.show()},this._hoverHideHandler=function(){setTimeout(function(){e._targetEl.matches(":hover")||e.hide()},e._options.delay)},this._options.triggerType==="hover"&&(t.showEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._hoverShowTriggerElHandler),e._targetEl.addEventListener(i,e._hoverShowTargetElHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._hoverHideHandler),e._targetEl.addEventListener(i,e._hoverHideHandler)}))},r.prototype._createPopperInstance=function(){return Ne(this._triggerEl,this._targetEl,{placement:this._options.placement,modifiers:[{name:"offset",options:{offset:[this._options.offsetSkidding,this._options.offsetDistance]}}]})},r.prototype._setupClickOutsideListener=function(){var e=this;this._clickOutsideEventListener=function(t){e._handleClickOutside(t,e._targetEl)},document.body.addEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._removeClickOutsideListener=function(){document.body.removeEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._handleClickOutside=function(e,t){var i=e.target,s=this._options.ignoreClickOutsideClass,n=!1;if(s){var o=document.querySelectorAll(".".concat(s));o.forEach(function(a){if(a.contains(i)){n=!0;return}})}i!==t&&!t.contains(i)&&!this._triggerEl.contains(i)&&!n&&this.isVisible()&&this.hide()},r.prototype._getTriggerEvents=function(){switch(this._options.triggerType){case"hover":return{showEvents:["mouseenter","click"],hideEvents:["mouseleave"]};case"click":return{showEvents:["click"],hideEvents:[]};case"none":return{showEvents:[],hideEvents:[]};default:return{showEvents:["click"],hideEvents:[]}}},r.prototype.toggle=function(){this.isVisible()?this.hide():this.show(),this._options.onToggle(this)},r.prototype.isVisible=function(){return this._visible},r.prototype.show=function(){this._targetEl.classList.remove("hidden"),this._targetEl.classList.add("block"),this._popperInstance.setOptions(function(e){return _e(_e({},e),{modifiers:vr(vr([],e.modifiers,!0),[{name:"eventListeners",enabled:!0}],!1)})}),this._setupClickOutsideListener(),this._popperInstance.update(),this._visible=!0,this._options.onShow(this)},r.prototype.hide=function(){this._targetEl.classList.remove("block"),this._targetEl.classList.add("hidden"),this._popperInstance.setOptions(function(e){return _e(_e({},e),{modifiers:vr(vr([],e.modifiers,!0),[{name:"eventListeners",enabled:!1}],!1)})}),this._visible=!1,this._removeClickOutsideListener(),this._options.onHide(this)},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function rt(){document.querySelectorAll("[data-dropdown-toggle]").forEach(function(r){var e=r.getAttribute("data-dropdown-toggle"),t=document.getElementById(e);if(t){var i=r.getAttribute("data-dropdown-placement"),s=r.getAttribute("data-dropdown-offset-skidding"),n=r.getAttribute("data-dropdown-offset-distance"),o=r.getAttribute("data-dropdown-trigger"),a=r.getAttribute("data-dropdown-delay"),d=r.getAttribute("data-dropdown-ignore-click-outside-class");new Bi(t,r,{placement:i||Se.placement,triggerType:o||Se.triggerType,offsetSkidding:s?parseInt(s):Se.offsetSkidding,offsetDistance:n?parseInt(n):Se.offsetDistance,delay:a?parseInt(a):Se.delay,ignoreClickOutsideClass:d||Se.ignoreClickOutsideClass})}else console.error('The dropdown element with id "'.concat(e,'" does not exist. Please check the data-dropdown-toggle attribute.'))})}typeof window<"u"&&(window.Dropdown=Bi,window.initDropdowns=rt);var Di=Bi;var br=function(){return br=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},br.apply(this,arguments)},yr={placement:"center",backdropClasses:"bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-40",backdrop:"dynamic",closable:!0,onHide:function(){},onShow:function(){},onToggle:function(){}},nl={id:null,override:!0},wn=function(){function r(e,t,i){e===void 0&&(e=null),t===void 0&&(t=yr),i===void 0&&(i=nl),this._eventListenerInstances=[],this._instanceId=i.id?i.id:e.id,this._targetEl=e,this._options=br(br({},yr),t),this._isHidden=!0,this._backdropEl=null,this._initialized=!1,this.init(),b.addInstance("Modal",this,this._instanceId,i.override)}return r.prototype.init=function(){var e=this;this._targetEl&&!this._initialized&&(this._getPlacementClasses().map(function(t){e._targetEl.classList.add(t)}),this._initialized=!0)},r.prototype.destroy=function(){this._initialized&&(this.removeAllEventListenerInstances(),this._destroyBackdropEl(),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Modal",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype._createBackdrop=function(){var e;if(this._isHidden){var t=document.createElement("div");t.setAttribute("modal-backdrop",""),(e=t.classList).add.apply(e,this._options.backdropClasses.split(" ")),document.querySelector("body").append(t),this._backdropEl=t}},r.prototype._destroyBackdropEl=function(){this._isHidden||document.querySelector("[modal-backdrop]").remove()},r.prototype._setupModalCloseEventListeners=function(){var e=this;this._options.backdrop==="dynamic"&&(this._clickOutsideEventListener=function(t){e._handleOutsideClick(t.target)},this._targetEl.addEventListener("click",this._clickOutsideEventListener,!0)),this._keydownEventListener=function(t){t.key==="Escape"&&e.hide()},document.body.addEventListener("keydown",this._keydownEventListener,!0)},r.prototype._removeModalCloseEventListeners=function(){this._options.backdrop==="dynamic"&&this._targetEl.removeEventListener("click",this._clickOutsideEventListener,!0),document.body.removeEventListener("keydown",this._keydownEventListener,!0)},r.prototype._handleOutsideClick=function(e){(e===this._targetEl||e===this._backdropEl&&this.isVisible())&&this.hide()},r.prototype._getPlacementClasses=function(){switch(this._options.placement){case"top-left":return["justify-start","items-start"];case"top-center":return["justify-center","items-start"];case"top-right":return["justify-end","items-start"];case"center-left":return["justify-start","items-center"];case"center":return["justify-center","items-center"];case"center-right":return["justify-end","items-center"];case"bottom-left":return["justify-start","items-end"];case"bottom-center":return["justify-center","items-end"];case"bottom-right":return["justify-end","items-end"];default:return["justify-center","items-center"]}},r.prototype.toggle=function(){this._isHidden?this.show():this.hide(),this._options.onToggle(this)},r.prototype.show=function(){this.isHidden&&(this._targetEl.classList.add("flex"),this._targetEl.classList.remove("hidden"),this._targetEl.setAttribute("aria-modal","true"),this._targetEl.setAttribute("role","dialog"),this._targetEl.removeAttribute("aria-hidden"),this._createBackdrop(),this._isHidden=!1,this._options.closable&&this._setupModalCloseEventListeners(),document.body.classList.add("overflow-hidden"),this._options.onShow(this))},r.prototype.hide=function(){this.isVisible&&(this._targetEl.classList.add("hidden"),this._targetEl.classList.remove("flex"),this._targetEl.setAttribute("aria-hidden","true"),this._targetEl.removeAttribute("aria-modal"),this._targetEl.removeAttribute("role"),this._destroyBackdropEl(),this._isHidden=!0,document.body.classList.remove("overflow-hidden"),this._options.closable&&this._removeModalCloseEventListeners(),this._options.onHide(this))},r.prototype.isVisible=function(){return!this._isHidden},r.prototype.isHidden=function(){return this._isHidden},r.prototype.addEventListenerInstance=function(e,t,i){this._eventListenerInstances.push({element:e,type:t,handler:i})},r.prototype.removeAllEventListenerInstances=function(){this._eventListenerInstances.map(function(e){e.element.removeEventListener(e.type,e.handler)}),this._eventListenerInstances=[]},r.prototype.getAllEventListenerInstances=function(){return this._eventListenerInstances},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function it(){document.querySelectorAll("[data-modal-target]").forEach(function(r){var e=r.getAttribute("data-modal-target"),t=document.getElementById(e);if(t){var i=t.getAttribute("data-modal-placement"),s=t.getAttribute("data-modal-backdrop");new wn(t,{placement:i||yr.placement,backdrop:s||yr.backdrop})}else console.error("Modal with id ".concat(e," does not exist. Are you sure that the data-modal-target attribute points to the correct modal id?."))}),document.querySelectorAll("[data-modal-toggle]").forEach(function(r){var e=r.getAttribute("data-modal-toggle"),t=document.getElementById(e);if(t){var i=b.getInstance("Modal",e);if(i){var s=function(){i.toggle()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Modal with id ".concat(e," has not been initialized. Please initialize it using the data-modal-target attribute."))}else console.error("Modal with id ".concat(e," does not exist. Are you sure that the data-modal-toggle attribute points to the correct modal id?"))}),document.querySelectorAll("[data-modal-show]").forEach(function(r){var e=r.getAttribute("data-modal-show"),t=document.getElementById(e);if(t){var i=b.getInstance("Modal",e);if(i){var s=function(){i.show()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Modal with id ".concat(e," has not been initialized. Please initialize it using the data-modal-target attribute."))}else console.error("Modal with id ".concat(e," does not exist. Are you sure that the data-modal-show attribute points to the correct modal id?"))}),document.querySelectorAll("[data-modal-hide]").forEach(function(r){var e=r.getAttribute("data-modal-hide"),t=document.getElementById(e);if(t){var i=b.getInstance("Modal",e);if(i){var s=function(){i.hide()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Modal with id ".concat(e," has not been initialized. Please initialize it using the data-modal-target attribute."))}else console.error("Modal with id ".concat(e," does not exist. Are you sure that the data-modal-hide attribute points to the correct modal id?"))})}typeof window<"u"&&(window.Modal=wn,window.initModals=it);var wr=function(){return wr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},wr.apply(this,arguments)},Ve={placement:"left",bodyScrolling:!1,backdrop:!0,edge:!1,edgeOffset:"bottom-[60px]",backdropClasses:"bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30",onShow:function(){},onHide:function(){},onToggle:function(){}},ol={id:null,override:!0},En=function(){function r(e,t,i){e===void 0&&(e=null),t===void 0&&(t=Ve),i===void 0&&(i=ol),this._eventListenerInstances=[],this._instanceId=i.id?i.id:e.id,this._targetEl=e,this._options=wr(wr({},Ve),t),this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Drawer",this,this._instanceId,i.override)}return r.prototype.init=function(){var e=this;this._targetEl&&!this._initialized&&(this._targetEl.setAttribute("aria-hidden","true"),this._targetEl.classList.add("transition-transform"),this._getPlacementClasses(this._options.placement).base.map(function(t){e._targetEl.classList.add(t)}),this._handleEscapeKey=function(t){t.key==="Escape"&&e.isVisible()&&e.hide()},document.addEventListener("keydown",this._handleEscapeKey),this._initialized=!0)},r.prototype.destroy=function(){this._initialized&&(this.removeAllEventListenerInstances(),this._destroyBackdropEl(),document.removeEventListener("keydown",this._handleEscapeKey),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Drawer",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.hide=function(){var e=this;this._options.edge?(this._getPlacementClasses(this._options.placement+"-edge").active.map(function(t){e._targetEl.classList.remove(t)}),this._getPlacementClasses(this._options.placement+"-edge").inactive.map(function(t){e._targetEl.classList.add(t)})):(this._getPlacementClasses(this._options.placement).active.map(function(t){e._targetEl.classList.remove(t)}),this._getPlacementClasses(this._options.placement).inactive.map(function(t){e._targetEl.classList.add(t)})),this._targetEl.setAttribute("aria-hidden","true"),this._targetEl.removeAttribute("aria-modal"),this._targetEl.removeAttribute("role"),this._options.bodyScrolling||document.body.classList.remove("overflow-hidden"),this._options.backdrop&&this._destroyBackdropEl(),this._visible=!1,this._options.onHide(this)},r.prototype.show=function(){var e=this;this._options.edge?(this._getPlacementClasses(this._options.placement+"-edge").active.map(function(t){e._targetEl.classList.add(t)}),this._getPlacementClasses(this._options.placement+"-edge").inactive.map(function(t){e._targetEl.classList.remove(t)})):(this._getPlacementClasses(this._options.placement).active.map(function(t){e._targetEl.classList.add(t)}),this._getPlacementClasses(this._options.placement).inactive.map(function(t){e._targetEl.classList.remove(t)})),this._targetEl.setAttribute("aria-modal","true"),this._targetEl.setAttribute("role","dialog"),this._targetEl.removeAttribute("aria-hidden"),this._options.bodyScrolling||document.body.classList.add("overflow-hidden"),this._options.backdrop&&this._createBackdrop(),this._visible=!0,this._options.onShow(this)},r.prototype.toggle=function(){this.isVisible()?this.hide():this.show()},r.prototype._createBackdrop=function(){var e,t=this;if(!this._visible){var i=document.createElement("div");i.setAttribute("drawer-backdrop",""),(e=i.classList).add.apply(e,this._options.backdropClasses.split(" ")),document.querySelector("body").append(i),i.addEventListener("click",function(){t.hide()})}},r.prototype._destroyBackdropEl=function(){this._visible&&document.querySelector("[drawer-backdrop]")!==null&&document.querySelector("[drawer-backdrop]").remove()},r.prototype._getPlacementClasses=function(e){switch(e){case"top":return{base:["top-0","left-0","right-0"],active:["transform-none"],inactive:["-translate-y-full"]};case"right":return{base:["right-0","top-0"],active:["transform-none"],inactive:["translate-x-full"]};case"bottom":return{base:["bottom-0","left-0","right-0"],active:["transform-none"],inactive:["translate-y-full"]};case"left":return{base:["left-0","top-0"],active:["transform-none"],inactive:["-translate-x-full"]};case"bottom-edge":return{base:["left-0","top-0"],active:["transform-none"],inactive:["translate-y-full",this._options.edgeOffset]};default:return{base:["left-0","top-0"],active:["transform-none"],inactive:["-translate-x-full"]}}},r.prototype.isHidden=function(){return!this._visible},r.prototype.isVisible=function(){return this._visible},r.prototype.addEventListenerInstance=function(e,t,i){this._eventListenerInstances.push({element:e,type:t,handler:i})},r.prototype.removeAllEventListenerInstances=function(){this._eventListenerInstances.map(function(e){e.element.removeEventListener(e.type,e.handler)}),this._eventListenerInstances=[]},r.prototype.getAllEventListenerInstances=function(){return this._eventListenerInstances},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function st(){document.querySelectorAll("[data-drawer-target]").forEach(function(r){var e=r.getAttribute("data-drawer-target"),t=document.getElementById(e);if(t){var i=r.getAttribute("data-drawer-placement"),s=r.getAttribute("data-drawer-body-scrolling"),n=r.getAttribute("data-drawer-backdrop"),o=r.getAttribute("data-drawer-edge"),a=r.getAttribute("data-drawer-edge-offset");new En(t,{placement:i||Ve.placement,bodyScrolling:s?s==="true":Ve.bodyScrolling,backdrop:n?n==="true":Ve.backdrop,edge:o?o==="true":Ve.edge,edgeOffset:a||Ve.edgeOffset})}else console.error("Drawer with id ".concat(e," not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?"))}),document.querySelectorAll("[data-drawer-toggle]").forEach(function(r){var e=r.getAttribute("data-drawer-toggle"),t=document.getElementById(e);if(t){var i=b.getInstance("Drawer",e);if(i){var s=function(){i.toggle()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Drawer with id ".concat(e," has not been initialized. Please initialize it using the data-drawer-target attribute."))}else console.error("Drawer with id ".concat(e," not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?"))}),document.querySelectorAll("[data-drawer-dismiss], [data-drawer-hide]").forEach(function(r){var e=r.getAttribute("data-drawer-dismiss")?r.getAttribute("data-drawer-dismiss"):r.getAttribute("data-drawer-hide"),t=document.getElementById(e);if(t){var i=b.getInstance("Drawer",e);if(i){var s=function(){i.hide()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Drawer with id ".concat(e," has not been initialized. Please initialize it using the data-drawer-target attribute."))}else console.error("Drawer with id ".concat(e," not found. Are you sure that the data-drawer-target attribute points to the correct drawer id"))}),document.querySelectorAll("[data-drawer-show]").forEach(function(r){var e=r.getAttribute("data-drawer-show"),t=document.getElementById(e);if(t){var i=b.getInstance("Drawer",e);if(i){var s=function(){i.show()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Drawer with id ".concat(e," has not been initialized. Please initialize it using the data-drawer-target attribute."))}else console.error("Drawer with id ".concat(e," not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?"))})}typeof window<"u"&&(window.Drawer=En,window.initDrawers=st);var Er=function(){return Er=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Er.apply(this,arguments)},_r={defaultTabId:null,activeClasses:"text-blue-600 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-500 border-blue-600 dark:border-blue-500",inactiveClasses:"dark:border-transparent text-gray-500 hover:text-gray-600 dark:text-gray-400 border-gray-100 hover:border-gray-300 dark:border-gray-700 dark:hover:text-gray-300",onShow:function(){}},al={id:null,override:!0},_n=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=[]),i===void 0&&(i=_r),s===void 0&&(s=al),this._instanceId=s.id?s.id:e.id,this._tabsEl=e,this._items=t,this._activeTab=i?this.getTab(i.defaultTabId):null,this._options=Er(Er({},_r),i),this._initialized=!1,this.init(),b.addInstance("Tabs",this,this._tabsEl.id,!0),b.addInstance("Tabs",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._items.length&&!this._initialized&&(this._activeTab||this.setActiveTab(this._items[0]),this.show(this._activeTab.id,!0),this._items.map(function(t){t.triggerEl.addEventListener("click",function(i){i.preventDefault(),e.show(t.id)})}))},r.prototype.destroy=function(){this._initialized&&(this._initialized=!1)},r.prototype.removeInstance=function(){this.destroy(),b.removeInstance("Tabs",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.getActiveTab=function(){return this._activeTab},r.prototype.setActiveTab=function(e){this._activeTab=e},r.prototype.getTab=function(e){return this._items.filter(function(t){return t.id===e})[0]},r.prototype.show=function(e,t){var i,s,n=this;t===void 0&&(t=!1);var o=this.getTab(e);o===this._activeTab&&!t||(this._items.map(function(a){var d,f;a!==o&&((d=a.triggerEl.classList).remove.apply(d,n._options.activeClasses.split(" ")),(f=a.triggerEl.classList).add.apply(f,n._options.inactiveClasses.split(" ")),a.targetEl.classList.add("hidden"),a.triggerEl.setAttribute("aria-selected","false"))}),(i=o.triggerEl.classList).add.apply(i,this._options.activeClasses.split(" ")),(s=o.triggerEl.classList).remove.apply(s,this._options.inactiveClasses.split(" ")),o.triggerEl.setAttribute("aria-selected","true"),o.targetEl.classList.remove("hidden"),this.setActiveTab(o),this._options.onShow(this,o))},r.prototype.updateOnShow=function(e){this._options.onShow=e},r}();function nt(){document.querySelectorAll("[data-tabs-toggle]").forEach(function(r){var e=[],t=r.getAttribute("data-tabs-active-classes"),i=r.getAttribute("data-tabs-inactive-classes"),s=null;r.querySelectorAll('[role="tab"]').forEach(function(n){var o=n.getAttribute("aria-selected")==="true",a={id:n.getAttribute("data-tabs-target"),triggerEl:n,targetEl:document.querySelector(n.getAttribute("data-tabs-target"))};e.push(a),o&&(s=a.id)}),new _n(r,e,{defaultTabId:s,activeClasses:t||_r.activeClasses,inactiveClasses:i||_r.inactiveClasses})})}typeof window<"u"&&(window.Tabs=_n,window.initTabs=nt);var Ae=function(){return Ae=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Ae.apply(this,arguments)},Sr=function(r,e,t){if(t||arguments.length===2)for(var i=0,s=e.length,n;i<s;i++)(n||!(i in e))&&(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return r.concat(n||Array.prototype.slice.call(e))},Ar={placement:"top",triggerType:"hover",onShow:function(){},onHide:function(){},onToggle:function(){}},ll={id:null,override:!0},Sn=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=Ar),s===void 0&&(s=ll),this._instanceId=s.id?s.id:e.id,this._targetEl=e,this._triggerEl=t,this._options=Ae(Ae({},Ar),i),this._popperInstance=null,this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Tooltip",this,this._instanceId,s.override)}return r.prototype.init=function(){this._triggerEl&&this._targetEl&&!this._initialized&&(this._setupEventListeners(),this._popperInstance=this._createPopperInstance(),this._initialized=!0)},r.prototype.destroy=function(){var e=this;if(this._initialized){var t=this._getTriggerEvents();t.showEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._showHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._hideHandler)}),this._removeKeydownListener(),this._removeClickOutsideListener(),this._popperInstance&&this._popperInstance.destroy(),this._initialized=!1}},r.prototype.removeInstance=function(){b.removeInstance("Tooltip",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype._setupEventListeners=function(){var e=this,t=this._getTriggerEvents();this._showHandler=function(){e.show()},this._hideHandler=function(){e.hide()},t.showEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._showHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._hideHandler)})},r.prototype._createPopperInstance=function(){return Ne(this._triggerEl,this._targetEl,{placement:this._options.placement,modifiers:[{name:"offset",options:{offset:[0,8]}}]})},r.prototype._getTriggerEvents=function(){switch(this._options.triggerType){case"hover":return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]};case"click":return{showEvents:["click","focus"],hideEvents:["focusout","blur"]};case"none":return{showEvents:[],hideEvents:[]};default:return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]}}},r.prototype._setupKeydownListener=function(){var e=this;this._keydownEventListener=function(t){t.key==="Escape"&&e.hide()},document.body.addEventListener("keydown",this._keydownEventListener,!0)},r.prototype._removeKeydownListener=function(){document.body.removeEventListener("keydown",this._keydownEventListener,!0)},r.prototype._setupClickOutsideListener=function(){var e=this;this._clickOutsideEventListener=function(t){e._handleClickOutside(t,e._targetEl)},document.body.addEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._removeClickOutsideListener=function(){document.body.removeEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._handleClickOutside=function(e,t){var i=e.target;i!==t&&!t.contains(i)&&!this._triggerEl.contains(i)&&this.isVisible()&&this.hide()},r.prototype.isVisible=function(){return this._visible},r.prototype.toggle=function(){this.isVisible()?this.hide():this.show()},r.prototype.show=function(){this._targetEl.classList.remove("opacity-0","invisible"),this._targetEl.classList.add("opacity-100","visible"),this._popperInstance.setOptions(function(e){return Ae(Ae({},e),{modifiers:Sr(Sr([],e.modifiers,!0),[{name:"eventListeners",enabled:!0}],!1)})}),this._setupClickOutsideListener(),this._setupKeydownListener(),this._popperInstance.update(),this._visible=!0,this._options.onShow(this)},r.prototype.hide=function(){this._targetEl.classList.remove("opacity-100","visible"),this._targetEl.classList.add("opacity-0","invisible"),this._popperInstance.setOptions(function(e){return Ae(Ae({},e),{modifiers:Sr(Sr([],e.modifiers,!0),[{name:"eventListeners",enabled:!1}],!1)})}),this._removeClickOutsideListener(),this._removeKeydownListener(),this._visible=!1,this._options.onHide(this)},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function ot(){document.querySelectorAll("[data-tooltip-target]").forEach(function(r){var e=r.getAttribute("data-tooltip-target"),t=document.getElementById(e);if(t){var i=r.getAttribute("data-tooltip-trigger"),s=r.getAttribute("data-tooltip-placement");new Sn(t,r,{placement:s||Ar.placement,triggerType:i||Ar.triggerType})}else console.error('The tooltip element with id "'.concat(e,'" does not exist. Please check the data-tooltip-target attribute.'))})}typeof window<"u"&&(window.Tooltip=Sn,window.initTooltips=ot);var Le=function(){return Le=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Le.apply(this,arguments)},Lr=function(r,e,t){if(t||arguments.length===2)for(var i=0,s=e.length,n;i<s;i++)(n||!(i in e))&&(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return r.concat(n||Array.prototype.slice.call(e))},kt={placement:"top",offset:10,triggerType:"hover",onShow:function(){},onHide:function(){},onToggle:function(){}},cl={id:null,override:!0},An=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=kt),s===void 0&&(s=cl),this._instanceId=s.id?s.id:e.id,this._targetEl=e,this._triggerEl=t,this._options=Le(Le({},kt),i),this._popperInstance=null,this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Popover",this,s.id?s.id:this._targetEl.id,s.override)}return r.prototype.init=function(){this._triggerEl&&this._targetEl&&!this._initialized&&(this._setupEventListeners(),this._popperInstance=this._createPopperInstance(),this._initialized=!0)},r.prototype.destroy=function(){var e=this;if(this._initialized){var t=this._getTriggerEvents();t.showEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._showHandler),e._targetEl.removeEventListener(i,e._showHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._hideHandler),e._targetEl.removeEventListener(i,e._hideHandler)}),this._removeKeydownListener(),this._removeClickOutsideListener(),this._popperInstance&&this._popperInstance.destroy(),this._initialized=!1}},r.prototype.removeInstance=function(){b.removeInstance("Popover",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype._setupEventListeners=function(){var e=this,t=this._getTriggerEvents();this._showHandler=function(){e.show()},this._hideHandler=function(){setTimeout(function(){e._targetEl.matches(":hover")||e.hide()},100)},t.showEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._showHandler),e._targetEl.addEventListener(i,e._showHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._hideHandler),e._targetEl.addEventListener(i,e._hideHandler)})},r.prototype._createPopperInstance=function(){return Ne(this._triggerEl,this._targetEl,{placement:this._options.placement,modifiers:[{name:"offset",options:{offset:[0,this._options.offset]}}]})},r.prototype._getTriggerEvents=function(){switch(this._options.triggerType){case"hover":return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]};case"click":return{showEvents:["click","focus"],hideEvents:["focusout","blur"]};case"none":return{showEvents:[],hideEvents:[]};default:return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]}}},r.prototype._setupKeydownListener=function(){var e=this;this._keydownEventListener=function(t){t.key==="Escape"&&e.hide()},document.body.addEventListener("keydown",this._keydownEventListener,!0)},r.prototype._removeKeydownListener=function(){document.body.removeEventListener("keydown",this._keydownEventListener,!0)},r.prototype._setupClickOutsideListener=function(){var e=this;this._clickOutsideEventListener=function(t){e._handleClickOutside(t,e._targetEl)},document.body.addEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._removeClickOutsideListener=function(){document.body.removeEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._handleClickOutside=function(e,t){var i=e.target;i!==t&&!t.contains(i)&&!this._triggerEl.contains(i)&&this.isVisible()&&this.hide()},r.prototype.isVisible=function(){return this._visible},r.prototype.toggle=function(){this.isVisible()?this.hide():this.show(),this._options.onToggle(this)},r.prototype.show=function(){this._targetEl.classList.remove("opacity-0","invisible"),this._targetEl.classList.add("opacity-100","visible"),this._popperInstance.setOptions(function(e){return Le(Le({},e),{modifiers:Lr(Lr([],e.modifiers,!0),[{name:"eventListeners",enabled:!0}],!1)})}),this._setupClickOutsideListener(),this._setupKeydownListener(),this._popperInstance.update(),this._visible=!0,this._options.onShow(this)},r.prototype.hide=function(){this._targetEl.classList.remove("opacity-100","visible"),this._targetEl.classList.add("opacity-0","invisible"),this._popperInstance.setOptions(function(e){return Le(Le({},e),{modifiers:Lr(Lr([],e.modifiers,!0),[{name:"eventListeners",enabled:!1}],!1)})}),this._removeClickOutsideListener(),this._removeKeydownListener(),this._visible=!1,this._options.onHide(this)},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function at(){document.querySelectorAll("[data-popover-target]").forEach(function(r){var e=r.getAttribute("data-popover-target"),t=document.getElementById(e);if(t){var i=r.getAttribute("data-popover-trigger"),s=r.getAttribute("data-popover-placement"),n=r.getAttribute("data-popover-offset");new An(t,r,{placement:s||kt.placement,offset:n?parseInt(n):kt.offset,triggerType:i||kt.triggerType})}else console.error('The popover element with id "'.concat(e,'" does not exist. Please check the data-popover-target attribute.'))})}typeof window<"u"&&(window.Popover=An,window.initPopovers=at);var Tr=function(){return Tr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Tr.apply(this,arguments)},Hi={triggerType:"hover",onShow:function(){},onHide:function(){},onToggle:function(){}},hl={id:null,override:!0},Ln=function(){function r(e,t,i,s,n){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=null),s===void 0&&(s=Hi),n===void 0&&(n=hl),this._instanceId=n.id?n.id:i.id,this._parentEl=e,this._triggerEl=t,this._targetEl=i,this._options=Tr(Tr({},Hi),s),this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Dial",this,this._instanceId,n.override)}return r.prototype.init=function(){var e=this;if(this._triggerEl&&this._targetEl&&!this._initialized){var t=this._getTriggerEventTypes(this._options.triggerType);this._showEventHandler=function(){e.show()},t.showEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._showEventHandler),e._targetEl.addEventListener(i,e._showEventHandler)}),this._hideEventHandler=function(){e._parentEl.matches(":hover")||e.hide()},t.hideEvents.forEach(function(i){e._parentEl.addEventListener(i,e._hideEventHandler)}),this._initialized=!0}},r.prototype.destroy=function(){var e=this;if(this._initialized){var t=this._getTriggerEventTypes(this._options.triggerType);t.showEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._showEventHandler),e._targetEl.removeEventListener(i,e._showEventHandler)}),t.hideEvents.forEach(function(i){e._parentEl.removeEventListener(i,e._hideEventHandler)}),this._initialized=!1}},r.prototype.removeInstance=function(){b.removeInstance("Dial",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.hide=function(){this._targetEl.classList.add("hidden"),this._triggerEl&&this._triggerEl.setAttribute("aria-expanded","false"),this._visible=!1,this._options.onHide(this)},r.prototype.show=function(){this._targetEl.classList.remove("hidden"),this._triggerEl&&this._triggerEl.setAttribute("aria-expanded","true"),this._visible=!0,this._options.onShow(this)},r.prototype.toggle=function(){this._visible?this.hide():this.show()},r.prototype.isHidden=function(){return!this._visible},r.prototype.isVisible=function(){return this._visible},r.prototype._getTriggerEventTypes=function(e){switch(e){case"hover":return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]};case"click":return{showEvents:["click","focus"],hideEvents:["focusout","blur"]};case"none":return{showEvents:[],hideEvents:[]};default:return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]}}},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function lt(){document.querySelectorAll("[data-dial-init]").forEach(function(r){var e=r.querySelector("[data-dial-toggle]");if(e){var t=e.getAttribute("data-dial-toggle"),i=document.getElementById(t);if(i){var s=e.getAttribute("data-dial-trigger");new Ln(r,e,i,{triggerType:s||Hi.triggerType})}else console.error("Dial with id ".concat(t," does not exist. Are you sure that the data-dial-toggle attribute points to the correct modal id?"))}else console.error("Dial with id ".concat(r.id," does not have a trigger element. Are you sure that the data-dial-toggle attribute exists?"))})}typeof window<"u"&&(window.Dial=Ln,window.initDials=lt);var Cr=function(){return Cr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Cr.apply(this,arguments)},Tn={minValue:null,maxValue:null,onIncrement:function(){},onDecrement:function(){}},dl={id:null,override:!0},Cn=function(){function r(e,t,i,s,n){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=null),s===void 0&&(s=Tn),n===void 0&&(n=dl),this._instanceId=n.id?n.id:e.id,this._targetEl=e,this._incrementEl=t,this._decrementEl=i,this._options=Cr(Cr({},Tn),s),this._initialized=!1,this.init(),b.addInstance("InputCounter",this,this._instanceId,n.override)}return r.prototype.init=function(){var e=this;this._targetEl&&!this._initialized&&(this._inputHandler=function(t){{var i=t.target;/^\d*$/.test(i.value)||(i.value=i.value.replace(/[^\d]/g,"")),e._options.maxValue!==null&&parseInt(i.value)>e._options.maxValue&&(i.value=e._options.maxValue.toString()),e._options.minValue!==null&&parseInt(i.value)<e._options.minValue&&(i.value=e._options.minValue.toString())}},this._incrementClickHandler=function(){e.increment()},this._decrementClickHandler=function(){e.decrement()},this._targetEl.addEventListener("input",this._inputHandler),this._incrementEl&&this._incrementEl.addEventListener("click",this._incrementClickHandler),this._decrementEl&&this._decrementEl.addEventListener("click",this._decrementClickHandler),this._initialized=!0)},r.prototype.destroy=function(){this._targetEl&&this._initialized&&(this._targetEl.removeEventListener("input",this._inputHandler),this._incrementEl&&this._incrementEl.removeEventListener("click",this._incrementClickHandler),this._decrementEl&&this._decrementEl.removeEventListener("click",this._decrementClickHandler),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("InputCounter",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.getCurrentValue=function(){return parseInt(this._targetEl.value)||0},r.prototype.increment=function(){this._options.maxValue!==null&&this.getCurrentValue()>=this._options.maxValue||(this._targetEl.value=(this.getCurrentValue()+1).toString(),this._options.onIncrement(this))},r.prototype.decrement=function(){this._options.minValue!==null&&this.getCurrentValue()<=this._options.minValue||(this._targetEl.value=(this.getCurrentValue()-1).toString(),this._options.onDecrement(this))},r.prototype.updateOnIncrement=function(e){this._options.onIncrement=e},r.prototype.updateOnDecrement=function(e){this._options.onDecrement=e},r}();function ct(){document.querySelectorAll("[data-input-counter]").forEach(function(r){var e=r.id,t=document.querySelector('[data-input-counter-increment="'+e+'"]'),i=document.querySelector('[data-input-counter-decrement="'+e+'"]'),s=r.getAttribute("data-input-counter-min"),n=r.getAttribute("data-input-counter-max");r?b.instanceExists("InputCounter",r.getAttribute("id"))||new Cn(r,t||null,i||null,{minValue:s?parseInt(s):null,maxValue:n?parseInt(n):null}):console.error('The target element with id "'.concat(e,'" does not exist. Please check the data-input-counter attribute.'))})}typeof window<"u"&&(window.InputCounter=Cn,window.initInputCounters=ct);var xr=function(){return xr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},xr.apply(this,arguments)},kr={htmlEntities:!1,contentType:"input",onCopy:function(){}},ul={id:null,override:!0},xn=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=kr),s===void 0&&(s=ul),this._instanceId=s.id?s.id:t.id,this._triggerEl=e,this._targetEl=t,this._options=xr(xr({},kr),i),this._initialized=!1,this.init(),b.addInstance("CopyClipboard",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._targetEl&&this._triggerEl&&!this._initialized&&(this._triggerElClickHandler=function(){e.copy()},this._triggerEl&&this._triggerEl.addEventListener("click",this._triggerElClickHandler),this._initialized=!0)},r.prototype.destroy=function(){this._triggerEl&&this._targetEl&&this._initialized&&(this._triggerEl&&this._triggerEl.removeEventListener("click",this._triggerElClickHandler),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("CopyClipboard",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.getTargetValue=function(){if(this._options.contentType==="input")return this._targetEl.value;if(this._options.contentType==="innerHTML")return this._targetEl.innerHTML;if(this._options.contentType==="textContent")return this._targetEl.textContent.replace(/\s+/g," ").trim()},r.prototype.copy=function(){var e=this.getTargetValue();this._options.htmlEntities&&(e=this.decodeHTML(e));var t=document.createElement("textarea");return t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),this._options.onCopy(this),e},r.prototype.decodeHTML=function(e){var t=document.createElement("textarea");return t.innerHTML=e,t.textContent},r.prototype.updateOnCopyCallback=function(e){this._options.onCopy=e},r}();function ht(){document.querySelectorAll("[data-copy-to-clipboard-target]").forEach(function(r){var e=r.getAttribute("data-copy-to-clipboard-target"),t=document.getElementById(e),i=r.getAttribute("data-copy-to-clipboard-content-type"),s=r.getAttribute("data-copy-to-clipboard-html-entities");t?b.instanceExists("CopyClipboard",t.getAttribute("id"))||new xn(r,t,{htmlEntities:s&&s==="true"?!0:kr.htmlEntities,contentType:i||kr.contentType}):console.error('The target element with id "'.concat(e,'" does not exist. Please check the data-copy-to-clipboard-target attribute.'))})}typeof window<"u"&&(window.CopyClipboard=xn,window.initClipboards=ht);function kn(){Ke(),Xe(),Ye(),Je(),rt(),it(),st(),nt(),ot(),at(),lt(),ct(),ht()}typeof window<"u"&&(window.initFlowbite=kn);var fl=new Us("load",[Ke,Xe,Ye,Je,rt,it,st,nt,ot,at,lt,ct,ht]);fl.init();var Or=class extends w{static targets=["trigger","menu"];connect(){console.log(`resource-drop-down connected: ${this.element}`),this.dropdown=new Di(this.menuTarget,this.triggerTarget)}disconnect(){this.dropdown=null}toggle(){this.dropdown.toggle()}show(){this.dropdown.show()}hide(){this.dropdown.show()}};var Ir=class extends w{static targets=["trigger","target"];static values={after:Number};connect(){console.log(`resource-dismiss connected: ${this.element}`),this.dismiss=new _i(this.targetTarget,this.triggerTarget),console.log(this.hasAfterValue),console.log(this.afterValue),this.hasAfterValue&&this.afterValue>0&&(this.autoDismissTimeout=setTimeout(()=>{this.hide(),this.autoDismissTimeout=null},this.afterValue))}disconnect(){this.autoDismissTimeout&&clearTimeout(this.autoDismissTimeout),this.dismiss=null,this.autoDismissTimeout=null}hide(){this.dismiss.hide()}};var Mr=class extends w{static targets=["frame","refreshButton","backButton","homeButton"];connect(){console.log(`frame-navigator connected: ${this.element}`),this.srcHistory=[],this.originalFrameSrc=this.frameTarget.src,this.hasRefreshButtonTarget&&(this.refreshButtonTarget.style.display="",this.refreshButtonClicked=this.refreshButtonClicked.bind(this),this.refreshButtonTarget.addEventListener("click",this.refreshButtonClicked)),this.hasBackButtonTarget&&(this.backButtonClicked=this.backButtonClicked.bind(this),this.backButtonTarget.addEventListener("click",this.backButtonClicked)),this.hasHomeButtonTarget&&(this.homeButtonClicked=this.homeButtonClicked.bind(this),this.homeButtonTarget.addEventListener("click",this.homeButtonClicked)),this.frameLoaded=this.frameLoaded.bind(this),this.frameTarget.addEventListener("turbo:frame-load",this.frameLoaded),this.frameLoading=this.frameLoading.bind(this),this.frameTarget.addEventListener("turbo:click",this.frameLoading),this.frameTarget.addEventListener("turbo:submit-start",this.frameLoading)}disconnect(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.removeEventListener("click",this.refreshButtonClicked),this.hasBackButtonTarget&&this.backButtonTarget.removeEventListener("click",this.backButtonClicked),this.hasHomeButtonTarget&&this.homeButtonTarget.removeEventListener("click",this.homeButtonClicked),this.frameTarget.removeEventListener("turbo:frame-load",this.frameLoaded),this.frameTarget.removeEventListener("turbo:click",this.frameLoading),this.frameTarget.removeEventListener("turbo:submit-start",this.frameLoading)}frameLoading(r){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.add("motion-safe:animate-spin"),this.frameTarget.classList.add("motion-safe:animate-pulse")}frameLoaded(r){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.remove("motion-safe:animate-spin"),this.frameTarget.classList.remove("motion-safe:animate-pulse");let e=r.target.src;e==this.currentSrc||(e==this.originalFrameSrc?this.srcHistory=[e]:this.srcHistory.push(e)),this.updateNavigationButtonsDisplay()}refreshButtonClicked(r){this.frameLoading(null),this.frameTarget.reload()}backButtonClicked(r){this.frameLoading(null),this.srcHistory.pop(),this.frameTarget.src=this.currentSrc}homeButtonClicked(r){this.frameLoading(null),this.frameTarget.src=this.originalFrameSrc}get currentSrc(){return this.srcHistory[this.srcHistory.length-1]}updateNavigationButtonsDisplay(){this.hasHomeButtonTarget&&(this.homeButtonTarget.style.display=this.srcHistory.length>1?"":"none"),this.hasBackButtonTarget&&(this.backButtonTarget.style.display=this.srcHistory.length>2?"":"none")}};var Pr=class extends w{connect(){console.log(`color-mode connected: ${this.element}`),this.updateColorMode()}disconnect(){}updateColorMode(){localStorage.theme==="dark"||!("theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}setLightColorMode(){localStorage.theme="light",this.updateColorMode()}setDarkColorMode(){localStorage.theme="dark",this.updateColorMode()}setSystemColorMode(){localStorage.removeItem("theme"),this.updateColorMode()}};function qi(r){r.register("resource-layout",zt),r.register("nav-grid-menu-item",$t),r.register("nav-grid-menu",Ut),r.register("nav-user-section",Kt),r.register("nav-user-link",Xt),r.register("nav-user",Yt),r.register("resource-header",Jt),r.register("sidebar-menu-item",Gt),r.register("sidebar-menu",Qt),r.register("has-many-panel",Zt),r.register("nested-resource-form-fields",er),r.register("toolbar",tr),r.register("table-search-input",rr),r.register("table-toolbar",ir),r.register("table",sr),r.register("form",nr),r.register("resource-drop-down",Or),r.register("resource-dismiss",Ir),r.register("frame-navigator",Mr),r.register("color-mode",Pr)}(function(r){if(typeof r.requestSubmit=="function")return;r.requestSubmit=function(i){i?(e(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function e(i,s){i instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||t(TypeError,"The specified element is not a submit button"),i.form==s||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(i,s,n){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+s+".",n)}})(HTMLFormElement.prototype);var Fn=new WeakMap;function pl(r){let e=r instanceof Element?r:r instanceof Node?r.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function ml(r){let e=pl(r.target);e&&e.form&&Fn.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let r=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))r=e;else return}addEventListener("click",ml,!0),Object.defineProperty(r,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Fn.get(this.target)}})})();var ut={eager:"eager",lazy:"lazy"},fe=class r extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new r.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get loading(){return gl(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?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")}};function gl(r){switch(r.toLowerCase()){case"lazy":return ut.lazy;default:return ut.eager}}function G(r){return new URL(r.toString(),document.baseURI)}function ze(r){let e;if(r.hash)return r.hash.slice(1);if(e=r.href.match(/#(.*)$/))return e[1]}function ms(r,e){let t=e?.getAttribute("formaction")||r.getAttribute("action")||r.action;return G(t)}function vl(r){return(_l(r).match(/\.[^.]*$/)||[])[0]||""}function bl(r){return!!vl(r).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function yl(r,e){let t=Sl(e);return r.href===G(t).href||r.href.startsWith(t)}function Te(r,e){return yl(r,e)&&bl(r)}function Ni(r){let e=ze(r);return e!=null?r.href.slice(0,-(e.length+1)):r.href}function Rr(r){return Ni(r)}function wl(r,e){return G(r).href==G(e).href}function El(r){return r.pathname.split("/").slice(1)}function _l(r){return El(r).slice(-1)[0]}function Sl(r){return Al(r.origin+r.pathname)}function Al(r){return r.endsWith("/")?r:r+"/"}var Ot=class{constructor(e){this.response=e}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 G(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(e){return this.response.headers.get(e)}};function It(r){if(r.getAttribute("data-turbo-eval")=="false")return r;{let e=document.createElement("script"),t=vt("csp-nonce");return t&&(e.nonce=t),e.textContent=r.textContent,e.async=!1,Ll(e,r),e}}function Ll(r,e){for(let{name:t,value:i}of e.attributes)r.setAttribute(t,i)}function Tl(r){let e=document.createElement("template");return e.innerHTML=r,e.content}function q(r,{target:e,cancelable:t,detail:i}={}){let s=new CustomEvent(r,{cancelable:t,bubbles:!0,composed:!0,detail:i});return e&&e.isConnected?e.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function pt(){return document.visibilityState==="hidden"?Dn():Bn()}function Bn(){return new Promise(r=>requestAnimationFrame(()=>r()))}function Dn(){return new Promise(r=>setTimeout(()=>r(),0))}function Cl(){return Promise.resolve()}function Hn(r=""){return new DOMParser().parseFromString(r,"text/html")}function qn(r,...e){let t=xl(r,e).replace(/^\n/,"").split(`
|
5
|
+
%o`,t,e,i),(s=window.onerror)===null||s===void 0||s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,i={}){i=Object.assign({application:this},i),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},i)),this.logger.groupEnd()}};function Wo(){return new Promise(r=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>r()):r()})}function zo(r){return _t(r,"classes").reduce((t,i)=>Object.assign(t,$o(i)),{})}function $o(r){return{[`${r}Class`]:{get(){let{classes:e}=this;if(e.has(r))return e.get(r);{let t=e.getAttributeName(r);throw new Error(`Missing attribute "${t}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${Et(r)}Class`]:{get(){return this.classes.has(r)}}}}function Uo(r){return _t(r,"outlets").reduce((t,i)=>Object.assign(t,Ko(i)),{})}function Fs(r,e,t){return r.application.getControllerForElementAndIdentifier(e,t)}function Bs(r,e,t){let i=Fs(r,e,t);if(i||(r.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),i=Fs(r,e,t),i))return i}function Ko(r){let e=Qr(r);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(r),i=this.outlets.getSelectorForOutletName(r);if(t){let s=Bs(this,t,r);if(s)return s;throw new Error(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${i}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(r);return t.length>0?t.map(i=>{let s=Bs(this,i,r);if(s)return s;console.warn(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`,i)}).filter(i=>i):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(r),i=this.outlets.getSelectorForOutletName(r);if(t)return t;throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${i}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(r)}},[`has${Et(e)}Outlet`]:{get(){return this.outlets.has(r)}}}}function Xo(r){return _t(r,"targets").reduce((t,i)=>Object.assign(t,Yo(i)),{})}function Yo(r){return{[`${r}Target`]:{get(){let e=this.targets.find(r);if(e)return e;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${Et(r)}Target`]:{get(){return this.targets.has(r)}}}}function Jo(r){let e=Io(r,"values"),t={valueDescriptorMap:{get(){return e.reduce((i,s)=>{let n=Ws(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(i,{[o]:n})},{})}}};return e.reduce((i,s)=>Object.assign(i,Go(s)),t)}function Go(r,e){let t=Ws(r,e),{key:i,name:s,reader:n,writer:o}=t;return{[s]:{get(){let a=this.data.get(i);return a!==null?n(a):t.defaultValue},set(a){a===void 0?this.data.delete(i):this.data.set(i,o(a))}},[`has${Et(s)}`]:{get(){return this.data.has(i)||t.hasCustomDefaultValue}}}}function Ws([r,e],t){return ta({controller:t,token:r,typeDefinition:e})}function Wt(r){switch(r){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function wt(r){switch(typeof r){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(r))return"array";if(Object.prototype.toString.call(r)==="[object Object]")return"object"}function Qo(r){let{controller:e,token:t,typeObject:i}=r,s=Is(i.type),n=Is(i.default),o=s&&n,a=s&&!n,d=!s&&n,f=Wt(i.type),u=wt(r.typeObject.default);if(a)return f;if(d)return u;if(f!==u){let _=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${_}" must match the defined type "${f}". The provided default value of "${i.default}" is of type "${u}".`)}if(o)return f}function Zo(r){let{controller:e,token:t,typeDefinition:i}=r,n=Qo({controller:e,token:t,typeObject:i}),o=wt(i),a=Wt(i),d=n||o||a;if(d)return d;let f=e?`${e}.${i}`:t;throw new Error(`Unknown value type "${f}" for "${t}" value`)}function ea(r){let e=Wt(r);if(e)return Ds[e];let t=Zr(r,"default"),i=Zr(r,"type"),s=r;if(t)return s.default;if(i){let{type:n}=s,o=Wt(n);if(o)return Ds[o]}return r}function ta(r){let{token:e,typeDefinition:t}=r,i=`${Ns(e)}-value`,s=Zo(r);return{type:s,key:i,name:yi(i),get defaultValue(){return ea(t)},get hasCustomDefaultValue(){return wt(t)!==void 0},reader:ra[s],writer:Hs[s]||Hs.default}}var Ds={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},ra={array(r){let e=JSON.parse(r);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${r}" of type "${wt(e)}"`);return e},boolean(r){return!(r=="0"||String(r).toLowerCase()=="false")},number(r){return Number(r.replace(/_/g,""))},object(r){let e=JSON.parse(r);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${r}" of type "${wt(e)}"`);return e},string(r){return r}},Hs={default:ia,array:qs,object:qs};function qs(r){return JSON.stringify(r)}function ia(r){return`${r}`}var y=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}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(e,{target:t=this.element,detail:i={},prefix:s=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let a=s?`${s}:${e}`:e,d=new CustomEvent(a,{detail:i,bubbles:n,cancelable:o});return t.dispatchEvent(d),d}};y.blessings=[zo,Xo,Jo,Uo];y.targets=[];y.outlets=[];y.values={};var zt=class extends y{connect(){console.log(`resource-layout connected: ${this.element}`)}};var $t=class extends y{connect(){console.log(`nav-grid-menu-item connected: ${this.element}`)}};var Ut=class extends y{connect(){console.log(`nav-grid-menu connected: ${this.element}`)}};var Kt=class extends y{connect(){console.log(`nav-user-section connected: ${this.element}`)}};var Xt=class extends y{connect(){console.log(`nav-user-link connected: ${this.element}`)}};var Yt=class extends y{connect(){console.log(`nav-user connected: ${this.element}`)}};var Jt=class extends y{connect(){console.log(`resource-header connected: ${this.element}`)}};var Gt=class extends y{connect(){console.log(`sidebar-menu-item connected: ${this.element}`)}};var Qt=class extends y{connect(){console.log(`sidebar-menu connected: ${this.element}`)}};var Zt=class extends y{connect(){console.log(`has-many-panel connected: ${this.element}`)}};var er=class extends y{static targets=["target","template","addButton"];static values={wrapperSelector:{type:String,default:".nested-resource-form-fields"},limit:Number};connect(){this.updateState()}add(r){r.preventDefault();let e=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",e);let t=new CustomEvent("nested-resource-form-fields:add",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}remove(r){r.preventDefault();let e=r.target.closest(this.wrapperSelectorValue);if(e.dataset.newRecord==="true")e.remove();else{e.style.display="none";let i=e.querySelector("input[name*='_destroy']");i.value="1"}let t=new CustomEvent("nested-resource-form-fields:remove",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}updateState(){!this.hasAddButtonTarget||this.limitValue==0||(this.childCount>=this.limitValue?this.addButtonTarget.style.display="none":this.addButtonTarget.style.display="initial")}get childCount(){return this.element.querySelectorAll(this.wrapperSelectorValue).length}};var tr=class extends y{connect(){console.log(`toolbar connected: ${this.element}`)}};var rr=class extends y{connect(){console.log(`table-search-input connected: ${this.element}`)}};var ir=class extends y{connect(){console.log(`table-toolbar connected: ${this.element}`)}};var sr=class extends y{connect(){console.log(`table connected: ${this.element}`)}};var Ph=po(Ks(),1),nr=class extends y{connect(){console.log(`form connected: ${this.element}`)}submit(){this.element.requestSubmit()}};var Ea=function(){function r(e,t){t===void 0&&(t=[]),this._eventType=e,this._eventFunctions=t}return r.prototype.init=function(){var e=this;this._eventFunctions.forEach(function(t){typeof window<"u"&&window.addEventListener(e._eventType,t)})},r}(),Xs=Ea;var _a=function(){function r(){this._instances={Accordion:{},Carousel:{},Collapse:{},Dial:{},Dismiss:{},Drawer:{},Dropdown:{},Modal:{},Popover:{},Tabs:{},Tooltip:{},InputCounter:{},CopyClipboard:{}}}return r.prototype.addInstance=function(e,t,i,s){if(s===void 0&&(s=!1),!this._instances[e])return console.warn("Flowbite: Component ".concat(e," does not exist.")),!1;if(this._instances[e][i]&&!s){console.warn("Flowbite: Instance with ID ".concat(i," already exists."));return}s&&this._instances[e][i]&&this._instances[e][i].destroyAndRemoveInstance(),this._instances[e][i||this._generateRandomId()]=t},r.prototype.getAllInstances=function(){return this._instances},r.prototype.getInstances=function(e){return this._instances[e]?this._instances[e]:(console.warn("Flowbite: Component ".concat(e," does not exist.")),!1)},r.prototype.getInstance=function(e,t){if(this._componentAndInstanceCheck(e,t)){if(!this._instances[e][t]){console.warn("Flowbite: Instance with ID ".concat(t," does not exist."));return}return this._instances[e][t]}},r.prototype.destroyAndRemoveInstance=function(e,t){this._componentAndInstanceCheck(e,t)&&(this.destroyInstanceObject(e,t),this.removeInstance(e,t))},r.prototype.removeInstance=function(e,t){this._componentAndInstanceCheck(e,t)&&delete this._instances[e][t]},r.prototype.destroyInstanceObject=function(e,t){this._componentAndInstanceCheck(e,t)&&this._instances[e][t].destroy()},r.prototype.instanceExists=function(e,t){return!(!this._instances[e]||!this._instances[e][t])},r.prototype._generateRandomId=function(){return Math.random().toString(36).substr(2,9)},r.prototype._componentAndInstanceCheck=function(e,t){return this._instances[e]?this._instances[e][t]?!0:(console.warn("Flowbite: Instance with ID ".concat(t," does not exist.")),!1):(console.warn("Flowbite: Component ".concat(e," does not exist.")),!1)},r}(),Ys=new _a,b=Ys;typeof window<"u"&&(window.FlowbiteInstances=Ys);var or=function(){return or=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},or.apply(this,arguments)},ar={alwaysOpen:!1,activeClasses:"bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white",inactiveClasses:"text-gray-500 dark:text-gray-400",onOpen:function(){},onClose:function(){},onToggle:function(){}},Sa={id:null,override:!0},Js=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=[]),i===void 0&&(i=ar),s===void 0&&(s=Sa),this._instanceId=s.id?s.id:e.id,this._accordionEl=e,this._items=t,this._options=or(or({},ar),i),this._initialized=!1,this.init(),b.addInstance("Accordion",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._items.length&&!this._initialized&&(this._items.forEach(function(t){t.active&&e.open(t.id);var i=function(){e.toggle(t.id)};t.triggerEl.addEventListener("click",i),t.clickHandler=i}),this._initialized=!0)},r.prototype.destroy=function(){this._items.length&&this._initialized&&(this._items.forEach(function(e){e.triggerEl.removeEventListener("click",e.clickHandler),delete e.clickHandler}),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Accordion",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.getItem=function(e){return this._items.filter(function(t){return t.id===e})[0]},r.prototype.open=function(e){var t,i,s=this,n=this.getItem(e);this._options.alwaysOpen||this._items.map(function(o){var a,d;o!==n&&((a=o.triggerEl.classList).remove.apply(a,s._options.activeClasses.split(" ")),(d=o.triggerEl.classList).add.apply(d,s._options.inactiveClasses.split(" ")),o.targetEl.classList.add("hidden"),o.triggerEl.setAttribute("aria-expanded","false"),o.active=!1,o.iconEl&&o.iconEl.classList.add("rotate-180"))}),(t=n.triggerEl.classList).add.apply(t,this._options.activeClasses.split(" ")),(i=n.triggerEl.classList).remove.apply(i,this._options.inactiveClasses.split(" ")),n.triggerEl.setAttribute("aria-expanded","true"),n.targetEl.classList.remove("hidden"),n.active=!0,n.iconEl&&n.iconEl.classList.remove("rotate-180"),this._options.onOpen(this,n)},r.prototype.toggle=function(e){var t=this.getItem(e);t.active?this.close(e):this.open(e),this._options.onToggle(this,t)},r.prototype.close=function(e){var t,i,s=this.getItem(e);(t=s.triggerEl.classList).remove.apply(t,this._options.activeClasses.split(" ")),(i=s.triggerEl.classList).add.apply(i,this._options.inactiveClasses.split(" ")),s.targetEl.classList.add("hidden"),s.triggerEl.setAttribute("aria-expanded","false"),s.active=!1,s.iconEl&&s.iconEl.classList.add("rotate-180"),this._options.onClose(this,s)},r.prototype.updateOnOpen=function(e){this._options.onOpen=e},r.prototype.updateOnClose=function(e){this._options.onClose=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function Ke(){document.querySelectorAll("[data-accordion]").forEach(function(r){var e=r.getAttribute("data-accordion"),t=r.getAttribute("data-active-classes"),i=r.getAttribute("data-inactive-classes"),s=[];r.querySelectorAll("[data-accordion-target]").forEach(function(n){if(n.closest("[data-accordion]")===r){var o={id:n.getAttribute("data-accordion-target"),triggerEl:n,targetEl:document.querySelector(n.getAttribute("data-accordion-target")),iconEl:n.querySelector("[data-accordion-icon]"),active:n.getAttribute("aria-expanded")==="true"};s.push(o)}}),new Js(r,s,{alwaysOpen:e==="open",activeClasses:t||ar.activeClasses,inactiveClasses:i||ar.inactiveClasses})})}typeof window<"u"&&(window.Accordion=Js,window.initAccordions=Ke);var lr=function(){return lr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},lr.apply(this,arguments)},Gs={onCollapse:function(){},onExpand:function(){},onToggle:function(){}},Aa={id:null,override:!0},cr=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=Gs),s===void 0&&(s=Aa),this._instanceId=s.id?s.id:e.id,this._targetEl=e,this._triggerEl=t,this._options=lr(lr({},Gs),i),this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Collapse",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._triggerEl&&this._targetEl&&!this._initialized&&(this._triggerEl.hasAttribute("aria-expanded")?this._visible=this._triggerEl.getAttribute("aria-expanded")==="true":this._visible=!this._targetEl.classList.contains("hidden"),this._clickHandler=function(){e.toggle()},this._triggerEl.addEventListener("click",this._clickHandler),this._initialized=!0)},r.prototype.destroy=function(){this._triggerEl&&this._initialized&&(this._triggerEl.removeEventListener("click",this._clickHandler),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Collapse",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.collapse=function(){this._targetEl.classList.add("hidden"),this._triggerEl&&this._triggerEl.setAttribute("aria-expanded","false"),this._visible=!1,this._options.onCollapse(this)},r.prototype.expand=function(){this._targetEl.classList.remove("hidden"),this._triggerEl&&this._triggerEl.setAttribute("aria-expanded","true"),this._visible=!0,this._options.onExpand(this)},r.prototype.toggle=function(){this._visible?this.collapse():this.expand(),this._options.onToggle(this)},r.prototype.updateOnCollapse=function(e){this._options.onCollapse=e},r.prototype.updateOnExpand=function(e){this._options.onExpand=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function Xe(){document.querySelectorAll("[data-collapse-toggle]").forEach(function(r){var e=r.getAttribute("data-collapse-toggle"),t=document.getElementById(e);t?b.instanceExists("Collapse",t.getAttribute("id"))?new cr(t,r,{},{id:t.getAttribute("id")+"_"+b._generateRandomId()}):new cr(t,r):console.error('The target element with id "'.concat(e,'" does not exist. Please check the data-collapse-toggle attribute.'))})}typeof window<"u"&&(window.Collapse=cr,window.initCollapses=Xe);var _i=cr;var Ie=function(){return Ie=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Ie.apply(this,arguments)},hr={defaultPosition:0,indicators:{items:[],activeClasses:"bg-white dark:bg-gray-800",inactiveClasses:"bg-white/50 dark:bg-gray-800/50 hover:bg-white dark:hover:bg-gray-800"},interval:3e3,onNext:function(){},onPrev:function(){},onChange:function(){}},La={id:null,override:!0},Qs=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=[]),i===void 0&&(i=hr),s===void 0&&(s=La),this._instanceId=s.id?s.id:e.id,this._carouselEl=e,this._items=t,this._options=Ie(Ie(Ie({},hr),i),{indicators:Ie(Ie({},hr.indicators),i.indicators)}),this._activeItem=this.getItem(this._options.defaultPosition),this._indicators=this._options.indicators.items,this._intervalDuration=this._options.interval,this._intervalInstance=null,this._initialized=!1,this.init(),b.addInstance("Carousel",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._items.length&&!this._initialized&&(this._items.map(function(t){t.el.classList.add("absolute","inset-0","transition-transform","transform")}),this.getActiveItem()?this.slideTo(this.getActiveItem().position):this.slideTo(0),this._indicators.map(function(t,i){t.el.addEventListener("click",function(){e.slideTo(i)})}),this._initialized=!0)},r.prototype.destroy=function(){this._initialized&&(this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Carousel",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.getItem=function(e){return this._items[e]},r.prototype.slideTo=function(e){var t=this._items[e],i={left:t.position===0?this._items[this._items.length-1]:this._items[t.position-1],middle:t,right:t.position===this._items.length-1?this._items[0]:this._items[t.position+1]};this._rotate(i),this._setActiveItem(t),this._intervalInstance&&(this.pause(),this.cycle()),this._options.onChange(this)},r.prototype.next=function(){var e=this.getActiveItem(),t=null;e.position===this._items.length-1?t=this._items[0]:t=this._items[e.position+1],this.slideTo(t.position),this._options.onNext(this)},r.prototype.prev=function(){var e=this.getActiveItem(),t=null;e.position===0?t=this._items[this._items.length-1]:t=this._items[e.position-1],this.slideTo(t.position),this._options.onPrev(this)},r.prototype._rotate=function(e){if(this._items.map(function(t){t.el.classList.add("hidden")}),this._items.length===1){e.middle.el.classList.remove("-translate-x-full","translate-x-full","translate-x-0","hidden","z-10"),e.middle.el.classList.add("translate-x-0","z-20");return}e.left.el.classList.remove("-translate-x-full","translate-x-full","translate-x-0","hidden","z-20"),e.left.el.classList.add("-translate-x-full","z-10"),e.middle.el.classList.remove("-translate-x-full","translate-x-full","translate-x-0","hidden","z-10"),e.middle.el.classList.add("translate-x-0","z-30"),e.right.el.classList.remove("-translate-x-full","translate-x-full","translate-x-0","hidden","z-30"),e.right.el.classList.add("translate-x-full","z-20")},r.prototype.cycle=function(){var e=this;typeof window<"u"&&(this._intervalInstance=window.setInterval(function(){e.next()},this._intervalDuration))},r.prototype.pause=function(){clearInterval(this._intervalInstance)},r.prototype.getActiveItem=function(){return this._activeItem},r.prototype._setActiveItem=function(e){var t,i,s=this;this._activeItem=e;var n=e.position;this._indicators.length&&(this._indicators.map(function(o){var a,d;o.el.setAttribute("aria-current","false"),(a=o.el.classList).remove.apply(a,s._options.indicators.activeClasses.split(" ")),(d=o.el.classList).add.apply(d,s._options.indicators.inactiveClasses.split(" "))}),(t=this._indicators[n].el.classList).add.apply(t,this._options.indicators.activeClasses.split(" ")),(i=this._indicators[n].el.classList).remove.apply(i,this._options.indicators.inactiveClasses.split(" ")),this._indicators[n].el.setAttribute("aria-current","true"))},r.prototype.updateOnNext=function(e){this._options.onNext=e},r.prototype.updateOnPrev=function(e){this._options.onPrev=e},r.prototype.updateOnChange=function(e){this._options.onChange=e},r}();function Ye(){document.querySelectorAll("[data-carousel]").forEach(function(r){var e=r.getAttribute("data-carousel-interval"),t=r.getAttribute("data-carousel")==="slide",i=[],s=0;r.querySelectorAll("[data-carousel-item]").length&&Array.from(r.querySelectorAll("[data-carousel-item]")).map(function(f,u){i.push({position:u,el:f}),f.getAttribute("data-carousel-item")==="active"&&(s=u)});var n=[];r.querySelectorAll("[data-carousel-slide-to]").length&&Array.from(r.querySelectorAll("[data-carousel-slide-to]")).map(function(f){n.push({position:parseInt(f.getAttribute("data-carousel-slide-to")),el:f})});var o=new Qs(r,i,{defaultPosition:s,indicators:{items:n},interval:e||hr.interval});t&&o.cycle();var a=r.querySelector("[data-carousel-next]"),d=r.querySelector("[data-carousel-prev]");a&&a.addEventListener("click",function(){o.next()}),d&&d.addEventListener("click",function(){o.prev()})})}typeof window<"u"&&(window.Carousel=Qs,window.initCarousels=Ye);var dr=function(){return dr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},dr.apply(this,arguments)},Zs={transition:"transition-opacity",duration:300,timing:"ease-out",onHide:function(){}},Ca={id:null,override:!0},Si=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=Zs),s===void 0&&(s=Ca),this._instanceId=s.id?s.id:e.id,this._targetEl=e,this._triggerEl=t,this._options=dr(dr({},Zs),i),this._initialized=!1,this.init(),b.addInstance("Dismiss",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._triggerEl&&this._targetEl&&!this._initialized&&(this._clickHandler=function(){e.hide()},this._triggerEl.addEventListener("click",this._clickHandler),this._initialized=!0)},r.prototype.destroy=function(){this._triggerEl&&this._initialized&&(this._triggerEl.removeEventListener("click",this._clickHandler),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Dismiss",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.hide=function(){var e=this;this._targetEl.classList.add(this._options.transition,"duration-".concat(this._options.duration),this._options.timing,"opacity-0"),setTimeout(function(){e._targetEl.classList.add("hidden")},this._options.duration),this._options.onHide(this,this._targetEl)},r.prototype.updateOnHide=function(e){this._options.onHide=e},r}();function Je(){document.querySelectorAll("[data-dismiss-target]").forEach(function(r){var e=r.getAttribute("data-dismiss-target"),t=document.querySelector(e);t?new Si(t,r):console.error('The dismiss element with id "'.concat(e,'" does not exist. Please check the data-dismiss-target attribute.'))})}typeof window<"u"&&(window.Dismiss=Si,window.initDismisses=Je);var Ai=Si;var N="top",U="bottom",z="right",W="left",ur="auto",we=[N,U,z,W],ge="start",Me="end",en="clippingParents",fr="viewport",Ge="popper",tn="reference",Li=we.reduce(function(r,e){return r.concat([e+"-"+ge,e+"-"+Me])},[]),pr=[].concat(we,[ur]).reduce(function(r,e){return r.concat([e,e+"-"+ge,e+"-"+Me])},[]),Ta="beforeRead",xa="read",ka="afterRead",Oa="beforeMain",Ia="main",Ma="afterMain",Pa="beforeWrite",Ra="write",Fa="afterWrite",rn=[Ta,xa,ka,Oa,Ia,Ma,Pa,Ra,Fa];function Y(r){return r?(r.nodeName||"").toLowerCase():null}function D(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function ie(r){var e=D(r).Element;return r instanceof e||r instanceof Element}function K(r){var e=D(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function Qe(r){if(typeof ShadowRoot>"u")return!1;var e=D(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function Ba(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},s=e.attributes[t]||{},n=e.elements[t];!K(n)||!Y(n)||(Object.assign(n.style,i),Object.keys(s).forEach(function(o){var a=s[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function Da(r){var e=r.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var s=e.elements[i],n=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(d,f){return d[f]="",d},{});!K(s)||!Y(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(d){s.removeAttribute(d)}))})}}var sn={name:"applyStyles",enabled:!0,phase:"write",fn:Ba,effect:Da,requires:["computeStyles"]};function J(r){return r.split("-")[0]}var le=Math.max,Pe=Math.min,ve=Math.round;function Ze(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function St(){return!/^((?!chrome|android).)*safari/i.test(Ze())}function se(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=r.getBoundingClientRect(),s=1,n=1;e&&K(r)&&(s=r.offsetWidth>0&&ve(i.width)/r.offsetWidth||1,n=r.offsetHeight>0&&ve(i.height)/r.offsetHeight||1);var o=ie(r)?D(r):window,a=o.visualViewport,d=!St()&&t,f=(i.left+(d&&a?a.offsetLeft:0))/s,u=(i.top+(d&&a?a.offsetTop:0))/n,_=i.width/s,E=i.height/n;return{width:_,height:E,top:u,right:f+_,bottom:u+E,left:f,x:f,y:u}}function Re(r){var e=se(r),t=r.offsetWidth,i=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:i}}function At(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&Qe(t)){var i=e;do{if(i&&r.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function Z(r){return D(r).getComputedStyle(r)}function Ci(r){return["table","td","th"].indexOf(Y(r))>=0}function Q(r){return((ie(r)?r.ownerDocument:r.document)||window.document).documentElement}function be(r){return Y(r)==="html"?r:r.assignedSlot||r.parentNode||(Qe(r)?r.host:null)||Q(r)}function nn(r){return!K(r)||Z(r).position==="fixed"?null:r.offsetParent}function Ha(r){var e=/firefox/i.test(Ze()),t=/Trident/i.test(Ze());if(t&&K(r)){var i=Z(r);if(i.position==="fixed")return null}var s=be(r);for(Qe(s)&&(s=s.host);K(s)&&["html","body"].indexOf(Y(s))<0;){var n=Z(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function ce(r){for(var e=D(r),t=nn(r);t&&Ci(t)&&Z(t).position==="static";)t=nn(t);return t&&(Y(t)==="html"||Y(t)==="body"&&Z(t).position==="static")?e:t||Ha(r)||e}function Fe(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function Be(r,e,t){return le(r,Pe(e,t))}function on(r,e,t){var i=Be(r,e,t);return i>t?t:i}function Lt(){return{top:0,right:0,bottom:0,left:0}}function Ct(r){return Object.assign({},Lt(),r)}function Tt(r,e){return e.reduce(function(t,i){return t[i]=r,t},{})}var qa=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Ct(typeof e!="number"?e:Tt(e,we))};function Na(r){var e,t=r.state,i=r.name,s=r.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=J(t.placement),d=Fe(a),f=[W,z].indexOf(a)>=0,u=f?"height":"width";if(!(!n||!o)){var _=qa(s.padding,t),E=Re(n),w=d==="y"?N:W,O=d==="y"?U:z,C=t.rects.reference[u]+t.rects.reference[d]-o[d]-t.rects.popper[u],S=o[d]-t.rects.reference[d],x=ce(n),I=x?d==="y"?x.clientHeight||0:x.clientWidth||0:0,M=C/2-S/2,L=_[w],T=I-E[u]-_[O],v=I/2-E[u]/2+M,k=Be(L,v,T),P=d;t.modifiersData[i]=(e={},e[P]=k,e.centerOffset=k-v,e)}}function Va(r){var e=r.state,t=r.options,i=t.element,s=i===void 0?"[data-popper-arrow]":i;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||At(e.elements.popper,s)&&(e.elements.arrow=s))}var an={name:"arrow",enabled:!0,phase:"main",fn:Na,effect:Va,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ne(r){return r.split("-")[1]}var ja={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Wa(r,e){var t=r.x,i=r.y,s=e.devicePixelRatio||1;return{x:ve(t*s)/s||0,y:ve(i*s)/s||0}}function ln(r){var e,t=r.popper,i=r.popperRect,s=r.placement,n=r.variation,o=r.offsets,a=r.position,d=r.gpuAcceleration,f=r.adaptive,u=r.roundOffsets,_=r.isFixed,E=o.x,w=E===void 0?0:E,O=o.y,C=O===void 0?0:O,S=typeof u=="function"?u({x:w,y:C}):{x:w,y:C};w=S.x,C=S.y;var x=o.hasOwnProperty("x"),I=o.hasOwnProperty("y"),M=W,L=N,T=window;if(f){var v=ce(t),k="clientHeight",P="clientWidth";if(v===D(t)&&(v=Q(t),Z(v).position!=="static"&&a==="absolute"&&(k="scrollHeight",P="scrollWidth")),v=v,s===N||(s===W||s===z)&&n===Me){L=U;var F=_&&v===T&&T.visualViewport?T.visualViewport.height:v[k];C-=F-i.height,C*=d?1:-1}if(s===W||(s===N||s===U)&&n===Me){M=z;var V=_&&v===T&&T.visualViewport?T.visualViewport.width:v[P];w-=V-i.width,w*=d?1:-1}}var X=Object.assign({position:a},f&&ja),$=u===!0?Wa({x:w,y:C},D(t)):{x:w,y:C};if(w=$.x,C=$.y,d){var j;return Object.assign({},X,(j={},j[L]=I?"0":"",j[M]=x?"0":"",j.transform=(T.devicePixelRatio||1)<=1?"translate("+w+"px, "+C+"px)":"translate3d("+w+"px, "+C+"px, 0)",j))}return Object.assign({},X,(e={},e[L]=I?C+"px":"",e[M]=x?w+"px":"",e.transform="",e))}function za(r){var e=r.state,t=r.options,i=t.gpuAcceleration,s=i===void 0?!0:i,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,d=a===void 0?!0:a,f={placement:J(e.placement),variation:ne(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,ln(Object.assign({},f,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:d})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,ln(Object.assign({},f,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var cn={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:za,data:{}};var mr={passive:!0};function $a(r){var e=r.state,t=r.instance,i=r.options,s=i.scroll,n=s===void 0?!0:s,o=i.resize,a=o===void 0?!0:o,d=D(e.elements.popper),f=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&f.forEach(function(u){u.addEventListener("scroll",t.update,mr)}),a&&d.addEventListener("resize",t.update,mr),function(){n&&f.forEach(function(u){u.removeEventListener("scroll",t.update,mr)}),a&&d.removeEventListener("resize",t.update,mr)}}var hn={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:$a,data:{}};var Ua={left:"right",right:"left",bottom:"top",top:"bottom"};function et(r){return r.replace(/left|right|bottom|top/g,function(e){return Ua[e]})}var Ka={start:"end",end:"start"};function gr(r){return r.replace(/start|end/g,function(e){return Ka[e]})}function De(r){var e=D(r),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function He(r){return se(Q(r)).left+De(r).scrollLeft}function Ti(r,e){var t=D(r),i=Q(r),s=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,d=0;if(s){n=s.width,o=s.height;var f=St();(f||!f&&e==="fixed")&&(a=s.offsetLeft,d=s.offsetTop)}return{width:n,height:o,x:a+He(r),y:d}}function xi(r){var e,t=Q(r),i=De(r),s=(e=r.ownerDocument)==null?void 0:e.body,n=le(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=le(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-i.scrollLeft+He(r),d=-i.scrollTop;return Z(s||t).direction==="rtl"&&(a+=le(t.clientWidth,s?s.clientWidth:0)-n),{width:n,height:o,x:a,y:d}}function qe(r){var e=Z(r),t=e.overflow,i=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+i)}function vr(r){return["html","body","#document"].indexOf(Y(r))>=0?r.ownerDocument.body:K(r)&&qe(r)?r:vr(be(r))}function Ee(r,e){var t;e===void 0&&(e=[]);var i=vr(r),s=i===((t=r.ownerDocument)==null?void 0:t.body),n=D(i),o=s?[n].concat(n.visualViewport||[],qe(i)?i:[]):i,a=e.concat(o);return s?a:a.concat(Ee(be(o)))}function tt(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function Xa(r,e){var t=se(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function dn(r,e,t){return e===fr?tt(Ti(r,t)):ie(e)?Xa(e,t):tt(xi(Q(r)))}function Ya(r){var e=Ee(be(r)),t=["absolute","fixed"].indexOf(Z(r).position)>=0,i=t&&K(r)?ce(r):r;return ie(i)?e.filter(function(s){return ie(s)&&At(s,i)&&Y(s)!=="body"}):[]}function ki(r,e,t,i){var s=e==="clippingParents"?Ya(r):[].concat(e),n=[].concat(s,[t]),o=n[0],a=n.reduce(function(d,f){var u=dn(r,f,i);return d.top=le(u.top,d.top),d.right=Pe(u.right,d.right),d.bottom=Pe(u.bottom,d.bottom),d.left=le(u.left,d.left),d},dn(r,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function xt(r){var e=r.reference,t=r.element,i=r.placement,s=i?J(i):null,n=i?ne(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,d;switch(s){case N:d={x:o,y:e.y-t.height};break;case U:d={x:o,y:e.y+e.height};break;case z:d={x:e.x+e.width,y:a};break;case W:d={x:e.x-t.width,y:a};break;default:d={x:e.x,y:e.y}}var f=s?Fe(s):null;if(f!=null){var u=f==="y"?"height":"width";switch(n){case ge:d[f]=d[f]-(e[u]/2-t[u]/2);break;case Me:d[f]=d[f]+(e[u]/2-t[u]/2);break;default:}}return d}function he(r,e){e===void 0&&(e={});var t=e,i=t.placement,s=i===void 0?r.placement:i,n=t.strategy,o=n===void 0?r.strategy:n,a=t.boundary,d=a===void 0?en:a,f=t.rootBoundary,u=f===void 0?fr:f,_=t.elementContext,E=_===void 0?Ge:_,w=t.altBoundary,O=w===void 0?!1:w,C=t.padding,S=C===void 0?0:C,x=Ct(typeof S!="number"?S:Tt(S,we)),I=E===Ge?tn:Ge,M=r.rects.popper,L=r.elements[O?I:E],T=ki(ie(L)?L:L.contextElement||Q(r.elements.popper),d,u,o),v=se(r.elements.reference),k=xt({reference:v,element:M,strategy:"absolute",placement:s}),P=tt(Object.assign({},M,k)),F=E===Ge?P:v,V={top:T.top-F.top+x.top,bottom:F.bottom-T.bottom+x.bottom,left:T.left-F.left+x.left,right:F.right-T.right+x.right},X=r.modifiersData.offset;if(E===Ge&&X){var $=X[s];Object.keys(V).forEach(function(j){var ue=[z,U].indexOf(j)>=0?1:-1,pe=[N,U].indexOf(j)>=0?"y":"x";V[j]+=$[pe]*ue})}return V}function Oi(r,e){e===void 0&&(e={});var t=e,i=t.placement,s=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,d=t.allowedAutoPlacements,f=d===void 0?pr:d,u=ne(i),_=u?a?Li:Li.filter(function(O){return ne(O)===u}):we,E=_.filter(function(O){return f.indexOf(O)>=0});E.length===0&&(E=_);var w=E.reduce(function(O,C){return O[C]=he(r,{placement:C,boundary:s,rootBoundary:n,padding:o})[J(C)],O},{});return Object.keys(w).sort(function(O,C){return w[O]-w[C]})}function Ja(r){if(J(r)===ur)return[];var e=et(r);return[gr(r),e,gr(e)]}function Ga(r){var e=r.state,t=r.options,i=r.name;if(!e.modifiersData[i]._skip){for(var s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!0:o,d=t.fallbackPlacements,f=t.padding,u=t.boundary,_=t.rootBoundary,E=t.altBoundary,w=t.flipVariations,O=w===void 0?!0:w,C=t.allowedAutoPlacements,S=e.options.placement,x=J(S),I=x===S,M=d||(I||!O?[et(S)]:Ja(S)),L=[S].concat(M).reduce(function(ee,ae){return ee.concat(J(ae)===ur?Oi(e,{placement:ae,boundary:u,rootBoundary:_,padding:f,flipVariations:O,allowedAutoPlacements:C}):ae)},[]),T=e.rects.reference,v=e.rects.popper,k=new Map,P=!0,F=L[0],V=0;V<L.length;V++){var X=L[V],$=J(X),j=ne(X)===ge,ue=[N,U].indexOf($)>=0,pe=ue?"width":"height",l=he(e,{placement:X,boundary:u,rootBoundary:_,altBoundary:E,padding:f}),c=ue?j?z:W:j?U:N;T[pe]>v[pe]&&(c=et(c));var h=et(c),p=[];if(n&&p.push(l[$]<=0),a&&p.push(l[c]<=0,l[h]<=0),p.every(function(ee){return ee})){F=X,P=!1;break}k.set(X,p)}if(P)for(var m=O?3:1,g=function(ae){var R=L.find(function(te){var re=k.get(te);if(re)return re.slice(0,ae).every(function(ke){return ke})});if(R)return F=R,"break"},A=m;A>0;A--){var B=g(A);if(B==="break")break}e.placement!==F&&(e.modifiersData[i]._skip=!0,e.placement=F,e.reset=!0)}}var un={name:"flip",enabled:!0,phase:"main",fn:Ga,requiresIfExists:["offset"],data:{_skip:!1}};function fn(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function pn(r){return[N,z,U,W].some(function(e){return r[e]>=0})}function Qa(r){var e=r.state,t=r.name,i=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,o=he(e,{elementContext:"reference"}),a=he(e,{altBoundary:!0}),d=fn(o,i),f=fn(a,s,n),u=pn(d),_=pn(f);e.modifiersData[t]={referenceClippingOffsets:d,popperEscapeOffsets:f,isReferenceHidden:u,hasPopperEscaped:_},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":_})}var mn={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Qa};function Za(r,e,t){var i=J(r),s=[W,N].indexOf(i)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*s,[W,z].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function el(r){var e=r.state,t=r.options,i=r.name,s=t.offset,n=s===void 0?[0,0]:s,o=pr.reduce(function(u,_){return u[_]=Za(_,e.rects,n),u},{}),a=o[e.placement],d=a.x,f=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=d,e.modifiersData.popperOffsets.y+=f),e.modifiersData[i]=o}var gn={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:el};function tl(r){var e=r.state,t=r.name;e.modifiersData[t]=xt({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var vn={name:"popperOffsets",enabled:!0,phase:"read",fn:tl,data:{}};function Ii(r){return r==="x"?"y":"x"}function rl(r){var e=r.state,t=r.options,i=r.name,s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!1:o,d=t.boundary,f=t.rootBoundary,u=t.altBoundary,_=t.padding,E=t.tether,w=E===void 0?!0:E,O=t.tetherOffset,C=O===void 0?0:O,S=he(e,{boundary:d,rootBoundary:f,padding:_,altBoundary:u}),x=J(e.placement),I=ne(e.placement),M=!I,L=Fe(x),T=Ii(L),v=e.modifiersData.popperOffsets,k=e.rects.reference,P=e.rects.popper,F=typeof C=="function"?C(Object.assign({},e.rects,{placement:e.placement})):C,V=typeof F=="number"?{mainAxis:F,altAxis:F}:Object.assign({mainAxis:0,altAxis:0},F),X=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,$={x:0,y:0};if(v){if(n){var j,ue=L==="y"?N:W,pe=L==="y"?U:z,l=L==="y"?"height":"width",c=v[L],h=c+S[ue],p=c-S[pe],m=w?-P[l]/2:0,g=I===ge?k[l]:P[l],A=I===ge?-P[l]:-k[l],B=e.elements.arrow,ee=w&&B?Re(B):{width:0,height:0},ae=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Lt(),R=ae[ue],te=ae[pe],re=Be(0,k[l],ee[l]),ke=M?k[l]/2-m-re-R-V.mainAxis:g-re-R-V.mainAxis,Kr=M?-k[l]/2+m+re+te+V.mainAxis:A+re+te+V.mainAxis,Xr=e.elements.arrow&&ce(e.elements.arrow),to=Xr?L==="y"?Xr.clientTop||0:Xr.clientLeft||0:0,Es=(j=X?.[L])!=null?j:0,ro=c+ke-Es-to,io=c+Kr-Es,_s=Be(w?Pe(h,ro):h,c,w?le(p,io):p);v[L]=_s,$[L]=_s-c}if(a){var Ss,so=L==="x"?N:W,no=L==="x"?U:z,Oe=v[T],Bt=T==="y"?"height":"width",As=Oe+S[so],Ls=Oe-S[no],Yr=[N,W].indexOf(x)!==-1,Cs=(Ss=X?.[T])!=null?Ss:0,Ts=Yr?As:Oe-k[Bt]-P[Bt]-Cs+V.altAxis,xs=Yr?Oe+k[Bt]+P[Bt]-Cs-V.altAxis:Ls,ks=w&&Yr?on(Ts,Oe,xs):Be(w?Ts:As,Oe,w?xs:Ls);v[T]=ks,$[T]=ks-Oe}e.modifiersData[i]=$}}var bn={name:"preventOverflow",enabled:!0,phase:"main",fn:rl,requiresIfExists:["offset"]};function Mi(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function Pi(r){return r===D(r)||!K(r)?De(r):Mi(r)}function il(r){var e=r.getBoundingClientRect(),t=ve(e.width)/r.offsetWidth||1,i=ve(e.height)/r.offsetHeight||1;return t!==1||i!==1}function Ri(r,e,t){t===void 0&&(t=!1);var i=K(e),s=K(e)&&il(e),n=Q(e),o=se(r,s,t),a={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(i||!i&&!t)&&((Y(e)!=="body"||qe(n))&&(a=Pi(e)),K(e)?(d=se(e,!0),d.x+=e.clientLeft,d.y+=e.clientTop):n&&(d.x=He(n))),{x:o.left+a.scrollLeft-d.x,y:o.top+a.scrollTop-d.y,width:o.width,height:o.height}}function sl(r){var e=new Map,t=new Set,i=[];r.forEach(function(n){e.set(n.name,n)});function s(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var d=e.get(a);d&&s(d)}}),i.push(n)}return r.forEach(function(n){t.has(n.name)||s(n)}),i}function Fi(r){var e=sl(r);return rn.reduce(function(t,i){return t.concat(e.filter(function(s){return s.phase===i}))},[])}function Bi(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function Di(r){var e=r.reduce(function(t,i){var s=t[i.name];return t[i.name]=s?Object.assign({},s,i,{options:Object.assign({},s.options,i.options),data:Object.assign({},s.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var yn={placement:"bottom",modifiers:[],strategy:"absolute"};function wn(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function En(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,i=t===void 0?[]:t,s=e.defaultOptions,n=s===void 0?yn:s;return function(a,d,f){f===void 0&&(f=n);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},yn,n),modifiersData:{},elements:{reference:a,popper:d},attributes:{},styles:{}},_=[],E=!1,w={state:u,setOptions:function(x){var I=typeof x=="function"?x(u.options):x;C(),u.options=Object.assign({},n,u.options,I),u.scrollParents={reference:ie(a)?Ee(a):a.contextElement?Ee(a.contextElement):[],popper:Ee(d)};var M=Fi(Di([].concat(i,u.options.modifiers)));return u.orderedModifiers=M.filter(function(L){return L.enabled}),O(),w.update()},forceUpdate:function(){if(!E){var x=u.elements,I=x.reference,M=x.popper;if(wn(I,M)){u.rects={reference:Ri(I,ce(M),u.options.strategy==="fixed"),popper:Re(M)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(V){return u.modifiersData[V.name]=Object.assign({},V.data)});for(var L=0;L<u.orderedModifiers.length;L++){if(u.reset===!0){u.reset=!1,L=-1;continue}var T=u.orderedModifiers[L],v=T.fn,k=T.options,P=k===void 0?{}:k,F=T.name;typeof v=="function"&&(u=v({state:u,options:P,name:F,instance:w})||u)}}}},update:Bi(function(){return new Promise(function(S){w.forceUpdate(),S(u)})}),destroy:function(){C(),E=!0}};if(!wn(a,d))return w;w.setOptions(f).then(function(S){!E&&f.onFirstUpdate&&f.onFirstUpdate(S)});function O(){u.orderedModifiers.forEach(function(S){var x=S.name,I=S.options,M=I===void 0?{}:I,L=S.effect;if(typeof L=="function"){var T=L({state:u,name:x,instance:w,options:M}),v=function(){};_.push(T||v)}})}function C(){_.forEach(function(S){return S()}),_=[]}return w}}var nl=[hn,vn,cn,sn,gn,un,bn,an,mn],Ne=En({defaultModifiers:nl});var _e=function(){return _e=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},_e.apply(this,arguments)},br=function(r,e,t){if(t||arguments.length===2)for(var i=0,s=e.length,n;i<s;i++)(n||!(i in e))&&(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return r.concat(n||Array.prototype.slice.call(e))},Se={placement:"bottom",triggerType:"click",offsetSkidding:0,offsetDistance:10,delay:300,ignoreClickOutsideClass:!1,onShow:function(){},onHide:function(){},onToggle:function(){}},ol={id:null,override:!0},Hi=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=Se),s===void 0&&(s=ol),this._instanceId=s.id?s.id:e.id,this._targetEl=e,this._triggerEl=t,this._options=_e(_e({},Se),i),this._popperInstance=null,this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Dropdown",this,this._instanceId,s.override)}return r.prototype.init=function(){this._triggerEl&&this._targetEl&&!this._initialized&&(this._popperInstance=this._createPopperInstance(),this._setupEventListeners(),this._initialized=!0)},r.prototype.destroy=function(){var e=this,t=this._getTriggerEvents();this._options.triggerType==="click"&&t.showEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._clickHandler)}),this._options.triggerType==="hover"&&(t.showEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._hoverShowTriggerElHandler),e._targetEl.removeEventListener(i,e._hoverShowTargetElHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._hoverHideHandler),e._targetEl.removeEventListener(i,e._hoverHideHandler)})),this._popperInstance.destroy(),this._initialized=!1},r.prototype.removeInstance=function(){b.removeInstance("Dropdown",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype._setupEventListeners=function(){var e=this,t=this._getTriggerEvents();this._clickHandler=function(){e.toggle()},this._options.triggerType==="click"&&t.showEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._clickHandler)}),this._hoverShowTriggerElHandler=function(i){i.type==="click"?e.toggle():setTimeout(function(){e.show()},e._options.delay)},this._hoverShowTargetElHandler=function(){e.show()},this._hoverHideHandler=function(){setTimeout(function(){e._targetEl.matches(":hover")||e.hide()},e._options.delay)},this._options.triggerType==="hover"&&(t.showEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._hoverShowTriggerElHandler),e._targetEl.addEventListener(i,e._hoverShowTargetElHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._hoverHideHandler),e._targetEl.addEventListener(i,e._hoverHideHandler)}))},r.prototype._createPopperInstance=function(){return Ne(this._triggerEl,this._targetEl,{placement:this._options.placement,modifiers:[{name:"offset",options:{offset:[this._options.offsetSkidding,this._options.offsetDistance]}}]})},r.prototype._setupClickOutsideListener=function(){var e=this;this._clickOutsideEventListener=function(t){e._handleClickOutside(t,e._targetEl)},document.body.addEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._removeClickOutsideListener=function(){document.body.removeEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._handleClickOutside=function(e,t){var i=e.target,s=this._options.ignoreClickOutsideClass,n=!1;if(s){var o=document.querySelectorAll(".".concat(s));o.forEach(function(a){if(a.contains(i)){n=!0;return}})}i!==t&&!t.contains(i)&&!this._triggerEl.contains(i)&&!n&&this.isVisible()&&this.hide()},r.prototype._getTriggerEvents=function(){switch(this._options.triggerType){case"hover":return{showEvents:["mouseenter","click"],hideEvents:["mouseleave"]};case"click":return{showEvents:["click"],hideEvents:[]};case"none":return{showEvents:[],hideEvents:[]};default:return{showEvents:["click"],hideEvents:[]}}},r.prototype.toggle=function(){this.isVisible()?this.hide():this.show(),this._options.onToggle(this)},r.prototype.isVisible=function(){return this._visible},r.prototype.show=function(){this._targetEl.classList.remove("hidden"),this._targetEl.classList.add("block"),this._popperInstance.setOptions(function(e){return _e(_e({},e),{modifiers:br(br([],e.modifiers,!0),[{name:"eventListeners",enabled:!0}],!1)})}),this._setupClickOutsideListener(),this._popperInstance.update(),this._visible=!0,this._options.onShow(this)},r.prototype.hide=function(){this._targetEl.classList.remove("block"),this._targetEl.classList.add("hidden"),this._popperInstance.setOptions(function(e){return _e(_e({},e),{modifiers:br(br([],e.modifiers,!0),[{name:"eventListeners",enabled:!1}],!1)})}),this._visible=!1,this._removeClickOutsideListener(),this._options.onHide(this)},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function rt(){document.querySelectorAll("[data-dropdown-toggle]").forEach(function(r){var e=r.getAttribute("data-dropdown-toggle"),t=document.getElementById(e);if(t){var i=r.getAttribute("data-dropdown-placement"),s=r.getAttribute("data-dropdown-offset-skidding"),n=r.getAttribute("data-dropdown-offset-distance"),o=r.getAttribute("data-dropdown-trigger"),a=r.getAttribute("data-dropdown-delay"),d=r.getAttribute("data-dropdown-ignore-click-outside-class");new Hi(t,r,{placement:i||Se.placement,triggerType:o||Se.triggerType,offsetSkidding:s?parseInt(s):Se.offsetSkidding,offsetDistance:n?parseInt(n):Se.offsetDistance,delay:a?parseInt(a):Se.delay,ignoreClickOutsideClass:d||Se.ignoreClickOutsideClass})}else console.error('The dropdown element with id "'.concat(e,'" does not exist. Please check the data-dropdown-toggle attribute.'))})}typeof window<"u"&&(window.Dropdown=Hi,window.initDropdowns=rt);var qi=Hi;var yr=function(){return yr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},yr.apply(this,arguments)},wr={placement:"center",backdropClasses:"bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-40",backdrop:"dynamic",closable:!0,onHide:function(){},onShow:function(){},onToggle:function(){}},al={id:null,override:!0},_n=function(){function r(e,t,i){e===void 0&&(e=null),t===void 0&&(t=wr),i===void 0&&(i=al),this._eventListenerInstances=[],this._instanceId=i.id?i.id:e.id,this._targetEl=e,this._options=yr(yr({},wr),t),this._isHidden=!0,this._backdropEl=null,this._initialized=!1,this.init(),b.addInstance("Modal",this,this._instanceId,i.override)}return r.prototype.init=function(){var e=this;this._targetEl&&!this._initialized&&(this._getPlacementClasses().map(function(t){e._targetEl.classList.add(t)}),this._initialized=!0)},r.prototype.destroy=function(){this._initialized&&(this.removeAllEventListenerInstances(),this._destroyBackdropEl(),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Modal",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype._createBackdrop=function(){var e;if(this._isHidden){var t=document.createElement("div");t.setAttribute("modal-backdrop",""),(e=t.classList).add.apply(e,this._options.backdropClasses.split(" ")),document.querySelector("body").append(t),this._backdropEl=t}},r.prototype._destroyBackdropEl=function(){this._isHidden||document.querySelector("[modal-backdrop]").remove()},r.prototype._setupModalCloseEventListeners=function(){var e=this;this._options.backdrop==="dynamic"&&(this._clickOutsideEventListener=function(t){e._handleOutsideClick(t.target)},this._targetEl.addEventListener("click",this._clickOutsideEventListener,!0)),this._keydownEventListener=function(t){t.key==="Escape"&&e.hide()},document.body.addEventListener("keydown",this._keydownEventListener,!0)},r.prototype._removeModalCloseEventListeners=function(){this._options.backdrop==="dynamic"&&this._targetEl.removeEventListener("click",this._clickOutsideEventListener,!0),document.body.removeEventListener("keydown",this._keydownEventListener,!0)},r.prototype._handleOutsideClick=function(e){(e===this._targetEl||e===this._backdropEl&&this.isVisible())&&this.hide()},r.prototype._getPlacementClasses=function(){switch(this._options.placement){case"top-left":return["justify-start","items-start"];case"top-center":return["justify-center","items-start"];case"top-right":return["justify-end","items-start"];case"center-left":return["justify-start","items-center"];case"center":return["justify-center","items-center"];case"center-right":return["justify-end","items-center"];case"bottom-left":return["justify-start","items-end"];case"bottom-center":return["justify-center","items-end"];case"bottom-right":return["justify-end","items-end"];default:return["justify-center","items-center"]}},r.prototype.toggle=function(){this._isHidden?this.show():this.hide(),this._options.onToggle(this)},r.prototype.show=function(){this.isHidden&&(this._targetEl.classList.add("flex"),this._targetEl.classList.remove("hidden"),this._targetEl.setAttribute("aria-modal","true"),this._targetEl.setAttribute("role","dialog"),this._targetEl.removeAttribute("aria-hidden"),this._createBackdrop(),this._isHidden=!1,this._options.closable&&this._setupModalCloseEventListeners(),document.body.classList.add("overflow-hidden"),this._options.onShow(this))},r.prototype.hide=function(){this.isVisible&&(this._targetEl.classList.add("hidden"),this._targetEl.classList.remove("flex"),this._targetEl.setAttribute("aria-hidden","true"),this._targetEl.removeAttribute("aria-modal"),this._targetEl.removeAttribute("role"),this._destroyBackdropEl(),this._isHidden=!0,document.body.classList.remove("overflow-hidden"),this._options.closable&&this._removeModalCloseEventListeners(),this._options.onHide(this))},r.prototype.isVisible=function(){return!this._isHidden},r.prototype.isHidden=function(){return this._isHidden},r.prototype.addEventListenerInstance=function(e,t,i){this._eventListenerInstances.push({element:e,type:t,handler:i})},r.prototype.removeAllEventListenerInstances=function(){this._eventListenerInstances.map(function(e){e.element.removeEventListener(e.type,e.handler)}),this._eventListenerInstances=[]},r.prototype.getAllEventListenerInstances=function(){return this._eventListenerInstances},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function it(){document.querySelectorAll("[data-modal-target]").forEach(function(r){var e=r.getAttribute("data-modal-target"),t=document.getElementById(e);if(t){var i=t.getAttribute("data-modal-placement"),s=t.getAttribute("data-modal-backdrop");new _n(t,{placement:i||wr.placement,backdrop:s||wr.backdrop})}else console.error("Modal with id ".concat(e," does not exist. Are you sure that the data-modal-target attribute points to the correct modal id?."))}),document.querySelectorAll("[data-modal-toggle]").forEach(function(r){var e=r.getAttribute("data-modal-toggle"),t=document.getElementById(e);if(t){var i=b.getInstance("Modal",e);if(i){var s=function(){i.toggle()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Modal with id ".concat(e," has not been initialized. Please initialize it using the data-modal-target attribute."))}else console.error("Modal with id ".concat(e," does not exist. Are you sure that the data-modal-toggle attribute points to the correct modal id?"))}),document.querySelectorAll("[data-modal-show]").forEach(function(r){var e=r.getAttribute("data-modal-show"),t=document.getElementById(e);if(t){var i=b.getInstance("Modal",e);if(i){var s=function(){i.show()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Modal with id ".concat(e," has not been initialized. Please initialize it using the data-modal-target attribute."))}else console.error("Modal with id ".concat(e," does not exist. Are you sure that the data-modal-show attribute points to the correct modal id?"))}),document.querySelectorAll("[data-modal-hide]").forEach(function(r){var e=r.getAttribute("data-modal-hide"),t=document.getElementById(e);if(t){var i=b.getInstance("Modal",e);if(i){var s=function(){i.hide()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Modal with id ".concat(e," has not been initialized. Please initialize it using the data-modal-target attribute."))}else console.error("Modal with id ".concat(e," does not exist. Are you sure that the data-modal-hide attribute points to the correct modal id?"))})}typeof window<"u"&&(window.Modal=_n,window.initModals=it);var Er=function(){return Er=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Er.apply(this,arguments)},Ve={placement:"left",bodyScrolling:!1,backdrop:!0,edge:!1,edgeOffset:"bottom-[60px]",backdropClasses:"bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30",onShow:function(){},onHide:function(){},onToggle:function(){}},ll={id:null,override:!0},Sn=function(){function r(e,t,i){e===void 0&&(e=null),t===void 0&&(t=Ve),i===void 0&&(i=ll),this._eventListenerInstances=[],this._instanceId=i.id?i.id:e.id,this._targetEl=e,this._options=Er(Er({},Ve),t),this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Drawer",this,this._instanceId,i.override)}return r.prototype.init=function(){var e=this;this._targetEl&&!this._initialized&&(this._targetEl.setAttribute("aria-hidden","true"),this._targetEl.classList.add("transition-transform"),this._getPlacementClasses(this._options.placement).base.map(function(t){e._targetEl.classList.add(t)}),this._handleEscapeKey=function(t){t.key==="Escape"&&e.isVisible()&&e.hide()},document.addEventListener("keydown",this._handleEscapeKey),this._initialized=!0)},r.prototype.destroy=function(){this._initialized&&(this.removeAllEventListenerInstances(),this._destroyBackdropEl(),document.removeEventListener("keydown",this._handleEscapeKey),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("Drawer",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.hide=function(){var e=this;this._options.edge?(this._getPlacementClasses(this._options.placement+"-edge").active.map(function(t){e._targetEl.classList.remove(t)}),this._getPlacementClasses(this._options.placement+"-edge").inactive.map(function(t){e._targetEl.classList.add(t)})):(this._getPlacementClasses(this._options.placement).active.map(function(t){e._targetEl.classList.remove(t)}),this._getPlacementClasses(this._options.placement).inactive.map(function(t){e._targetEl.classList.add(t)})),this._targetEl.setAttribute("aria-hidden","true"),this._targetEl.removeAttribute("aria-modal"),this._targetEl.removeAttribute("role"),this._options.bodyScrolling||document.body.classList.remove("overflow-hidden"),this._options.backdrop&&this._destroyBackdropEl(),this._visible=!1,this._options.onHide(this)},r.prototype.show=function(){var e=this;this._options.edge?(this._getPlacementClasses(this._options.placement+"-edge").active.map(function(t){e._targetEl.classList.add(t)}),this._getPlacementClasses(this._options.placement+"-edge").inactive.map(function(t){e._targetEl.classList.remove(t)})):(this._getPlacementClasses(this._options.placement).active.map(function(t){e._targetEl.classList.add(t)}),this._getPlacementClasses(this._options.placement).inactive.map(function(t){e._targetEl.classList.remove(t)})),this._targetEl.setAttribute("aria-modal","true"),this._targetEl.setAttribute("role","dialog"),this._targetEl.removeAttribute("aria-hidden"),this._options.bodyScrolling||document.body.classList.add("overflow-hidden"),this._options.backdrop&&this._createBackdrop(),this._visible=!0,this._options.onShow(this)},r.prototype.toggle=function(){this.isVisible()?this.hide():this.show()},r.prototype._createBackdrop=function(){var e,t=this;if(!this._visible){var i=document.createElement("div");i.setAttribute("drawer-backdrop",""),(e=i.classList).add.apply(e,this._options.backdropClasses.split(" ")),document.querySelector("body").append(i),i.addEventListener("click",function(){t.hide()})}},r.prototype._destroyBackdropEl=function(){this._visible&&document.querySelector("[drawer-backdrop]")!==null&&document.querySelector("[drawer-backdrop]").remove()},r.prototype._getPlacementClasses=function(e){switch(e){case"top":return{base:["top-0","left-0","right-0"],active:["transform-none"],inactive:["-translate-y-full"]};case"right":return{base:["right-0","top-0"],active:["transform-none"],inactive:["translate-x-full"]};case"bottom":return{base:["bottom-0","left-0","right-0"],active:["transform-none"],inactive:["translate-y-full"]};case"left":return{base:["left-0","top-0"],active:["transform-none"],inactive:["-translate-x-full"]};case"bottom-edge":return{base:["left-0","top-0"],active:["transform-none"],inactive:["translate-y-full",this._options.edgeOffset]};default:return{base:["left-0","top-0"],active:["transform-none"],inactive:["-translate-x-full"]}}},r.prototype.isHidden=function(){return!this._visible},r.prototype.isVisible=function(){return this._visible},r.prototype.addEventListenerInstance=function(e,t,i){this._eventListenerInstances.push({element:e,type:t,handler:i})},r.prototype.removeAllEventListenerInstances=function(){this._eventListenerInstances.map(function(e){e.element.removeEventListener(e.type,e.handler)}),this._eventListenerInstances=[]},r.prototype.getAllEventListenerInstances=function(){return this._eventListenerInstances},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function st(){document.querySelectorAll("[data-drawer-target]").forEach(function(r){var e=r.getAttribute("data-drawer-target"),t=document.getElementById(e);if(t){var i=r.getAttribute("data-drawer-placement"),s=r.getAttribute("data-drawer-body-scrolling"),n=r.getAttribute("data-drawer-backdrop"),o=r.getAttribute("data-drawer-edge"),a=r.getAttribute("data-drawer-edge-offset");new Sn(t,{placement:i||Ve.placement,bodyScrolling:s?s==="true":Ve.bodyScrolling,backdrop:n?n==="true":Ve.backdrop,edge:o?o==="true":Ve.edge,edgeOffset:a||Ve.edgeOffset})}else console.error("Drawer with id ".concat(e," not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?"))}),document.querySelectorAll("[data-drawer-toggle]").forEach(function(r){var e=r.getAttribute("data-drawer-toggle"),t=document.getElementById(e);if(t){var i=b.getInstance("Drawer",e);if(i){var s=function(){i.toggle()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Drawer with id ".concat(e," has not been initialized. Please initialize it using the data-drawer-target attribute."))}else console.error("Drawer with id ".concat(e," not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?"))}),document.querySelectorAll("[data-drawer-dismiss], [data-drawer-hide]").forEach(function(r){var e=r.getAttribute("data-drawer-dismiss")?r.getAttribute("data-drawer-dismiss"):r.getAttribute("data-drawer-hide"),t=document.getElementById(e);if(t){var i=b.getInstance("Drawer",e);if(i){var s=function(){i.hide()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Drawer with id ".concat(e," has not been initialized. Please initialize it using the data-drawer-target attribute."))}else console.error("Drawer with id ".concat(e," not found. Are you sure that the data-drawer-target attribute points to the correct drawer id"))}),document.querySelectorAll("[data-drawer-show]").forEach(function(r){var e=r.getAttribute("data-drawer-show"),t=document.getElementById(e);if(t){var i=b.getInstance("Drawer",e);if(i){var s=function(){i.show()};r.addEventListener("click",s),i.addEventListenerInstance(r,"click",s)}else console.error("Drawer with id ".concat(e," has not been initialized. Please initialize it using the data-drawer-target attribute."))}else console.error("Drawer with id ".concat(e," not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?"))})}typeof window<"u"&&(window.Drawer=Sn,window.initDrawers=st);var _r=function(){return _r=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},_r.apply(this,arguments)},Sr={defaultTabId:null,activeClasses:"text-blue-600 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-500 border-blue-600 dark:border-blue-500",inactiveClasses:"dark:border-transparent text-gray-500 hover:text-gray-600 dark:text-gray-400 border-gray-100 hover:border-gray-300 dark:border-gray-700 dark:hover:text-gray-300",onShow:function(){}},cl={id:null,override:!0},An=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=[]),i===void 0&&(i=Sr),s===void 0&&(s=cl),this._instanceId=s.id?s.id:e.id,this._tabsEl=e,this._items=t,this._activeTab=i?this.getTab(i.defaultTabId):null,this._options=_r(_r({},Sr),i),this._initialized=!1,this.init(),b.addInstance("Tabs",this,this._tabsEl.id,!0),b.addInstance("Tabs",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._items.length&&!this._initialized&&(this._activeTab||this.setActiveTab(this._items[0]),this.show(this._activeTab.id,!0),this._items.map(function(t){t.triggerEl.addEventListener("click",function(i){i.preventDefault(),e.show(t.id)})}))},r.prototype.destroy=function(){this._initialized&&(this._initialized=!1)},r.prototype.removeInstance=function(){this.destroy(),b.removeInstance("Tabs",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.getActiveTab=function(){return this._activeTab},r.prototype.setActiveTab=function(e){this._activeTab=e},r.prototype.getTab=function(e){return this._items.filter(function(t){return t.id===e})[0]},r.prototype.show=function(e,t){var i,s,n=this;t===void 0&&(t=!1);var o=this.getTab(e);o===this._activeTab&&!t||(this._items.map(function(a){var d,f;a!==o&&((d=a.triggerEl.classList).remove.apply(d,n._options.activeClasses.split(" ")),(f=a.triggerEl.classList).add.apply(f,n._options.inactiveClasses.split(" ")),a.targetEl.classList.add("hidden"),a.triggerEl.setAttribute("aria-selected","false"))}),(i=o.triggerEl.classList).add.apply(i,this._options.activeClasses.split(" ")),(s=o.triggerEl.classList).remove.apply(s,this._options.inactiveClasses.split(" ")),o.triggerEl.setAttribute("aria-selected","true"),o.targetEl.classList.remove("hidden"),this.setActiveTab(o),this._options.onShow(this,o))},r.prototype.updateOnShow=function(e){this._options.onShow=e},r}();function nt(){document.querySelectorAll("[data-tabs-toggle]").forEach(function(r){var e=[],t=r.getAttribute("data-tabs-active-classes"),i=r.getAttribute("data-tabs-inactive-classes"),s=null;r.querySelectorAll('[role="tab"]').forEach(function(n){var o=n.getAttribute("aria-selected")==="true",a={id:n.getAttribute("data-tabs-target"),triggerEl:n,targetEl:document.querySelector(n.getAttribute("data-tabs-target"))};e.push(a),o&&(s=a.id)}),new An(r,e,{defaultTabId:s,activeClasses:t||Sr.activeClasses,inactiveClasses:i||Sr.inactiveClasses})})}typeof window<"u"&&(window.Tabs=An,window.initTabs=nt);var Ae=function(){return Ae=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Ae.apply(this,arguments)},Ar=function(r,e,t){if(t||arguments.length===2)for(var i=0,s=e.length,n;i<s;i++)(n||!(i in e))&&(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return r.concat(n||Array.prototype.slice.call(e))},Lr={placement:"top",triggerType:"hover",onShow:function(){},onHide:function(){},onToggle:function(){}},hl={id:null,override:!0},Ln=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=Lr),s===void 0&&(s=hl),this._instanceId=s.id?s.id:e.id,this._targetEl=e,this._triggerEl=t,this._options=Ae(Ae({},Lr),i),this._popperInstance=null,this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Tooltip",this,this._instanceId,s.override)}return r.prototype.init=function(){this._triggerEl&&this._targetEl&&!this._initialized&&(this._setupEventListeners(),this._popperInstance=this._createPopperInstance(),this._initialized=!0)},r.prototype.destroy=function(){var e=this;if(this._initialized){var t=this._getTriggerEvents();t.showEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._showHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._hideHandler)}),this._removeKeydownListener(),this._removeClickOutsideListener(),this._popperInstance&&this._popperInstance.destroy(),this._initialized=!1}},r.prototype.removeInstance=function(){b.removeInstance("Tooltip",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype._setupEventListeners=function(){var e=this,t=this._getTriggerEvents();this._showHandler=function(){e.show()},this._hideHandler=function(){e.hide()},t.showEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._showHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._hideHandler)})},r.prototype._createPopperInstance=function(){return Ne(this._triggerEl,this._targetEl,{placement:this._options.placement,modifiers:[{name:"offset",options:{offset:[0,8]}}]})},r.prototype._getTriggerEvents=function(){switch(this._options.triggerType){case"hover":return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]};case"click":return{showEvents:["click","focus"],hideEvents:["focusout","blur"]};case"none":return{showEvents:[],hideEvents:[]};default:return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]}}},r.prototype._setupKeydownListener=function(){var e=this;this._keydownEventListener=function(t){t.key==="Escape"&&e.hide()},document.body.addEventListener("keydown",this._keydownEventListener,!0)},r.prototype._removeKeydownListener=function(){document.body.removeEventListener("keydown",this._keydownEventListener,!0)},r.prototype._setupClickOutsideListener=function(){var e=this;this._clickOutsideEventListener=function(t){e._handleClickOutside(t,e._targetEl)},document.body.addEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._removeClickOutsideListener=function(){document.body.removeEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._handleClickOutside=function(e,t){var i=e.target;i!==t&&!t.contains(i)&&!this._triggerEl.contains(i)&&this.isVisible()&&this.hide()},r.prototype.isVisible=function(){return this._visible},r.prototype.toggle=function(){this.isVisible()?this.hide():this.show()},r.prototype.show=function(){this._targetEl.classList.remove("opacity-0","invisible"),this._targetEl.classList.add("opacity-100","visible"),this._popperInstance.setOptions(function(e){return Ae(Ae({},e),{modifiers:Ar(Ar([],e.modifiers,!0),[{name:"eventListeners",enabled:!0}],!1)})}),this._setupClickOutsideListener(),this._setupKeydownListener(),this._popperInstance.update(),this._visible=!0,this._options.onShow(this)},r.prototype.hide=function(){this._targetEl.classList.remove("opacity-100","visible"),this._targetEl.classList.add("opacity-0","invisible"),this._popperInstance.setOptions(function(e){return Ae(Ae({},e),{modifiers:Ar(Ar([],e.modifiers,!0),[{name:"eventListeners",enabled:!1}],!1)})}),this._removeClickOutsideListener(),this._removeKeydownListener(),this._visible=!1,this._options.onHide(this)},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function ot(){document.querySelectorAll("[data-tooltip-target]").forEach(function(r){var e=r.getAttribute("data-tooltip-target"),t=document.getElementById(e);if(t){var i=r.getAttribute("data-tooltip-trigger"),s=r.getAttribute("data-tooltip-placement");new Ln(t,r,{placement:s||Lr.placement,triggerType:i||Lr.triggerType})}else console.error('The tooltip element with id "'.concat(e,'" does not exist. Please check the data-tooltip-target attribute.'))})}typeof window<"u"&&(window.Tooltip=Ln,window.initTooltips=ot);var Le=function(){return Le=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Le.apply(this,arguments)},Cr=function(r,e,t){if(t||arguments.length===2)for(var i=0,s=e.length,n;i<s;i++)(n||!(i in e))&&(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return r.concat(n||Array.prototype.slice.call(e))},kt={placement:"top",offset:10,triggerType:"hover",onShow:function(){},onHide:function(){},onToggle:function(){}},dl={id:null,override:!0},Cn=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=kt),s===void 0&&(s=dl),this._instanceId=s.id?s.id:e.id,this._targetEl=e,this._triggerEl=t,this._options=Le(Le({},kt),i),this._popperInstance=null,this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Popover",this,s.id?s.id:this._targetEl.id,s.override)}return r.prototype.init=function(){this._triggerEl&&this._targetEl&&!this._initialized&&(this._setupEventListeners(),this._popperInstance=this._createPopperInstance(),this._initialized=!0)},r.prototype.destroy=function(){var e=this;if(this._initialized){var t=this._getTriggerEvents();t.showEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._showHandler),e._targetEl.removeEventListener(i,e._showHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._hideHandler),e._targetEl.removeEventListener(i,e._hideHandler)}),this._removeKeydownListener(),this._removeClickOutsideListener(),this._popperInstance&&this._popperInstance.destroy(),this._initialized=!1}},r.prototype.removeInstance=function(){b.removeInstance("Popover",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype._setupEventListeners=function(){var e=this,t=this._getTriggerEvents();this._showHandler=function(){e.show()},this._hideHandler=function(){setTimeout(function(){e._targetEl.matches(":hover")||e.hide()},100)},t.showEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._showHandler),e._targetEl.addEventListener(i,e._showHandler)}),t.hideEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._hideHandler),e._targetEl.addEventListener(i,e._hideHandler)})},r.prototype._createPopperInstance=function(){return Ne(this._triggerEl,this._targetEl,{placement:this._options.placement,modifiers:[{name:"offset",options:{offset:[0,this._options.offset]}}]})},r.prototype._getTriggerEvents=function(){switch(this._options.triggerType){case"hover":return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]};case"click":return{showEvents:["click","focus"],hideEvents:["focusout","blur"]};case"none":return{showEvents:[],hideEvents:[]};default:return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]}}},r.prototype._setupKeydownListener=function(){var e=this;this._keydownEventListener=function(t){t.key==="Escape"&&e.hide()},document.body.addEventListener("keydown",this._keydownEventListener,!0)},r.prototype._removeKeydownListener=function(){document.body.removeEventListener("keydown",this._keydownEventListener,!0)},r.prototype._setupClickOutsideListener=function(){var e=this;this._clickOutsideEventListener=function(t){e._handleClickOutside(t,e._targetEl)},document.body.addEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._removeClickOutsideListener=function(){document.body.removeEventListener("click",this._clickOutsideEventListener,!0)},r.prototype._handleClickOutside=function(e,t){var i=e.target;i!==t&&!t.contains(i)&&!this._triggerEl.contains(i)&&this.isVisible()&&this.hide()},r.prototype.isVisible=function(){return this._visible},r.prototype.toggle=function(){this.isVisible()?this.hide():this.show(),this._options.onToggle(this)},r.prototype.show=function(){this._targetEl.classList.remove("opacity-0","invisible"),this._targetEl.classList.add("opacity-100","visible"),this._popperInstance.setOptions(function(e){return Le(Le({},e),{modifiers:Cr(Cr([],e.modifiers,!0),[{name:"eventListeners",enabled:!0}],!1)})}),this._setupClickOutsideListener(),this._setupKeydownListener(),this._popperInstance.update(),this._visible=!0,this._options.onShow(this)},r.prototype.hide=function(){this._targetEl.classList.remove("opacity-100","visible"),this._targetEl.classList.add("opacity-0","invisible"),this._popperInstance.setOptions(function(e){return Le(Le({},e),{modifiers:Cr(Cr([],e.modifiers,!0),[{name:"eventListeners",enabled:!1}],!1)})}),this._removeClickOutsideListener(),this._removeKeydownListener(),this._visible=!1,this._options.onHide(this)},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function at(){document.querySelectorAll("[data-popover-target]").forEach(function(r){var e=r.getAttribute("data-popover-target"),t=document.getElementById(e);if(t){var i=r.getAttribute("data-popover-trigger"),s=r.getAttribute("data-popover-placement"),n=r.getAttribute("data-popover-offset");new Cn(t,r,{placement:s||kt.placement,offset:n?parseInt(n):kt.offset,triggerType:i||kt.triggerType})}else console.error('The popover element with id "'.concat(e,'" does not exist. Please check the data-popover-target attribute.'))})}typeof window<"u"&&(window.Popover=Cn,window.initPopovers=at);var Tr=function(){return Tr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Tr.apply(this,arguments)},Ni={triggerType:"hover",onShow:function(){},onHide:function(){},onToggle:function(){}},ul={id:null,override:!0},Tn=function(){function r(e,t,i,s,n){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=null),s===void 0&&(s=Ni),n===void 0&&(n=ul),this._instanceId=n.id?n.id:i.id,this._parentEl=e,this._triggerEl=t,this._targetEl=i,this._options=Tr(Tr({},Ni),s),this._visible=!1,this._initialized=!1,this.init(),b.addInstance("Dial",this,this._instanceId,n.override)}return r.prototype.init=function(){var e=this;if(this._triggerEl&&this._targetEl&&!this._initialized){var t=this._getTriggerEventTypes(this._options.triggerType);this._showEventHandler=function(){e.show()},t.showEvents.forEach(function(i){e._triggerEl.addEventListener(i,e._showEventHandler),e._targetEl.addEventListener(i,e._showEventHandler)}),this._hideEventHandler=function(){e._parentEl.matches(":hover")||e.hide()},t.hideEvents.forEach(function(i){e._parentEl.addEventListener(i,e._hideEventHandler)}),this._initialized=!0}},r.prototype.destroy=function(){var e=this;if(this._initialized){var t=this._getTriggerEventTypes(this._options.triggerType);t.showEvents.forEach(function(i){e._triggerEl.removeEventListener(i,e._showEventHandler),e._targetEl.removeEventListener(i,e._showEventHandler)}),t.hideEvents.forEach(function(i){e._parentEl.removeEventListener(i,e._hideEventHandler)}),this._initialized=!1}},r.prototype.removeInstance=function(){b.removeInstance("Dial",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.hide=function(){this._targetEl.classList.add("hidden"),this._triggerEl&&this._triggerEl.setAttribute("aria-expanded","false"),this._visible=!1,this._options.onHide(this)},r.prototype.show=function(){this._targetEl.classList.remove("hidden"),this._triggerEl&&this._triggerEl.setAttribute("aria-expanded","true"),this._visible=!0,this._options.onShow(this)},r.prototype.toggle=function(){this._visible?this.hide():this.show()},r.prototype.isHidden=function(){return!this._visible},r.prototype.isVisible=function(){return this._visible},r.prototype._getTriggerEventTypes=function(e){switch(e){case"hover":return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]};case"click":return{showEvents:["click","focus"],hideEvents:["focusout","blur"]};case"none":return{showEvents:[],hideEvents:[]};default:return{showEvents:["mouseenter","focus"],hideEvents:["mouseleave","blur"]}}},r.prototype.updateOnShow=function(e){this._options.onShow=e},r.prototype.updateOnHide=function(e){this._options.onHide=e},r.prototype.updateOnToggle=function(e){this._options.onToggle=e},r}();function lt(){document.querySelectorAll("[data-dial-init]").forEach(function(r){var e=r.querySelector("[data-dial-toggle]");if(e){var t=e.getAttribute("data-dial-toggle"),i=document.getElementById(t);if(i){var s=e.getAttribute("data-dial-trigger");new Tn(r,e,i,{triggerType:s||Ni.triggerType})}else console.error("Dial with id ".concat(t," does not exist. Are you sure that the data-dial-toggle attribute points to the correct modal id?"))}else console.error("Dial with id ".concat(r.id," does not have a trigger element. Are you sure that the data-dial-toggle attribute exists?"))})}typeof window<"u"&&(window.Dial=Tn,window.initDials=lt);var xr=function(){return xr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},xr.apply(this,arguments)},xn={minValue:null,maxValue:null,onIncrement:function(){},onDecrement:function(){}},fl={id:null,override:!0},kn=function(){function r(e,t,i,s,n){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=null),s===void 0&&(s=xn),n===void 0&&(n=fl),this._instanceId=n.id?n.id:e.id,this._targetEl=e,this._incrementEl=t,this._decrementEl=i,this._options=xr(xr({},xn),s),this._initialized=!1,this.init(),b.addInstance("InputCounter",this,this._instanceId,n.override)}return r.prototype.init=function(){var e=this;this._targetEl&&!this._initialized&&(this._inputHandler=function(t){{var i=t.target;/^\d*$/.test(i.value)||(i.value=i.value.replace(/[^\d]/g,"")),e._options.maxValue!==null&&parseInt(i.value)>e._options.maxValue&&(i.value=e._options.maxValue.toString()),e._options.minValue!==null&&parseInt(i.value)<e._options.minValue&&(i.value=e._options.minValue.toString())}},this._incrementClickHandler=function(){e.increment()},this._decrementClickHandler=function(){e.decrement()},this._targetEl.addEventListener("input",this._inputHandler),this._incrementEl&&this._incrementEl.addEventListener("click",this._incrementClickHandler),this._decrementEl&&this._decrementEl.addEventListener("click",this._decrementClickHandler),this._initialized=!0)},r.prototype.destroy=function(){this._targetEl&&this._initialized&&(this._targetEl.removeEventListener("input",this._inputHandler),this._incrementEl&&this._incrementEl.removeEventListener("click",this._incrementClickHandler),this._decrementEl&&this._decrementEl.removeEventListener("click",this._decrementClickHandler),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("InputCounter",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.getCurrentValue=function(){return parseInt(this._targetEl.value)||0},r.prototype.increment=function(){this._options.maxValue!==null&&this.getCurrentValue()>=this._options.maxValue||(this._targetEl.value=(this.getCurrentValue()+1).toString(),this._options.onIncrement(this))},r.prototype.decrement=function(){this._options.minValue!==null&&this.getCurrentValue()<=this._options.minValue||(this._targetEl.value=(this.getCurrentValue()-1).toString(),this._options.onDecrement(this))},r.prototype.updateOnIncrement=function(e){this._options.onIncrement=e},r.prototype.updateOnDecrement=function(e){this._options.onDecrement=e},r}();function ct(){document.querySelectorAll("[data-input-counter]").forEach(function(r){var e=r.id,t=document.querySelector('[data-input-counter-increment="'+e+'"]'),i=document.querySelector('[data-input-counter-decrement="'+e+'"]'),s=r.getAttribute("data-input-counter-min"),n=r.getAttribute("data-input-counter-max");r?b.instanceExists("InputCounter",r.getAttribute("id"))||new kn(r,t||null,i||null,{minValue:s?parseInt(s):null,maxValue:n?parseInt(n):null}):console.error('The target element with id "'.concat(e,'" does not exist. Please check the data-input-counter attribute.'))})}typeof window<"u"&&(window.InputCounter=kn,window.initInputCounters=ct);var kr=function(){return kr=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},kr.apply(this,arguments)},Or={htmlEntities:!1,contentType:"input",onCopy:function(){}},pl={id:null,override:!0},On=function(){function r(e,t,i,s){e===void 0&&(e=null),t===void 0&&(t=null),i===void 0&&(i=Or),s===void 0&&(s=pl),this._instanceId=s.id?s.id:t.id,this._triggerEl=e,this._targetEl=t,this._options=kr(kr({},Or),i),this._initialized=!1,this.init(),b.addInstance("CopyClipboard",this,this._instanceId,s.override)}return r.prototype.init=function(){var e=this;this._targetEl&&this._triggerEl&&!this._initialized&&(this._triggerElClickHandler=function(){e.copy()},this._triggerEl&&this._triggerEl.addEventListener("click",this._triggerElClickHandler),this._initialized=!0)},r.prototype.destroy=function(){this._triggerEl&&this._targetEl&&this._initialized&&(this._triggerEl&&this._triggerEl.removeEventListener("click",this._triggerElClickHandler),this._initialized=!1)},r.prototype.removeInstance=function(){b.removeInstance("CopyClipboard",this._instanceId)},r.prototype.destroyAndRemoveInstance=function(){this.destroy(),this.removeInstance()},r.prototype.getTargetValue=function(){if(this._options.contentType==="input")return this._targetEl.value;if(this._options.contentType==="innerHTML")return this._targetEl.innerHTML;if(this._options.contentType==="textContent")return this._targetEl.textContent.replace(/\s+/g," ").trim()},r.prototype.copy=function(){var e=this.getTargetValue();this._options.htmlEntities&&(e=this.decodeHTML(e));var t=document.createElement("textarea");return t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),this._options.onCopy(this),e},r.prototype.decodeHTML=function(e){var t=document.createElement("textarea");return t.innerHTML=e,t.textContent},r.prototype.updateOnCopyCallback=function(e){this._options.onCopy=e},r}();function ht(){document.querySelectorAll("[data-copy-to-clipboard-target]").forEach(function(r){var e=r.getAttribute("data-copy-to-clipboard-target"),t=document.getElementById(e),i=r.getAttribute("data-copy-to-clipboard-content-type"),s=r.getAttribute("data-copy-to-clipboard-html-entities");t?b.instanceExists("CopyClipboard",t.getAttribute("id"))||new On(r,t,{htmlEntities:s&&s==="true"?!0:Or.htmlEntities,contentType:i||Or.contentType}):console.error('The target element with id "'.concat(e,'" does not exist. Please check the data-copy-to-clipboard-target attribute.'))})}typeof window<"u"&&(window.CopyClipboard=On,window.initClipboards=ht);function In(){Ke(),Xe(),Ye(),Je(),rt(),it(),st(),nt(),ot(),at(),lt(),ct(),ht()}typeof window<"u"&&(window.initFlowbite=In);var ml=new Xs("load",[Ke,Xe,Ye,Je,rt,it,st,nt,ot,at,lt,ct,ht]);ml.init();var Ir=class extends y{static targets=["trigger","menu"];connect(){console.log(`resource-drop-down connected: ${this.element}`),this.dropdown=new qi(this.menuTarget,this.triggerTarget)}disconnect(){this.dropdown=null}toggle(){this.dropdown.toggle()}show(){this.dropdown.show()}hide(){this.dropdown.hide()}};var Mr=class extends y{static targets=["trigger","menu"];connect(){console.log(`resource-collapse connected: ${this.element}`),this.collapse=new _i(this.menuTarget,this.triggerTarget)}disconnect(){this.collapse=null}toggle(){this.collapse.toggle()}show(){this.collapse.show()}hide(){this.collapse.hide()}};var Pr=class extends y{static targets=["trigger","target"];static values={after:Number};connect(){console.log(`resource-dismiss connected: ${this.element}`),this.dismiss=new Ai(this.targetTarget,this.triggerTarget),console.log(this.hasAfterValue),console.log(this.afterValue),this.hasAfterValue&&this.afterValue>0&&(this.autoDismissTimeout=setTimeout(()=>{this.hide(),this.autoDismissTimeout=null},this.afterValue))}disconnect(){this.autoDismissTimeout&&clearTimeout(this.autoDismissTimeout),this.dismiss=null,this.autoDismissTimeout=null}hide(){this.dismiss.hide()}};var Rr=class extends y{static targets=["frame","refreshButton","backButton","homeButton"];connect(){console.log(`frame-navigator connected: ${this.element}`),this.srcHistory=[],this.originalFrameSrc=this.frameTarget.src,this.hasRefreshButtonTarget&&(this.refreshButtonTarget.style.display="",this.refreshButtonClicked=this.refreshButtonClicked.bind(this),this.refreshButtonTarget.addEventListener("click",this.refreshButtonClicked)),this.hasBackButtonTarget&&(this.backButtonClicked=this.backButtonClicked.bind(this),this.backButtonTarget.addEventListener("click",this.backButtonClicked)),this.hasHomeButtonTarget&&(this.homeButtonClicked=this.homeButtonClicked.bind(this),this.homeButtonTarget.addEventListener("click",this.homeButtonClicked)),this.frameLoaded=this.frameLoaded.bind(this),this.frameTarget.addEventListener("turbo:frame-load",this.frameLoaded),this.frameLoading=this.frameLoading.bind(this),this.frameTarget.addEventListener("turbo:click",this.frameLoading),this.frameTarget.addEventListener("turbo:submit-start",this.frameLoading)}disconnect(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.removeEventListener("click",this.refreshButtonClicked),this.hasBackButtonTarget&&this.backButtonTarget.removeEventListener("click",this.backButtonClicked),this.hasHomeButtonTarget&&this.homeButtonTarget.removeEventListener("click",this.homeButtonClicked),this.frameTarget.removeEventListener("turbo:frame-load",this.frameLoaded),this.frameTarget.removeEventListener("turbo:click",this.frameLoading),this.frameTarget.removeEventListener("turbo:submit-start",this.frameLoading)}frameLoading(r){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.add("motion-safe:animate-spin"),this.frameTarget.classList.add("motion-safe:animate-pulse")}frameLoaded(r){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.remove("motion-safe:animate-spin"),this.frameTarget.classList.remove("motion-safe:animate-pulse");let e=r.target.src;e==this.currentSrc||(e==this.originalFrameSrc?this.srcHistory=[e]:this.srcHistory.push(e)),this.updateNavigationButtonsDisplay()}refreshButtonClicked(r){this.frameLoading(null),this.frameTarget.reload()}backButtonClicked(r){this.frameLoading(null),this.srcHistory.pop(),this.frameTarget.src=this.currentSrc}homeButtonClicked(r){this.frameLoading(null),this.frameTarget.src=this.originalFrameSrc}get currentSrc(){return this.srcHistory[this.srcHistory.length-1]}updateNavigationButtonsDisplay(){this.hasHomeButtonTarget&&(this.homeButtonTarget.style.display=this.srcHistory.length>1?"":"none"),this.hasBackButtonTarget&&(this.backButtonTarget.style.display=this.srcHistory.length>2?"":"none")}};var Fr=class extends y{connect(){console.log(`color-mode connected: ${this.element}`),this.updateColorMode()}disconnect(){}updateColorMode(){localStorage.theme==="dark"||!("theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}setLightColorMode(){localStorage.theme="light",this.updateColorMode()}setDarkColorMode(){localStorage.theme="dark",this.updateColorMode()}setSystemColorMode(){localStorage.removeItem("theme"),this.updateColorMode()}};function Vi(r){r.register("resource-layout",zt),r.register("nav-grid-menu-item",$t),r.register("nav-grid-menu",Ut),r.register("nav-user-section",Kt),r.register("nav-user-link",Xt),r.register("nav-user",Yt),r.register("resource-header",Jt),r.register("sidebar-menu-item",Gt),r.register("sidebar-menu",Qt),r.register("has-many-panel",Zt),r.register("nested-resource-form-fields",er),r.register("toolbar",tr),r.register("table-search-input",rr),r.register("table-toolbar",ir),r.register("table",sr),r.register("form",nr),r.register("resource-drop-down",Ir),r.register("resource-collapse",Mr),r.register("resource-dismiss",Pr),r.register("frame-navigator",Rr),r.register("color-mode",Fr)}(function(r){if(typeof r.requestSubmit=="function")return;r.requestSubmit=function(i){i?(e(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function e(i,s){i instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||t(TypeError,"The specified element is not a submit button"),i.form==s||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(i,s,n){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+s+".",n)}})(HTMLFormElement.prototype);var Dn=new WeakMap;function gl(r){let e=r instanceof Element?r:r instanceof Node?r.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function vl(r){let e=gl(r.target);e&&e.form&&Dn.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let r=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))r=e;else return}addEventListener("click",vl,!0),Object.defineProperty(r,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Dn.get(this.target)}})})();var ut={eager:"eager",lazy:"lazy"},fe=class r extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new r.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get loading(){return bl(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?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")}};function bl(r){switch(r.toLowerCase()){case"lazy":return ut.lazy;default:return ut.eager}}function G(r){return new URL(r.toString(),document.baseURI)}function ze(r){let e;if(r.hash)return r.hash.slice(1);if(e=r.href.match(/#(.*)$/))return e[1]}function vs(r,e){let t=e?.getAttribute("formaction")||r.getAttribute("action")||r.action;return G(t)}function yl(r){return(Al(r).match(/\.[^.]*$/)||[])[0]||""}function wl(r){return!!yl(r).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function El(r,e){let t=Ll(e);return r.href===G(t).href||r.href.startsWith(t)}function Ce(r,e){return El(r,e)&&wl(r)}function ji(r){let e=ze(r);return e!=null?r.href.slice(0,-(e.length+1)):r.href}function Br(r){return ji(r)}function _l(r,e){return G(r).href==G(e).href}function Sl(r){return r.pathname.split("/").slice(1)}function Al(r){return Sl(r).slice(-1)[0]}function Ll(r){return Cl(r.origin+r.pathname)}function Cl(r){return r.endsWith("/")?r:r+"/"}var Ot=class{constructor(e){this.response=e}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 G(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(e){return this.response.headers.get(e)}};function It(r){if(r.getAttribute("data-turbo-eval")=="false")return r;{let e=document.createElement("script"),t=vt("csp-nonce");return t&&(e.nonce=t),e.textContent=r.textContent,e.async=!1,Tl(e,r),e}}function Tl(r,e){for(let{name:t,value:i}of e.attributes)r.setAttribute(t,i)}function xl(r){let e=document.createElement("template");return e.innerHTML=r,e.content}function q(r,{target:e,cancelable:t,detail:i}={}){let s=new CustomEvent(r,{cancelable:t,bubbles:!0,composed:!0,detail:i});return e&&e.isConnected?e.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function pt(){return document.visibilityState==="hidden"?qn():Hn()}function Hn(){return new Promise(r=>requestAnimationFrame(()=>r()))}function qn(){return new Promise(r=>setTimeout(()=>r(),0))}function kl(){return Promise.resolve()}function Nn(r=""){return new DOMParser().parseFromString(r,"text/html")}function Vn(r,...e){let t=Ol(r,e).replace(/^\n/,"").split(`
|
6
6
|
`),i=t[0].match(/^\s+/),s=i?i[0].length:0;return t.map(n=>n.slice(s)).join(`
|
7
|
-
`)}function xl(r,e){return r.reduce((t,i,s)=>{let n=e[s]==null?"":e[s];return t+i+n},"")}function Ce(){return Array.from({length:36}).map((r,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function Br(r,...e){for(let t of e.map(i=>i?.getAttribute(r)))if(typeof t=="string")return t;return null}function kl(r,...e){return e.some(t=>t&&t.hasAttribute(r))}function Dr(...r){for(let e of r)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function Hr(...r){for(let e of r)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Ol(r,e=2e3){return new Promise(t=>{let i=()=>{r.removeEventListener("error",i),r.removeEventListener("load",i),t()};r.addEventListener("load",i,{once:!0}),r.addEventListener("error",i,{once:!0}),setTimeout(t,e)})}function Nn(r){switch(r){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Il(r){return r=="advance"||r=="replace"||r=="restore"}function $e(...r){let e=Br("data-turbo-action",...r);return Il(e)?e:null}function Vn(r){return document.querySelector(`meta[name="${r}"]`)}function vt(r){let e=Vn(r);return e&&e.content}function Ml(r,e){let t=Vn(r);return t||(t=document.createElement("meta"),t.setAttribute("name",r),document.head.appendChild(t)),t.setAttribute("content",e),t}function mt(r,e){if(r instanceof Element)return r.closest(e)||mt(r.assignedSlot||r.getRootNode()?.host,e)}function gs(r){return!!r&&r.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof r.focus=="function"}function jn(r){return Array.from(r.querySelectorAll("[autofocus]")).find(gs)}async function Pl(r,e){let t=e();r(),await Bn();let i=e();return[t,i]}function Rl(r){if(r.hasAttribute("target")){for(let e of document.getElementsByName(r.target))if(e instanceof HTMLIFrameElement)return!1}return!0}function Fl(r){return mt(r,"a[href]:not([target^=_]):not([download])")}function Wn(r){return G(r.getAttribute("href")||"")}function Bl(r,e){let t=null;return(...i)=>{let s=()=>r.apply(this,i);clearTimeout(t),t=setTimeout(s,e)}}var Vi=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let i=this.values().next().value;this.delete(i)}super.add(e)}},zn=new Vi(20),Dl=window.fetch;function $n(r,e={}){let t=new Headers(e.headers||{}),i=Ce();return zn.add(i),t.append("X-Turbo-Request-Id",i),Dl(r,{...e,headers:t})}function vs(r){switch(r.toLowerCase()){case"get":return oe.get;case"post":return oe.post;case"put":return oe.put;case"patch":return oe.patch;case"delete":return oe.delete}}var oe={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Hl(r){switch(r.toLowerCase()){case We.multipart:return We.multipart;case We.plain:return We.plain;default:return We.urlEncoded}}var We={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},Ue=class{abortController=new AbortController;#e=e=>{};constructor(e,t,i,s=new URLSearchParams,n=null,o=We.urlEncoded){let[a,d]=On(G(i),t,s,o);this.delegate=e,this.url=a,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t,headers:{...this.defaultHeaders},body:d,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,i=vs(e)||oe.get;this.url.search="";let[s,n]=On(this.url,i,t,this.enctype);this.url=s,this.fetchOptions.body=n,this.fetchOptions.method=i}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}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(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=$n(this.url.href,e);let i=await this.response;return await this.receive(i)}catch(i){if(i.name!=="AbortError")throw this.#r(i)&&this.delegate.requestErrored(this,i),i}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new Ot(e);return q("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return bs(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(s=>this.#e=s),i=q("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=i.detail.url,i.defaultPrevented&&await t,i}#r(e){return!q("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function bs(r){return vs(r)==oe.get}function On(r,e,t,i){let s=Array.from(t).length>0?new URLSearchParams(Un(t)):r.searchParams;return bs(e)?[ql(r,s),null]:i==We.urlEncoded?[r,s]:[r,t]}function Un(r){let e=[];for(let[t,i]of r)i instanceof File||e.push([t,i]);return e}function ql(r,e){let t=new URLSearchParams(Un(e));return r.search=t.toString(),r}var ji=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,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=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},xe=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(Tl(e)):e}constructor(e){this.fragment=Nl(e)}};function Nl(r){for(let e of r.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let i of t.templateElement.content.querySelectorAll("script"))i.replaceWith(It(i));e.replaceWith(t)}return r}var Vl=100,Wi=class{#e=null;#t=null;get(e){if(this.#t&&this.#t.url===e&&this.#t.expire>Date.now())return this.#t.request}setLater(e,t,i){this.clear(),this.#e=setTimeout(()=>{t.perform(),this.set(e,t,i),this.#e=null},Vl)}set(e,t,i){this.#t={url:e,request:t,expire:new Date(new Date().getTime()+i)}}clear(){this.#e&&clearTimeout(this.#e),this.#t=null}},jl=10*1e3,ft=new Wi,dt={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},Mt=class r{state=dt.initialized;static confirmMethod(e,t,i){return Promise.resolve(confirm(e))}constructor(e,t,i,s=!1){let n=Xl(t,i),o=Kl(Ul(t,i),n),a=Wl(t,i),d=Yl(t,i);this.delegate=e,this.formElement=t,this.submitter=i,this.fetchRequest=new Ue(this,n,o,a,t,d),this.mustRedirect=s}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=G(e)}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(){let{initialized:e,requesting:t}=dt,i=Br("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof i=="string"&&!await r.confirmMethod(i,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=dt;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=zl(vt("csrf-param"))||vt("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(xe.contentType)}requestStarted(e){this.state=dt.waiting,this.submitter?.setAttribute("disabled",""),this.setSubmitsWith(),Dr(this.formElement),q("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){ft.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(ft.clear(),this.requestMustRedirect(e)&&$l(t)){let i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=dt.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=dt.stopped,this.submitter?.removeAttribute("disabled"),this.resetSubmitterText(),Hr(this.formElement),q("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")){let e=this.submitter;this.originalSubmitText=e.value,e.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")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||kl("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function Wl(r,e){let t=new FormData(r),i=e?.getAttribute("name"),s=e?.getAttribute("value");return i&&t.append(i,s||""),t}function zl(r){if(r!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(i=>i.startsWith(r));if(t){let i=t.split("=").slice(1).join("=");return i?decodeURIComponent(i):void 0}}}function $l(r){return r.statusCode==200&&!r.redirected}function Ul(r,e){let t=typeof r.action=="string"?r.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":r.getAttribute("action")||t||""}function Kl(r,e){let t=G(r);return bs(e)&&(t.search=""),t}function Xl(r,e){let t=e?.getAttribute("formmethod")||r.getAttribute("method")||"";return vs(t.toLowerCase())||oe.get}function Yl(r,e){return Hl(e?.getAttribute("formenctype")||r.enctype)}var bt=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return jn(this.element)}get permanentElements(){return Xn(this.element)}getPermanentElementById(e){return Kn(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let i of this.permanentElements){let{id:s}=i,n=e.getPermanentElementById(s);n&&(t[s]=[i,n])}return t}};function Kn(r,e){return r.querySelector(`#${e}[data-turbo-permanent]`)}function Xn(r){return r.querySelectorAll("[id][data-turbo-permanent]")}var Pt=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}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=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,i=e.submitter||void 0;t&&Jl(t,i)&&Gl(t,i)&&this.delegate.willSubmitForm(t,i)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,i))}}};function Jl(r,e){return(e?.getAttribute("formmethod")||r.getAttribute("method"))!="dialog"}function Gl(r,e){if(e?.hasAttribute("formtarget")||r.hasAttribute("target")){let t=e?.getAttribute("formtarget")||r.target;for(let i of document.getElementsByName(t))if(i instanceof HTMLIFrameElement)return!1;return!0}else return!0}var qr=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(ze(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:i,willRender:s,newSnapshot:n}=e,o=s;if(i)try{this.renderPromise=new Promise(u=>this.#e=u),this.renderer=e,await this.prepareToRenderSnapshot(e);let a=new Promise(u=>this.#t=u),d={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,d)||await a,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else o&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},zi=class extends qr{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new bt(this.element)}},Nr=class{constructor(e,t){this.delegate=e,this.element=t}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=e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.respondsToEventTarget(e.target)&&e.target instanceof Element&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},Vr=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}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=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,i=Fl(t);if(i&&Rl(i)){let s=Wn(i);this.delegate.willFollowLinkToLocation(i,s,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(i,s))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},jr=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new Vr(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,i){return this.delegate.willSubmitFormLinkToLocation(e,t,i)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let i=document.createElement("form"),s="hidden";for(let[_,E]of t.searchParams)i.append(Object.assign(document.createElement("input"),{type:s,name:_,value:E}));let n=Object.assign(t,{search:""});i.setAttribute("data-turbo","true"),i.setAttribute("action",n.href),i.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&i.setAttribute("method",o);let a=e.getAttribute("data-turbo-frame");a&&i.setAttribute("data-turbo-frame",a);let d=$e(e);d&&i.setAttribute("data-turbo-action",d);let f=e.getAttribute("data-turbo-confirm");f&&i.setAttribute("data-turbo-confirm",f),e.hasAttribute("data-turbo-stream")&&i.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,i),document.body.appendChild(i),i.addEventListener("turbo:submit-end",()=>i.remove(),{once:!0}),requestAnimationFrame(()=>i.requestSubmit())}},Wr=class{static async preservingPermanentElements(e,t,i){let s=new this(e,t);s.enter(),await i(),s.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,i]=this.permanentElementMap[e];this.delegate.enteringBardo(t,i),this.replaceNewPermanentElementWithPlaceholder(i)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=Ql(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function Ql(r){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",r.id),e}var Rt=class{#e=null;constructor(e,t,i,s,n=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=s,this.willRender=n,this.renderElement=i,this.promise=new Promise((o,a)=>this.resolvingFunctions={resolve:o,reject:a})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await Wr.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=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"}},Ft=class extends Rt{static renderElement(e,t){let i=document.createRange();i.selectNodeContents(e),i.deleteContents();let s=t,n=s.ownerDocument?.createRange();n&&(n.selectNodeContents(s),e.appendChild(n.extractContents()))}constructor(e,t,i,s,n,o=!0){super(t,i,s,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await pt(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await pt(),this.focusFirstAutofocusableElement(),await pt(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=Zl(this.currentElement.getAttribute("data-autoscroll-block"),"end"),i=ec(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:i}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=It(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function Zl(r,e){return r=="end"||r=="start"||r=="center"||r=="nearest"?r:e}function ec(r,e){return r=="auto"||r=="smooth"?r:e}var $i=class r{static animationDuration=300;static get defaultCSS(){return qn`
|
7
|
+
`)}function Ol(r,e){return r.reduce((t,i,s)=>{let n=e[s]==null?"":e[s];return t+i+n},"")}function Te(){return Array.from({length:36}).map((r,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function Hr(r,...e){for(let t of e.map(i=>i?.getAttribute(r)))if(typeof t=="string")return t;return null}function Il(r,...e){return e.some(t=>t&&t.hasAttribute(r))}function qr(...r){for(let e of r)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function Nr(...r){for(let e of r)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Ml(r,e=2e3){return new Promise(t=>{let i=()=>{r.removeEventListener("error",i),r.removeEventListener("load",i),t()};r.addEventListener("load",i,{once:!0}),r.addEventListener("error",i,{once:!0}),setTimeout(t,e)})}function jn(r){switch(r){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Pl(r){return r=="advance"||r=="replace"||r=="restore"}function $e(...r){let e=Hr("data-turbo-action",...r);return Pl(e)?e:null}function Wn(r){return document.querySelector(`meta[name="${r}"]`)}function vt(r){let e=Wn(r);return e&&e.content}function Rl(r,e){let t=Wn(r);return t||(t=document.createElement("meta"),t.setAttribute("name",r),document.head.appendChild(t)),t.setAttribute("content",e),t}function mt(r,e){if(r instanceof Element)return r.closest(e)||mt(r.assignedSlot||r.getRootNode()?.host,e)}function bs(r){return!!r&&r.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof r.focus=="function"}function zn(r){return Array.from(r.querySelectorAll("[autofocus]")).find(bs)}async function Fl(r,e){let t=e();r(),await Hn();let i=e();return[t,i]}function Bl(r){if(r.hasAttribute("target")){for(let e of document.getElementsByName(r.target))if(e instanceof HTMLIFrameElement)return!1}return!0}function Dl(r){return mt(r,"a[href]:not([target^=_]):not([download])")}function $n(r){return G(r.getAttribute("href")||"")}function Hl(r,e){let t=null;return(...i)=>{let s=()=>r.apply(this,i);clearTimeout(t),t=setTimeout(s,e)}}var Wi=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let i=this.values().next().value;this.delete(i)}super.add(e)}},Un=new Wi(20),ql=window.fetch;function Kn(r,e={}){let t=new Headers(e.headers||{}),i=Te();return Un.add(i),t.append("X-Turbo-Request-Id",i),ql(r,{...e,headers:t})}function ys(r){switch(r.toLowerCase()){case"get":return oe.get;case"post":return oe.post;case"put":return oe.put;case"patch":return oe.patch;case"delete":return oe.delete}}var oe={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Nl(r){switch(r.toLowerCase()){case We.multipart:return We.multipart;case We.plain:return We.plain;default:return We.urlEncoded}}var We={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},Ue=class{abortController=new AbortController;#e=e=>{};constructor(e,t,i,s=new URLSearchParams,n=null,o=We.urlEncoded){let[a,d]=Mn(G(i),t,s,o);this.delegate=e,this.url=a,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t,headers:{...this.defaultHeaders},body:d,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,i=ys(e)||oe.get;this.url.search="";let[s,n]=Mn(this.url,i,t,this.enctype);this.url=s,this.fetchOptions.body=n,this.fetchOptions.method=i}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}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(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=Kn(this.url.href,e);let i=await this.response;return await this.receive(i)}catch(i){if(i.name!=="AbortError")throw this.#r(i)&&this.delegate.requestErrored(this,i),i}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new Ot(e);return q("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return ws(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(s=>this.#e=s),i=q("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=i.detail.url,i.defaultPrevented&&await t,i}#r(e){return!q("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function ws(r){return ys(r)==oe.get}function Mn(r,e,t,i){let s=Array.from(t).length>0?new URLSearchParams(Xn(t)):r.searchParams;return ws(e)?[Vl(r,s),null]:i==We.urlEncoded?[r,s]:[r,t]}function Xn(r){let e=[];for(let[t,i]of r)i instanceof File||e.push([t,i]);return e}function Vl(r,e){let t=new URLSearchParams(Xn(e));return r.search=t.toString(),r}var zi=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,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=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},xe=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(xl(e)):e}constructor(e){this.fragment=jl(e)}};function jl(r){for(let e of r.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let i of t.templateElement.content.querySelectorAll("script"))i.replaceWith(It(i));e.replaceWith(t)}return r}var Wl=100,$i=class{#e=null;#t=null;get(e){if(this.#t&&this.#t.url===e&&this.#t.expire>Date.now())return this.#t.request}setLater(e,t,i){this.clear(),this.#e=setTimeout(()=>{t.perform(),this.set(e,t,i),this.#e=null},Wl)}set(e,t,i){this.#t={url:e,request:t,expire:new Date(new Date().getTime()+i)}}clear(){this.#e&&clearTimeout(this.#e),this.#t=null}},zl=10*1e3,ft=new $i,dt={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},Mt=class r{state=dt.initialized;static confirmMethod(e,t,i){return Promise.resolve(confirm(e))}constructor(e,t,i,s=!1){let n=Jl(t,i),o=Yl(Xl(t,i),n),a=$l(t,i),d=Gl(t,i);this.delegate=e,this.formElement=t,this.submitter=i,this.fetchRequest=new Ue(this,n,o,a,t,d),this.mustRedirect=s}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=G(e)}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(){let{initialized:e,requesting:t}=dt,i=Hr("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof i=="string"&&!await r.confirmMethod(i,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=dt;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=Ul(vt("csrf-param"))||vt("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(xe.contentType)}requestStarted(e){this.state=dt.waiting,this.submitter?.setAttribute("disabled",""),this.setSubmitsWith(),qr(this.formElement),q("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){ft.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(ft.clear(),this.requestMustRedirect(e)&&Kl(t)){let i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=dt.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=dt.stopped,this.submitter?.removeAttribute("disabled"),this.resetSubmitterText(),Nr(this.formElement),q("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")){let e=this.submitter;this.originalSubmitText=e.value,e.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")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||Il("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function $l(r,e){let t=new FormData(r),i=e?.getAttribute("name"),s=e?.getAttribute("value");return i&&t.append(i,s||""),t}function Ul(r){if(r!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(i=>i.startsWith(r));if(t){let i=t.split("=").slice(1).join("=");return i?decodeURIComponent(i):void 0}}}function Kl(r){return r.statusCode==200&&!r.redirected}function Xl(r,e){let t=typeof r.action=="string"?r.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":r.getAttribute("action")||t||""}function Yl(r,e){let t=G(r);return ws(e)&&(t.search=""),t}function Jl(r,e){let t=e?.getAttribute("formmethod")||r.getAttribute("method")||"";return ys(t.toLowerCase())||oe.get}function Gl(r,e){return Nl(e?.getAttribute("formenctype")||r.enctype)}var bt=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return zn(this.element)}get permanentElements(){return Jn(this.element)}getPermanentElementById(e){return Yn(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let i of this.permanentElements){let{id:s}=i,n=e.getPermanentElementById(s);n&&(t[s]=[i,n])}return t}};function Yn(r,e){return r.querySelector(`#${e}[data-turbo-permanent]`)}function Jn(r){return r.querySelectorAll("[id][data-turbo-permanent]")}var Pt=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}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=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,i=e.submitter||void 0;t&&Ql(t,i)&&Zl(t,i)&&this.delegate.willSubmitForm(t,i)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,i))}}};function Ql(r,e){return(e?.getAttribute("formmethod")||r.getAttribute("method"))!="dialog"}function Zl(r,e){if(e?.hasAttribute("formtarget")||r.hasAttribute("target")){let t=e?.getAttribute("formtarget")||r.target;for(let i of document.getElementsByName(t))if(i instanceof HTMLIFrameElement)return!1;return!0}else return!0}var Vr=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(ze(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:i,willRender:s,newSnapshot:n}=e,o=s;if(i)try{this.renderPromise=new Promise(u=>this.#e=u),this.renderer=e,await this.prepareToRenderSnapshot(e);let a=new Promise(u=>this.#t=u),d={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,d)||await a,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else o&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},Ui=class extends Vr{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new bt(this.element)}},jr=class{constructor(e,t){this.delegate=e,this.element=t}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=e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.respondsToEventTarget(e.target)&&e.target instanceof Element&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},Wr=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}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=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,i=Dl(t);if(i&&Bl(i)){let s=$n(i);this.delegate.willFollowLinkToLocation(i,s,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(i,s))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},zr=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new Wr(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,i){return this.delegate.willSubmitFormLinkToLocation(e,t,i)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let i=document.createElement("form"),s="hidden";for(let[_,E]of t.searchParams)i.append(Object.assign(document.createElement("input"),{type:s,name:_,value:E}));let n=Object.assign(t,{search:""});i.setAttribute("data-turbo","true"),i.setAttribute("action",n.href),i.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&i.setAttribute("method",o);let a=e.getAttribute("data-turbo-frame");a&&i.setAttribute("data-turbo-frame",a);let d=$e(e);d&&i.setAttribute("data-turbo-action",d);let f=e.getAttribute("data-turbo-confirm");f&&i.setAttribute("data-turbo-confirm",f),e.hasAttribute("data-turbo-stream")&&i.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,i),document.body.appendChild(i),i.addEventListener("turbo:submit-end",()=>i.remove(),{once:!0}),requestAnimationFrame(()=>i.requestSubmit())}},$r=class{static async preservingPermanentElements(e,t,i){let s=new this(e,t);s.enter(),await i(),s.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,i]=this.permanentElementMap[e];this.delegate.enteringBardo(t,i),this.replaceNewPermanentElementWithPlaceholder(i)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=ec(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function ec(r){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",r.id),e}var Rt=class{#e=null;constructor(e,t,i,s,n=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=s,this.willRender=n,this.renderElement=i,this.promise=new Promise((o,a)=>this.resolvingFunctions={resolve:o,reject:a})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await $r.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=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"}},Ft=class extends Rt{static renderElement(e,t){let i=document.createRange();i.selectNodeContents(e),i.deleteContents();let s=t,n=s.ownerDocument?.createRange();n&&(n.selectNodeContents(s),e.appendChild(n.extractContents()))}constructor(e,t,i,s,n,o=!0){super(t,i,s,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await pt(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await pt(),this.focusFirstAutofocusableElement(),await pt(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=tc(this.currentElement.getAttribute("data-autoscroll-block"),"end"),i=rc(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:i}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=It(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function tc(r,e){return r=="end"||r=="start"||r=="center"||r=="nearest"?r:e}function rc(r,e){return r=="auto"||r=="smooth"?r:e}var Ki=class r{static animationDuration=300;static get defaultCSS(){return Vn`
|
8
8
|
.turbo-progress-bar {
|
9
9
|
position: fixed;
|
10
10
|
display: block;
|
@@ -18,7 +18,7 @@
|
|
18
18
|
opacity ${r.animationDuration/2}ms ${r.animationDuration/2}ms ease-in;
|
19
19
|
transform: translate3d(0, 0, 0);
|
20
20
|
}
|
21
|
-
`}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(e){this.value=e,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(e){this.progressElement.style.opacity="0",setTimeout(e,r.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,r.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=r.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return vt("csp-nonce")}},Ui=class extends bt{detailsByOuterHTML=this.children.filter(e=>!sc(e)).map(e=>ac(e)).reduce((e,t)=>{let{outerHTML:i}=t,s=i in e?e[i]:{type:tc(t),tracked:rc(t),elements:[]};return{...e,[i]:{...s,elements:[...s.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in t.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==e).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:i,tracked:s,elements:n}=this.detailsByOuterHTML[t];return i==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,i)=>{let{elements:[s]}=this.detailsByOuterHTML[i];return oc(s,e)?s:t},void 0|void 0)}};function tc(r){if(ic(r))return"script";if(nc(r))return"stylesheet"}function rc(r){return r.getAttribute("data-turbo-track")=="reload"}function ic(r){return r.localName=="script"}function sc(r){return r.localName=="noscript"}function nc(r){let e=r.localName;return e=="style"||e=="link"&&r.getAttribute("rel")=="stylesheet"}function oc(r,e){return r.localName=="meta"&&r.getAttribute("name")==e}function ac(r){return r.hasAttribute("nonce")&&r.setAttribute("nonce",""),r}var de=class r extends bt{static fromHTMLString(e=""){return this.fromDocument(Hn(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:i}){return new this(e,t,new Ui(i))}constructor(e,t,i){super(t),this.documentElement=e,this.headSnapshot=i}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),i=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=i[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";return new r(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return G(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return this.headSnapshot.getMetaValue("view-transition")==="same-origin"}get shouldMorphPage(){return this.getSetting("refresh-method")==="morph"}get shouldPreserveScrollPosition(){return this.getSetting("refresh-scroll")==="preserve"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},Ki=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},lc={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},Fr={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},ye={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},gt={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},cc={advance:"forward",restore:"back",replace:"none"},Xi=class{identifier=Ce();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=ye.initialized;viewTransitioner=new Ki;constructor(e,t,i,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=i||Ce();let{action:n,historyChanged:o,referrer:a,snapshot:d,snapshotHTML:f,response:u,visitCachedSnapshot:_,willRender:E,updateHistory:y,shouldCacheSnapshot:O,acceptsStreamResponse:T,direction:S}={...lc,...s};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=d,this.snapshotHTML=f,this.response=u,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=_,this.willRender=E,this.updateHistory=y,this.scrolled=!E,this.shouldCacheSnapshot=O,this.acceptsStreamResponse=T,this.direction=S||cc[n]}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==ye.initialized&&(this.recordTimingMetric(Fr.visitStart),this.state=ye.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==ye.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=ye.canceled)}complete(){this.state==ye.started&&(this.recordTimingMetric(Fr.visitEnd),this.adapter.visitCompleted(this),this.state=ye.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==ye.started&&(this.state=ye.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=Nn(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Ue(this,oe.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Fr.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;In(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(Fr.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,In(e)&&t!=null){let i=de.fromHTMLString(t);await this.renderPageSnapshot(i,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(de.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!ze(this.location)||e.hasAnchor(ze(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return de.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=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(e,t),this.adapter.visitRendered(this),t||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(e){this.acceptsStreamResponse&&e.acceptResponseType(xe.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let i=await t.responseHTML,{redirected:s,statusCode:n}=t;i==null?this.recordResponse({statusCode:gt.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:i,redirected:s}))}async requestFailedWithResponse(e,t){let i=await t.responseHTML,{redirected:s,statusCode:n}=t;i==null?this.recordResponse({statusCode:gt.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:i,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:gt.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?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(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=ze(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),this.frame=await pt(),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function In(r){return r>=200&&r<300}var Yi=class{progressBar=new $i;constructor(e){this.session=e}visitProposedToLocation(e,t){Te(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||Ce(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,e.loadCachedSnapshot(),e.issueRequest(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case gt.networkFailure:case gt.timeoutFailure:case gt.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){q("turbo:reload",{detail:e}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}},Ji=class{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=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}},Gi=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new Nr(this,t),this.formSubmitObserver=new Pt(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,i){return this.#t(e)}linkClickIntercepted(e,t,i){let s=this.#r(e);s&&s.delegate.linkClickIntercepted(e,t,i)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let i=this.#r(e,t);i&&i.delegate.formSubmitted(e,t)}#e(e,t){let i=ms(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=G(s?.content??"/");return this.#t(e,t)&&Te(i,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.#r(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}#r(e,t){let i=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(i&&i!="_top"){let s=this.element.querySelector(`#${i}:not([disabled])`);if(s instanceof fe)return s}}},Qi=class{location;restorationIdentifier=Ce();restorationData={};started=!1;pageLoaded=!1;currentIndex=0;constructor(e){this.delegate=e}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(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,i=Ce()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:i,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=i}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,i=this.restorationData[t];this.restorationData[t]={...i,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{if(this.shouldHandlePopState()){let{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);let{restorationIdentifier:i,restorationIndex:s}=t;this.restorationIdentifier=i;let n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,i,n),this.currentIndex=s}}};onPageLoad=async e=>{await Cl(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},Zi=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#r,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#s,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#i,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#r,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#s,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#i,!0),this.started=!0};#r=e=>{if(vt("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#a(t)){let s=t,n=Wn(s);if(this.delegate.canPrefetchRequestToLocation(s,n)){this.#e=s;let o=new Ue(this,oe.get,n,new URLSearchParams,t);ft.setLater(n.toString(),o,this.#o)}}};#s=e=>{e.target===this.#e&&this.#n()};#n=()=>{ft.clear(),this.#e=null};#i=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="get"){let t=ft.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),ft.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let i=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||i?.getAttribute("target")||i?.id;s&&s!=="_top"&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#o(){return Number(vt("turbo-prefetch-cache-time"))||jl}#a(e){return!(!e.getAttribute("href")||hc(e)||dc(e)||uc(e)||fc(e)||mc(e))}},hc=r=>r.origin!==document.location.origin||!["http:","https:"].includes(r.protocol)||r.hasAttribute("target"),dc=r=>r.pathname+r.search===document.location.pathname+document.location.search||r.href.startsWith("#"),uc=r=>{if(r.getAttribute("data-turbo-prefetch")==="false"||r.getAttribute("data-turbo")==="false")return!0;let e=mt(r,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},fc=r=>{let e=r.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||pc(r)||r.hasAttribute("data-turbo-confirm")||r.hasAttribute("data-turbo-stream"))},pc=r=>r.hasAttribute("data-remote")||r.hasAttribute("data-behavior")||r.hasAttribute("data-confirm")||r.hasAttribute("data-method"),mc=r=>q("turbo:before-prefetch",{target:r,cancelable:!0}).defaultPrevented,es=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,i={}){this.stop(),this.currentVisit=new Xi(this,G(e),t,{referrer:this.location,...i}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new Mt(this,e,t,!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(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let i=await t.responseHTML;if(i){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,d={action:this.#e(e,t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:i,redirected:o}};this.proposeVisit(t.location,d)}}}async formSubmissionFailedWithResponse(e,t){let i=await t.responseHTML;if(i){let s=de.fromHTMLString(i);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){let i=ze(e),s=ze(this.view.lastRenderedLocation),n=t==="restore"&&typeof i>"u";return t!=="replace"&&Ni(e)===Ni(this.view.lastRenderedLocation)&&(n||i!=null&&i!==s)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:i,formElement:s}=e;return $e(i,s)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},je={initial:0,loading:1,interactive:2,complete:3},ts=class{stage=je.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==je.initial&&(this.stage=je.loading),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=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==je.loading&&(this.stage=je.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==je.interactive&&(this.stage=je.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},rs=class{started=!1;constructor(e){this.delegate=e}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(e){this.delegate.scrollPositionChanged(e)}},is=class{render({fragment:e}){Wr.preservingPermanentElements(this,gc(e),()=>{vc(e,()=>{bc(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function gc(r){let e=Xn(document.documentElement),t={};for(let i of e){let{id:s}=i;for(let n of r.querySelectorAll("turbo-stream")){let o=Kn(n.templateElement.content,s);o&&(t[s]=[i,o])}}return t}async function vc(r,e){let t=`turbo-stream-autofocus-${Ce()}`,i=r.querySelectorAll("turbo-stream"),s=yc(i),n=null;if(s&&(s.id?n=s.id:n=t,s.id=n),e(),await pt(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);gs(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function bc(r){let[e,t]=await Pl(r,()=>document.activeElement),i=e&&e.id;if(i){let s=document.getElementById(i);gs(s)&&s!=t&&s.focus()}}function yc(r){for(let e of r){let t=jn(e.templateElement.content);if(t)return t}return null}var ss=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=wc(e);t&&Ec(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(xe.wrap(e))}};function wc(r){let e=r.detail?.fetchResponse;if(e instanceof Ot)return e}function Ec(r){return(r.contentType??"").startsWith(xe.contentType)}var zr=class extends Rt{static renderElement(e,t){let{documentElement:i,body:s}=document;i.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let i=It(e);t.replaceChild(i,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},_c=function(){let r=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:E,afterNodeAdded:E,beforeNodeMorphed:E,afterNodeMorphed:E,beforeNodeRemoved:E,afterNodeRemoved:E,beforeAttributeUpdated:E},head:{style:"merge",shouldPreserve:function(l){return l.getAttribute("im-preserve")==="true"},shouldReAppend:function(l){return l.getAttribute("im-re-append")==="true"},shouldRemove:E,afterHeadMorphed:E}};function t(l,c,h={}){l instanceof Document&&(l=l.documentElement),typeof c=="string"&&(c=L(c));let p=C(c),m=O(l,p,h);return i(l,p,m)}function i(l,c,h){if(h.head.block){let p=l.querySelector("head"),m=c.querySelector("head");if(p&&m){let g=_(m,p,h);Promise.all(g).then(function(){i(l,c,Object.assign(h,{head:{block:!1,ignore:!0}}))});return}}if(h.morphStyle==="innerHTML")return o(c,l,h),l.children;if(h.morphStyle==="outerHTML"||h.morphStyle==null){let p=k(c,l,h),m=p?.previousSibling,g=p?.nextSibling,A=n(l,p,h);return p?v(m,A,g):[]}else throw"Do not understand how to morph style "+h.morphStyle}function s(l,c){return c.ignoreActiveValue&&l===document.activeElement&&l!==document.body}function n(l,c,h){if(!(h.ignoreActive&&l===document.activeElement))return c==null?h.callbacks.beforeNodeRemoved(l)===!1?l:(l.remove(),h.callbacks.afterNodeRemoved(l),null):S(l,c)?(h.callbacks.beforeNodeMorphed(l,c)===!1||(l instanceof HTMLHeadElement&&h.head.ignore||(l instanceof HTMLHeadElement&&h.head.style!=="morph"?_(c,l,h):(d(c,l,h),s(l,h)||o(c,l,h))),h.callbacks.afterNodeMorphed(l,c)),l):h.callbacks.beforeNodeRemoved(l)===!1||h.callbacks.beforeNodeAdded(c)===!1?l:(l.parentElement.replaceChild(c,l),h.callbacks.afterNodeAdded(c),h.callbacks.afterNodeRemoved(l),c)}function o(l,c,h){let p=l.firstChild,m=c.firstChild,g;for(;p;){if(g=p,p=g.nextSibling,m==null){if(h.callbacks.beforeNodeAdded(g)===!1)return;c.appendChild(g),h.callbacks.afterNodeAdded(g),$(h,g);continue}if(T(g,m,h)){n(m,g,h),m=m.nextSibling,$(h,g);continue}let A=I(l,c,g,m,h);if(A){m=x(m,A,h),n(A,g,h),$(h,g);continue}let B=M(l,c,g,m,h);if(B){m=x(m,B,h),n(B,g,h),$(h,g);continue}if(h.callbacks.beforeNodeAdded(g)===!1)return;c.insertBefore(g,m),h.callbacks.afterNodeAdded(g),$(h,g)}for(;m!==null;){let A=m;m=m.nextSibling,F(A,h)}}function a(l,c,h,p){return l==="value"&&p.ignoreActiveValue&&c===document.activeElement?!0:p.callbacks.beforeAttributeUpdated(l,c,h)===!1}function d(l,c,h){let p=l.nodeType;if(p===1){let m=l.attributes,g=c.attributes;for(let A of m)a(A.name,c,"update",h)||c.getAttribute(A.name)!==A.value&&c.setAttribute(A.name,A.value);for(let A=g.length-1;0<=A;A--){let B=g[A];a(B.name,c,"remove",h)||l.hasAttribute(B.name)||c.removeAttribute(B.name)}}(p===8||p===3)&&c.nodeValue!==l.nodeValue&&(c.nodeValue=l.nodeValue),s(c,h)||u(l,c,h)}function f(l,c,h,p){if(l[h]!==c[h]){let m=a(h,c,"update",p);m||(c[h]=l[h]),l[h]?m||c.setAttribute(h,l[h]):a(h,c,"remove",p)||c.removeAttribute(h)}}function u(l,c,h){if(l instanceof HTMLInputElement&&c instanceof HTMLInputElement&&l.type!=="file"){let p=l.value,m=c.value;f(l,c,"checked",h),f(l,c,"disabled",h),l.hasAttribute("value")?p!==m&&(a("value",c,"update",h)||(c.setAttribute("value",p),c.value=p)):a("value",c,"remove",h)||(c.value="",c.removeAttribute("value"))}else if(l instanceof HTMLOptionElement)f(l,c,"selected",h);else if(l instanceof HTMLTextAreaElement&&c instanceof HTMLTextAreaElement){let p=l.value,m=c.value;if(a("value",c,"update",h))return;p!==m&&(c.value=p),c.firstChild&&c.firstChild.nodeValue!==p&&(c.firstChild.nodeValue=p)}}function _(l,c,h){let p=[],m=[],g=[],A=[],B=h.head.style,ee=new Map;for(let R of l.children)ee.set(R.outerHTML,R);for(let R of c.children){let te=ee.has(R.outerHTML),re=h.head.shouldReAppend(R),ke=h.head.shouldPreserve(R);te||ke?re?m.push(R):(ee.delete(R.outerHTML),g.push(R)):B==="append"?re&&(m.push(R),A.push(R)):h.head.shouldRemove(R)!==!1&&m.push(R)}A.push(...ee.values());let ae=[];for(let R of A){let te=document.createRange().createContextualFragment(R.outerHTML).firstChild;if(h.callbacks.beforeNodeAdded(te)!==!1){if(te.href||te.src){let re=null,ke=new Promise(function($r){re=$r});te.addEventListener("load",function(){re()}),ae.push(ke)}c.appendChild(te),h.callbacks.afterNodeAdded(te),p.push(te)}}for(let R of m)h.callbacks.beforeNodeRemoved(R)!==!1&&(c.removeChild(R),h.callbacks.afterNodeRemoved(R));return h.head.afterHeadMorphed(c,{added:p,kept:g,removed:m}),ae}function E(){}function y(l){let c={};return Object.assign(c,e),Object.assign(c,l),c.callbacks={},Object.assign(c.callbacks,e.callbacks),Object.assign(c.callbacks,l.callbacks),c.head={},Object.assign(c.head,e.head),Object.assign(c.head,l.head),c}function O(l,c,h){return h=y(h),{target:l,newContent:c,config:h,morphStyle:h.morphStyle,ignoreActive:h.ignoreActive,ignoreActiveValue:h.ignoreActiveValue,idMap:pe(l,c),deadIds:new Set,callbacks:h.callbacks,head:h.head}}function T(l,c,h){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName?l.id!==""&&l.id===c.id?!0:j(h,l,c)>0:!1}function S(l,c){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName}function x(l,c,h){for(;l!==c;){let p=l;l=l.nextSibling,F(p,h)}return $(h,c),c.nextSibling}function I(l,c,h,p,m){let g=j(m,h,c),A=null;if(g>0){let B=p,ee=0;for(;B!=null;){if(T(h,B,m))return B;if(ee+=j(m,B,l),ee>g)return null;B=B.nextSibling}}return A}function M(l,c,h,p,m){let g=p,A=h.nextSibling,B=0;for(;g!=null;){if(j(m,g,l)>0)return null;if(S(h,g))return g;if(S(A,g)&&(B++,A=A.nextSibling,B>=2))return null;g=g.nextSibling}return g}function L(l){let c=new DOMParser,h=l.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(h.match(/<\/html>/)||h.match(/<\/head>/)||h.match(/<\/body>/)){let p=c.parseFromString(l,"text/html");if(h.match(/<\/html>/))return p.generatedByIdiomorph=!0,p;{let m=p.firstChild;return m?(m.generatedByIdiomorph=!0,m):null}}else{let m=c.parseFromString("<body><template>"+l+"</template></body>","text/html").body.querySelector("template").content;return m.generatedByIdiomorph=!0,m}}function C(l){if(l==null)return document.createElement("div");if(l.generatedByIdiomorph)return l;if(l instanceof Node){let c=document.createElement("div");return c.append(l),c}else{let c=document.createElement("div");for(let h of[...l])c.append(h);return c}}function v(l,c,h){let p=[],m=[];for(;l!=null;)p.push(l),l=l.previousSibling;for(;p.length>0;){let g=p.pop();m.push(g),c.parentElement.insertBefore(g,c)}for(m.push(c);h!=null;)p.push(h),m.push(h),h=h.nextSibling;for(;p.length>0;)c.parentElement.insertBefore(p.pop(),c.nextSibling);return m}function k(l,c,h){let p;p=l.firstChild;let m=p,g=0;for(;p;){let A=P(p,c,h);A>g&&(m=p,g=A),p=p.nextSibling}return m}function P(l,c,h){return S(l,c)?.5+j(h,l,c):0}function F(l,c){$(c,l),c.callbacks.beforeNodeRemoved(l)!==!1&&(l.remove(),c.callbacks.afterNodeRemoved(l))}function V(l,c){return!l.deadIds.has(c)}function X(l,c,h){return(l.idMap.get(h)||r).has(c)}function $(l,c){let h=l.idMap.get(c)||r;for(let p of h)l.deadIds.add(p)}function j(l,c,h){let p=l.idMap.get(c)||r,m=0;for(let g of p)V(l,g)&&X(l,g,h)&&++m;return m}function ue(l,c){let h=l.parentElement,p=l.querySelectorAll("[id]");for(let m of p){let g=m;for(;g!==h&&g!=null;){let A=c.get(g);A==null&&(A=new Set,c.set(g,A)),A.add(m.id),g=g.parentElement}}}function pe(l,c){let h=new Map;return ue(l,h),ue(c,h),h}return{morph:t,defaults:e}}(),yt=class extends Rt{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),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}#e(){let{documentElement:e}=this.currentSnapshot,{lang:t}=this.newSnapshot;t?e.setAttribute("lang",t):e.removeAttribute("lang")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,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(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(Ol(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(It(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[i,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(i,1),!0}if(s.isEqualNode(e))return t.splice(i,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=It(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}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")}},ns=class extends yt{async render(){this.willRender&&await this.#e()}get renderMethod(){return"morph"}async#e(){this.#t(this.currentElement,this.newElement),this.#a(),q("turbo:morph",{detail:{currentElement:this.currentElement,newElement:this.newElement}})}#t(e,t,i="outerHTML"){this.isMorphingTurboFrame=this.#l(e),_c.morph(e,t,{morphStyle:i,callbacks:{beforeNodeAdded:this.#r,beforeNodeMorphed:this.#s,beforeAttributeUpdated:this.#n,beforeNodeRemoved:this.#o,afterNodeMorphed:this.#i}})}#r=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));#s=(e,t)=>{if(e instanceof HTMLElement)return!e.hasAttribute("data-turbo-permanent")&&(this.isMorphingTurboFrame||!this.#l(e))?!q("turbo:before-morph-element",{cancelable:!0,target:e,detail:{newElement:t}}).defaultPrevented:!1};#n=(e,t,i)=>!q("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:i}}).defaultPrevented;#i=(e,t)=>{t instanceof HTMLElement&&q("turbo:morph-element",{target:e,detail:{newElement:t}})};#o=e=>this.#s(e);#a(){this.#u().forEach(e=>{this.#l(e)&&(this.#h(e),e.reload())})}#h(e){e.addEventListener("turbo:before-frame-render",t=>{t.detail.render=this.#d},{once:!0})}#d=(e,t)=>{q("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),this.#t(e,t.children,"innerHTML")};#l(e){return e.src&&e.refresh==="morph"}#u(){return Array.from(document.querySelectorAll("turbo-frame[src]")).filter(e=>!e.closest("[data-turbo-permanent]"))}},os=class{keys=[];snapshots={};constructor(e){this.size=e}has(e){return Rr(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[Rr(e)]}write(e,t){this.snapshots[Rr(e)]=t}touch(e){let t=Rr(e),i=this.keys.indexOf(t);i>-1&&this.keys.splice(i,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},as=class extends qr{snapshotCache=new os(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,i=!0,s){let o=this.isPageRefresh(s)&&this.snapshot.shouldMorphPage?ns:yt,a=new o(this.snapshot,e,yt.renderElement,t,i);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let i=new zr(this.snapshot,e,zr.renderElement,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await Dn();let i=e.clone();return this.snapshotCache.put(t,i),i}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return de.fromElement(this.element)}},ls=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new Ue(this,oe.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let i=await t.responseHTML,s=de.fromHTMLString(i);this.snapshotCache.put(e.url,s)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},cs=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){Ml("turbo-cache-control",e)}},hs=class{navigator=new es(this);history=new Qi(this);view=new as(this,document.documentElement);adapter=new Yi(this);pageObserver=new ts(this);cacheObserver=new Ji;linkPrefetchObserver=new Zi(this,document);linkClickObserver=new Vr(this,window);formSubmitObserver=new Pt(this,document);scrollObserver=new rs(this);streamObserver=new ss(this);formLinkClickObserver=new jr(this,document.documentElement);frameRedirector=new Gi(this,document.documentElement);streamMessageRenderer=new is;cache=new cs(this);drive=!0;enabled=!0;progressBarDelay=500;started=!1;formMode="on";#e=150;constructor(e){this.recentRequests=e,this.preloader=new ls(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(e){this.adapter=e}visit(e,t={}){let i=t.frame?document.getElementById(t.frame):null;if(i instanceof fe){let s=t.action||$e(i);i.delegate.proposeVisitIfNavigatedWithAction(i,s),i.src=e.toString()}else this.navigator.proposeVisit(G(e),t)}refresh(e,t){t&&this.recentRequests.has(t)||this.visit(e,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(xe.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=Bl(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),i=e.hasAttribute("data-turbo-stream"),s=e.getAttribute("data-turbo-frame"),n=s=="_top"?null:document.getElementById(s)||mt(e,"turbo-frame:not([disabled])");if(t||i||n instanceof fe)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&Te(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,i){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:i}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&Te(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&Te(t,this.snapshot.rootLocation)}willFollowLinkToLocation(e,t,i){return this.elementIsNavigatable(e)&&Te(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,i)}followedLinkToLocation(e,t){let i=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:i,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Mn(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Dr(document.documentElement),this.view.markVisitDirection(e.direction)),Mn(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Hr(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let i=ms(e,t);return this.submissionIsNavigatable(e,t)&&Te(G(i),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.navigator.currentVisit?.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let i=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,i){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(i)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,i){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,i).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,i){return q("turbo:click",{target:e,detail:{url:t.href,originalEvent:i},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return q("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return q("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return q("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return q("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return q("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return q("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return q("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return q("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{let i=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?i&&e.closest('[data-turbo="true"]')!=null:i&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=mt(e,"[data-turbo]"),i=mt(e,"turbo-frame");return this.drive||i?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return $e(e)||"advance"}get snapshot(){return this.view.snapshot}};function Mn(r){Object.defineProperties(r,Sc)}var Sc={absoluteURL:{get(){return this.toString()}}},H=new hs(zn),{cache:Ac,navigator:Lc}=H;function Yn(){H.start()}function Tc(r){H.registerAdapter(r)}function Cc(r,e){H.visit(r,e)}function Jn(r){H.connectStreamSource(r)}function Gn(r){H.disconnectStreamSource(r)}function xc(r){H.renderStreamMessage(r)}function kc(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),H.clearCache()}function Oc(r){H.setProgressBarDelay(r)}function Ic(r){Mt.confirmMethod=r}function Mc(r){H.setFormMode(r)}var Pc=Object.freeze({__proto__:null,navigator:Lc,session:H,cache:Ac,PageRenderer:yt,PageSnapshot:de,FrameRenderer:Ft,fetch:$n,start:Yn,registerAdapter:Tc,visit:Cc,connectStreamSource:Jn,disconnectStreamSource:Gn,renderStreamMessage:xc,clearCache:kc,setProgressBarDelay:Oc,setConfirmMethod:Ic,setFormMode:Mc}),ds=class extends Error{},us=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#r=!1;#s=!1;#n=new Set;action=null;constructor(e){this.element=e,this.view=new zi(this,this.element),this.appearanceObserver=new ji(this,this.element),this.formLinkClickObserver=new jr(this,this.element),this.linkInterceptor=new Nr(this,this.element),this.restorationIdentifier=Ce(),this.formSubmitObserver=new Pt(this,this.element)}connect(){this.#r||(this.#r=!0,this.loadingStyle==ut.lazy?this.appearanceObserver.start():this.#i(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#r&&(this.#r=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==ut.eager&&this.#i()}sourceURLChanged(){this.#v("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==ut.eager||this.#s)&&this.#i())}sourceURLReloaded(){let{src:e}=this.element;return this.element.removeAttribute("complete"),this.element.src=null,this.element.src=e,this.element.loaded}loadingStyleChanged(){this.loadingStyle==ut.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#i())}async#i(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#a(G(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#s=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let i=Hn(t);de.fromDocument(i).isVisitable?await this.#o(e,i):await this.#d(e)}}finally{this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,$e(e)),this.#i()}willSubmitFormLinkToLocation(e){return this.#f(e)}submittedFormLinkToLocation(e,t,i){let s=this.#c(e);s&&i.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,i){return this.#f(e)}linkClickIntercepted(e,t){this.#h(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#f(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Mt(this,e,t);let{fetchRequest:i}=this.formSubmission;this.prepareRequest(i),this.formSubmission.start()}prepareRequest(e){e.headers["Turbo-Frame"]=this.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(xe.contentType)}requestStarted(e){Dr(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){Hr(this.element)}formSubmissionStarted({formElement:e}){Dr(e,this.#c(e))}formSubmissionSucceededWithResponse(e,t){let i=this.#c(e.formElement,e.submitter);i.delegate.proposeVisitIfNavigatedWithAction(i,$e(e.submitter,e.formElement,i)),i.delegate.loadResponse(t),e.isSafe||H.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),H.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Hr(e,this.#c(e))}allowsImmediateRender({element:e},t){let i=q("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,i){}preloadOnLoadLinksForView(e){H.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#o(e,t){let i=await this.extractForeignFrameElement(t.body);if(i){let s=new bt(i),n=new Ft(this,this.view.snapshot,s,Ft.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(n),this.complete=!0,H.frameRendered(e,this.element),H.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#l(e)&&this.#u(e)}async#a(e){let t=new Ue(this,oe.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(i=>{this.#t=()=>{this.#t=()=>{},this.#e=null,i()},t.perform()})}#h(e,t,i){let s=this.#c(e,i);s.delegate.proposeVisitIfNavigatedWithAction(s,$e(i,e,s)),this.#y(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let i=de.fromElement(e).clone(),{visitCachedSnapshot:s}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:a}=n,d=await n.responseHTML,u={response:{statusCode:o,redirected:a,responseHTML:d},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:i};this.action&&(u.action=this.action),H.visit(e.src,u)}}}}changeHistory(){if(this.action){let e=Nn(this.action);H.history.update(e,G(this.element.src||""),this.restorationIdentifier)}}async#d(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#p(e.response)}#l(e){this.element.setAttribute("complete","");let t=e.response,i=async(n,o)=>{n instanceof Response?this.#p(n):H.visit(n,o)};return!q("turbo:frame-missing",{target:this.element,detail:{response:t,visit:i},cancelable:!0}).defaultPrevented}#u(e){this.view.missing(),this.#m(e)}#m(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new ds(t)}async#p(e){let t=new Ot(e),i=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return H.visit(s,{response:{redirected:n,statusCode:o,responseHTML:i}})}#c(e,t){let i=Br("data-turbo-frame",t,e)||this.element.getAttribute("target");return Pn(i)??this.element}async extractForeignFrameElement(e){let t,i=CSS.escape(this.id);try{if(t=Rn(e.querySelector(`turbo-frame#${i}`),this.sourceURL),t)return t;if(t=Rn(e.querySelector(`turbo-frame[src][recurse~=${i}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new fe}return null}#g(e,t){let i=ms(e,t);return Te(G(i),this.rootLocation)}#f(e,t){let i=Br("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#g(e,t)||!this.enabled||i=="_top")return!1;if(i){let s=Pn(i);if(s)return!s.disabled}return!(!H.elementIsNavigatable(e)||t&&!H.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#b("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#r}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return G(t)}#v(e){return this.#n.has(e)}#b(e,t){this.#n.add(e),t(),this.#n.delete(e)}#y(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}};function Pn(r){if(r!=null){let e=document.getElementById(r);if(e instanceof fe)return e}}function Rn(r,e){if(r){let t=r.getAttribute("src");if(t!=null&&e!=null&&wl(t,e))throw new Error(`Matching <turbo-frame id="${r.id}"> element has a source URL which references itself`);if(r.ownerDocument!==document&&(r=document.importNode(r,!0)),r instanceof fe)return r.connectedCallback(),r.disconnectedCallback(),r}}var Qn={after(){this.targetElements.forEach(r=>r.parentElement?.insertBefore(this.templateContent,r.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.append(this.templateContent))},before(){this.targetElements.forEach(r=>r.parentElement?.insertBefore(this.templateContent,r))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.prepend(this.templateContent))},remove(){this.targetElements.forEach(r=>r.remove())},replace(){this.targetElements.forEach(r=>r.replaceWith(this.templateContent))},update(){this.targetElements.forEach(r=>{r.innerHTML="",r.append(this.templateContent)})},refresh(){H.refresh(this.baseURI,this.requestId)}},fs=class r extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await pt(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(i=>[...i.children]).filter(i=>!!i.id),t=[...this.templateContent?.children||[]].filter(i=>!!i.id).map(i=>i.id);return e.filter(i=>t.includes(i.id))}get performAction(){if(this.action){let e=Qn[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:r.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},ps=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Jn(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),Gn(this.streamSource))}get src(){return this.getAttribute("src")||""}};fe.delegateConstructor=us;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",fe);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",fs);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",ps);(()=>{let r=document.currentScript;if(r&&!r.hasAttribute("data-turbo-suppress-warning"))for(r=r.parentElement;r;){if(r==document.body)return console.warn(qn`
|
21
|
+
`}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(e){this.value=e,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(e){this.progressElement.style.opacity="0",setTimeout(e,r.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,r.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=r.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return vt("csp-nonce")}},Xi=class extends bt{detailsByOuterHTML=this.children.filter(e=>!oc(e)).map(e=>cc(e)).reduce((e,t)=>{let{outerHTML:i}=t,s=i in e?e[i]:{type:ic(t),tracked:sc(t),elements:[]};return{...e,[i]:{...s,elements:[...s.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in t.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==e).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:i,tracked:s,elements:n}=this.detailsByOuterHTML[t];return i==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,i)=>{let{elements:[s]}=this.detailsByOuterHTML[i];return lc(s,e)?s:t},void 0|void 0)}};function ic(r){if(nc(r))return"script";if(ac(r))return"stylesheet"}function sc(r){return r.getAttribute("data-turbo-track")=="reload"}function nc(r){return r.localName=="script"}function oc(r){return r.localName=="noscript"}function ac(r){let e=r.localName;return e=="style"||e=="link"&&r.getAttribute("rel")=="stylesheet"}function lc(r,e){return r.localName=="meta"&&r.getAttribute("name")==e}function cc(r){return r.hasAttribute("nonce")&&r.setAttribute("nonce",""),r}var de=class r extends bt{static fromHTMLString(e=""){return this.fromDocument(Nn(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:i}){return new this(e,t,new Xi(i))}constructor(e,t,i){super(t),this.documentElement=e,this.headSnapshot=i}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),i=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=i[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";return new r(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return G(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return this.headSnapshot.getMetaValue("view-transition")==="same-origin"}get shouldMorphPage(){return this.getSetting("refresh-method")==="morph"}get shouldPreserveScrollPosition(){return this.getSetting("refresh-scroll")==="preserve"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},Yi=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},hc={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},Dr={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},ye={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},gt={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},dc={advance:"forward",restore:"back",replace:"none"},Ji=class{identifier=Te();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=ye.initialized;viewTransitioner=new Yi;constructor(e,t,i,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=i||Te();let{action:n,historyChanged:o,referrer:a,snapshot:d,snapshotHTML:f,response:u,visitCachedSnapshot:_,willRender:E,updateHistory:w,shouldCacheSnapshot:O,acceptsStreamResponse:C,direction:S}={...hc,...s};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=d,this.snapshotHTML=f,this.response=u,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=_,this.willRender=E,this.updateHistory=w,this.scrolled=!E,this.shouldCacheSnapshot=O,this.acceptsStreamResponse=C,this.direction=S||dc[n]}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==ye.initialized&&(this.recordTimingMetric(Dr.visitStart),this.state=ye.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==ye.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=ye.canceled)}complete(){this.state==ye.started&&(this.recordTimingMetric(Dr.visitEnd),this.adapter.visitCompleted(this),this.state=ye.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==ye.started&&(this.state=ye.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=jn(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Ue(this,oe.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Dr.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Pn(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(Dr.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Pn(e)&&t!=null){let i=de.fromHTMLString(t);await this.renderPageSnapshot(i,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(de.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!ze(this.location)||e.hasAnchor(ze(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return de.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=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(e,t),this.adapter.visitRendered(this),t||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(e){this.acceptsStreamResponse&&e.acceptResponseType(xe.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let i=await t.responseHTML,{redirected:s,statusCode:n}=t;i==null?this.recordResponse({statusCode:gt.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:i,redirected:s}))}async requestFailedWithResponse(e,t){let i=await t.responseHTML,{redirected:s,statusCode:n}=t;i==null?this.recordResponse({statusCode:gt.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:i,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:gt.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?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(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=ze(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),this.frame=await pt(),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Pn(r){return r>=200&&r<300}var Gi=class{progressBar=new Ki;constructor(e){this.session=e}visitProposedToLocation(e,t){Ce(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||Te(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,e.loadCachedSnapshot(),e.issueRequest(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case gt.networkFailure:case gt.timeoutFailure:case gt.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){q("turbo:reload",{detail:e}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}},Qi=class{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=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}},Zi=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new jr(this,t),this.formSubmitObserver=new Pt(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,i){return this.#t(e)}linkClickIntercepted(e,t,i){let s=this.#r(e);s&&s.delegate.linkClickIntercepted(e,t,i)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let i=this.#r(e,t);i&&i.delegate.formSubmitted(e,t)}#e(e,t){let i=vs(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=G(s?.content??"/");return this.#t(e,t)&&Ce(i,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.#r(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}#r(e,t){let i=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(i&&i!="_top"){let s=this.element.querySelector(`#${i}:not([disabled])`);if(s instanceof fe)return s}}},es=class{location;restorationIdentifier=Te();restorationData={};started=!1;pageLoaded=!1;currentIndex=0;constructor(e){this.delegate=e}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(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,i=Te()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:i,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=i}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,i=this.restorationData[t];this.restorationData[t]={...i,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{if(this.shouldHandlePopState()){let{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);let{restorationIdentifier:i,restorationIndex:s}=t;this.restorationIdentifier=i;let n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,i,n),this.currentIndex=s}}};onPageLoad=async e=>{await kl(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},ts=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#r,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#s,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#i,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#r,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#s,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#i,!0),this.started=!0};#r=e=>{if(vt("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#a(t)){let s=t,n=$n(s);if(this.delegate.canPrefetchRequestToLocation(s,n)){this.#e=s;let o=new Ue(this,oe.get,n,new URLSearchParams,t);ft.setLater(n.toString(),o,this.#o)}}};#s=e=>{e.target===this.#e&&this.#n()};#n=()=>{ft.clear(),this.#e=null};#i=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="get"){let t=ft.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),ft.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let i=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||i?.getAttribute("target")||i?.id;s&&s!=="_top"&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#o(){return Number(vt("turbo-prefetch-cache-time"))||zl}#a(e){return!(!e.getAttribute("href")||uc(e)||fc(e)||pc(e)||mc(e)||vc(e))}},uc=r=>r.origin!==document.location.origin||!["http:","https:"].includes(r.protocol)||r.hasAttribute("target"),fc=r=>r.pathname+r.search===document.location.pathname+document.location.search||r.href.startsWith("#"),pc=r=>{if(r.getAttribute("data-turbo-prefetch")==="false"||r.getAttribute("data-turbo")==="false")return!0;let e=mt(r,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},mc=r=>{let e=r.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||gc(r)||r.hasAttribute("data-turbo-confirm")||r.hasAttribute("data-turbo-stream"))},gc=r=>r.hasAttribute("data-remote")||r.hasAttribute("data-behavior")||r.hasAttribute("data-confirm")||r.hasAttribute("data-method"),vc=r=>q("turbo:before-prefetch",{target:r,cancelable:!0}).defaultPrevented,rs=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,i={}){this.stop(),this.currentVisit=new Ji(this,G(e),t,{referrer:this.location,...i}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new Mt(this,e,t,!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(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let i=await t.responseHTML;if(i){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,d={action:this.#e(e,t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:i,redirected:o}};this.proposeVisit(t.location,d)}}}async formSubmissionFailedWithResponse(e,t){let i=await t.responseHTML;if(i){let s=de.fromHTMLString(i);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){let i=ze(e),s=ze(this.view.lastRenderedLocation),n=t==="restore"&&typeof i>"u";return t!=="replace"&&ji(e)===ji(this.view.lastRenderedLocation)&&(n||i!=null&&i!==s)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:i,formElement:s}=e;return $e(i,s)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},je={initial:0,loading:1,interactive:2,complete:3},is=class{stage=je.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==je.initial&&(this.stage=je.loading),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=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==je.loading&&(this.stage=je.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==je.interactive&&(this.stage=je.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},ss=class{started=!1;constructor(e){this.delegate=e}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(e){this.delegate.scrollPositionChanged(e)}},ns=class{render({fragment:e}){$r.preservingPermanentElements(this,bc(e),()=>{yc(e,()=>{wc(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function bc(r){let e=Jn(document.documentElement),t={};for(let i of e){let{id:s}=i;for(let n of r.querySelectorAll("turbo-stream")){let o=Yn(n.templateElement.content,s);o&&(t[s]=[i,o])}}return t}async function yc(r,e){let t=`turbo-stream-autofocus-${Te()}`,i=r.querySelectorAll("turbo-stream"),s=Ec(i),n=null;if(s&&(s.id?n=s.id:n=t,s.id=n),e(),await pt(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);bs(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function wc(r){let[e,t]=await Fl(r,()=>document.activeElement),i=e&&e.id;if(i){let s=document.getElementById(i);bs(s)&&s!=t&&s.focus()}}function Ec(r){for(let e of r){let t=zn(e.templateElement.content);if(t)return t}return null}var os=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=_c(e);t&&Sc(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(xe.wrap(e))}};function _c(r){let e=r.detail?.fetchResponse;if(e instanceof Ot)return e}function Sc(r){return(r.contentType??"").startsWith(xe.contentType)}var Ur=class extends Rt{static renderElement(e,t){let{documentElement:i,body:s}=document;i.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let i=It(e);t.replaceChild(i,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},Ac=function(){let r=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:E,afterNodeAdded:E,beforeNodeMorphed:E,afterNodeMorphed:E,beforeNodeRemoved:E,afterNodeRemoved:E,beforeAttributeUpdated:E},head:{style:"merge",shouldPreserve:function(l){return l.getAttribute("im-preserve")==="true"},shouldReAppend:function(l){return l.getAttribute("im-re-append")==="true"},shouldRemove:E,afterHeadMorphed:E}};function t(l,c,h={}){l instanceof Document&&(l=l.documentElement),typeof c=="string"&&(c=L(c));let p=T(c),m=O(l,p,h);return i(l,p,m)}function i(l,c,h){if(h.head.block){let p=l.querySelector("head"),m=c.querySelector("head");if(p&&m){let g=_(m,p,h);Promise.all(g).then(function(){i(l,c,Object.assign(h,{head:{block:!1,ignore:!0}}))});return}}if(h.morphStyle==="innerHTML")return o(c,l,h),l.children;if(h.morphStyle==="outerHTML"||h.morphStyle==null){let p=k(c,l,h),m=p?.previousSibling,g=p?.nextSibling,A=n(l,p,h);return p?v(m,A,g):[]}else throw"Do not understand how to morph style "+h.morphStyle}function s(l,c){return c.ignoreActiveValue&&l===document.activeElement&&l!==document.body}function n(l,c,h){if(!(h.ignoreActive&&l===document.activeElement))return c==null?h.callbacks.beforeNodeRemoved(l)===!1?l:(l.remove(),h.callbacks.afterNodeRemoved(l),null):S(l,c)?(h.callbacks.beforeNodeMorphed(l,c)===!1||(l instanceof HTMLHeadElement&&h.head.ignore||(l instanceof HTMLHeadElement&&h.head.style!=="morph"?_(c,l,h):(d(c,l,h),s(l,h)||o(c,l,h))),h.callbacks.afterNodeMorphed(l,c)),l):h.callbacks.beforeNodeRemoved(l)===!1||h.callbacks.beforeNodeAdded(c)===!1?l:(l.parentElement.replaceChild(c,l),h.callbacks.afterNodeAdded(c),h.callbacks.afterNodeRemoved(l),c)}function o(l,c,h){let p=l.firstChild,m=c.firstChild,g;for(;p;){if(g=p,p=g.nextSibling,m==null){if(h.callbacks.beforeNodeAdded(g)===!1)return;c.appendChild(g),h.callbacks.afterNodeAdded(g),$(h,g);continue}if(C(g,m,h)){n(m,g,h),m=m.nextSibling,$(h,g);continue}let A=I(l,c,g,m,h);if(A){m=x(m,A,h),n(A,g,h),$(h,g);continue}let B=M(l,c,g,m,h);if(B){m=x(m,B,h),n(B,g,h),$(h,g);continue}if(h.callbacks.beforeNodeAdded(g)===!1)return;c.insertBefore(g,m),h.callbacks.afterNodeAdded(g),$(h,g)}for(;m!==null;){let A=m;m=m.nextSibling,F(A,h)}}function a(l,c,h,p){return l==="value"&&p.ignoreActiveValue&&c===document.activeElement?!0:p.callbacks.beforeAttributeUpdated(l,c,h)===!1}function d(l,c,h){let p=l.nodeType;if(p===1){let m=l.attributes,g=c.attributes;for(let A of m)a(A.name,c,"update",h)||c.getAttribute(A.name)!==A.value&&c.setAttribute(A.name,A.value);for(let A=g.length-1;0<=A;A--){let B=g[A];a(B.name,c,"remove",h)||l.hasAttribute(B.name)||c.removeAttribute(B.name)}}(p===8||p===3)&&c.nodeValue!==l.nodeValue&&(c.nodeValue=l.nodeValue),s(c,h)||u(l,c,h)}function f(l,c,h,p){if(l[h]!==c[h]){let m=a(h,c,"update",p);m||(c[h]=l[h]),l[h]?m||c.setAttribute(h,l[h]):a(h,c,"remove",p)||c.removeAttribute(h)}}function u(l,c,h){if(l instanceof HTMLInputElement&&c instanceof HTMLInputElement&&l.type!=="file"){let p=l.value,m=c.value;f(l,c,"checked",h),f(l,c,"disabled",h),l.hasAttribute("value")?p!==m&&(a("value",c,"update",h)||(c.setAttribute("value",p),c.value=p)):a("value",c,"remove",h)||(c.value="",c.removeAttribute("value"))}else if(l instanceof HTMLOptionElement)f(l,c,"selected",h);else if(l instanceof HTMLTextAreaElement&&c instanceof HTMLTextAreaElement){let p=l.value,m=c.value;if(a("value",c,"update",h))return;p!==m&&(c.value=p),c.firstChild&&c.firstChild.nodeValue!==p&&(c.firstChild.nodeValue=p)}}function _(l,c,h){let p=[],m=[],g=[],A=[],B=h.head.style,ee=new Map;for(let R of l.children)ee.set(R.outerHTML,R);for(let R of c.children){let te=ee.has(R.outerHTML),re=h.head.shouldReAppend(R),ke=h.head.shouldPreserve(R);te||ke?re?m.push(R):(ee.delete(R.outerHTML),g.push(R)):B==="append"?re&&(m.push(R),A.push(R)):h.head.shouldRemove(R)!==!1&&m.push(R)}A.push(...ee.values());let ae=[];for(let R of A){let te=document.createRange().createContextualFragment(R.outerHTML).firstChild;if(h.callbacks.beforeNodeAdded(te)!==!1){if(te.href||te.src){let re=null,ke=new Promise(function(Kr){re=Kr});te.addEventListener("load",function(){re()}),ae.push(ke)}c.appendChild(te),h.callbacks.afterNodeAdded(te),p.push(te)}}for(let R of m)h.callbacks.beforeNodeRemoved(R)!==!1&&(c.removeChild(R),h.callbacks.afterNodeRemoved(R));return h.head.afterHeadMorphed(c,{added:p,kept:g,removed:m}),ae}function E(){}function w(l){let c={};return Object.assign(c,e),Object.assign(c,l),c.callbacks={},Object.assign(c.callbacks,e.callbacks),Object.assign(c.callbacks,l.callbacks),c.head={},Object.assign(c.head,e.head),Object.assign(c.head,l.head),c}function O(l,c,h){return h=w(h),{target:l,newContent:c,config:h,morphStyle:h.morphStyle,ignoreActive:h.ignoreActive,ignoreActiveValue:h.ignoreActiveValue,idMap:pe(l,c),deadIds:new Set,callbacks:h.callbacks,head:h.head}}function C(l,c,h){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName?l.id!==""&&l.id===c.id?!0:j(h,l,c)>0:!1}function S(l,c){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName}function x(l,c,h){for(;l!==c;){let p=l;l=l.nextSibling,F(p,h)}return $(h,c),c.nextSibling}function I(l,c,h,p,m){let g=j(m,h,c),A=null;if(g>0){let B=p,ee=0;for(;B!=null;){if(C(h,B,m))return B;if(ee+=j(m,B,l),ee>g)return null;B=B.nextSibling}}return A}function M(l,c,h,p,m){let g=p,A=h.nextSibling,B=0;for(;g!=null;){if(j(m,g,l)>0)return null;if(S(h,g))return g;if(S(A,g)&&(B++,A=A.nextSibling,B>=2))return null;g=g.nextSibling}return g}function L(l){let c=new DOMParser,h=l.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(h.match(/<\/html>/)||h.match(/<\/head>/)||h.match(/<\/body>/)){let p=c.parseFromString(l,"text/html");if(h.match(/<\/html>/))return p.generatedByIdiomorph=!0,p;{let m=p.firstChild;return m?(m.generatedByIdiomorph=!0,m):null}}else{let m=c.parseFromString("<body><template>"+l+"</template></body>","text/html").body.querySelector("template").content;return m.generatedByIdiomorph=!0,m}}function T(l){if(l==null)return document.createElement("div");if(l.generatedByIdiomorph)return l;if(l instanceof Node){let c=document.createElement("div");return c.append(l),c}else{let c=document.createElement("div");for(let h of[...l])c.append(h);return c}}function v(l,c,h){let p=[],m=[];for(;l!=null;)p.push(l),l=l.previousSibling;for(;p.length>0;){let g=p.pop();m.push(g),c.parentElement.insertBefore(g,c)}for(m.push(c);h!=null;)p.push(h),m.push(h),h=h.nextSibling;for(;p.length>0;)c.parentElement.insertBefore(p.pop(),c.nextSibling);return m}function k(l,c,h){let p;p=l.firstChild;let m=p,g=0;for(;p;){let A=P(p,c,h);A>g&&(m=p,g=A),p=p.nextSibling}return m}function P(l,c,h){return S(l,c)?.5+j(h,l,c):0}function F(l,c){$(c,l),c.callbacks.beforeNodeRemoved(l)!==!1&&(l.remove(),c.callbacks.afterNodeRemoved(l))}function V(l,c){return!l.deadIds.has(c)}function X(l,c,h){return(l.idMap.get(h)||r).has(c)}function $(l,c){let h=l.idMap.get(c)||r;for(let p of h)l.deadIds.add(p)}function j(l,c,h){let p=l.idMap.get(c)||r,m=0;for(let g of p)V(l,g)&&X(l,g,h)&&++m;return m}function ue(l,c){let h=l.parentElement,p=l.querySelectorAll("[id]");for(let m of p){let g=m;for(;g!==h&&g!=null;){let A=c.get(g);A==null&&(A=new Set,c.set(g,A)),A.add(m.id),g=g.parentElement}}}function pe(l,c){let h=new Map;return ue(l,h),ue(c,h),h}return{morph:t,defaults:e}}(),yt=class extends Rt{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),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}#e(){let{documentElement:e}=this.currentSnapshot,{lang:t}=this.newSnapshot;t?e.setAttribute("lang",t):e.removeAttribute("lang")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,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(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(Ml(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(It(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[i,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(i,1),!0}if(s.isEqualNode(e))return t.splice(i,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=It(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}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")}},as=class extends yt{async render(){this.willRender&&await this.#e()}get renderMethod(){return"morph"}async#e(){this.#t(this.currentElement,this.newElement),this.#a(),q("turbo:morph",{detail:{currentElement:this.currentElement,newElement:this.newElement}})}#t(e,t,i="outerHTML"){this.isMorphingTurboFrame=this.#l(e),Ac.morph(e,t,{morphStyle:i,callbacks:{beforeNodeAdded:this.#r,beforeNodeMorphed:this.#s,beforeAttributeUpdated:this.#n,beforeNodeRemoved:this.#o,afterNodeMorphed:this.#i}})}#r=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));#s=(e,t)=>{if(e instanceof HTMLElement)return!e.hasAttribute("data-turbo-permanent")&&(this.isMorphingTurboFrame||!this.#l(e))?!q("turbo:before-morph-element",{cancelable:!0,target:e,detail:{newElement:t}}).defaultPrevented:!1};#n=(e,t,i)=>!q("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:i}}).defaultPrevented;#i=(e,t)=>{t instanceof HTMLElement&&q("turbo:morph-element",{target:e,detail:{newElement:t}})};#o=e=>this.#s(e);#a(){this.#u().forEach(e=>{this.#l(e)&&(this.#h(e),e.reload())})}#h(e){e.addEventListener("turbo:before-frame-render",t=>{t.detail.render=this.#d},{once:!0})}#d=(e,t)=>{q("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),this.#t(e,t.children,"innerHTML")};#l(e){return e.src&&e.refresh==="morph"}#u(){return Array.from(document.querySelectorAll("turbo-frame[src]")).filter(e=>!e.closest("[data-turbo-permanent]"))}},ls=class{keys=[];snapshots={};constructor(e){this.size=e}has(e){return Br(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[Br(e)]}write(e,t){this.snapshots[Br(e)]=t}touch(e){let t=Br(e),i=this.keys.indexOf(t);i>-1&&this.keys.splice(i,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},cs=class extends Vr{snapshotCache=new ls(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,i=!0,s){let o=this.isPageRefresh(s)&&this.snapshot.shouldMorphPage?as:yt,a=new o(this.snapshot,e,yt.renderElement,t,i);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let i=new Ur(this.snapshot,e,Ur.renderElement,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await qn();let i=e.clone();return this.snapshotCache.put(t,i),i}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return de.fromElement(this.element)}},hs=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new Ue(this,oe.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let i=await t.responseHTML,s=de.fromHTMLString(i);this.snapshotCache.put(e.url,s)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},ds=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){Rl("turbo-cache-control",e)}},us=class{navigator=new rs(this);history=new es(this);view=new cs(this,document.documentElement);adapter=new Gi(this);pageObserver=new is(this);cacheObserver=new Qi;linkPrefetchObserver=new ts(this,document);linkClickObserver=new Wr(this,window);formSubmitObserver=new Pt(this,document);scrollObserver=new ss(this);streamObserver=new os(this);formLinkClickObserver=new zr(this,document.documentElement);frameRedirector=new Zi(this,document.documentElement);streamMessageRenderer=new ns;cache=new ds(this);drive=!0;enabled=!0;progressBarDelay=500;started=!1;formMode="on";#e=150;constructor(e){this.recentRequests=e,this.preloader=new hs(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(e){this.adapter=e}visit(e,t={}){let i=t.frame?document.getElementById(t.frame):null;if(i instanceof fe){let s=t.action||$e(i);i.delegate.proposeVisitIfNavigatedWithAction(i,s),i.src=e.toString()}else this.navigator.proposeVisit(G(e),t)}refresh(e,t){t&&this.recentRequests.has(t)||this.visit(e,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(xe.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=Hl(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),i=e.hasAttribute("data-turbo-stream"),s=e.getAttribute("data-turbo-frame"),n=s=="_top"?null:document.getElementById(s)||mt(e,"turbo-frame:not([disabled])");if(t||i||n instanceof fe)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&Ce(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,i){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:i}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&Ce(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&Ce(t,this.snapshot.rootLocation)}willFollowLinkToLocation(e,t,i){return this.elementIsNavigatable(e)&&Ce(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,i)}followedLinkToLocation(e,t){let i=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:i,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Rn(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(qr(document.documentElement),this.view.markVisitDirection(e.direction)),Rn(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Nr(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let i=vs(e,t);return this.submissionIsNavigatable(e,t)&&Ce(G(i),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.navigator.currentVisit?.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let i=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,i){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(i)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,i){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,i).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,i){return q("turbo:click",{target:e,detail:{url:t.href,originalEvent:i},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return q("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return q("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return q("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return q("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return q("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return q("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return q("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return q("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{let i=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?i&&e.closest('[data-turbo="true"]')!=null:i&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=mt(e,"[data-turbo]"),i=mt(e,"turbo-frame");return this.drive||i?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return $e(e)||"advance"}get snapshot(){return this.view.snapshot}};function Rn(r){Object.defineProperties(r,Lc)}var Lc={absoluteURL:{get(){return this.toString()}}},H=new us(Un),{cache:Cc,navigator:Tc}=H;function Gn(){H.start()}function xc(r){H.registerAdapter(r)}function kc(r,e){H.visit(r,e)}function Qn(r){H.connectStreamSource(r)}function Zn(r){H.disconnectStreamSource(r)}function Oc(r){H.renderStreamMessage(r)}function Ic(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),H.clearCache()}function Mc(r){H.setProgressBarDelay(r)}function Pc(r){Mt.confirmMethod=r}function Rc(r){H.setFormMode(r)}var Fc=Object.freeze({__proto__:null,navigator:Tc,session:H,cache:Cc,PageRenderer:yt,PageSnapshot:de,FrameRenderer:Ft,fetch:Kn,start:Gn,registerAdapter:xc,visit:kc,connectStreamSource:Qn,disconnectStreamSource:Zn,renderStreamMessage:Oc,clearCache:Ic,setProgressBarDelay:Mc,setConfirmMethod:Pc,setFormMode:Rc}),fs=class extends Error{},ps=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#r=!1;#s=!1;#n=new Set;action=null;constructor(e){this.element=e,this.view=new Ui(this,this.element),this.appearanceObserver=new zi(this,this.element),this.formLinkClickObserver=new zr(this,this.element),this.linkInterceptor=new jr(this,this.element),this.restorationIdentifier=Te(),this.formSubmitObserver=new Pt(this,this.element)}connect(){this.#r||(this.#r=!0,this.loadingStyle==ut.lazy?this.appearanceObserver.start():this.#i(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#r&&(this.#r=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==ut.eager&&this.#i()}sourceURLChanged(){this.#v("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==ut.eager||this.#s)&&this.#i())}sourceURLReloaded(){let{src:e}=this.element;return this.element.removeAttribute("complete"),this.element.src=null,this.element.src=e,this.element.loaded}loadingStyleChanged(){this.loadingStyle==ut.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#i())}async#i(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#a(G(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#s=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let i=Nn(t);de.fromDocument(i).isVisitable?await this.#o(e,i):await this.#d(e)}}finally{this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,$e(e)),this.#i()}willSubmitFormLinkToLocation(e){return this.#f(e)}submittedFormLinkToLocation(e,t,i){let s=this.#c(e);s&&i.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,i){return this.#f(e)}linkClickIntercepted(e,t){this.#h(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#f(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Mt(this,e,t);let{fetchRequest:i}=this.formSubmission;this.prepareRequest(i),this.formSubmission.start()}prepareRequest(e){e.headers["Turbo-Frame"]=this.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(xe.contentType)}requestStarted(e){qr(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){Nr(this.element)}formSubmissionStarted({formElement:e}){qr(e,this.#c(e))}formSubmissionSucceededWithResponse(e,t){let i=this.#c(e.formElement,e.submitter);i.delegate.proposeVisitIfNavigatedWithAction(i,$e(e.submitter,e.formElement,i)),i.delegate.loadResponse(t),e.isSafe||H.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),H.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Nr(e,this.#c(e))}allowsImmediateRender({element:e},t){let i=q("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,i){}preloadOnLoadLinksForView(e){H.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#o(e,t){let i=await this.extractForeignFrameElement(t.body);if(i){let s=new bt(i),n=new Ft(this,this.view.snapshot,s,Ft.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(n),this.complete=!0,H.frameRendered(e,this.element),H.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#l(e)&&this.#u(e)}async#a(e){let t=new Ue(this,oe.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(i=>{this.#t=()=>{this.#t=()=>{},this.#e=null,i()},t.perform()})}#h(e,t,i){let s=this.#c(e,i);s.delegate.proposeVisitIfNavigatedWithAction(s,$e(i,e,s)),this.#y(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let i=de.fromElement(e).clone(),{visitCachedSnapshot:s}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:a}=n,d=await n.responseHTML,u={response:{statusCode:o,redirected:a,responseHTML:d},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:i};this.action&&(u.action=this.action),H.visit(e.src,u)}}}}changeHistory(){if(this.action){let e=jn(this.action);H.history.update(e,G(this.element.src||""),this.restorationIdentifier)}}async#d(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#p(e.response)}#l(e){this.element.setAttribute("complete","");let t=e.response,i=async(n,o)=>{n instanceof Response?this.#p(n):H.visit(n,o)};return!q("turbo:frame-missing",{target:this.element,detail:{response:t,visit:i},cancelable:!0}).defaultPrevented}#u(e){this.view.missing(),this.#m(e)}#m(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new fs(t)}async#p(e){let t=new Ot(e),i=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return H.visit(s,{response:{redirected:n,statusCode:o,responseHTML:i}})}#c(e,t){let i=Hr("data-turbo-frame",t,e)||this.element.getAttribute("target");return Fn(i)??this.element}async extractForeignFrameElement(e){let t,i=CSS.escape(this.id);try{if(t=Bn(e.querySelector(`turbo-frame#${i}`),this.sourceURL),t)return t;if(t=Bn(e.querySelector(`turbo-frame[src][recurse~=${i}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new fe}return null}#g(e,t){let i=vs(e,t);return Ce(G(i),this.rootLocation)}#f(e,t){let i=Hr("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#g(e,t)||!this.enabled||i=="_top")return!1;if(i){let s=Fn(i);if(s)return!s.disabled}return!(!H.elementIsNavigatable(e)||t&&!H.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#b("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#r}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return G(t)}#v(e){return this.#n.has(e)}#b(e,t){this.#n.add(e),t(),this.#n.delete(e)}#y(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}};function Fn(r){if(r!=null){let e=document.getElementById(r);if(e instanceof fe)return e}}function Bn(r,e){if(r){let t=r.getAttribute("src");if(t!=null&&e!=null&&_l(t,e))throw new Error(`Matching <turbo-frame id="${r.id}"> element has a source URL which references itself`);if(r.ownerDocument!==document&&(r=document.importNode(r,!0)),r instanceof fe)return r.connectedCallback(),r.disconnectedCallback(),r}}var eo={after(){this.targetElements.forEach(r=>r.parentElement?.insertBefore(this.templateContent,r.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.append(this.templateContent))},before(){this.targetElements.forEach(r=>r.parentElement?.insertBefore(this.templateContent,r))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.prepend(this.templateContent))},remove(){this.targetElements.forEach(r=>r.remove())},replace(){this.targetElements.forEach(r=>r.replaceWith(this.templateContent))},update(){this.targetElements.forEach(r=>{r.innerHTML="",r.append(this.templateContent)})},refresh(){H.refresh(this.baseURI,this.requestId)}},ms=class r extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await pt(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(i=>[...i.children]).filter(i=>!!i.id),t=[...this.templateContent?.children||[]].filter(i=>!!i.id).map(i=>i.id);return e.filter(i=>t.includes(i.id))}get performAction(){if(this.action){let e=eo[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:r.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},gs=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Qn(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),Zn(this.streamSource))}get src(){return this.getAttribute("src")||""}};fe.delegateConstructor=ps;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",fe);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",ms);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",gs);(()=>{let r=document.currentScript;if(r&&!r.hasAttribute("data-turbo-suppress-warning"))for(r=r.parentElement;r;){if(r==document.body)return console.warn(Vn`
|
22
22
|
You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
|
23
23
|
|
24
24
|
Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
|
@@ -27,7 +27,7 @@
|
|
27
27
|
|
28
28
|
——
|
29
29
|
Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
|
30
|
-
`,r.outerHTML);r=r.parentElement}})();window.Turbo={...
|
30
|
+
`,r.outerHTML);r=r.parentElement}})();window.Turbo={...Fc,StreamActions:eo};Gn();["turbo:click","turbo:before-visit","turbo:visit","turbo:submit-start","turbo:before-fetch-request","turbo:before-fetch-response","turbo:submit-end","turbo:before-cache","turbo:before-render","turbo:before-stream-render","turbo:render","turbo:load","turbo:before-frame-render","turbo:frame-render","turbo:frame-load","turbo:frame-missing","turbo:fetch-request-error","turbo:reload","turbo:morph","turbo:before-morph-element","turbo:morph-attribute","turbo:morph"].forEach(r=>{document.addEventListener(r,e=>{console.log(e.type,e)})});var Bc=jt.start();Vi(Bc);})();
|
31
31
|
/*! Bundled license information:
|
32
32
|
|
33
33
|
@hotwired/turbo/dist/turbo.es2017-esm.js:
|