stimulus-library 0.6.1 → 0.6.5
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.
- package/CHANGELOG.md +58 -0
- package/dist/controllers/ajax/async_block_controller.d.ts +1 -2
- package/dist/controllers/ajax/async_block_controller.d.ts.map +1 -1
- package/dist/controllers/ajax/index.d.ts +5 -0
- package/dist/controllers/ajax/index.d.ts.map +1 -0
- package/dist/controllers/ajax/lazy_block_controller.d.ts.map +1 -1
- package/dist/controllers/ajax/load_block_controller.d.ts +4 -0
- package/dist/controllers/ajax/load_block_controller.d.ts.map +1 -1
- package/dist/controllers/ajax/poll_block_controller.d.ts +2 -0
- package/dist/controllers/ajax/poll_block_controller.d.ts.map +1 -1
- package/dist/controllers/anchor_spy_controller.d.ts +7 -0
- package/dist/controllers/anchor_spy_controller.d.ts.map +1 -1
- package/dist/controllers/confirm_navigation_controller.d.ts +0 -1
- package/dist/controllers/confirm_navigation_controller.d.ts.map +1 -1
- package/dist/controllers/disable_with_controller.d.ts +0 -1
- package/dist/controllers/disable_with_controller.d.ts.map +1 -1
- package/dist/controllers/element_save_controller.d.ts.map +1 -1
- package/dist/controllers/empty_dom_controller.d.ts +4 -12
- package/dist/controllers/empty_dom_controller.d.ts.map +1 -1
- package/dist/controllers/forms/autosize_controller.d.ts +1 -2
- package/dist/controllers/forms/autosize_controller.d.ts.map +1 -1
- package/dist/controllers/forms/char_count_controller.d.ts +2 -6
- package/dist/controllers/forms/char_count_controller.d.ts.map +1 -1
- package/dist/controllers/forms/checkbox_select_all_controller.d.ts +1 -0
- package/dist/controllers/forms/checkbox_select_all_controller.d.ts.map +1 -1
- package/dist/controllers/forms/checkbox_xor_controller.d.ts +9 -0
- package/dist/controllers/forms/checkbox_xor_controller.d.ts.map +1 -0
- package/dist/controllers/forms/detect_dirty_controller.d.ts.map +1 -1
- package/dist/controllers/forms/detect_dirty_form_controller.d.ts.map +1 -1
- package/dist/controllers/forms/index.d.ts +23 -0
- package/dist/controllers/forms/index.d.ts.map +1 -0
- package/dist/controllers/forms/limited_selection_checkboxes_controller.d.ts +2 -1
- package/dist/controllers/forms/limited_selection_checkboxes_controller.d.ts.map +1 -1
- package/dist/controllers/forms/navigate_form_errors_controller.d.ts +6 -0
- package/dist/controllers/forms/navigate_form_errors_controller.d.ts.map +1 -1
- package/dist/controllers/forms/password_confirm_controller.d.ts +2 -6
- package/dist/controllers/forms/password_confirm_controller.d.ts.map +1 -1
- package/dist/controllers/forms/sync_inputs_controller.d.ts +0 -2
- package/dist/controllers/forms/sync_inputs_controller.d.ts.map +1 -1
- package/dist/controllers/forms/value_warn_controller.d.ts +5 -12
- package/dist/controllers/forms/value_warn_controller.d.ts.map +1 -1
- package/dist/controllers/forms/word_count_controller.d.ts +2 -6
- package/dist/controllers/forms/word_count_controller.d.ts.map +1 -1
- package/dist/controllers/index.d.ts +30 -0
- package/dist/controllers/index.d.ts.map +1 -0
- package/dist/controllers/media/fallback_image_controller.d.ts +4 -12
- package/dist/controllers/media/fallback_image_controller.d.ts.map +1 -1
- package/dist/controllers/media/index.d.ts +4 -0
- package/dist/controllers/media/index.d.ts.map +1 -0
- package/dist/controllers/media/lightbox_image_controller.d.ts +1 -0
- package/dist/controllers/media/lightbox_image_controller.d.ts.map +1 -1
- package/dist/controllers/media/media_player_controller.d.ts +0 -3
- package/dist/controllers/media/media_player_controller.d.ts.map +1 -1
- package/dist/controllers/print_button_controller.d.ts +2 -6
- package/dist/controllers/print_button_controller.d.ts.map +1 -1
- package/dist/controllers/responsive_iframe_controller.d.ts +0 -5
- package/dist/controllers/responsive_iframe_controller.d.ts.map +1 -1
- package/dist/controllers/scroll/index.d.ts +6 -0
- package/dist/controllers/scroll/index.d.ts.map +1 -0
- package/dist/controllers/signal/events.d.ts +4 -0
- package/dist/controllers/signal/events.d.ts.map +1 -0
- package/dist/controllers/signal/expressions.d.ts +2 -0
- package/dist/controllers/signal/expressions.d.ts.map +1 -0
- package/dist/controllers/signal/index.d.ts +4 -0
- package/dist/controllers/signal/index.d.ts.map +1 -0
- package/dist/controllers/signal/signal_action_controller.d.ts +15 -0
- package/dist/controllers/signal/signal_action_controller.d.ts.map +1 -0
- package/dist/controllers/signal/signal_input_controller.d.ts +20 -0
- package/dist/controllers/signal/signal_input_controller.d.ts.map +1 -0
- package/dist/controllers/signal/signal_visibility_controller.d.ts +18 -0
- package/dist/controllers/signal/signal_visibility_controller.d.ts.map +1 -0
- package/dist/controllers/sticky_controller.d.ts +3 -6
- package/dist/controllers/sticky_controller.d.ts.map +1 -1
- package/dist/controllers/tables/index.d.ts +3 -0
- package/dist/controllers/tables/index.d.ts.map +1 -0
- package/dist/controllers/tables/table_sort_controller.d.ts +1 -0
- package/dist/controllers/tables/table_sort_controller.d.ts.map +1 -1
- package/dist/controllers/tables/table_truncate_controller.d.ts +0 -1
- package/dist/controllers/tables/table_truncate_controller.d.ts.map +1 -1
- package/dist/controllers/temporary_state_controller.d.ts +0 -1
- package/dist/controllers/temporary_state_controller.d.ts.map +1 -1
- package/dist/controllers/toggle_class_controller.d.ts.map +1 -1
- package/dist/controllers/trix_modifier_controller.d.ts +88 -0
- package/dist/controllers/trix_modifier_controller.d.ts.map +1 -0
- package/dist/controllers/utility/alert_controller.d.ts +9 -0
- package/dist/controllers/utility/alert_controller.d.ts.map +1 -0
- package/dist/controllers/utility/fullscreen_controller.d.ts +8 -0
- package/dist/controllers/utility/fullscreen_controller.d.ts.map +1 -0
- package/dist/controllers/utility/index.d.ts +9 -0
- package/dist/controllers/utility/index.d.ts.map +1 -0
- package/dist/controllers/utility/intersection_controller.d.ts.map +1 -1
- package/dist/controllers/utility/presence_controller.d.ts +2 -0
- package/dist/controllers/utility/presence_controller.d.ts.map +1 -1
- package/dist/controllers/visual/countdown_controller.d.ts +4 -12
- package/dist/controllers/visual/countdown_controller.d.ts.map +1 -1
- package/dist/controllers/visual/duration_controller.d.ts +1 -2
- package/dist/controllers/visual/duration_controller.d.ts.map +1 -1
- package/dist/controllers/visual/index.d.ts +7 -0
- package/dist/controllers/visual/index.d.ts.map +1 -0
- package/dist/controllers/visual/tabs_controller.d.ts +6 -12
- package/dist/controllers/visual/tabs_controller.d.ts.map +1 -1
- package/dist/controllers/visual/time_distance_controller.d.ts +0 -1
- package/dist/controllers/visual/time_distance_controller.d.ts.map +1 -1
- package/dist/controllers/visual/tree_view_controller.d.ts +8 -12
- package/dist/controllers/visual/tree_view_controller.d.ts.map +1 -1
- package/dist/index.d.ts +3 -79
- package/dist/index.d.ts.map +1 -1
- package/dist/mixins/create_mixin.d.ts +3 -0
- package/dist/mixins/create_mixin.d.ts.map +1 -0
- package/dist/mixins/index.d.ts +8 -0
- package/dist/mixins/index.d.ts.map +1 -0
- package/dist/mixins/install_class_methods.d.ts +6 -0
- package/dist/mixins/install_class_methods.d.ts.map +1 -0
- package/dist/mixins/use_click_outside.d.ts +5 -0
- package/dist/mixins/use_click_outside.d.ts.map +1 -0
- package/dist/mixins/use_event_bus.d.ts +8 -0
- package/dist/mixins/use_event_bus.d.ts.map +1 -0
- package/dist/mixins/use_event_listener.d.ts +14 -2
- package/dist/mixins/use_event_listener.d.ts.map +1 -1
- package/dist/mixins/use_fullscreen.d.ts +9 -0
- package/dist/mixins/use_fullscreen.d.ts.map +1 -0
- package/dist/mixins/use_geolocation.d.ts +19 -0
- package/dist/mixins/use_geolocation.d.ts.map +1 -0
- package/dist/mixins/use_hover.d.ts +5 -0
- package/dist/mixins/use_hover.d.ts.map +1 -0
- package/dist/mixins/use_injected_html.d.ts +2 -2
- package/dist/mixins/use_injected_html.d.ts.map +1 -1
- package/dist/mixins/use_intersection.d.ts +14 -0
- package/dist/mixins/use_intersection.d.ts.map +1 -0
- package/dist/mixins/use_interval.d.ts.map +1 -1
- package/dist/mixins/use_localstorage.d.ts +15 -0
- package/dist/mixins/use_localstorage.d.ts.map +1 -0
- package/dist/mixins/use_mutation_observer.d.ts +3 -0
- package/dist/mixins/use_mutation_observer.d.ts.map +1 -0
- package/dist/mixins/use_timeout.d.ts.map +1 -1
- package/dist/mixins/use_trix_modifiers.d.ts +11 -0
- package/dist/mixins/use_trix_modifiers.d.ts.map +1 -0
- package/dist/stimulus-library.cjs.js +1 -1
- package/dist/stimulus-library.cjs.js.map +1 -1
- package/dist/stimulus-library.es.js +4584 -1
- package/dist/stimulus-library.es.js.map +1 -1
- package/dist/stimulus-library.umd.js +1 -1
- package/dist/stimulus-library.umd.js.map +1 -1
- package/dist/utilities/arrays.d.ts +2 -0
- package/dist/utilities/arrays.d.ts.map +1 -0
- package/dist/utilities/elements.d.ts +3 -0
- package/dist/utilities/elements.d.ts.map +1 -1
- package/dist/utilities/fetchRetry.d.ts +2 -0
- package/dist/utilities/fetchRetry.d.ts.map +1 -0
- package/dist/utilities/index.d.ts +8 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/reactive.d.ts +2 -0
- package/dist/utilities/reactive.d.ts.map +1 -0
- package/dist/utilities/stimulus.d.ts +3 -0
- package/dist/utilities/stimulus.d.ts.map +1 -0
- package/dist/utilities/strings.d.ts +2 -0
- package/dist/utilities/strings.d.ts.map +1 -0
- package/package.json +9 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=Object.defineProperty,t=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,i=(t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r,n=(e,n)=>{for(var o in n||(n={}))s.call(n,o)&&i(e,o,n[o]);if(t)for(var o of t(n))r.call(n,o)&&i(e,o,n[o]);return e},o=(e,t,s)=>(i(e,"symbol"!=typeof t?t+"":t,s),s);Object.defineProperty(exports,"__esModule",{value:!0}),exports[Symbol.toStringTag]="Module";var a=require("lodash-es"),l=require("date-fns");function c(e){if(e&&e.__esModule)return e;var t={__proto__:null,[Symbol.toStringTag]:"Module"};return e&&Object.keys(e).forEach((function(s){if("default"!==s){var r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var h=function(){function e(e,t,s){this.eventTarget=e,this.eventName=t,this.eventOptions=s,this.unorderedBindings=new Set}return e.prototype.connect=function(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)},e.prototype.disconnect=function(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)},e.prototype.bindingConnected=function(e){this.unorderedBindings.add(e)},e.prototype.bindingDisconnected=function(e){this.unorderedBindings.delete(e)},e.prototype.handleEvent=function(e){for(var t=function(e){if("immediatePropagationStopped"in e)return e;var t=e.stopImmediatePropagation;return Object.assign(e,{immediatePropagationStopped:!1,stopImmediatePropagation:function(){this.immediatePropagationStopped=!0,t.call(this)}})}(e),s=0,r=this.bindings;s<r.length;s++){var i=r[s];if(t.immediatePropagationStopped)break;i.handleEvent(t)}},Object.defineProperty(e.prototype,"bindings",{get:function(){return Array.from(this.unorderedBindings).sort((function(e,t){var s=e.index,r=t.index;return s<r?-1:s>r?1:0}))},enumerable:!1,configurable:!0}),e}();var u=function(){function e(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}return e.prototype.start=function(){this.started||(this.started=!0,this.eventListeners.forEach((function(e){return e.connect()})))},e.prototype.stop=function(){this.started&&(this.started=!1,this.eventListeners.forEach((function(e){return e.disconnect()})))},Object.defineProperty(e.prototype,"eventListeners",{get:function(){return Array.from(this.eventListenerMaps.values()).reduce((function(e,t){return e.concat(Array.from(t.values()))}),[])},enumerable:!1,configurable:!0}),e.prototype.bindingConnected=function(e){this.fetchEventListenerForBinding(e).bindingConnected(e)},e.prototype.bindingDisconnected=function(e){this.fetchEventListenerForBinding(e).bindingDisconnected(e)},e.prototype.handleError=function(e,t,s){void 0===s&&(s={}),this.application.handleError(e,"Error "+t,s)},e.prototype.fetchEventListenerForBinding=function(e){var t=e.eventTarget,s=e.eventName,r=e.eventOptions;return this.fetchEventListener(t,s,r)},e.prototype.fetchEventListener=function(e,t,s){var r=this.fetchEventListenerMapForEventTarget(e),i=this.cacheKey(t,s),n=r.get(i);return n||(n=this.createEventListener(e,t,s),r.set(i,n)),n},e.prototype.createEventListener=function(e,t,s){var r=new h(e,t,s);return this.started&&r.connect(),r},e.prototype.fetchEventListenerMapForEventTarget=function(e){var t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t},e.prototype.cacheKey=function(e,t){var s=[e];return Object.keys(t).sort().forEach((function(e){s.push((t[e]?"":"!")+e)})),s.join(":")},e}(),d=/^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;function p(e){return"window"==e?window:"document"==e?document:void 0}var m=function(){function e(e,t,s){this.element=e,this.index=t,this.eventTarget=s.eventTarget||e,this.eventName=s.eventName||function(e){var t=e.tagName.toLowerCase();if(t in f)return f[t](e)}(e)||g("missing event name"),this.eventOptions=s.eventOptions||{},this.identifier=s.identifier||g("missing identifier"),this.methodName=s.methodName||g("missing method name")}return e.forToken=function(e){return new this(e.element,e.index,(t=e.content,{eventTarget:p((r=t.trim().match(d)||[])[4]),eventName:r[2],eventOptions:r[9]?(s=r[9],s.split(":").reduce((function(e,t){var s;return Object.assign(e,((s={})[t.replace(/^!/,"")]=!/^!/.test(t),s))}),{})):{},identifier:r[5],methodName:r[7]}));var t,s,r},e.prototype.toString=function(){var e=this.eventTargetName?"@"+this.eventTargetName:"";return""+this.eventName+e+"->"+this.identifier+"#"+this.methodName},Object.defineProperty(e.prototype,"eventTargetName",{get:function(){return(e=this.eventTarget)==window?"window":e==document?"document":void 0;var e},enumerable:!1,configurable:!0}),e}(),f={a:function(e){return"click"},button:function(e){return"click"},form:function(e){return"submit"},input:function(e){return"submit"==e.getAttribute("type")?"click":"input"},select:function(e){return"change"},textarea:function(e){return"input"}};function g(e){throw new Error(e)}var v=function(){function e(e,t){this.context=e,this.action=t}return Object.defineProperty(e.prototype,"index",{get:function(){return this.action.index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventTarget",{get:function(){return this.action.eventTarget},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventOptions",{get:function(){return this.action.eventOptions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!1,configurable:!0}),e.prototype.handleEvent=function(e){this.willBeInvokedByEvent(e)&&this.invokeWithEvent(e)},Object.defineProperty(e.prototype,"eventName",{get:function(){return this.action.eventName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){var e=this.controller[this.methodName];if("function"==typeof e)return e;throw new Error('Action "'+this.action+'" references undefined method "'+this.methodName+'"')},enumerable:!1,configurable:!0}),e.prototype.invokeWithEvent=function(e){try{this.method.call(this.controller,e)}catch(r){var t=this,s={identifier:t.identifier,controller:t.controller,element:t.element,index:t.index,event:e};this.context.handleError(r,'invoking action "'+this.action+'"',s)}},e.prototype.willBeInvokedByEvent=function(e){var t=e.target;return this.element===t||(t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element))},Object.defineProperty(e.prototype,"controller",{get:function(){return this.context.controller},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"methodName",{get:function(){return this.action.methodName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scope",{get:function(){return this.context.scope},enumerable:!1,configurable:!0}),e}(),b=function(){function e(e,t){var s=this;this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver((function(e){return s.processMutations(e)}))}return e.prototype.start=function(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,childList:!0,subtree:!0}),this.refresh())},e.prototype.stop=function(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)},e.prototype.refresh=function(){if(this.started){for(var e=new Set(this.matchElementsInTree()),t=0,s=Array.from(this.elements);t<s.length;t++){var r=s[t];e.has(r)||this.removeElement(r)}for(var i=0,n=Array.from(e);i<n.length;i++){r=n[i];this.addElement(r)}}},e.prototype.processMutations=function(e){if(this.started)for(var t=0,s=e;t<s.length;t++){var r=s[t];this.processMutation(r)}},e.prototype.processMutation=function(e){"attributes"==e.type?this.processAttributeChange(e.target,e.attributeName):"childList"==e.type&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))},e.prototype.processAttributeChange=function(e,t){var s=e;this.elements.has(s)?this.delegate.elementAttributeChanged&&this.matchElement(s)?this.delegate.elementAttributeChanged(s,t):this.removeElement(s):this.matchElement(s)&&this.addElement(s)},e.prototype.processRemovedNodes=function(e){for(var t=0,s=Array.from(e);t<s.length;t++){var r=s[t],i=this.elementFromNode(r);i&&this.processTree(i,this.removeElement)}},e.prototype.processAddedNodes=function(e){for(var t=0,s=Array.from(e);t<s.length;t++){var r=s[t],i=this.elementFromNode(r);i&&this.elementIsActive(i)&&this.processTree(i,this.addElement)}},e.prototype.matchElement=function(e){return this.delegate.matchElement(e)},e.prototype.matchElementsInTree=function(e){return void 0===e&&(e=this.element),this.delegate.matchElementsInTree(e)},e.prototype.processTree=function(e,t){for(var s=0,r=this.matchElementsInTree(e);s<r.length;s++){var i=r[s];t.call(this,i)}},e.prototype.elementFromNode=function(e){if(e.nodeType==Node.ELEMENT_NODE)return e},e.prototype.elementIsActive=function(e){return e.isConnected==this.element.isConnected&&this.element.contains(e)},e.prototype.addElement=function(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))},e.prototype.removeElement=function(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))},e}(),y=function(){function e(e,t,s){this.attributeName=t,this.delegate=s,this.elementObserver=new b(e,this)}return Object.defineProperty(e.prototype,"element",{get:function(){return this.elementObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selector",{get:function(){return"["+this.attributeName+"]"},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.elementObserver.start()},e.prototype.stop=function(){this.elementObserver.stop()},e.prototype.refresh=function(){this.elementObserver.refresh()},Object.defineProperty(e.prototype,"started",{get:function(){return this.elementObserver.started},enumerable:!1,configurable:!0}),e.prototype.matchElement=function(e){return e.hasAttribute(this.attributeName)},e.prototype.matchElementsInTree=function(e){var t=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(this.selector));return t.concat(s)},e.prototype.elementMatched=function(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)},e.prototype.elementUnmatched=function(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)},e.prototype.elementAttributeChanged=function(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)},e}(),_=function(){function e(e,t){var s=this;this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((function(e){return s.processMutations(e)}))}return e.prototype.start=function(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0}),this.refresh())},e.prototype.stop=function(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)},e.prototype.refresh=function(){if(this.started)for(var e=0,t=this.knownAttributeNames;e<t.length;e++){var s=t[e];this.refreshAttribute(s)}},e.prototype.processMutations=function(e){if(this.started)for(var t=0,s=e;t<s.length;t++){var r=s[t];this.processMutation(r)}},e.prototype.processMutation=function(e){var t=e.attributeName;t&&this.refreshAttribute(t)},e.prototype.refreshAttribute=function(e){var t=this.delegate.getStringMapKeyForAttribute(e);if(null!=t){this.stringMap.has(e)||this.stringMapKeyAdded(t,e);var s=this.element.getAttribute(e);this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,t),null==s?(this.stringMap.delete(e),this.stringMapKeyRemoved(t,e)):this.stringMap.set(e,s)}},e.prototype.stringMapKeyAdded=function(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)},e.prototype.stringMapValueChanged=function(e,t){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t)},e.prototype.stringMapKeyRemoved=function(e,t){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t)},Object.defineProperty(e.prototype,"knownAttributeNames",{get:function(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentAttributeNames",{get:function(){return Array.from(this.element.attributes).map((function(e){return e.name}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"recordedAttributeNames",{get:function(){return Array.from(this.stringMap.keys())},enumerable:!1,configurable:!0}),e}();function w(e,t,s){E(e,t).add(s)}function C(e,t,s){E(e,t).delete(s),function(e,t){var s=e.get(t);null!=s&&0==s.size&&e.delete(t)}(e,t)}function E(e,t){var s=e.get(t);return s||(s=new Set,e.set(t,s)),s}var x,T=function(){function e(){this.valuesByKey=new Map}return Object.defineProperty(e.prototype,"values",{get:function(){return Array.from(this.valuesByKey.values()).reduce((function(e,t){return e.concat(Array.from(t))}),[])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return Array.from(this.valuesByKey.values()).reduce((function(e,t){return e+t.size}),0)},enumerable:!1,configurable:!0}),e.prototype.add=function(e,t){w(this.valuesByKey,e,t)},e.prototype.delete=function(e,t){C(this.valuesByKey,e,t)},e.prototype.has=function(e,t){var s=this.valuesByKey.get(e);return null!=s&&s.has(t)},e.prototype.hasKey=function(e){return this.valuesByKey.has(e)},e.prototype.hasValue=function(e){return Array.from(this.valuesByKey.values()).some((function(t){return t.has(e)}))},e.prototype.getValuesForKey=function(e){var t=this.valuesByKey.get(e);return t?Array.from(t):[]},e.prototype.getKeysForValue=function(e){return Array.from(this.valuesByKey).filter((function(t){return t[0],t[1].has(e)})).map((function(e){var t=e[0];return e[1],t}))},e}(),k=(x=function(e,t){return(x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])})(e,t)},function(e,t){function s(){this.constructor=e}x(e,t),e.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)});!function(e){function t(){var t=e.call(this)||this;return t.keysByValue=new Map,t}k(t,e),Object.defineProperty(t.prototype,"values",{get:function(){return Array.from(this.keysByValue.keys())},enumerable:!1,configurable:!0}),t.prototype.add=function(t,s){e.prototype.add.call(this,t,s),w(this.keysByValue,s,t)},t.prototype.delete=function(t,s){e.prototype.delete.call(this,t,s),C(this.keysByValue,s,t)},t.prototype.hasValue=function(e){return this.keysByValue.has(e)},t.prototype.getKeysForValue=function(e){var t=this.keysByValue.get(e);return t?Array.from(t):[]}}(T);var S=function(){function e(e,t,s){this.attributeObserver=new y(e,t,this),this.delegate=s,this.tokensByElement=new T}return Object.defineProperty(e.prototype,"started",{get:function(){return this.attributeObserver.started},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.attributeObserver.start()},e.prototype.stop=function(){this.attributeObserver.stop()},e.prototype.refresh=function(){this.attributeObserver.refresh()},Object.defineProperty(e.prototype,"element",{get:function(){return this.attributeObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this.attributeObserver.attributeName},enumerable:!1,configurable:!0}),e.prototype.elementMatchedAttribute=function(e){this.tokensMatched(this.readTokensForElement(e))},e.prototype.elementAttributeValueChanged=function(e){var t=this.refreshTokensForElement(e),s=t[0],r=t[1];this.tokensUnmatched(s),this.tokensMatched(r)},e.prototype.elementUnmatchedAttribute=function(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))},e.prototype.tokensMatched=function(e){var t=this;e.forEach((function(e){return t.tokenMatched(e)}))},e.prototype.tokensUnmatched=function(e){var t=this;e.forEach((function(e){return t.tokenUnmatched(e)}))},e.prototype.tokenMatched=function(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)},e.prototype.tokenUnmatched=function(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)},e.prototype.refreshTokensForElement=function(e){var t,s,r,i=this.tokensByElement.getValuesForKey(e),n=this.readTokensForElement(e),o=(t=i,s=n,r=Math.max(t.length,s.length),Array.from({length:r},(function(e,r){return[t[r],s[r]]}))).findIndex((function(e){return!function(e,t){return e&&t&&e.index==t.index&&e.content==t.content}(e[0],e[1])}));return-1==o?[[],[]]:[i.slice(o),n.slice(o)]},e.prototype.readTokensForElement=function(e){var t=this.attributeName;return function(e,t,s){return e.trim().split(/\s+/).filter((function(e){return e.length})).map((function(e,r){return{element:t,attributeName:s,content:e,index:r}}))}(e.getAttribute(t)||"",e,t)},e}();var A=function(){function e(e,t,s){this.tokenListObserver=new S(e,t,this),this.delegate=s,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}return Object.defineProperty(e.prototype,"started",{get:function(){return this.tokenListObserver.started},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.tokenListObserver.start()},e.prototype.stop=function(){this.tokenListObserver.stop()},e.prototype.refresh=function(){this.tokenListObserver.refresh()},Object.defineProperty(e.prototype,"element",{get:function(){return this.tokenListObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this.tokenListObserver.attributeName},enumerable:!1,configurable:!0}),e.prototype.tokenMatched=function(e){var t=e.element,s=this.fetchParseResultForToken(e).value;s&&(this.fetchValuesByTokenForElement(t).set(e,s),this.delegate.elementMatchedValue(t,s))},e.prototype.tokenUnmatched=function(e){var t=e.element,s=this.fetchParseResultForToken(e).value;s&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,s))},e.prototype.fetchParseResultForToken=function(e){var t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t},e.prototype.fetchValuesByTokenForElement=function(e){var t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t},e.prototype.parseToken=function(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}},e}(),V=function(){function e(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}return e.prototype.start=function(){this.valueListObserver||(this.valueListObserver=new A(this.element,this.actionAttribute,this),this.valueListObserver.start())},e.prototype.stop=function(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())},Object.defineProperty(e.prototype,"element",{get:function(){return this.context.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"actionAttribute",{get:function(){return this.schema.actionAttribute},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return this.context.schema},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bindings",{get:function(){return Array.from(this.bindingsByAction.values())},enumerable:!1,configurable:!0}),e.prototype.connectAction=function(e){var t=new v(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)},e.prototype.disconnectAction=function(e){var t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))},e.prototype.disconnectAllActions=function(){var e=this;this.bindings.forEach((function(t){return e.delegate.bindingDisconnected(t)})),this.bindingsByAction.clear()},e.prototype.parseValueForToken=function(e){var t=m.forToken(e);if(t.identifier==this.identifier)return t},e.prototype.elementMatchedValue=function(e,t){this.connectAction(t)},e.prototype.elementUnmatchedValue=function(e,t){this.disconnectAction(t)},e}(),O=function(){function e(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new _(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap,this.invokeChangedCallbacksForDefaultValues()}return e.prototype.start=function(){this.stringMapObserver.start()},e.prototype.stop=function(){this.stringMapObserver.stop()},Object.defineProperty(e.prototype,"element",{get:function(){return this.context.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controller",{get:function(){return this.context.controller},enumerable:!1,configurable:!0}),e.prototype.getStringMapKeyForAttribute=function(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name},e.prototype.stringMapValueChanged=function(e,t){this.invokeChangedCallbackForValue(t)},e.prototype.invokeChangedCallbacksForDefaultValues=function(){for(var e=0,t=this.valueDescriptors;e<t.length;e++){var s=t[e],r=s.key,i=s.name;null==s.defaultValue||this.controller.data.has(r)||this.invokeChangedCallbackForValue(i)}},e.prototype.invokeChangedCallbackForValue=function(e){var t=e+"Changed",s=this.receiver[t];if("function"==typeof s){var r=this.receiver[e];s.call(this.receiver,r)}},Object.defineProperty(e.prototype,"valueDescriptors",{get:function(){var e=this.valueDescriptorMap;return Object.keys(e).map((function(t){return e[t]}))},enumerable:!1,configurable:!0}),e}(),M=function(){function e(e,t){this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new V(this,this.dispatcher),this.valueObserver=new O(this,this.controller);try{this.controller.initialize()}catch(s){this.handleError(s,"initializing controller")}}return e.prototype.connect=function(){this.bindingObserver.start(),this.valueObserver.start();try{this.controller.connect()}catch(e){this.handleError(e,"connecting controller")}},e.prototype.disconnect=function(){try{this.controller.disconnect()}catch(e){this.handleError(e,"disconnecting controller")}this.valueObserver.stop(),this.bindingObserver.stop()},Object.defineProperty(e.prototype,"application",{get:function(){return this.module.application},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.module.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return this.application.schema},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dispatcher",{get:function(){return this.application.dispatcher},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentElement",{get:function(){return this.element.parentElement},enumerable:!1,configurable:!0}),e.prototype.handleError=function(e,t,s){void 0===s&&(s={});var r=this,i=r.identifier,n=r.controller,o=r.element;s=Object.assign({identifier:i,controller:n,element:o},s),this.application.handleError(e,"Error "+t,s)},e}();function L(e,t){var s=N(e);return Array.from(s.reduce((function(e,s){return function(e,t){var s=e[t];return Array.isArray(s)?s:[]}(s,t).forEach((function(t){return e.add(t)})),e}),new Set))}function D(e,t){return N(e).reduce((function(e,s){return e.push.apply(e,function(e,t){var s=e[t];return s?Object.keys(s).map((function(e){return[e,s[e]]})):[]}(s,t)),e}),[])}function N(e){for(var t=[];e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}var I=function(){var e=function(t,s){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])})(t,s)};return function(t,s){function r(){this.constructor=t}e(t,s),t.prototype=null===s?Object.create(s):(r.prototype=s.prototype,new r)}}();function P(e){return function(e,t){var s=B(e),r=function(e,t){return F(t).reduce((function(s,r){var i,n=function(e,t,s){var r=Object.getOwnPropertyDescriptor(e,s);if(!r||!("value"in r)){var i=Object.getOwnPropertyDescriptor(t,s).value;return r&&(i.get=r.get||i.get,i.set=r.set||i.set),i}}(e,t,r);return n&&Object.assign(s,((i={})[r]=n,i)),s}),{})}(e.prototype,t);return Object.defineProperties(s.prototype,r),s}(e,function(e){return L(e,"blessings").reduce((function(t,s){var r=s(e);for(var i in r){var n=t[i]||{};t[i]=Object.assign(n,r[i])}return t}),{})}(e))}var F="function"==typeof Object.getOwnPropertySymbols?function(e){return function(){for(var e=0,t=0,s=arguments.length;t<s;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<s;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,i++)r[i]=n[o];return r}(Object.getOwnPropertyNames(e),Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,B=function(){function e(e){function t(){var s=this&&this instanceof t?this.constructor:void 0;return Reflect.construct(e,arguments,s)}return t.prototype=Object.create(e.prototype,{constructor:{value:t}}),Reflect.setPrototypeOf(t,e),t}try{return(t=e((function(){this.a.call(this)}))).prototype.a=function(){},new t,e}catch(s){return function(e){return function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return I(t,e),t}(e)}}var t}();var j=function(){function e(e,t){this.application=e,this.definition=function(e){return{identifier:e.identifier,controllerConstructor:P(e.controllerConstructor)}}(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}return Object.defineProperty(e.prototype,"identifier",{get:function(){return this.definition.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerConstructor",{get:function(){return this.definition.controllerConstructor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contexts",{get:function(){return Array.from(this.connectedContexts)},enumerable:!1,configurable:!0}),e.prototype.connectContextForScope=function(e){var t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()},e.prototype.disconnectContextForScope=function(e){var t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())},e.prototype.fetchContextForScope=function(e){var t=this.contextsByScope.get(e);return t||(t=new M(this,e),this.contextsByScope.set(e,t)),t},e}(),H=function(){function e(e){this.scope=e}return e.prototype.has=function(e){return this.data.has(this.getDataKey(e))},e.prototype.get=function(e){return this.data.get(this.getDataKey(e))},e.prototype.getAttributeName=function(e){return this.data.getAttributeNameForKey(this.getDataKey(e))},e.prototype.getDataKey=function(e){return e+"-class"},Object.defineProperty(e.prototype,"data",{get:function(){return this.scope.data},enumerable:!1,configurable:!0}),e}();function R(e){return e.replace(/(?:[_-])([a-z0-9])/g,(function(e,t){return t.toUpperCase()}))}function q(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $(e){return e.replace(/([A-Z])/g,(function(e,t){return"-"+t.toLowerCase()}))}var U=function(){function e(e){this.scope=e}return Object.defineProperty(e.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),e.prototype.get=function(e){var t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)},e.prototype.set=function(e,t){var s=this.getAttributeNameForKey(e);return this.element.setAttribute(s,t),this.get(e)},e.prototype.has=function(e){var t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)},e.prototype.delete=function(e){if(this.has(e)){var t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}return!1},e.prototype.getAttributeNameForKey=function(e){return"data-"+this.identifier+"-"+$(e)},e}(),z=function(){function e(e){this.warnedKeysByObject=new WeakMap,this.logger=e}return e.prototype.warn=function(e,t,s){var r=this.warnedKeysByObject.get(e);r||(r=new Set,this.warnedKeysByObject.set(e,r)),r.has(t)||(r.add(t),this.logger.warn(s,e))},e}();function W(e,t){return"["+e+'~="'+t+'"]'}var K=function(){for(var e=0,t=0,s=arguments.length;t<s;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<s;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,i++)r[i]=n[o];return r},J=function(){function e(e){this.scope=e}return Object.defineProperty(e.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return this.scope.schema},enumerable:!1,configurable:!0}),e.prototype.has=function(e){return null!=this.find(e)},e.prototype.find=function(){for(var e=this,t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];return t.reduce((function(t,s){return t||e.findTarget(s)||e.findLegacyTarget(s)}),void 0)},e.prototype.findAll=function(){for(var e=this,t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];return t.reduce((function(t,s){return K(t,e.findAllTargets(s),e.findAllLegacyTargets(s))}),[])},e.prototype.findTarget=function(e){var t=this.getSelectorForTargetName(e);return this.scope.findElement(t)},e.prototype.findAllTargets=function(e){var t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)},e.prototype.getSelectorForTargetName=function(e){return W("data-"+this.identifier+"-target",e)},e.prototype.findLegacyTarget=function(e){var t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)},e.prototype.findAllLegacyTargets=function(e){var t=this,s=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(s).map((function(s){return t.deprecate(s,e)}))},e.prototype.getLegacySelectorForTargetName=function(e){var t=this.identifier+"."+e;return W(this.schema.targetAttribute,t)},e.prototype.deprecate=function(e,t){if(e){var s=this.identifier,r=this.schema.targetAttribute;this.guide.warn(e,"target:"+t,"Please replace "+r+'="'+s+"."+t+'" with data-'+s+'-target="'+t+'". The '+r+" attribute is deprecated and will be removed in a future version of Stimulus.")}return e},Object.defineProperty(e.prototype,"guide",{get:function(){return this.scope.guide},enumerable:!1,configurable:!0}),e}(),Y=function(){function e(e,t,s,r){var i=this;this.targets=new J(this),this.classes=new H(this),this.data=new U(this),this.containsElement=function(e){return e.closest(i.controllerSelector)===i.element},this.schema=e,this.element=t,this.identifier=s,this.guide=new z(r)}return e.prototype.findElement=function(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)},e.prototype.findAllElements=function(e){return function(){for(var e=0,t=0,s=arguments.length;t<s;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<s;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,i++)r[i]=n[o];return r}(this.element.matches(e)?[this.element]:[],this.queryElements(e).filter(this.containsElement))},e.prototype.queryElements=function(e){return Array.from(this.element.querySelectorAll(e))},Object.defineProperty(e.prototype,"controllerSelector",{get:function(){return W(this.schema.controllerAttribute,this.identifier)},enumerable:!1,configurable:!0}),e}(),Z=function(){function e(e,t,s){this.element=e,this.schema=t,this.delegate=s,this.valueListObserver=new A(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}return e.prototype.start=function(){this.valueListObserver.start()},e.prototype.stop=function(){this.valueListObserver.stop()},Object.defineProperty(e.prototype,"controllerAttribute",{get:function(){return this.schema.controllerAttribute},enumerable:!1,configurable:!0}),e.prototype.parseValueForToken=function(e){var t=e.element,s=e.content,r=this.fetchScopesByIdentifierForElement(t),i=r.get(s);return i||(i=this.delegate.createScopeForElementAndIdentifier(t,s),r.set(s,i)),i},e.prototype.elementMatchedValue=function(e,t){var s=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,s),1==s&&this.delegate.scopeConnected(t)},e.prototype.elementUnmatchedValue=function(e,t){var s=this.scopeReferenceCounts.get(t);s&&(this.scopeReferenceCounts.set(t,s-1),1==s&&this.delegate.scopeDisconnected(t))},e.prototype.fetchScopesByIdentifierForElement=function(e){var t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t},e}(),X=function(){function e(e){this.application=e,this.scopeObserver=new Z(this.element,this.schema,this),this.scopesByIdentifier=new T,this.modulesByIdentifier=new Map}return Object.defineProperty(e.prototype,"element",{get:function(){return this.application.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return this.application.schema},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"logger",{get:function(){return this.application.logger},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerAttribute",{get:function(){return this.schema.controllerAttribute},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"modules",{get:function(){return Array.from(this.modulesByIdentifier.values())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contexts",{get:function(){return this.modules.reduce((function(e,t){return e.concat(t.contexts)}),[])},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.scopeObserver.start()},e.prototype.stop=function(){this.scopeObserver.stop()},e.prototype.loadDefinition=function(e){this.unloadIdentifier(e.identifier);var t=new j(this.application,e);this.connectModule(t)},e.prototype.unloadIdentifier=function(e){var t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)},e.prototype.getContextForElementAndIdentifier=function(e,t){var s=this.modulesByIdentifier.get(t);if(s)return s.contexts.find((function(t){return t.element==e}))},e.prototype.handleError=function(e,t,s){this.application.handleError(e,t,s)},e.prototype.createScopeForElementAndIdentifier=function(e,t){return new Y(this.schema,e,t,this.logger)},e.prototype.scopeConnected=function(e){this.scopesByIdentifier.add(e.identifier,e);var t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)},e.prototype.scopeDisconnected=function(e){this.scopesByIdentifier.delete(e.identifier,e);var t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)},e.prototype.connectModule=function(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((function(t){return e.connectContextForScope(t)}))},e.prototype.disconnectModule=function(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((function(t){return e.disconnectContextForScope(t)}))},e}(),G={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target"},Q=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{l(r.next(e))}catch(t){n(t)}}function a(e){try{l(r.throw(e))}catch(t){n(t)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))},ee=function(e,t){var s,r,i,n,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(n){return function(a){return function(n){if(s)throw new TypeError("Generator is already executing.");for(;o;)try{if(s=1,r&&(i=2&n[0]?r.return:n[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,n[1])).done)return i;switch(r=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,r=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){o.label=n[1];break}if(6===n[0]&&o.label<i[1]){o.label=i[1],i=n;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(n);break}i[2]&&o.ops.pop(),o.trys.pop();continue}n=t.call(e,o)}catch(a){n=[6,a],r=0}finally{s=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}},te=function(){for(var e=0,t=0,s=arguments.length;t<s;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<s;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,i++)r[i]=n[o];return r};function se(e){return L(e,"classes").reduce((function(e,t){return Object.assign(e,((r={})[i=(s=t)+"Class"]={get:function(){var e=this.classes;if(e.has(s))return e.get(s);var t=e.getAttributeName(s);throw new Error('Missing attribute "'+t+'"')}},r["has"+q(i)]={get:function(){return this.classes.has(s)}},r));var s,r,i}),{})}function re(e){return L(e,"targets").reduce((function(e,t){return Object.assign(e,((r={})[(s=t)+"Target"]={get:function(){var e=this.targets.find(s);if(e)return e;throw new Error('Missing target element "'+this.identifier+"."+s+'"')}},r[s+"Targets"]={get:function(){return this.targets.findAll(s)}},r["has"+q(s)+"Target"]={get:function(){return this.targets.has(s)}},r));var s,r}),{})}function ie(e){var t=D(e,"values"),s={valueDescriptorMap:{get:function(){var e=this;return t.reduce((function(t,s){var r,i=ne(s),n=e.data.getAttributeNameForKey(i.key);return Object.assign(t,((r={})[n]=i,r))}),{})}}};return t.reduce((function(e,t){return Object.assign(e,function(e){var t,s=ne(e),r=s.type,i=s.key,n=s.name,o=ae[r],a=le[r]||le.default;return(t={})[n]={get:function(){var e=this.data.get(i);return null!==e?o(e):s.defaultValue},set:function(e){void 0===e?this.data.delete(i):this.data.set(i,a(e))}},t["has"+q(n)]={get:function(){return this.data.has(i)}},t}(t))}),s)}function ne(e){return function(e,t){var s=$(e)+"-value";return{type:t,key:s,name:R(s),get defaultValue(){return oe[t]}}}(e[0],function(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}throw new Error('Unknown value type constant "'+e+'"')}(e[1]))}!function(){function e(e,t){void 0===e&&(e=document.documentElement),void 0===t&&(t=G),this.logger=console,this.element=e,this.schema=t,this.dispatcher=new u(this),this.router=new X(this)}e.start=function(t,s){var r=new e(t,s);return r.start(),r},e.prototype.start=function(){return Q(this,void 0,void 0,(function(){return ee(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){"loading"==document.readyState?document.addEventListener("DOMContentLoaded",e):e()}))];case 1:return e.sent(),this.dispatcher.start(),this.router.start(),[2]}}))}))},e.prototype.stop=function(){this.dispatcher.stop(),this.router.stop()},e.prototype.register=function(e,t){this.load({identifier:e,controllerConstructor:t})},e.prototype.load=function(e){for(var t=this,s=[],r=1;r<arguments.length;r++)s[r-1]=arguments[r];var i=Array.isArray(e)?e:te([e],s);i.forEach((function(e){return t.router.loadDefinition(e)}))},e.prototype.unload=function(e){for(var t=this,s=[],r=1;r<arguments.length;r++)s[r-1]=arguments[r];var i=Array.isArray(e)?e:te([e],s);i.forEach((function(e){return t.router.unloadIdentifier(e)}))},Object.defineProperty(e.prototype,"controllers",{get:function(){return this.router.contexts.map((function(e){return e.controller}))},enumerable:!1,configurable:!0}),e.prototype.getControllerForElementAndIdentifier=function(e,t){var s=this.router.getContextForElementAndIdentifier(e,t);return s?s.controller:null},e.prototype.handleError=function(e,t,s){this.logger.error("%s\n\n%o\n\n%o",t,e,s)}}();var oe={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},ae={array:function(e){var t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError("Expected array");return t},boolean:function(e){return!("0"==e||"false"==e)},number:function(e){return parseFloat(e)},object:function(e){var t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError("Expected object");return t},string:function(e){return e}},le={default:function(e){return""+e},array:ce,object:ce};function ce(e){return JSON.stringify(e)}var he=function(){function e(e){this.context=e}return Object.defineProperty(e.prototype,"application",{get:function(){return this.context.application},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scope",{get:function(){return this.context.scope},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"targets",{get:function(){return this.scope.targets},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"classes",{get:function(){return this.scope.classes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.scope.data},enumerable:!1,configurable:!0}),e.prototype.initialize=function(){},e.prototype.connect=function(){},e.prototype.disconnect=function(){},e.blessings=[se,re,ie],e.targets=[],e.values={},e}();class ue extends he{constructor(e){return super(e),this.application.debug?new Proxy(this,{get:(e,t)=>{let s=Reflect.get(e,t),r=this;if(function(e){switch(e){case"application":case"el":case"element":case"constructor":case"initialize":case"log":case"logEvent":case"dispatch":case"data":case"valueDescriptorMap":case"mutate":case"identifier":return!1}if(/^_.*?$/.test(e))return!1;if(/^.*?Target(s)?$/.test(e))return!1;if(/^.*?Value$/.test(e))return!1;if(/^.*?ValueChanged$/.test(e))return!1;if(/^.*?Class$/.test(e))return!1;if(/^.*?Classes$/.test(e))return!1;return!0}(t.toString())){if("function"==typeof s)return new Proxy(s,{apply:(e,s,i)=>(r.log(t.toString(),{args:i}),Reflect.apply(e,s,i))});this.log(t.toString())}return s}}):this}get el(){return this.element}get isTurboPreview(){return document.documentElement.hasAttribute("data-turbo-preview")||document.documentElement.hasAttribute("data-turbolinks-preview")}get isTurbolinksPreview(){return this.isTurboPreview}get csrfToken(){return this.metaValue("csrf-token")}metaValue(e){const t=document.head.querySelector(`meta[name="${e}"]`);return(null==t?void 0:t.getAttribute("content"))||null}dispatch(e,t,s={}){let r=Object.assign({},{bubbles:!0,cancelable:!0,detail:{target:e}},s);r.detail.target&&(r.detail.target=e);let i=new CustomEvent(t,r);this.logEvent(t,i,e),e.dispatchEvent(i)}log(e,t={}){if(!this.application.debug)return;let s=console;s.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: #3B82F6","color: unset"),s.log(n({element:this.element,controller:this},t)),s.groupEnd()}warn(e,t={}){if(!this.application.debug)return;let s=console;s.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: F39B1AFF","color: unset"),s.warn(n({element:this.element,controller:this},t)),s.groupEnd()}logEvent(e,t,s){if(!this.application.debug)return;let r=console;r.groupCollapsed(`%c${this.identifier} %c${e}%c`,"color: #3B82F6","color: #0be000","color: unset"),r.log({element:s}),r.groupEnd()}}var de={exports:{}};const pe=(e,t)=>{if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");if(t=n({pascalCase:!1,preserveConsecutiveUppercase:!1},t),0===(e=Array.isArray(e)?e.map((e=>e.trim())).filter((e=>e.length)).join("-"):e.trim()).length)return"";if(1===e.length)return t.pascalCase?e.toLocaleUpperCase(t.locale):e.toLocaleLowerCase(t.locale);return e!==e.toLocaleLowerCase(t.locale)&&(e=((e,t)=>{let s=!1,r=!1,i=!1;for(let n=0;n<e.length;n++){const o=e[n];s&&/[\p{Lu}]/u.test(o)?(e=e.slice(0,n)+"-"+e.slice(n),s=!1,i=r,r=!0,n++):r&&i&&/[\p{Ll}]/u.test(o)?(e=e.slice(0,n-1)+"-"+e.slice(n-1),i=r,r=!1,s=!0):(s=o.toLocaleLowerCase(t)===o&&o.toLocaleUpperCase(t)!==o,i=r,r=o.toLocaleUpperCase(t)===o&&o.toLocaleLowerCase(t)!==o)}return e})(e,t.locale)),e=e.replace(/^[_.\- ]+/,""),e=t.preserveConsecutiveUppercase?(e=>e.replace(/^[\p{Lu}](?![\p{Lu}])/gu,(e=>e.toLowerCase())))(e):e.toLocaleLowerCase(),t.pascalCase&&(e=e.charAt(0).toLocaleUpperCase(t.locale)+e.slice(1)),((e,t)=>e.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,((e,s)=>s.toLocaleUpperCase(t.locale))).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(e=>e.toLocaleUpperCase(t.locale))))(e,t)};de.exports=pe,de.exports.default=pe;var me=de.exports;class fe extends ue{_cleanupSelf(){this.cleanup(this.el)}cleanup(e){var t,s,r;e.dataset.controller=(null==(t=e.dataset.controller)?void 0:t.replaceAll(new RegExp(`(s|^)${this.identifier}(s|$)`,"g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;let i=new RegExp(`(s|^)${this.identifier}\\..+?(s|$)`,"g");e.dataset.target=(null==(s=e.dataset.target)?void 0:s.replaceAll(i,""))||"",delete e.dataset[me(`${this.identifier}-target`)],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(r=e.dataset.target)?void 0:r.replaceAll(i,""))||"",delete e.dataset[me(`${this.identifier}-action`)],""==e.dataset.action&&delete e.dataset.action;let n=this.constructor.values;n&&Object.keys(n).forEach((t=>delete e.dataset[me(`${this.identifier}-${t}-value`)]));let o=this.constructor.classes;o&&Object.keys(o).forEach((t=>delete e.dataset[me(`${this.identifier}-${t}-class`)]))}}const ge="scrollBehavior"in document.documentElement.style;let ve;async function be(e,{behavior:t="smooth",block:s="start",inline:r="nearest"}={}){"smooth"!=t||ge||await ke(),e.scrollIntoView({behavior:t,block:s,inline:r})}async function ye(e,{behavior:t="smooth"}={}){"smooth"!=t||ge||await ke(),e.scrollTo({top:0,left:0,behavior:t})}async function _e(e,{behavior:t="smooth"}={}){"smooth"!=t||ge||await ke(),e==window?e.scrollTo({top:document.body.scrollHeight,left:0,behavior:t}):e.scrollTo({top:e.scrollHeight,left:0,behavior:t})}async function we(e,{behavior:t="smooth"}={}){"smooth"!=t||ge||await ke(),e.scrollTo({left:0,behavior:t})}async function Ce(e,t,{behavior:s="smooth"}={}){"smooth"!=s||ge||await ke(),e.scrollBy({top:-t,left:0,behavior:s})}async function Ee(e,t,{behavior:s="smooth"}={}){"smooth"!=s||ge||await ke(),e.scrollBy({top:t,left:0,behavior:s})}async function xe(e,t,{behavior:s="smooth"}={}){"smooth"!=s||ge||await ke(),e.scrollBy({top:0,left:-t,behavior:s})}async function Te(e,t,{behavior:s="smooth"}={}){"smooth"!=s||ge||await ke(),e.scrollBy({top:0,left:t,behavior:s})}async function ke(){const{polyfill:e}=await Promise.resolve().then((function(){return c(require("smoothscroll-polyfill"))}));ve||(ve=!0,e())}function Se(e){if(!e)return null;if(e==document.body)return window;const t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:Se(e.parentElement)||document.body}function Ae(e){return"TURBO-FRAME"==e.nodeName}const Ve={all:Oe=Oe||new Map,on:function(e,t){var s=Oe.get(e);s?s.push(t):Oe.set(e,[t])},off:function(e,t){var s=Oe.get(e);s&&(t?s.splice(s.indexOf(t)>>>0,1):Oe.set(e,[]))},emit:function(e,t){var s=Oe.get(e);s&&s.slice().map((function(e){e(t)})),(s=Oe.get("*"))&&s.slice().map((function(s){s(e,t)}))}};var Oe;function Me(e){return"A"==e.nodeName}function Le(e){return"FORM"==e.nodeName}function De(e){return"INPUT"==e.nodeName}function Ne(e){return"TEXTAREA"==e.nodeName}function Ie(e){return"BUTTON"==e.nodeName}function Pe(e){return"SELECT"==e.nodeName}function Fe(e){return De(e)&&("radio"===e.type||"checkbox"===e.type)}function Be(e){let t=document.createElement("button");return t.type=e,t.style.display="none",t.dataset.sythentic="true",t}function je(e,t,s){let r=e.insertAdjacentElement(t,s);if(!r)throw new Error(`Failed to insert element ${s.nodeName} into ${e.nodeName}`);return r}function He(e,t,s){return je(t,s,Be(e))}function Re(e){if(e.requestSubmit)e.requestSubmit();else{let t=e.querySelector('button[type="submit"]');t||(t=He("submit",e,"beforeend")),t.click()}}function qe(e){let t=e.querySelector('button[type="reset"]');t||(t=He("reset",e,"beforeend")),t.click()}function $e(e,t,s,r,i){return Ue(e,t,[s],r,i)}function Ue(e,t,s,r,i){const n=e.disconnect.bind(e);let o=i;(null==o?void 0:o.debounce)?(r=a.debounce(r.bind(e),o.debounce),delete o.debounce):r=r.bind(e);let l=()=>s.forEach((e=>t.addEventListener(e,r,o))),c=()=>s.forEach((e=>t.removeEventListener(e,r)));return l(),Object.assign(e,{disconnect(){c(),n()}}),[l,c]}function ze(e,t,s){const r=e.disconnect.bind(e);t=t.bind(e);let i=null,n=()=>{null!==i&&clearInterval(i)};return i=setInterval(t,s),Object.assign(e,{disconnect(){n(),r()}}),n}function We(e,t,s){const r=e.disconnect.bind(e);t=t.bind(e);let i=null,n=()=>{null!==i&&clearTimeout(i)};return i=setTimeout(t,s),Object.assign(e,{disconnect(){n(),r()}}),n}function Ke(e,t,s,r,i={}){const n=e.disconnect.bind(e);let o,a=Array.from(r.childNodes);return o=i.cleanup?()=>{console.log("teardown"),a.forEach((e=>e.remove()))}:()=>console.log("void teardown"),(()=>{let e=t.parentElement;if(["beforebegin","afterend"].includes(s)&&null==e)throw new Error("Cannot insert beforebegin into a node with no parent");switch(s){case"beforeend":t.append(r);break;case"afterbegin":t.prepend(r);break;case"beforebegin":case"afterend":e.insertBefore(r,t)}})(),Object.assign(e,{disconnect(){o(),n()}}),[a,o]}function Je(e,t,s,r,i={}){const n=new DocumentFragment;n.append(r);let[o,a]=Ke(e,t,s,n,i);return[o[0],a]}class Ye extends ue{get _key(){return this.keyValue.replaceAll("#","")}get _anchor(){return window.location.hash.substr(1)}set _anchor(e){window.location.hash=e}connect(){requestAnimationFrame((()=>{this._checkAnchor(),$e(this,window,"hashchange",this._checkAnchor)}))}write(e){null==e||e.preventDefault(),this._anchor=this._key}_checkAnchor(){this._key===this._anchor?this.dispatch(this.el,"anchor-spy:active"):this.dispatch(this.el,"anchor-spy:inactive")}}o(Ye,"values",{key:String});class Ze extends ue{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}connect(){}async loadContent(e=null){null==e||e.preventDefault();let t=this,s=this.hasReplaceTarget?this.replaceTarget:this.el,r=()=>{s.replaceWith(this._errorMessage),t.dispatch(s,"ajax:error")};try{let e=await fetch(this.endpointValue);e.ok||r();let i=await e.text(),n=document.createElement("div");if(n.innerHTML=i,this.hasSelectorValue){let e=n.querySelectorAll(this.selectorValue);s.replaceWith(...e)}else s.replaceWith(...n.children);t.dispatch(s,"ajax:success")}catch(i){r()}finally{t.dispatch(s,"ajax:complete")}}}o(Ze,"targets",["replace"]),o(Ze,"values",{endpoint:String,errorMessage:String,selector:String});class Xe extends Ze{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}async connect(){await this.loadContent()}}o(Xe,"targets",["replace"]),o(Xe,"values",{endpoint:String,errorMessage:String,selector:String});class Ge extends ue{get _eventMode(){if(this.hasEventModeValue){if(!["change","input","debounced"].includes(this.eventModeValue))throw new Error(`The modeValue provided '${this.eventModeValue}' is not one of the recognised configuration options`);return this.eventModeValue}return"change"}get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:1e3}get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}return"request"}get _cssSelector(){return["input","textarea","select"].map((e=>e.concat(":not([data-no-autosubmit])"))).join(",")}get inputElements(){return this.element.querySelectorAll(this._cssSelector)}connect(){this.inputElements.forEach((e=>$e(this,e,"change"==this._eventMode?"change":"input",this.submit,{debounce:"debounced"==this._eventMode?this._debounceTimeout:void 0})))}submit(){let e=this.el;"request"==this._mode?Re(e):e.submit()}}o(Ge,"values",{submitMode:String,eventMode:String,debounceInterval:Number});const Qe=(e,t)=>{const s=e[t];return"function"==typeof s?s:(...e)=>{}},et=(e,t,s)=>{let r=e;return!0===s?r=`${t.identifier}:${e}`:"string"==typeof s&&(r=`${s}:${e}`),r},tt=(e,t,s)=>{const{bubbles:r,cancelable:i,composed:n}=t||{bubbles:!0,cancelable:!0,composed:!0};t&&Object.assign(s,{originalEvent:t});return new CustomEvent(e,{bubbles:r,cancelable:i,composed:n,detail:s})};const st={dispatchEvent:!0,eventPrefix:!0},rt=(e,t={})=>{const{dispatchEvent:s,eventPrefix:r}=Object.assign({},st,t),i=(null==t?void 0:t.element)||e.element,n=t=>{if(e.isVisible=!0,Qe(e,"appear").call(e,t),s){const s=et("appear",e,r),n=tt(s,null,{controller:e,entry:t});i.dispatchEvent(n)}},o=t=>{if(e.isVisible=!1,Qe(e,"disappear").call(e,t),s){const s=et("disappear",e,r),n=tt(s,null,{controller:e,entry:t});i.dispatchEvent(n)}},a=e.disconnect.bind(e),l=new IntersectionObserver((t=>{const[s]=t;s.isIntersecting?n(s):e.isVisible&&o(s)}),t),c=()=>{l.observe(i)},h=()=>{l.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){h(),a()}}),c(),[c,h]},it={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},nt=(e,t={})=>{const{onlyVisible:s,dispatchEvent:r,events:i,eventPrefix:n}=Object.assign({},it,t),o=i=>{const o=(null==t?void 0:t.element)||e.element;if(!(o.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth,i=t.top<=s&&t.top+t.height>=0,n=t.left<=r&&t.left+t.width>=0;return i&&n}(o)&&s)&&(e.clickOutside&&e.clickOutside(i),r)){const t=et("click:outside",e,n),s=tt(t,i,{controller:e});o.dispatchEvent(s)}},a=()=>{null==i||i.forEach((e=>{window.addEventListener(e,o,!1)}))},l=()=>{null==i||i.forEach((e=>{window.removeEventListener(e,o,!1)}))},c=e.disconnect.bind(e);return Object.assign(e,{disconnect(){l(),c()}}),a(),[a,l]},ot={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class at{constructor(e,i={}){var o,a,l;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(n({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.dispatch=(e,i={})=>{if(this.dispatchEvent){const o=i,{event:a}=o,l=((e,i)=>{var n={};for(var o in e)s.call(e,o)&&i.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&t)for(var o of t(e))i.indexOf(o)<0&&r.call(e,o)&&(n[o]=e[o]);return n})(o,["event"]),c=this.extendedEvent(e,a||null,l);this.targetElement.dispatchEvent(c),this.log("dispatchEvent",n({eventName:c.type},l))}},this.call=(e,t={})=>{const s=this.controller[e];if("function"==typeof s)return s.call(this.controller,t)},this.extendedEvent=(e,t,s)=>{const{bubbles:r,cancelable:i,composed:n}=t||{bubbles:!0,cancelable:!0,composed:!0};t&&Object.assign(s,{originalEvent:t});return new CustomEvent(this.composeEventName(e),{bubbles:r,cancelable:i,composed:n,detail:s})},this.composeEventName=e=>{let t=e;return!0===this.eventPrefix?t=`${this.controller.identifier}:${e}`:"string"==typeof this.eventPrefix&&(t=`${this.eventPrefix}:${e}`),t},this.debug=null!==(a=null!==(o=null==i?void 0:i.debug)&&void 0!==o?o:e.application.stimulusUseDebug)&&void 0!==a?a:ot.debug,this.logger=null!==(l=null==i?void 0:i.logger)&&void 0!==l?l:ot.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.targetElement=(null==i?void 0:i.element)||e.element;const{dispatchEvent:c,eventPrefix:h}=Object.assign({},ot,i);Object.assign(this,{dispatchEvent:c,eventPrefix:h}),this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class lt extends at{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=e=>{this.call("mouseEnter",e),this.log("mouseEnter",{hover:!0}),this.dispatch("mouseEnter",{hover:!1})},this.onLeave=e=>{this.call("mouseLeave",e),this.log("mouseLeave",{hover:!1}),this.dispatch("mouseLeave",{hover:!1})},this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class ct extends at{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{this.call("mutate",e),this.log("mutate",{entries:e}),this.dispatch("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const ht=(e,t={})=>{const s=new ct(e,t);return[s.observe,s.unobserve]},ut=e=>{const t=t=>{const{innerWidth:s,innerHeight:r}=window,i={height:r||1/0,width:s||1/0,event:t};Qe(e,"windowResize").call(e,i)},s=e.disconnect.bind(e),r=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),s()}}),r(),[r,i]};(class extends he{}).debounces=[];const dt=(e,t=200)=>{let s=null;return function(){const r=arguments,i=this,n=()=>e.apply(i,r);s&&clearTimeout(s),s=setTimeout(n,t)}};class pt extends ue{get _pages(){return this.hasPagesValue?Math.abs(this.pagesValue):1}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1500}connect(){$e(this,this.el,"click",this.goBack)}goBack(e){null==e||e.preventDefault(),history.go(-this._pages),this.el.href&&We(this,this.fallback,this._timeout)}fallback(){window.location.href=this.el.href}}o(pt,"values",{timeout:Number,pages:Number});class mt extends ue{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}connect(){requestAnimationFrame((()=>{$e(this,this.inputTarget,"input",this._updateCharCount),this._updateCharCount()}))}_addErrorClasses(e=this.el){this.hasErrorClass?e.classList.add(...this._errorClasses):e.classList.add(...this._defaultErrorClasses)}_removeErrorClasses(e=this.el){this.hasErrorClass?e.classList.remove(...this._errorClasses):e.classList.remove(...this._defaultErrorClasses)}_updateCharCount(){let e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this._isValidCount(e)?this._removeErrorClasses(this.outputTarget):this._addErrorClasses(this.outputTarget))}_isValidCount(e){let t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}o(mt,"targets",["input","output"]),o(mt,"values",{min:Number,max:Number}),o(mt,"classes",["error"]);class ft extends ue{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disable():this.enable()}disable(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(((t,s)=>{e&&(t.value=""),t.disabled=!0}))}enable(){this.disableTargets.forEach(((e,t)=>{e.disabled=!1}))}}o(ft,"targets",["disabler","disable"]),o(ft,"values",{clear:Boolean});class gt extends ue{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enable():this.disable()}disable(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(((t,s)=>{e&&(t.value=""),t.disabled=!0}))}enable(){this.enableTargets.forEach(((e,t)=>{e.disabled=!1}))}}o(gt,"targets",["enabler","enable"]),o(gt,"values",{clear:Boolean});class vt extends ue{get _checked(){return this.checkboxTargets.filter((e=>e.checked))}get _unchecked(){return this.checkboxTargets.filter((e=>!e.checked))}connect(){requestAnimationFrame((()=>{this.hasSelectAllTarget&&($e(this,this.selectAllTarget,"change",this._toggle),this.checkboxTargets.forEach((e=>$e(this,e,"change",this._refresh))),this._refresh())}))}_toggle(e){e.preventDefault();let t=e.target;this.checkboxTargets.forEach((e=>e.checked=t.checked))}_refresh(){const e=this.checkboxTargets.length,t=this._checked.length;this.selectAllTarget.checked=t>0,this.selectAllTarget.indeterminate=t>0&&t<e}}o(vt,"targets",["selectAll","checkbox"]);class bt extends ue{constructor(){super(...arguments),o(this,"_supported",!1)}connect(){this._supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this._supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())}select(e){e&&e.preventDefault(),this.sourceTarget.select()}copy(e){e&&e.preventDefault(),this.sourceTarget.select(),this._supported&&document.execCommand("copy")}}o(bt,"targets",["source","button","copy","fallback"]),o(bt,"values",{removeUnused:Boolean});class yt extends ue{get _tickInterval(){return this.hasMillisecondsTarget?1:this.hasSecondsTarget?1e3:this.hasMinutesTarget?15e3:3e5}connect(){requestAnimationFrame((()=>{ze(this,this._tick,this._tickInterval)}))}_tick(){let e=new Date;this.hasHoursTarget&&(this.hoursTarget.innerHTML=e.getHours().toString().padStart(2,"0")),this.hasMinutesTarget&&(this.minutesTarget.innerHTML=e.getMinutes().toString().padStart(2,"0")),this.hasSecondsTarget&&(this.secondsTarget.innerHTML=e.getSeconds().toString().padStart(2,"0")),this.hasMillisecondsTarget&&(this.millisecondsTarget.innerHTML=e.getMilliseconds().toString().padStart(3,"0"))}}o(yt,"targets",["hours","minutes","seconds","milliseconds"]);class _t extends ue{get _message(){return this.hasMessageValue?this.messageValue:"Are you sure?"}get _eventType(){if(Le(this.el))return"submit";if(Me(this.el))return"click";throw new Error("Can't handle confirmation on attached element")}connect(){requestAnimationFrame((()=>{$e(this,this.el,this._eventType,this.confirm)}))}confirm(e){window.confirm(this._message)||(e.preventDefault(),this.dispatch(this.el,"confirm:cancelled"))}}o(_t,"values",{message:String});class wt extends ue{get _message(){return this.hasMessageValue?this.messageValue:"Do you want to leave this page? Changes you made may not be saved"}initialize(){this.allowSubmit=this.allowSubmit.bind(this),this.confirmNavigation=this.confirmNavigation.bind(this),this.confirmTurboNavigation=this.confirmTurboNavigation.bind(this)}connect(){window.onbeforeunload=()=>this._message,$e(this,window,"popstate",this.confirmNavigation),$e(this,window,"submit",this.allowSubmit),Ue(this,window,["turbolinks:before-visit","turbo:before-visit"],this.confirmTurboNavigation)}disconnect(){window.onbeforeunload=null}allowSubmit(e){window.removeEventListener("popstate",this.confirmNavigation),window.onbeforeunload=null}confirmNavigation(e){return!1}confirmTurboNavigation(e){confirm(this._message)||e.preventDefault()}}o(wt,"values",{message:String});class Ct extends ue{constructor(){super(...arguments),o(this,"_interval",null)}get _removeUnused(){return!!this.hasRemoveUnusedValue&&this.removeUnusedValue}get _endedClasses(){return this.endedClass.split(" ")}get _defaultEndedClasses(){return[]}get _countingDownClasses(){return this.countingDownClass.split(" ")}get _defaultCountingDownClasses(){return[]}get _deadlineDate(){return new Date(this.deadlineValue)}connect(){this._interval=setInterval(this._tick.bind(this),1e3),this._addCountingDownClasses()}disconnect(){this._clearTick(),this._removeCountingDownClasses(),this._removeEndedClasses()}deadlineValueChanged(){null==this._interval&&(this._interval=setInterval(this._tick.bind(this),1e3))}_tick(){try{const e=new Date;let t={};l.isPast(this._deadlineDate)?(t={years:0,months:0,days:0,hours:0,minutes:0,seconds:0},this._clearTick(),this._removeCountingDownClasses(),this._addEndedClasses(),this.dispatch(this.el,"countdown:ended")):t=l.intervalToDuration({start:this._deadlineDate,end:e}),this.hasYearsTarget&&this._updateTarget(this.yearsTarget,this._years(t)),this.hasMonthsTarget&&this._updateTarget(this.monthsTarget,this._months(t)),this.hasDaysTarget&&this._updateTarget(this.daysTarget,this._days(t)),this.hasHoursTarget&&this._updateTarget(this.hoursTarget,this._hours(t)),this.hasMinutesTarget&&this._updateTarget(this.minutesTarget,this._minutes(t)),this.hasSecondsTarget&&this._updateTarget(this.secondsTarget,this._seconds(t))}catch(e){console.error(e),this._clearTick()}}_clearTick(){this._interval&&(clearInterval(this._interval),this._interval=null)}_updateTarget(e,t){this._removeTargetIfUnused(e,t),e.innerHTML=t.toString()}_removeTargetIfUnused(e,t){this._removeUnused&&(0===t&&e.dataset.unused?Number.parseInt(e.dataset.unused)>Date.now()+1500&&e.remove():e.dataset.unused=0==t?Date.now().toString():void 0)}_years(e){return e.years||0}_months(e){return e.months||0}_days(e){return e.days||0}_hours(e){return e.hours||0}_minutes(e){return e.minutes||0}_seconds(e){return e.seconds||0}_addEndedClasses(e=this.el){this.hasEndedClass?e.classList.add(...this._endedClasses):e.classList.add(...this._defaultEndedClasses)}_removeEndedClasses(e=this.el){this.hasEndedClass?e.classList.remove(...this._endedClasses):e.classList.remove(...this._defaultEndedClasses)}_addCountingDownClasses(e=this.el){this.hasCountingDownClass?e.classList.add(...this._countingDownClasses):e.classList.add(...this._defaultCountingDownClasses)}_removeCountingDownClasses(e=this.el){this.hasCountingDownClass?e.classList.remove(...this._countingDownClasses):e.classList.remove(...this._defaultCountingDownClasses)}}o(Ct,"values",{deadline:String,removeUnused:Boolean}),o(Ct,"targets",["years","months","days","hours","minutes","seconds"]),o(Ct,"classes",["countingDown","ended"]);class Et extends ue{connect(){console.log("Debug Controller",this,this.testTargets)}}o(Et,"targets",["test"]);function xt(e){return e.hasAttribute("data-dirty")}class Tt extends ue{constructor(){super(...arguments),o(this,"_cacheText")}get _message(){return this.hasMessageValue?this.messageValue:"Submitting..."}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1e3}initialize(){}connect(){requestAnimationFrame((()=>{Ue(this,this.el,["click"],this.disable),Ue(this,window,["turbo:load","turbolinks:load"],this._enable)}))}disable(e){let t=this.el;this._isDisabled(t)?(null==e||e.preventDefault(),null==e||e.stopImmediatePropagation()):(this._cacheText=this._getElText(t),this._setElText(t,this._message),this._disable(),We(this,this.enable,this._timeout))}enable(e){null==e||e.preventDefault();let t=this.el;this._isDisabled(t)&&(this._setElText(t,this._cacheText),this._enable())}_isDisabled(e){return De(e)&&"submit"==e.type||Ie(e)?e.disabled:"true"==e.dataset.disabled}_getElText(e){return De(e)&&"submit"==e.type?e.value:e.innerText}_setElText(e,t){De(e)&&"submit"==e.type?e.value=t:(Ie(e)||Me(e))&&(e.innerText=t)}_disable(){let e=this.el;De(e)&&"submit"==e.type||Ie(e)?e.disabled=!0:e.dataset.disabled="true"}_enable(){let e=this.el;De(e)&&"submit"==e.type||Ie(e)?e.disabled=!1:e.dataset.disabled=void 0}}o(Tt,"values",{message:String,timeout:Number});class kt extends ue{dismiss(){this.el.remove()}}class St extends ue{constructor(){super(...arguments),o(this,"_intervalHandle",null)}get _format(){return["years","months","weeks","days","hours",...this._minutes?["minutes"]:[],...this._seconds?["seconds"]:[]]}get _output(){let{years:e,months:t,weeks:s,days:r,hours:i,minutes:n,seconds:o}=this._duration;e||(e=0),t||(t=0),s||(s=0),r||(r=0),i||(i=0),n||(n=0),o||(o=0);let a=[e,t,s,r,i];return this._minutes||this._seconds||!a.every((e=>0===e))?l.formatDuration(this._duration,{format:this._format,delimiter:", "}):(n+=o/60,`${(n/60).toFixed(1)} hours`)}get _seconds(){return!this.hasSecondsValue||this.secondsValue}get _minutes(){return!this.hasMinutesValue||this.minutesValue}get _timestamp(){if(this.hasTimestampValue)return l.toDate(1e3*this.timestampValue);throw new Error("Expected `timestampValue` to be present")}get _duration(){return l.intervalToDuration({start:new Date,end:this._timestamp})}get _tickInterval(){return this._seconds?1e3:this._minutes?15e3:12e4}connect(){this._clearInterval=ze(this,this._update,this._tickInterval),this._update()}_update(){try{this.el.innerHTML=this._output}catch{this._intervalHandle&&window.clearInterval(this._intervalHandle)}}}o(St,"values",{timestamp:Number,minutes:Boolean,seconds:Boolean});class At extends ue{get _id(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(""!==e)return e;throw new Error(`No ID value to uniquely identify this element. Please either specify data-${this.identifier}-id-value or give this element an 'id' attribute. `)}get _uniqueIdentifier(){return`${location.href} ${this._id}`}get _restoreOnLoad(){return!this.hasRestoreOnLoadValue||this.restoreOnLoadValue}get _element(){return this.hasElementTarget?this.elementTarget:this.el}connect(){requestAnimationFrame((()=>{this._restoreOnLoad&&this.restore()}))}clear(e){e&&e.preventDefault(),localStorage.removeItem(this._uniqueIdentifier),this.dispatch(this._element,"element-save:cleared")}save(e){e&&e.preventDefault();let t=this._element,s=this.attributesValue.split(" "),r={};s.forEach((e=>r[e]=a.get(t,e))),localStorage.setItem(this._uniqueIdentifier,JSON.stringify(r)),this.dispatch(t,"element-save:save:success")}restore(e){e&&e.preventDefault();let t=this._element;if(localStorage.getItem(this._uniqueIdentifier)){const e=JSON.parse(localStorage.getItem(this._uniqueIdentifier));Object.keys(e).forEach((s=>{a.set(t,s,e[s])})),this.dispatch(t,"element-save:restore:success")}else this.dispatch(t,"element-save:restore:empty")}}o(At,"targets",["element"]),o(At,"values",{id:String,attributes:String,restoreOnLoad:Boolean});class Vt extends ue{get _container(){return this.hasContainerTarget?this.containerTarget:this.el}get _notEmptyClasses(){return this.notEmptyClass.split(" ")}get _defaultNotEmptyClasses(){return[]}get _emptyClasses(){return this.emptyClass.split(" ")}get _defaultEmptyClasses(){return[]}get _children(){let e=this._container;return this.hasScopeSelectorValue?Array.from(e.querySelectorAll(this.scopeSelectorValue)):Array.from(e.children)}connect(){ht(this,{element:this._container,childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e=this._container,t=this._children;0===t.length?(this._removeNotEmptyClasses(),this._addEmptyClasses(),this.dispatch(e,"dom:empty")):(this._addNotEmptyClasses(),this._removeEmptyClasses(),this.dispatch(e,"dom:not-empty",{detail:{count:t.length}}))}_addNotEmptyClasses(e=this.el){this.hasNotEmptyClass?e.classList.add(...this._notEmptyClasses):e.classList.add(...this._defaultNotEmptyClasses)}_removeNotEmptyClasses(e=this.el){this.hasNotEmptyClass?e.classList.remove(...this._notEmptyClasses):e.classList.remove(...this._defaultNotEmptyClasses)}_addEmptyClasses(e=this.el){this.hasEmptyClass?e.classList.add(...this._emptyClasses):e.classList.add(...this._defaultEmptyClasses)}_removeEmptyClasses(e=this.el){this.hasEmptyClass?e.classList.remove(...this._emptyClasses):e.classList.remove(...this._defaultEmptyClasses)}}o(Vt,"targets",["container"]),o(Vt,"classes",["empty","notEmpty"]),o(Vt,"values",{scopeSelector:String});class Ot extends ue{connect(){}disable(){let e=this.hasClearValue&&this.clearValue;this.inputTargets.forEach(((t,s)=>{e&&(t.value=""),t.disabled=!0}))}enable(){this.inputTargets.forEach(((e,t)=>e.disabled=!1))}}o(Ot,"targets",["input"]),o(Ot,"values",{clear:Boolean});class Mt extends ue{get _successClasses(){return this.successClass.split(" ")}get _defaultSuccessClasses(){return[]}get _failClasses(){return this.failClass.split(" ")}get _defaultFailClasses(){return[]}initialize(){this._hasLoadedSuccessfully=this._hasLoadedSuccessfully.bind(this),this._success=this._success.bind(this),this._fail=this._fail.bind(this)}connect(){let e=this.el;e.onerror=this._fail,e.complete&&!this._hasLoadedSuccessfully()?this._fail():this._success()}disconnect(){this._removeSuccessClasses(),this._removeFailClasses()}_success(){this._addSuccessClasses()}_fail(){let e=this.el;this._addFailClasses(),this.hasPlaceholderValue&&e.src!==this.placeholderValue?(this.dispatch(e,"fallback-image:placeholder"),e.src=this.placeholderValue,e.onerror=this._fail):(this.dispatch(e,"fallback-image:fail"),e.style.display="none")}_hasLoadedSuccessfully(){let e=this.el;return e.naturalHeight>0&&e.naturalWidth>0}_addFailClasses(e=this.el){this.hasFailClass?e.classList.add(...this._failClasses):e.classList.add(...this._defaultFailClasses)}_removeFailClasses(e=this.el){this.hasFailClass?e.classList.remove(...this._failClasses):e.classList.remove(...this._defaultFailClasses)}_addSuccessClasses(e=this.el){this.hasSuccessClass?e.classList.add(...this._successClasses):e.classList.add(...this._defaultSuccessClasses)}_removeSuccessClasses(e=this.el){this.hasSuccessClass?e.classList.remove(...this._successClasses):e.classList.remove(...this._defaultSuccessClasses)}}o(Mt,"values",{placeholder:String}),o(Mt,"classes",["success","fail"]);class Lt extends ue{get _mode(){const e=["immediate","wait"];if(this.hasModeValue){if(e.includes(this.modeValue))return this.modeValue;throw new Error(`The given modeValue '${this.modeValue}' is not one of the supported modes: "${e.join('", "')}"`)}return e[0]}connect(){"immediate"==this._mode&&this.steal()}steal(){this.el.focus()}}o(Lt,"values",{mode:String});class Dt extends ue{get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}return"request"}get form(){let e;if(this.hasFormSelectorValue){if(e=document.querySelector(this.formSelectorValue),!e)throw new Error(`Could not find a form on the page that matches selector '${this.formSelectorValue}'`)}else e=this.formTarget;return e}submit(e){null==e||e.preventDefault();let t=this.el;"request"==this._mode?Re(t):t.submit()}reset(e){null==e||e.preventDefault(),qe(this.form)}}o(Dt,"targets",["form"]),o(Dt,"values",{formSelector:String,submitMode:String});class Nt extends ue{get _formID(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(""!==e)return e;throw new Error(`No ID value to uniquely identify this form. Please either specify data-${this.identifier}-id-value or give this form an 'id' attribute. `)}get _formIdentifier(){return`${location.href} ${this._formID}`}get _formElements(){return this.el.elements}get _formData(){let e={[this._formIdentifier]:{}};for(const t of this._formElements){let s=t;s.name.length>0&&(De(s)&&"checkbox"==s.type?e[this._formIdentifier][s.name]=s.checked:De(s)&&"radio"==s.type?s.checked&&(e[this._formIdentifier][s.name]=s.value):e[this._formIdentifier][s.name]=s.value)}return e}get _restoreOnLoad(){return!this.hasRestoreOnLoadValue||this.restoreOnLoadValue}get _clearOnSubmit(){return!this.hasClearOnSubmitValue||this.clearOnSubmitValue}connect(){requestAnimationFrame((()=>{if(!Le(this.el))throw new Error("Expected controller to be mounted on a form element.");this._restoreOnLoad&&this.restore(),this._clearOnSubmit&&$e(this,this.el,"submit",this._clear)}))}_clear(){localStorage.removeItem(this._formIdentifier),this.dispatch(this.el,"form-save:cleared")}clear(e){null==e||e.preventDefault(),this._clear()}save(e){e.preventDefault();let t=this._formData;localStorage.setItem(this._formIdentifier,JSON.stringify(t[this._formIdentifier])),this.dispatch(this.el,"form-save:save:success")}restore(e){if(null==e||e.preventDefault(),localStorage.getItem(this._formIdentifier)){const e=JSON.parse(localStorage.getItem(this._formIdentifier));for(const t of this._formElements){let s=t;s.name in e&&(De(s)&&"checkbox"==s.type?s.checked=e[s.name]:De(s)&&"radio"==s.type?s.value==e[s.name]&&(s.checked=!0):s.value=e[s.name])}this.dispatch(this.el,"form-save:restore:success")}else this.dispatch(this.el,"form-save:restore:empty")}}o(Nt,"values",{id:String,restoreOnLoad:Boolean,clearOnSubmit:Boolean});class It extends ue{get _threshold(){return this.hasThresholdValue?this.thresholdValue.split(",").map((e=>Number.parseFloat(e.trim()))).filter((e=>e>=0&&e<=1)):[0,1]}connect(){rt(this,{threshold:this._threshold,element:this.el})}appear(e){this.dispatch(this.el,"intersection:appear",{detail:{element:this.el}})}disappear(e){this.dispatch(this.el,"intersection:disappear",{detail:{element:this.el}})}}o(It,"values",{threshold:String});class Pt extends ue{connect(){if(!this.hasSecondsValue)throw new Error("Expected `secondsValue` to be present");requestAnimationFrame((()=>{ze(this,this._interval,1e3*this.secondsValue)}))}_interval(){this.dispatch(this.el,"interval:action")}}o(Pt,"values",{seconds:Number});var Ft=window.CustomEvent;function Bt(e,t){var s="on"+t.type.toLowerCase();return"function"==typeof e[s]&&e[s](t),e.dispatchEvent(t)}function jt(e){for(;e;){if("dialog"===e.localName)return e;e=e.parentElement?e.parentElement:e.parentNode?e.parentNode.host:null}return null}function Ht(e){for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;e&&e.blur&&e!==document.body&&e.blur()}function Rt(e,t){for(var s=0;s<e.length;++s)if(e[s]===t)return!0;return!1}function qt(e){return!(!e||!e.hasAttribute("method"))&&"dialog"===e.getAttribute("method").toLowerCase()}function $t(e){var t=["button","input","keygen","select","textarea"].map((function(e){return e+":not([disabled])"}));t.push('[tabindex]:not([disabled]):not([tabindex=""])');var s=e.querySelector(t.join(", "));if(!s&&"attachShadow"in Element.prototype)for(var r=e.querySelectorAll("*"),i=0;i<r.length&&!(r[i].tagName&&r[i].shadowRoot&&(s=$t(r[i].shadowRoot)));i++);return s}function Ut(e){return e.isConnected||document.body.contains(e)}function zt(e){if(e.submitter)return e.submitter;var t=e.target;if(!(t instanceof HTMLFormElement))return null;var s=Jt.formSubmitter;if(!s){var r=e.target;s=("getRootNode"in r&&r.getRootNode()||document).activeElement}return s&&s.form===t?s:null}function Wt(e){if(!e.defaultPrevented){var t=e.target,s=Jt.imagemapUseValue,r=zt(e);null===s&&r&&(s=r.value);var i=jt(t);if(i)"dialog"===(r&&r.getAttribute("formmethod")||t.getAttribute("method"))&&(e.preventDefault(),null!=s?i.close(s):i.close())}}function Kt(e){if(this.dialog_=e,this.replacedStyleTop_=!1,this.openAsModal_=!1,e.hasAttribute("role")||e.setAttribute("role","dialog"),e.show=this.show.bind(this),e.showModal=this.showModal.bind(this),e.close=this.close.bind(this),e.addEventListener("submit",Wt,!1),"returnValue"in e||(e.returnValue=""),"MutationObserver"in window){new MutationObserver(this.maybeHideModal.bind(this)).observe(e,{attributes:!0,attributeFilter:["open"]})}else{var t,s=!1,r=function(){s?this.downgradeModal():this.maybeHideModal(),s=!1}.bind(this),i=function(i){if(i.target===e){var n="DOMNodeRemoved";s|=i.type.substr(0,n.length)===n,window.clearTimeout(t),t=window.setTimeout(r,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach((function(t){e.addEventListener(t,i)}))}Object.defineProperty(e,"open",{set:this.setOpen.bind(this),get:e.hasAttribute.bind(e,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}Ft&&"object"!=typeof Ft||((Ft=function(e,t){t=t||{};var s=document.createEvent("CustomEvent");return s.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail||null),s}).prototype=window.Event.prototype),Kt.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Ut(this.dialog_)||this.downgradeModal()},downgradeModal:function(){this.openAsModal_&&(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),Jt.dm.removeDialog(this))},setOpen:function(e){e?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(e){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var t=document.createElement("div");this.dialog_.insertBefore(t,this.dialog_.firstChild),t.tabIndex=-1,t.focus(),this.dialog_.removeChild(t)}var s=document.createEvent("MouseEvents");s.initMouseEvent(e.type,e.bubbles,e.cancelable,window,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),this.dialog_.dispatchEvent(s),e.stopPropagation()},focus_:function(){var e=this.dialog_.querySelector("[autofocus]:not([disabled])");!e&&this.dialog_.tabIndex>=0&&(e=this.dialog_),e||(e=$t(this.dialog_)),Ht(document.activeElement),e&&e.focus()},updateZIndex:function(e,t){if(e<t)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=e,this.backdrop_.style.zIndex=t},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!Ut(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!Jt.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");(function(e){for(;e&&e!==document.body;){var t=window.getComputedStyle(e),s=function(e,s){return!(void 0===t[e]||t[e]===s)};if(t.opacity<1||s("zIndex","auto")||s("transform","none")||s("mixBlendMode","normal")||s("filter","none")||s("perspective","none")||"isolate"===t.isolation||"fixed"===t.position||"touch"===t.webkitOverflowScrolling)return!0;e=e.parentElement}return!1})(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,Jt.needsCentering(this.dialog_)?(Jt.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(e){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),void 0!==e&&(this.dialog_.returnValue=e);var t=new Ft("close",{bubbles:!1,cancelable:!1});Bt(this.dialog_,t)}};var Jt={reposition:function(e){var t=document.body.scrollTop||document.documentElement.scrollTop,s=t+(window.innerHeight-e.offsetHeight)/2;e.style.top=Math.max(t,s)+"px"},isInlinePositionSetByStylesheet:function(e){for(var t=0;t<document.styleSheets.length;++t){var s=document.styleSheets[t],r=null;try{r=s.cssRules}catch(c){}if(r)for(var i=0;i<r.length;++i){var n=r[i],o=null;try{o=document.querySelectorAll(n.selectorText)}catch(c){}if(o&&Rt(o,e)){var a=n.style.getPropertyValue("top"),l=n.style.getPropertyValue("bottom");if(a&&"auto"!==a||l&&"auto"!==l)return!0}}}return!1},needsCentering:function(e){return"absolute"===window.getComputedStyle(e).position&&(!("auto"!==e.style.top&&""!==e.style.top||"auto"!==e.style.bottom&&""!==e.style.bottom)&&!Jt.isInlinePositionSetByStylesheet(e))},forceRegisterDialog:function(e){if((window.HTMLDialogElement||e.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",e),"dialog"!==e.localName)throw new Error("Failed to register dialog: The element is not a dialog.");new Kt(e)},registerDialog:function(e){e.showModal||Jt.forceRegisterDialog(e)},DialogManager:function(){this.pendingDialogStack=[];var e=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",function(t){this.forwardTab_=void 0,t.stopPropagation(),e([])}.bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver((function(t){var s=[];t.forEach((function(e){for(var t,r=0;t=e.removedNodes[r];++r)t instanceof Element&&("dialog"===t.localName&&s.push(t),s=s.concat(t.querySelectorAll("dialog")))})),s.length&&e(s)})))}};if(Jt.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})},Jt.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},Jt.DialogManager.prototype.updateStacking=function(){for(var e,t=this.zIndexHigh_,s=0;e=this.pendingDialogStack[s];++s)e.updateZIndex(--t,--t),0===s&&(this.overlay.style.zIndex=--t);var r=this.pendingDialogStack[0];r?(r.dialog.parentNode||document.body).appendChild(this.overlay):this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},Jt.DialogManager.prototype.containedByTopDialog_=function(e){for(;e=jt(e);){for(var t,s=0;t=this.pendingDialogStack[s];++s)if(t.dialog===e)return 0===s;e=e.parentElement}return!1},Jt.DialogManager.prototype.handleFocus_=function(e){var t=e.composedPath?e.composedPath()[0]:e.target;if(!this.containedByTopDialog_(t)&&document.activeElement!==document.documentElement&&(e.preventDefault(),e.stopPropagation(),Ht(t),void 0!==this.forwardTab_)){var s=this.pendingDialogStack[0];return s.dialog.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?s.focus_():t!==document.documentElement&&document.documentElement.focus()),!1}},Jt.DialogManager.prototype.handleKey_=function(e){if(this.forwardTab_=void 0,27===e.keyCode){e.preventDefault(),e.stopPropagation();var t=new Ft("cancel",{bubbles:!1,cancelable:!0}),s=this.pendingDialogStack[0];s&&Bt(s.dialog,t)&&s.dialog.close()}else 9===e.keyCode&&(this.forwardTab_=!e.shiftKey)},Jt.DialogManager.prototype.checkDOM_=function(e){this.pendingDialogStack.slice().forEach((function(t){-1!==e.indexOf(t.dialog)?t.downgradeModal():t.maybeHideModal()}))},Jt.DialogManager.prototype.pushDialog=function(e){var t=(this.zIndexHigh_-this.zIndexLow_)/2-1;return!(this.pendingDialogStack.length>=t)&&(1===this.pendingDialogStack.unshift(e)&&this.blockDocument(),this.updateStacking(),!0)},Jt.DialogManager.prototype.removeDialog=function(e){var t=this.pendingDialogStack.indexOf(e);-1!==t&&(this.pendingDialogStack.splice(t,1),0===this.pendingDialogStack.length&&this.unblockDocument(),this.updateStacking())},Jt.dm=new Jt.DialogManager,Jt.formSubmitter=null,Jt.imagemapUseValue=null,void 0===window.HTMLDialogElement){var Yt=document.createElement("form");if(Yt.setAttribute("method","dialog"),"dialog"!==Yt.method){var Zt=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(Zt){var Xt=Zt.get;Zt.get=function(){return qt(this)?"dialog":Xt.call(this)};var Gt=Zt.set;Zt.set=function(e){return"string"==typeof e&&"dialog"===e.toLowerCase()?this.setAttribute("method",e):Gt.call(this,e)},Object.defineProperty(HTMLFormElement.prototype,"method",Zt)}}document.addEventListener("click",(function(e){if(Jt.formSubmitter=null,Jt.imagemapUseValue=null,!e.defaultPrevented){var t=e.target;if("composedPath"in e)t=e.composedPath().shift()||t;if(t&&qt(t.form)){if(!("submit"===t.type&&["button","input"].indexOf(t.localName)>-1)){if("input"!==t.localName||"image"!==t.type)return;Jt.imagemapUseValue=e.offsetX+","+e.offsetY}jt(t)&&(Jt.formSubmitter=t)}}}),!1),document.addEventListener("submit",(function(e){var t=e.target;if(!jt(t)){var s=zt(e);"dialog"===(s&&s.getAttribute("formmethod")||t.getAttribute("method"))&&e.preventDefault()}}));var Qt=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(){if(!qt(this))return Qt.call(this);var e=jt(this);e&&e.close()}}class es extends ue{constructor(){super(...arguments),o(this,"_dialog",null)}get _src(){return this.hasSrcValue?this.srcValue:this.el.src}get _srcSet(){return this.hasSrcSetValue?this.srcSetValue:this.el.srcset}get _sizes(){return this.hasSizesValue?this.sizesValue:this.el.sizes}get _modalClassName(){return this.hasModalClass?this.modalClass:"image-lightbox-dialog"}get _imageClassName(){return this.hasImageClass?this.imageClass:"image-lightbox-image"}initialize(){this.open=this.open.bind(this),this.close=this.close.bind(this)}connect(){}open(){let e=this.el;if(this._dialog)return;this._dialog=document.createElement("dialog");let t=document.createElement("img");t.className=this._imageClassName,t.src=this._src,t.srcset=this._srcSet,t.sizes=this._sizes,this._dialog.appendChild(t),e.insertAdjacentElement("afterend",this._dialog),Jt.registerDialog(this._dialog),this._dialog.className=this._modalClassName,this._dialog.showModal(),be(this._dialog,{behavior:"smooth",block:"end"}).catch((()=>this._dialog.scrollIntoView(!1))),$e(this,this._dialog,"click",this.close),$e(this,this._dialog,"cancel",this.close),$e(this,this._dialog,"close",this.close)}close(){this._dialog&&(this._dialog.close(),this._dialog.remove(),this._dialog=null,be(this.el,{behavior:"smooth",block:"end"}).catch((()=>this.el.scrollIntoView(!1))))}}o(es,"values",{src:String,srcSet:String,sizes:String}),o(es,"classes",["modal","image"]);class ts extends ue{connect(){this.inputTargets.forEach((e=>$e(this,e,"change",this.handleInputs)))}handleInputs(e){let t=this.inputTargets.reduce(((e,t)=>t.checked?e+1:e),0),s=e.target;t>this.maxValue?(e.preventDefault(),s.checked=!1,this.dispatch(s,"change"),this.dispatch(s,"limited-selection:too-many"),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(this.dispatch(s,"limited-selection:selection"),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}o(ts,"targets",["input","error"]),o(ts,"values",{max:Number,message:String});class ss extends ue{initialize(){}connect(){}disconnect(){}async play(e){null==e||e.preventDefault(),await this.mediaTarget.play()}pause(e){null==e||e.preventDefault(),this.mediaTarget.pause()}restart(e){null==e||e.preventDefault(),this.mediaTarget.currentTime=0}seek(e){null==e||e.preventDefault(),this.mediaTarget.currentTime+=5}}o(ss,"targets",["media"]);class rs extends ue{constructor(){super(...arguments),o(this,"_errors",[]),o(this,"_firstClick",!1)}get _errorCount(){return this._errors.length}get _previousIndex(){let e=this._index-1;return e<0?0:e}get _nextIndex(){let e=this._index+1;return e>this._errors.length-1?this._errors.length-1:e}get _index(){return a.clamp(this.hasIndexValue?this.indexValue:0,0,this._errors.length)}get _selector(){if(this.hasSelectorValue)return this.selectorValue;throw new Error("Expected `selectorValue` to be present")}get _currentError(){return this._errors[this._index]}connect(){requestAnimationFrame((()=>{this._firstClick=!0,this._toggleButtons(),this._toggleVisibility()}))}async current(e){null==e||e.preventDefault(),this._firstClick&&(this._firstClick=!1,this._toggleButtons()),await be(this._currentError,{behavior:"smooth",block:"center",inline:"center"})}async next(e){null==e||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._nextIndex,await be(this._currentError,{behavior:"smooth",block:"center",inline:"center"})}async previous(e){null==e||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._previousIndex,await be(this._currentError,{behavior:"smooth",block:"center",inline:"center"})}indexValueChanged(){this._toggleButtons()}selectorValueChanged(){this._errors=Array.from(document.querySelectorAll(this._selector)),this.indexValue=0,this._toggleButtons(),this._toggleVisibility()}_toggleVisibility(){0===this._errorCount?this.el.style.display="none":this.el.style.display=""}_toggleButtons(){if(this.hasNextTarget){if(!this.hasCurrentTarget&&this._firstClick&&this.indexValue==this._errorCount-1)return void this.nextTarget.removeAttribute("disabled");this.indexValue>=this._errorCount-1?this.nextTarget.setAttribute("disabled","true"):this.nextTarget.removeAttribute("disabled")}this.hasPreviousTarget&&(this.indexValue<=0?this.previousTarget.setAttribute("disabled","true"):this.previousTarget.removeAttribute("disabled"))}}o(rs,"values",{selector:String,index:Number}),o(rs,"targets",["next","current","previous"]);class is extends ue{get _wrapperClass(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}get _insertMode(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}connect(){this._checkStructure()}add(e){null==e||e.preventDefault();const t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this._generateID());this.targetTarget.insertAdjacentHTML(this._insertMode,t)}remove(e){e.preventDefault();const t=e.target.closest(`.${this._wrapperClass}`);if(null==t)throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class .${this._wrapperClass}`);if("true"===t.dataset.newRecord)t.remove();else{t.style.display="none";let e=t.querySelector("input[name*='_destroy']");if(null==e)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");e.value="1"}}_generateID(){return(new Date).getTime().toString()+Math.random().toString().slice(2)}_checkStructure(){if(this.templateTarget.innerHTML.indexOf("NEW_RECORD"))throw new Error("Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`")}}o(is,"targets",["target","template"]),o(is,"values",{insertMode:String,wrapperClass:String});class ns extends ue{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}connect(){this.passwordTargets.forEach((e=>$e(this,e,"change",this._checkPasswordsMatch)))}_addErrorClasses(e=this.el){this.hasErrorClass?e.classList.add(...this._errorClasses):e.classList.add(...this._defaultErrorClasses)}_removeErrorClasses(e=this.el){this.hasErrorClass?e.classList.remove(...this._errorClasses):e.classList.remove(...this._defaultErrorClasses)}_allPasswordsMatch(){let e=new Set(this.passwordTargets.map((e=>e.value)));return e.has("")||1==e.size}_checkPasswordsMatch(){let e=this.el;this._allPasswordsMatch()?(this.dispatch(e,"password-confirm:match"),this.hasErrorClass&&this.passwordTargets.forEach((e=>this._removeErrorClasses(e)))):(this.dispatch(e,"password-confirm:no-match"),this.hasErrorClass&&this.passwordTargets.forEach((e=>this._addErrorClasses(e))))}}o(ns,"targets",["password"]),o(ns,"classes",["error"]);class os extends ue{peak(e){null==e||e.preventDefault(),this.passwordTarget.type="text"}hide(e){null==e||e.preventDefault(),this.passwordTarget.type="password"}toggle(e){null==e||e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()}}o(os,"targets",["password"]);class as extends Ze{connect(){requestAnimationFrame((()=>{this._timeout(),ze(this,this._timeout,1e3*this.secondsValue)}))}async _timeout(){await this.loadContent()}}o(as,"targets",["replace"]),o(as,"values",{endpoint:String,errorMessage:String,selector:String,seconds:Number});class ls extends ue{get _mode(){return this.hasModeValue?this.modeValue:"mouseover"}get _supportsPrefetch(){var e,t;const s=document.createElement("link");return(null==(e=s.relList)?void 0:e.supports)&&(null==(t=s.relList)?void 0:t.supports("prefetch"))}get _href(){return this.el.href}get _existingPrefetch(){return(document.head.querySelectorAll(`link[rel="prefetch"][href="${this._href}"]`)||[]).length>0}get _connectionSuitable(){const e=navigator.connection;if(!e)return!0;if(e){if(e.saveData)return this.warn("Data Saving is enabled"),!1;if(/2g/.test(e.effectiveType))return this.warn("Network is too slow"),!1}return!0}connect(){if(this._supportsPrefetch)switch(this._mode){case"intersect":this._setupObserver();break;case"mouseover":$e(this,this.el,"mouseover",this.prefetch,{once:!0});break;default:throw new Error(`'${this._mode}' is not a supported prefetch mode`)}}_setupObserver(){new IntersectionObserver((([e],t)=>{e.isIntersecting&&(this.prefetch(),t.unobserve(e.target))})).observe(this.element)}prefetch(){if(this._existingPrefetch||!this._connectionSuitable)return;const e=document.createElement("link");Object.assign(e,{rel:"prefetch",href:this._href,as:"document"}),document.head.appendChild(e)}}o(ls,"values",{mode:String});class cs extends ue{get name(){return this.hasNameValue?`${this.nameValue}:`:""}connect(){this.dispatch(this.el,`${this.nameValue}presence:added`)}disconnect(){this.dispatch(this.el,`${this.nameValue}presence:removed`)}}o(cs,"values",{name:String});class hs extends ue{print(e){null==e||e.preventDefault(),window.print()}}class us extends hs{get _unsupportedClasses(){return this.unsupportedClass.split(" ")}get _defaultUnsupportedClasses(){return["unsupported"]}connect(){"print"in window||this._addUnsupportedClasses(this.el),$e(this,this.el,"click",this.print)}_addUnsupportedClasses(e=this.el){this.hasUnsupportedClass?e.classList.add(...this._unsupportedClasses):e.classList.add(...this._defaultUnsupportedClasses)}_removeUnsupportedClasses(e=this.el){this.hasUnsupportedClass?e.classList.remove(...this._unsupportedClasses):e.classList.remove(...this._defaultUnsupportedClasses)}}o(us,"classes",["unsupported"]);class ds extends ue{get _selector(){return this.hasSelectorValue?this.selectorValue:`[data-controller~="${this.identifier}"]`}replace(e){const[t,s,r]=e.detail;if(t instanceof Node){let e=t.querySelector(this._selector);if(null==e)throw new Error(`expected new form DOM with [data-controller="${this.identifier}"] to be present in returned payload`);let s=this.el.parentNode;if(null==s)throw new Error("expected form to have a DOM parent, could not execute replaceChild");s.replaceChild(e,this.el),this.dispatch(e,"remote-form:replace")}else console.log("Unknown",t)}}o(ds,"targets",[]),o(ds,"values",{selector:String});class ps extends ue{connect(){var e,t,s;window.self!==window.top&&(ut(this),t={},null===(s=(e=this).constructor.debounces)||void 0===s||s.forEach((s=>{if("string"==typeof s&&(e[s]=dt(e[s],null==t?void 0:t.wait)),"object"==typeof s){const{name:r,wait:i}=s;if(!r)return;e[r]=dt(e[r],i||(null==t?void 0:t.wait))}})),this.postUpdate())}windowResize(e){this.postUpdate()}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}}o(ps,"debounces",["postUpdate"]);class ms extends ue{get _increment(){return this.hasIncrementValue?this.incrementValue:50}get _behaviour(){if(this.hasBehaviourValue){if(["auto","smooth"].includes(this.behaviourValue))return this.behaviourValue;throw new Error(`'${this.behaviourValue}' is not a recognised scroll behaviour`)}return"auto"}async scrollTop(e){null==e||e.preventDefault(),await ye(this.el,{behavior:this._behaviour})}async scrollBottom(e){null==e||e.preventDefault(),await _e(this.el,{behavior:this._behaviour})}async scrollLeft(e){null==e||e.preventDefault(),await we(this.el,{behavior:this._behaviour})}async scrollRight(e){null==e||e.preventDefault(),await we(this.el,{behavior:this._behaviour})}async up(e){null==e||e.preventDefault(),await Ce(this.el,this._increment,{behavior:this._behaviour})}async down(e){null==e||e.preventDefault(),await Ee(this.el,this._increment,{behavior:this._behaviour})}async left(e){null==e||e.preventDefault(),await xe(this.el,this._increment,{behavior:this._behaviour})}async right(e){null==e||e.preventDefault(),await Te(this.el,this._increment,{behavior:this._behaviour})}}o(ms,"values",{behaviour:String,increment:Number});class fs extends fe{connect(){requestAnimationFrame((()=>{be(this.el,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch((()=>this.el.scrollIntoView())),this._cleanupSelf()}))}}o(fs,"values",{behavior:String,block:String,inline:String});class gs extends ue{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return e="document"==this._mode?window:Se(this.el),e}async scroll(e){null==e||e.preventDefault(),this._scrollTarget&&await _e(this._scrollTarget)}}o(gs,"values",{mode:String});class vs extends ue{scroll(){let e=document.querySelector(this.selectorValue);e?be(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch((()=>e.scrollIntoView())):console.warn(`Could not find target for '${this.selectorValue}'`)}}o(vs,"values",{selector:String,behavior:String,block:String,inline:String});class bs extends ue{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return e="document"==this._mode?window:Se(this.el),e}async scroll(e){null==e||e.preventDefault(),this._scrollTarget&&await ye(this._scrollTarget)}}o(bs,"values",{mode:String});class ys extends ue{connect(){requestAnimationFrame((()=>{We(this,(()=>this.el.remove()),1e3*this.secondsValue)}))}}o(ys,"values",{seconds:Number});class _s extends ue{constructor(){super(...arguments),o(this,"_magicElement",null)}get _stuckClasses(){return this.stuckClass.split(" ")}get _defaultStuckClasses(){return["stuck"]}get _mode(){if(this.hasModeValue){if(!["top","bottom"].includes(this.modeValue))throw new Error(`The modeValue provided '${this.modeValue}' is not one of the recognised configuration options`);if("top"===this.modeValue)return"beforebegin"}return"afterend"}connect(){this._magicElement=document.createElement("div"),Je(this,this.el,this._mode,this._magicElement);new IntersectionObserver((e=>{e.forEach((e=>{e.target===this._magicElement&&(0===e.intersectionRatio?this._addStuckClasses():1===e.intersectionRatio&&this._removeStuckClasses())}))}),{threshold:[0,1]}).observe(this._magicElement)}_addStuckClasses(e=this.el){this.hasStuckClass?e.classList.add(...this._stuckClasses):e.classList.add(...this._defaultStuckClasses)}_removeStuckClasses(e=this.el){this.hasStuckClass?e.classList.remove(...this._stuckClasses):e.classList.remove(...this._defaultStuckClasses)}}o(_s,"classes",["stuck"]),o(_s,"values",{mode:String});class ws extends ue{get _eventName(){return`sync:${this._key}`}get _key(){if(this.hasKeyValue)return this.keyValue;throw new Error("Expected `keyValue` to be present")}get _value(){let e=this.el;return De(e)&&"checkbox"===e.type?e.checked:De(e)&&"radio"===e.type?e.checked?e.value:"":e.value}set _value(e){let t=this.el;De(t)&&"checkbox"===t.type?t.checked="true"===e.toString():De(t)&&"radio"===t.type?t.checked=t.value===e:De(t)||Ne(t)||Pe(t)?t.value=e.toString():t.innerHTML=e.toString()}initialize(){this._read=this._read.bind(this),this._emit=this._emit.bind(this)}connect(){Ve.on(this._eventName,this._read),requestAnimationFrame((()=>{var e;(De(e=this.el)||Pe(e)||Ne(e))&&(this._emit(),$e(this,this.el,"input",this._emit))}))}disconnect(){Ve.off(this._eventName,this._read)}_emit(){Ve.emit(this._eventName,{value:this._value,dispatcher:this.el})}_read(e){if(void 0===e)throw new Error("No payload received");let{dispatcher:t,value:s}=e;t!==this.el&&(this._value=s)}}o(ws,"values",{key:String});class Cs extends ue{constructor(){super(...arguments),o(this,"_lastIndex",null),o(this,"_reverse",!1)}get _tableHead(){let e=this.el.tHead;if(null==e)throw new Error("Expected table to have a <thead> element.");return e}get _tableHeaders(){let e=this._tableHead.rows;if(0==e.length)throw new Error("Expected table to have a <thead> element with at least one row.");return Array.from(e[0].cells)}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}connect(){requestAnimationFrame((()=>{this._tableHeaders.forEach((e=>$e(this,e,"click",this.sort))),this.hasStartSortValue&&this._sortByColumn(this.startSortValue)}))}sort(e){e.preventDefault();let t=e.target,s=this._indexOfHeaderCell(t);this._sortByColumn(s)}_indexOfHeaderCell(e){return this._tableHeaders.indexOf(e)}_sortByColumn(e){this._reverse=e===this._lastIndex&&!this._reverse;let t=document.createDocumentFragment();this._tableRows.sort(((t,s)=>{var r,i;let n=Array.from(t.cells),o=Array.from(s.cells),a=(null==(r=n[e])?void 0:r.innerText)||"",l=(null==(i=o[e])?void 0:i.innerText)||"",c=a.localeCompare(l,"en",{sensitivity:"base",numeric:!0,caseFirst:"upper"});return t.dataset.sortTop||s.dataset.sortBottom?t.dataset.sortTop&&s.dataset.sortTop?c:-1:t.dataset.sortBottom||s.dataset.sortTop?t.dataset.sortBottom&&s.dataset.sortBottom?c:1:this._reverse?c>0?-1:1:c})).forEach((e=>t.appendChild(e))),this._tableBody.innerHTML="",this._tableBody.appendChild(t),this._lastIndex=e}}o(Cs,"values",{startSort:Number});class Es extends ue{get _truncated(){return!!this.hasTruncatedValue&&this.truncatedValue}set _truncated(e){this.truncatedValue=e}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}get _limit(){return this.hasLimitValue?this.limitValue:20}initialize(){this.truncate=this.truncate.bind(this),this.expand=this.expand.bind(this)}connect(){ht(this,{childList:!0,element:this._tableBody}),requestAnimationFrame((()=>{this.truncate(),$e(this,this.showMoreTarget,"click",this.expand)}))}truncate(e){null==e||e.preventDefault(),this._truncated=!0,this._tableRows.length>=this._limit?(this._tableRows.slice(this._limit).forEach((e=>{e!==this.showMoreTarget&&this._hideElement(e)})),this._showElement(this.showMoreTarget)):this._hideElement(this.showMoreTarget)}expand(e){this._truncated=!1,null==e||e.preventDefault(),this._tableRows.slice(this._limit).forEach((e=>{e!==this.showMoreTarget&&this._showElement(e)})),this._hideElement(this.showMoreTarget)}mutate(e){this._truncated&&this._reTruncate()}_showElement(e){e.style.display=""}_hideElement(e){e.style.display="none"}_reTruncate(){this._tableRows.slice(0,this._limit).forEach((e=>{e!==this.showMoreTarget&&this._showElement(e)})),this._tableRows.slice(this._limit).forEach((e=>{e!==this.showMoreTarget&&this._hideElement(e)})),this._showElement(this.showMoreTarget)}}o(Es,"targets",["showMore"]),o(Es,"values",{limit:Number,truncated:Boolean});class xs extends ue{get _hideClasses(){return this.hideClass.split(" ")}get _defaultHideClasses(){return["hide"]}get _activeClasses(){return this.activeClass.split(" ")}get _defaultActiveClasses(){return["is-active"]}get _currentTab(){return this.hasCurrentTabValue?this.currentTabValue:0}get _equalize(){return!!this.hasEqualizeValue&&this.equalizeValue}connect(){this.linkTargets.forEach((e=>$e(this,e,"click",this.switchTabs))),this._equalize&&this._setMinHeight(),this.currentTabValue=this._currentTab}switchTabs(e){e.preventDefault(),this.currentTabValue=this.linkTargets.indexOf(e.currentTarget)}currentTabValueChanged(){let e=this._currentTab;e=this._clampIndex(e),this._selectTab(e)}_selectTab(e){e=this._clampIndex(e);let t=this.linkTargets,s=this.contentTargets,r=s[e],i=t[e],n=[...s.slice(0,e),...s.slice(e+1)],o=[...t.slice(0,e),...t.slice(e+1)];this._addActiveClasses(i),i.setAttribute("aria-selected","true"),this._addActiveClasses(r),this._removeHideClasses(r),o.forEach((e=>{e.removeAttribute("aria-selected"),this._removeActiveClasses(e)})),n.forEach((e=>{this._removeActiveClasses(e),this._addHideClasses(e)}))}_clampIndex(e){return a.clamp(e,0,this.contentTargets.length-1)}_setMinHeight(){let e=0;this.contentTargets.forEach((t=>{let s=t.hasAttribute("tab-hidden");s&&this._removeHideClasses(t);let r=t.offsetHeight;r>e&&(e=r),s&&this._addHideClasses(t)})),this.contentTargets.forEach((t=>t.style.minHeight=e+"px"))}_addHideClasses(e=this.el){e.setAttribute("tab-hidden","true"),this.hasHideClass?e.classList.add(...this._hideClasses):e.classList.add(...this._defaultHideClasses)}_removeHideClasses(e=this.el){e.removeAttribute("tab-hidden"),this.hasHideClass?e.classList.remove(...this._hideClasses):e.classList.remove(...this._defaultHideClasses)}_addActiveClasses(e=this.el){this.hasActiveClass?e.classList.add(...this._activeClasses):e.classList.add(...this._defaultActiveClasses)}_removeActiveClasses(e=this.el){this.hasActiveClass?e.classList.remove(...this._activeClasses):e.classList.remove(...this._defaultActiveClasses)}}o(xs,"values",{currentTab:Number,equalize:Boolean}),o(xs,"targets",["link","content"]),o(xs,"classes",["active","hide"]);class Ts extends fe{connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame((()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()}))}execute(e){null==e||e.preventDefault();let t=this.el,s=document.querySelector(this.targetValue);if(null==s)return void this.dispatch(t,"teleport:error");let r=t.cloneNode(!0);switch(this.cleanup(r),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":s.insertAdjacentHTML(this.insertValue,r.outerHTML);break;case"replaceOuter":s.outerHTML=r.outerHTML;break;case"replaceInner":s.innerHTML=r.outerHTML;break;case"prepend":s.insertAdjacentHTML("afterbegin",r.outerHTML);break;case"append":s.insertAdjacentHTML("beforeend",r.outerHTML);break;default:throw new Error("`insert` value was not specified")}t.remove()}}o(Ts,"values",{target:String,insert:String,immediate:Boolean});class ks extends fe{constructor(){super(...arguments),o(this,"_previousState",{})}get _value(){if(this.hasValueValue)return this.valueValue;throw new Error("Expected `valueValue` to be present")}get _attribute(){if(this.hasAttributeValue)return this.attributeValue;throw new Error("Expected `attributeValue` to be present")}get _seconds(){if(this.hasSecondsValue)return 1e3*this.secondsValue;throw new Error("Expected `secondsValue` to be present")}initialize(){this.setState=this.setState.bind(this),this.removeState=this.removeState.bind(this)}connect(){this.setState(),We(this,this.removeState,this._seconds)}disconnect(){this.removeState()}setState(){this._previousState[this._attribute]=a.get(this.el,this._attribute),a.set(this.el,this._attribute,this.valueValue)}removeState(){a.set(this.el,this._attribute,this._previousState[this._attribute])}}function Ss(e,t,s,r,i="temporary-state"){var n;e.dataset.controller&&(null==(n=e.dataset.controller)?void 0:n.includes(i))||(e.dataset.controller=(e.dataset.controller||` ${i} `).trim().replaceAll(" "," ")),e[a.camelCase(`${i}-attribute-value`)]=t,e[a.camelCase(`${i}-seconds-value`)]=r.toString()}o(ks,"values",{attribute:String,seconds:Number,value:String});class As extends ue{get _duration(){return l.isPast(this._timestamp)?l.intervalToDuration({start:this._timestamp,end:new Date}):l.intervalToDuration({start:new Date,end:this._timestamp})}get _nextUpdate(){let e=this._duration;return e.years&&e.years>0||e.months&&e.months>0||e.days&&e.days>0?null:e.hours&&e.hours>0?18e5:3e4}timestampValueChanged(){this._timestamp=l.toDate(1e3*this.timestampValue)}initialize(){this._update=this._update.bind(this)}connect(){if(!this.hasTimestampValue)throw new Error("Expected `timestampValue` to be present");this._update()}_update(){this.el.innerHTML=l.formatDistanceToNow(this._timestamp,{addSuffix:!0,includeSeconds:!0}),this._nextUpdate&&We(this,this._update,this._nextUpdate)}}o(As,"values",{timestamp:Number});class Vs extends ue{connect(){requestAnimationFrame((()=>{We(this,this._timeout,1e3*this.secondsValue)}))}_timeout(){this.dispatch(this.el,"timeout")}}o(Vs,"values",{seconds:Number});class Os extends ue{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{const s=new lt(e,t);s.observe,s.unobserve})(this),this.hasClickAwayValue&&this.clickAwayValue&&nt(this),requestAnimationFrame((()=>{this.hasInitialValue&&("on"===this.initialValue?this.toggleTargets.forEach((e=>this._elementOn(e))):this.toggleTargets.forEach((e=>this._elementOff(e))))}))}clickOutside(){this.toggleTargets.forEach((e=>{this._elementWasToggled(e)&&(this._elementToggleStatus(e),this._elementToggle(e))}))}mouseEnter(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}on(e){this.toggleTargets.forEach((e=>{this._elementToggleStatus(e),this._elementOn(e)}))}off(e){this.toggleTargets.forEach((e=>{this._elementToggleStatus(e),this._elementOff(e)}))}toggle(e){this.toggleTargets.forEach((e=>{this._elementToggleStatus(e),this._elementToggle(e)}))}_elementWasToggled(e){return"true"==e.dataset.toggled}_elementToggleStatus(e){this._elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}_elementToggle(e){this.classValue.split(" ").forEach((t=>e.classList.toggle(t)))}_elementOn(e){this.classValue.split(" ").forEach((t=>e.classList.toggle(t,!0)))}_elementOff(e){this.classValue.split(" ").forEach((t=>e.classList.toggle(t,!1)))}}o(Os,"targets",["toggle"]),o(Os,"values",{class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String});class Ms extends ue{get _collapsedClasses(){return this.hasCollapsedClass?this.collapsedClass.split(" "):this._defaultCollapsedClasses}get _defaultCollapsedClasses(){return["collapsed"]}get _activeClasses(){return this.hasActiveClass?this.activeClass.split(" "):this._defaultActiveClasses}get _defaultActiveClasses(){return["active"]}initialize(){this._nodeClicked=this._nodeClicked.bind(this)}connect(){this._setup(),ht(this,{subtree:!0,childList:!0})}disconnect(){this._teardown()}_setup(){this._setupNode(this.el)}_setupNode(e){const t=e=>{let t=e.parentElement;t&&(this._nodeActive(t)||this._hideNode(t),t.removeEventListener("click",this._nodeClicked),t.addEventListener("click",this._nodeClicked))};"UL"!==e.tagName&&"OL"!==e.tagName||t(e),e.querySelectorAll("ul, ol").forEach((e=>t(e)))}_teardown(){this.el.querySelectorAll("ul, ol, li").forEach((e=>this._teardownNode(e)))}_teardownNode(e){[e,...Array.from(e.querySelectorAll("ul, ol, li"))].forEach((e=>{e.removeEventListener("click",this._nodeClicked),this._removeActiveClasses(e),this._removeCollapsedClasses(e)}))}_nodeClicked(e){e&&e.stopImmediatePropagation();let t=e.target;t&&this._hasNested(t)&&(this._nodeActive(t)?this._hideNode(t):this._showNode(t))}_nodeActive(e){return this._activeClasses.every((t=>e.classList.contains(t)))}_showNode(e){this._removeCollapsedClasses(e),this._addActiveClasses(e)}_hideNode(e){this._removeActiveClasses(e),this._addCollapsedClasses(e)}_hasNested(e){return e.querySelectorAll("ul, ol").length>0}mutate(e){for(const t of e)"childList"===t.type&&(Array.from(t.addedNodes||[]).forEach((e=>this._setupNode(e))),Array.from(t.removedNodes||[]).forEach((e=>this._teardownNode(e))))}_addCollapsedClasses(e=this.el){this.hasCollapsedClass?e.classList.add(...this._collapsedClasses):e.classList.add(...this._defaultCollapsedClasses)}_removeCollapsedClasses(e=this.el){this.hasCollapsedClass?e.classList.remove(...this._collapsedClasses):e.classList.remove(...this._defaultCollapsedClasses)}_addActiveClasses(e=this.el){this.hasActiveClass?e.classList.add(...this._activeClasses):e.classList.add(...this._defaultActiveClasses)}_removeActiveClasses(e=this.el){this.hasActiveClass?e.classList.remove(...this._activeClasses):e.classList.remove(...this._defaultActiveClasses)}}o(Ms,"classes",["active","collapsed"]);class Ls extends ue{toggle(e){null==e||e.preventDefault();let t=this._getFrame().src;null==t||t!==this._getSrc()?this._setSrc():this._clear()}setSrc(e){null==e||e.preventDefault(),this._setSrc()}clear(e){null==e||e.preventDefault(),this._clear()}_setSrc(){let e=this._getFrame();this.hasLoadingMessageValue&&(e.innerHTML=this.loadingMessageValue),e.src=this._getSrc()}_clear(){let e=this._getFrame();e.src="",e.innerHTML=""}_getFrame(){let e=document.getElementById(`${this.frameIdValue}`);if(null==e)throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);if(Ae(e))return e;throw new Error(`Element targeted by ID '${this.frameIdValue}'`)}_getSrc(){let e=this.el;if(this.hasSrcValue)return this.srcValue;if(Me(e))return e.href;throw new Error("No link given to drive frame to")}}o(Ls,"values",{frameId:String,src:String,loadingMessage:String});class Ds extends ue{get _poll(){return!!this.hasPollValue&&this.pollValue}connect(){let e=this.el;if(!Ae(e))throw new Error("Expected controller to be mounted on a <turbo-frame> element.");if(e.src)throw new Error("The provided <turbo-frame> element has no `src` attribute.");this._poll&&requestAnimationFrame((()=>We(this,this.refresh,this.intervalValue)))}refresh(e){null==e||e.preventDefault();let t=this.el;t.src=t.src}}o(Ds,"values",{interval:Number,poll:Boolean});class Ns extends ue{get _maxMessage(){return this.hasMaxMessageValue?this.maxMessageValue:`Value must be less than ${this.maxValue}`}get _minMessage(){return this.hasMinMessageValue?this.minMessageValue:`Value must be greater than ${this.minValue}`}get _warningHideClasses(){return this.warningHideClass.split(" ")}get _defaultWarningHideClasses(){return["hide"]}get _inputWarningClasses(){return this.inputWarningClass.split(" ")}get _defaultInputWarningClasses(){return[""]}connect(){this._addWarningHideClasses(this.warningTarget),$e(this,this.inputTarget,"input",this._check),this._check()}_check(){this.hasMinValue&&Number.parseFloat(this.inputTarget.value)<this.minValue?(this._removeWarningHideClasses(this.warningTarget),this._addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._minMessage):this.hasMaxValue&&Number.parseFloat(this.inputTarget.value)>this.maxValue?(this._removeWarningHideClasses(this.warningTarget),this._addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._maxMessage):(this._addWarningHideClasses(this.warningTarget),this._removeInputWarningClasses(this.inputTarget),this.warningTarget.innerText="")}_addWarningHideClasses(e=this.el){this.hasWarningHideClass?e.classList.add(...this._warningHideClasses):e.classList.add(...this._defaultWarningHideClasses)}_removeWarningHideClasses(e=this.el){this.hasWarningHideClass?e.classList.remove(...this._warningHideClasses):e.classList.remove(...this._defaultWarningHideClasses)}_addInputWarningClasses(e=this.el){this.hasInputWarningClass?e.classList.add(...this._inputWarningClasses):e.classList.add(...this._defaultInputWarningClasses)}_removeInputWarningClasses(e=this.el){this.hasInputWarningClass?e.classList.remove(...this._inputWarningClasses):e.classList.remove(...this._defaultInputWarningClasses)}}o(Ns,"classes",["inputWarning","warningHide"]),o(Ns,"targets",["input","warning"]),o(Ns,"values",{max:Number,min:Number,minMessage:String,maxMessage:String});class Is extends ue{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}connect(){this._updateWordCount(),$e(this,this.inputTarget,"input",this._updateWordCount)}_updateWordCount(){let e=0,t=this.inputTarget.value.match(/\S+/g);e=t&&t.length||0,this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this._isValidCount(e)?this._removeErrorClasses(this.outputTarget):this._addErrorClasses(this.outputTarget))}_addErrorClasses(e=this.el){this.hasErrorClass?e.classList.add(...this._errorClasses):e.classList.add(...this._defaultErrorClasses)}_removeErrorClasses(e=this.el){this.hasErrorClass?e.classList.remove(...this._errorClasses):e.classList.remove(...this._defaultErrorClasses)}_isValidCount(e){let t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}o(Is,"targets",["input","output"]),o(Is,"values",{min:Number,max:Number}),o(Is,"classes",["error"]),exports.AnchorSpyController=Ye,exports.AsyncBlockController=Xe,exports.AutoSubmitFormController=Ge,exports.AutosizeController=class extends ue{connect(){ut(this);let[,e]=rt(this);if(this.unobserveIntersection=e,!Ne(this.el))throw new Error(`Expected controller to be attached to a textarea, but was a '${this.el.tagName}'`);requestAnimationFrame((()=>{this.el.style.resize="none",this.el.style.boxSizing="border-box",this._handler(),Ue(this,window,["resize"],this._handler),Ue(this,this.el,["input","focus"],this._handler)}))}appear(e){this.autosize(this.el),this.unobserveIntersection()}_handler(){this.autosize(this.el)}autosize(e){let t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"}},exports.BackLinkController=pt,exports.BaseController=ue,exports.CharCountController=mt,exports.CheckboxDisableInputsController=ft,exports.CheckboxEnableInputsController=gt,exports.CheckboxSelectAllController=vt,exports.ClipboardController=bt,exports.ClockController=yt,exports.ConfirmController=_t,exports.ConfirmNavigationController=wt,exports.CountdownController=Ct,exports.DebugController=Et,exports.DetectDirtyController=class extends ue{get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),Ue(this,e,["input","change"],this._checkDirty)}restore(e){null==e||e.preventDefault(),this._restoreElementFromLoadValue()}_getElementValue(){let e=this.el;return Fe(e)?e.checked:e.value}_getElementLoadValue(){let e=this.el,t=e.getAttribute(this._cacheAttrName);if(Fe(e))return null==t?e.defaultChecked:"true"==t;if(null!==t)return t;if(Pe(e)){Array.from(e.options).forEach((t=>{if(t.defaultSelected)return e.value=t.value,t.value}))}return t}_elementHasCachedLoadValue(){return this.el.hasAttribute(this._cacheAttrName)}_checkDirty(){let e=this.el;this._isElementDirty()?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(){return this._getElementValue()!==this._getElementLoadValue()}_restoreElementFromLoadValue(){let e=this.el,t=e.getAttribute(this._cacheAttrName);if(Fe(e))e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=null==t?e.defaultChecked:"true"==t;else if(Pe(e))if(null==t){Array.from(e.options).forEach((t=>{t.defaultSelected&&(e.value=t.value)}))}else e.value=t;else e.value=null==t?e.defaultValue:t}_cacheLoadValues(){let e=this.el;!this._elementHasCachedLoadValue()&&Fe(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}},exports.DetectDirtyFormController=class extends ue{get _formElements(){return Array.from(this.el.querySelectorAll("input, select, textarea"))}get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),Ue(this,e,["input","change"],this._checkDirty)}restore(e){null==e||e.preventDefault(),this._formElements.forEach((e=>this._restoreElementFromLoadValue(e)))}_getElementValue(e){return Fe(e)?e.checked:e.value}_getElementLoadValue(e){let t=e.getAttribute(this._cacheAttrName);if(Fe(e))return null==t?e.defaultChecked:"true"==t;if(null!==t)return t;if(Pe(e)){Array.from(e.options).forEach((t=>{if(t.defaultSelected)return e.value=t.value,t.value}))}return t}_elementHasCachedLoadValue(e){return e.hasAttribute(this._cacheAttrName)}_checkElementDirty(e){this._isElementDirty(e)?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(e){return this._getElementValue(e)!==this._getElementLoadValue(e)}_cacheElementLoadValue(e){!this._elementHasCachedLoadValue(e)&&Fe(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}_restoreElementFromLoadValue(e){let t=e.getAttribute(this._cacheAttrName);if(Fe(e))e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=null==t?e.defaultChecked:"true"==t;else if(Pe(e))if(null==t){Array.from(e.options).forEach((t=>{t.defaultSelected&&(e.value=t.value)}))}else e.value=t;else e.value=null==t?e.defaultValue:t}_cacheLoadValues(){this._formElements.forEach((e=>this._cacheElementLoadValue(e)))}_checkDirty(){this._formElements.forEach((e=>this._checkElementDirty(e))),this._formElements.some((e=>xt(e)))?this.el.setAttribute("data-dirty","true"):this.el.removeAttribute("data-dirty")}},exports.DisableWithController=Tt,exports.DismissableController=kt,exports.DurationController=St,exports.ElementSaveController=At,exports.EmptyDomController=Vt,exports.EnableInputsController=Ot,exports.EphemeralController=fe,exports.EventBus=Ve,exports.FallbackImageController=Mt,exports.FocusStealController=Lt,exports.FormRcController=Dt,exports.FormSaveController=Nt,exports.IntersectionController=It,exports.IntervalController=Pt,exports.LazyBlockController=class extends Ze{async connect(){let e=this.el;"IntersectionObserver"in window?[this.observe,this.unobserve]=rt(this,{element:e,threshold:.3}):await this.loadContent()}async appear(e){e.target===this.el&&e.isIntersecting&&(await this.loadContent(),this.unobserve&&this.unobserve())}},exports.LightboxImageController=es,exports.LimitedSelectionCheckboxesController=ts,exports.LoadBlockController=Ze,exports.MediaPlayerController=ss,exports.NavigateFormErrorsController=rs,exports.NestedFormController=is,exports.PasswordConfirmController=ns,exports.PasswordPeekController=os,exports.PollBlockController=as,exports.PrefetchController=ls,exports.PresenceController=cs,exports.PrintButtonController=us,exports.PrintController=hs,exports.RemoteFormController=ds,exports.RemoveController=class extends kt{},exports.ResponsiveIframeBodyController=ps,exports.ResponsiveIframeWrapperController=class extends ue{connect(){$e(this,window,"message",this.messageReceived)}messageReceived(e){let t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)}resize(e){this.el.style.height=`${e}px`}},exports.ScrollContainerController=ms,exports.ScrollIntoFocusController=fs,exports.ScrollToBottomController=gs,exports.ScrollToController=vs,exports.ScrollToTopController=bs,exports.SelfDestructController=ys,exports.StickyController=_s,exports.SyncInputsController=ws,exports.TableSortController=Cs,exports.TableTruncateController=Es,exports.TabsController=xs,exports.TeleportController=Ts,exports.TemporaryStateController=ks,exports.TimeDistanceController=As,exports.TimeoutController=Vs,exports.ToggleClassController=Os,exports.TreeViewController=Ms,exports.TurboFrameRCController=Ls,exports.TurboFrameRefreshController=Ds,exports.UserFocusController=class extends ue{connect(){Ue(this,window,["focus","blur"],this._handleVisibility),$e(this,document,"visibilitychange",this._handleVisibility),requestAnimationFrame((()=>{this._handleVisibility()}))}appear(){this.dispatch(this.el,"user-focus:active")}away(){this.dispatch(this.el,"user-focus:away")}_handleVisibility(){this._documentIsActive()?this.appear():this.away()}_documentIsActive(){return"visible"==document.visibilityState&&document.hasFocus()}},exports.ValueWarnController=Ns,exports.WordCountController=Is,exports.applyTemporaryClass=function(e,t,s){Ss(e,"className",0,s)},exports.applyTemporaryState=Ss,exports.createHiddenButton=Be,exports.createHiddenInput=function(e,t){let s=document.createElement("input");return s.type="hidden",s.name=e,s.value=t,s},exports.getScrollParent=Se,exports.insertElement=je,exports.isDirty=function(e){return e.hasAttribute("data-dirty")},exports.isFormDirty=xt,exports.isTurboFrame=Ae,exports.requestReset=qe,exports.requestSubmit=Re,exports.scrollAbsoluteBottom=_e,exports.scrollAbsoluteLeft=we,exports.scrollAbsoluteRight=async function(e,{behavior:t="smooth"}={}){"smooth"!=t||ge||await ke(),e==window?e.scrollTo({left:document.body.scrollWidth,behavior:t}):e.scrollTo({left:e.scrollWidth,behavior:t})},exports.scrollAbsoluteTop=ye,exports.scrollDown=Ee,exports.scrollLeft=xe,exports.scrollRight=Te,exports.scrollToElement=be,exports.scrollUp=Ce,exports.useEventListener=$e,exports.useEventListeners=Ue,exports.useInjectedElement=Je,exports.useInjectedFragment=Ke,exports.useInjectedHTML=function(e,t,s,r,i={}){return Ke(e,t,s,document.createRange().createContextualFragment(r),i)},exports.useInterval=ze,exports.useTimeout=We;
|
|
1
|
+
"use strict";var Jt=Object.defineProperty;var Fe=Object.getOwnPropertySymbols;var Gt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable;var Q=(t,e,s)=>e in t?Jt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,ee=(t,e)=>{for(var s in e||(e={}))Gt.call(e,s)&&Q(t,s,e[s]);if(Fe)for(var s of Fe(e))Xt.call(e,s)&&Q(t,s,e[s]);return t};var n=(t,e,s)=>(Q(t,typeof e!="symbol"?e+"":e,s),s);Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var Yt=require("stimulus"),_=require("lodash-es"),v=require("date-fns");function Zt(t){if(t&&t.__esModule)return t;var e={__proto__:null,[Symbol.toStringTag]:"Module"};return t&&Object.keys(t).forEach(function(s){if(s!=="default"){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,Object.freeze(e)}class h extends Yt.Controller{constructor(e){super(e);return this.application.debug?new Proxy(this,{get:(s,i)=>{let r=Reflect.get(s,i),a=this;if(Qt(i.toString())){if(typeof r=="function")return new Proxy(r,{apply(o,u,l){return a.log(i.toString(),{args:l}),Reflect.apply(o,u,l)}});this.log(i.toString())}return r}}):this}get el(){return this.element}get isTurboPreview(){return document.documentElement.hasAttribute("data-turbo-preview")||document.documentElement.hasAttribute("data-turbolinks-preview")}get isTurbolinksPreview(){return this.isTurboPreview}get csrfToken(){return this.metaValue("csrf-token")}metaValue(e){const s=document.head.querySelector(`meta[name="${e}"]`);return(s==null?void 0:s.getAttribute("content"))||null}dispatch(e,s,i={}){let r=Object.assign({},{bubbles:!0,cancelable:!0,detail:{target:e,element:e}},i);r.detail.target&&(r.detail.target=e);let a=new CustomEvent(s,r);this.logEvent(s,a,e),e.dispatchEvent(a)}log(e,s={}){if(!this.application.debug)return;let i=console;i.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: #3B82F6","color: unset"),i.log(ee({element:this.element,controller:this},s)),i.groupEnd()}warn(e,s={}){if(!this.application.debug)return;let i=console;i.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: F39B1AFF","color: unset"),i.warn(ee({element:this.element,controller:this},s)),i.groupEnd()}logEvent(e,s,i){if(!this.application.debug)return;let r=console;r.groupCollapsed(`%c${this.identifier} %c${e}%c`,"color: #3B82F6","color: #0be000","color: unset"),r.log({element:i}),r.groupEnd()}}function Qt(t){switch(t){case"application":case"el":case"element":case"constructor":case"initialize":case"log":case"logEvent":case"dispatch":case"data":case"valueDescriptorMap":case"mutate":case"identifier":return!1}return!(/^_.*?$/.test(t)||/^.*?Target(s)?$/.test(t)||/^.*?Value$/.test(t)||/^.*?ValueChanged$/.test(t)||/^.*?Class$/.test(t)||/^.*?Classes$/.test(t)||/^.*?ClassesPresent$/.test(t))}class q extends h{_cleanupSelf(){this.cleanup(this.el)}cleanup(e){var a,o,u;e.dataset.controller=((a=e.dataset.controller)==null?void 0:a.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`,"g"),""))||"",e.dataset.controller==""&&delete e.dataset.controller;let s=new RegExp(`(\\s|^)${this.identifier}\\..+?(\\s|$)`,"g");e.dataset.target=((o=e.dataset.target)==null?void 0:o.replaceAll(s,""))||"",delete e.dataset[_.camelCase(`${this.identifier}-target`)],e.dataset.target==""&&delete e.dataset.target,e.dataset.action=((u=e.dataset.target)==null?void 0:u.replaceAll(s,""))||"",delete e.dataset[_.camelCase(`${this.identifier}-action`)],e.dataset.action==""&&delete e.dataset.action;let i=this.constructor.values;i&&Object.keys(i).forEach(l=>delete e.dataset[_.camelCase(`${this.identifier}-${l}-value`)]);let r=this.constructor.classes;r&&Object.keys(r).forEach(l=>delete e.dataset[_.camelCase(`${this.identifier}-${l}-class`)])}}const y="scrollBehavior"in document.documentElement.style;let Be;async function C(t,{behavior:e="smooth",block:s="start",inline:i="nearest"}={}){e=="smooth"&&!y&&await E(),t.scrollIntoView({behavior:e,block:s,inline:i})}async function te(t,{behavior:e="smooth"}={}){e=="smooth"&&!y&&await E(),t.scrollTo({top:0,left:0,behavior:e})}async function se(t,{behavior:e="smooth"}={}){e=="smooth"&&!y&&await E(),t==window?t.scrollTo({top:document.body.scrollHeight,left:0,behavior:e}):t.scrollTo({top:t.scrollHeight,left:0,behavior:e})}async function ie(t,{behavior:e="smooth"}={}){e=="smooth"&&!y&&await E(),t.scrollTo({left:0,behavior:e})}async function es(t,{behavior:e="smooth"}={}){e=="smooth"&&!y&&await E(),t==window?t.scrollTo({left:document.body.scrollWidth,behavior:e}):t.scrollTo({left:t.scrollWidth,behavior:e})}async function qe(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!y&&await E(),t.scrollBy({top:-e,left:0,behavior:s})}async function Re(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!y&&await E(),t.scrollBy({top:e,left:0,behavior:s})}async function Pe(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!y&&await E(),t.scrollBy({top:0,left:-e,behavior:s})}async function $e(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!y&&await E(),t.scrollBy({top:0,left:e,behavior:s})}async function E(){const{polyfill:t}=await Promise.resolve().then(function(){return Zt(require("smoothscroll-polyfill"))});Be||(Be=!0,t())}function R(t){if(!t)return null;if(t==document.body)return window;const e=getComputedStyle(t).overflowY;return e!=="visible"&&e!=="hidden"&&t.scrollHeight>=t.clientHeight?t:R(t.parentElement)||document.body}function re(t){return t.nodeName=="TURBO-FRAME"}function ts(t){return{all:t=t||new Map,on:function(e,s){var i=t.get(e);i?i.push(s):t.set(e,[s])},off:function(e,s){var i=t.get(e);i&&(s?i.splice(i.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var i=t.get(e);i&&i.slice().map(function(r){r(s)}),(i=t.get("*"))&&i.slice().map(function(r){r(e,s)})}}}const x=ts();function ss(t){return t.nodeName=="LINK"}function P(t){return t.nodeName=="A"}function ae(t){return t.nodeName=="FORM"}function g(t){return t.nodeName=="INPUT"}function $(t){return t.nodeName=="TEXTAREA"}function L(t){return t.nodeName=="BUTTON"}function k(t){return t.nodeName=="SELECT"}function is(t){return t.nodeName=="IMG"}function T(t){return g(t)&&(t.type==="radio"||t.type==="checkbox")}function ze(t){return g(t)||k(t)||$(t)}function je(t){let e=document.createElement("button");return e.type=t,e.style.display="none",e.dataset.sythentic="true",e}function Ue(t,e){let s=document.createElement("input");return s.type="hidden",s.name=t,s.value=e,s}function ne(t,e,s){let i=t.insertAdjacentElement(e,s);if(!i)throw new Error(`Failed to insert element ${s.nodeName} into ${t.nodeName}`);return i}function rs(t,e,s,i){return ne(s,i,Ue(t,e))}function oe(t,e,s){return ne(e,s,je(t))}function le(t){let e=t.form||document;return Array.from(e.querySelectorAll(`input[type="radio"][name="${t.name}"]`))}function he(t){return le(t).filter(e=>e!==t)}function We(t){const e=t.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth,r=e.top<=s&&e.top+e.height>=0,a=e.left<=i&&e.left+e.width>=0;return r&&a}function ue(t){if(t.requestSubmit)t.requestSubmit();else{let e=t.querySelector('button[type="submit"]');e||(e=oe("submit",t,"beforeend")),e.click()}}function Ke(t){let e=t.querySelector('button[type="reset"]');e||(e=oe("reset",t,"beforeend")),e.click()}function Je(t){return Array.isArray(t)?t:[t]}function b(t,e,s){const i=t.disconnect.bind(t);return e(),Object.assign(t,{disconnect(){s(),i()}}),i}function c(t,e,s,i,r){(r==null?void 0:r.debounce)?(i=_.debounce(i.bind(t),r.debounce),delete r.debounce):i=i.bind(t);let a=Je(s),o=()=>a.forEach(l=>e.addEventListener(l,i,r)),u=()=>a.forEach(l=>e.removeEventListener(l,i));return b(t,o,u),{setup:o,teardown:u}}function as(t,e,s,i,r){return c(t,e,s,i,r)}function S(t,e,s,i,r){let a=[];return e.forEach(o=>{let{setup:u,teardown:l}=c(t,o,s,i,r);a.push({setup:u,teardown:l})}),[()=>a.forEach(o=>o.setup()),()=>a.forEach(o=>o.teardown())]}function ns(t,e,s,i,r){return S(t,e,s,i,r)}function Ge(t,e){let s=e||document.documentElement,i=document.fullscreenElement!==null;const r=()=>i=document.fullscreenElement!==null,a=()=>i,o=async()=>i?await m():await f();let u=()=>document.addEventListener("fullscreenchange",r),l=()=>document.removeEventListener("fullscreenchange",r);const m=async()=>{document.exitFullscreen&&(i=!1,await document.exitFullscreen())},f=async()=>{i&&await m(),s.requestFullscreen&&(await s.requestFullscreen(),i=!0)};return b(t,u,l),{isFullscreen:a,enter:f,exit:m,toggle:o,teardown:l}}function z(t){if(t===null||typeof t!="object")return t;for(const e in t)Object.getOwnPropertyDescriptor(t,e)!=null&&(t[e]=z(t[e]));return new Proxy(t,{get(e,s){return e[s]},set(e,s,i){return e[s]=z(i),!0}})}function os(t,e={},s,i){s&&(s=s.bind(t)),i&&(i=i.bind(t));const{enableHighAccuracy:r=!0,maximumAge:a=3e4,timeout:o=27e3}=e,u=navigator&&"geolocation"in navigator,l=z({locatedAt:null,error:null,coords:{accuracy:0,latitude:1/0,longitude:1/0,altitude:null,altitudeAccuracy:null,heading:null,speed:null},teardown:()=>{f&&(navigator.geolocation.clearWatch(f),f=null)}});let m=()=>{u&&(f=navigator.geolocation.watchPosition(p=>{l.locatedAt=p.timestamp,l.coords=p.coords,l.error=null,s&&s(p)},p=>{l.error=p,i&&i(p)},{enableHighAccuracy:r,maximumAge:a,timeout:o}))},f=null;return b(t,m,l.teardown),l}function ce(t,e,s,i,r={}){let a=Array.from(i.childNodes),o=()=>{let l=e.parentElement;if(["beforebegin","afterend"].includes(s)&&l==null)throw new Error("Cannot insert beforebegin into a node with no parent");switch(s){case"beforeend":e.append(i);break;case"afterbegin":e.prepend(i);break;case"beforebegin":l.insertBefore(i,e);break;case"afterend":l.insertBefore(i,e);break}},u=r.cleanup?()=>a.forEach(l=>l.remove()):()=>{};return b(t,o,u),[a,u]}function ls(t,e,s,i,r={}){const a=document.createRange().createContextualFragment(i);return ce(t,e,s,a,r)}function Xe(t,e,s,i,r={}){const a=new DocumentFragment;a.append(i);let[o,u]=ce(t,e,s,a,r);return[o[0],u]}const Ye={boolean:{read:t=>t==="true",write:t=>String(t)},object:{read:t=>JSON.parse(t),write:t=>JSON.stringify(t)},number:{read:t=>Number.parseFloat(t),write:t=>String(t)},any:{read:t=>t,write:t=>String(t)},string:{read:t=>t,write:t=>String(t)},map:{read:t=>new Map(JSON.parse(t)),write:t=>JSON.stringify(Array.from(t.entries()))},set:{read:t=>new Set(JSON.parse(t)),write:t=>JSON.stringify(Array.from(t.entries()))}};function hs(t,e,s,i){let r="any",{writeDefaults:a}=i;s==null&&(r="any"),s instanceof Set&&(r="set"),s instanceof Map&&(r="map"),typeof s=="boolean"&&(r="boolean"),typeof s=="string"&&(r="string"),typeof s=="object"&&(r="object"),Array.isArray(s)&&(r="object"),Number.isNaN(s)||(r="number");let o=z({value:s}),u=localStorage;const l=Ye[r],m=f=>{if(!(f&&f.key!==e))try{const p=f?f.newValue:u.getItem(e);p==null?(o.value=s,a&&s!==null&&u.setItem(e,l.write(s))):o.value=l.read(p)}catch{}};return m(),{get value(){return o.value},set value(f){o.value=f,u.setItem(e,l.write(f))},read:m}}function N(t,e,s){e=e.bind(t);let i=null,r=()=>i=setInterval(e,s),a=()=>{i!==null&&clearInterval(i)};return b(t,r,a),a}function V(t,e,s){let i,r=null;e=e.bind(t);let a=()=>{e(),r=null,Object.assign(t,{disconnect:i})},o=()=>r=setTimeout(a,s),u=()=>{r!==null&&(clearTimeout(r),r=null)};return i=b(t,o,u),u}async function Ze(t,e,s){try{return await fetch(e,s)}catch(i){if(t===1)throw i;return await Ze(t-1,e,s)}}class A extends h{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}get _maxRetries(){return this.hasMaxRetriesValue?this.maxRetriesValue:1}connect(){}async loadContent(e=null){e==null||e.preventDefault();let s=this,i=this.hasReplaceTarget?this.replaceTarget:this.el,r=()=>{i.replaceWith(this._errorMessage),s.dispatch(i,"ajax:error")};try{let a=await Ze(this._maxRetries,this.endpointValue);a.ok||r();let o=await a.text(),u=document.createElement("div");if(u.innerHTML=o,this.hasSelectorValue){let l=u.querySelectorAll(this.selectorValue);i.replaceWith(...l)}else i.replaceWith(...u.children);s.dispatch(i,"ajax:success")}catch{r()}finally{s.dispatch(i,"ajax:complete")}}}n(A,"targets",["replace"]),n(A,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});class de extends A{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}async connect(){await this.loadContent()}}n(de,"targets",["replace"]),n(de,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});function us(t,e,s){e=e.bind(t);let i=new IntersectionObserver(e,s);return{observer:i,teardown:()=>{i==null||i.disconnect(),i=null},observe:u=>i==null?void 0:i.observe(u),unobserve:u=>i==null?void 0:i.unobserve(u)}}function fe(t,e,s,i,r){s&&(s=s.bind(t)),i&&(i=i.bind(t));let a=r!=null?r:{},o=B=>{B.forEach(M=>{M.isIntersecting?s&&s(M):i&&i(M)})},{observer:u,observe:l,unobserve:m,teardown:f}=us(t,o,a);return b(t,()=>l(e),f),{observer:u,observe:()=>l(e),unobserve:()=>m(e),teardown:f}}class cs extends A{async connect(){let e=this.el;if("IntersectionObserver"in window){let{observe:s,unobserve:i}=fe(this,e,this.appear,null,{threshold:.3});this.observe=s,this.unobserve=i}else await this.loadContent()}async appear(e){e.target===this.el&&e.isIntersecting&&(await this.loadContent(),this.unobserve&&this.unobserve())}}class me extends A{connect(){if(!this.hasSecondsValue)throw new Error("Required value `seconds` is missing");requestAnimationFrame(()=>{this._timeout(),N(this,this._timeout,this.secondsValue*1e3)})}async _timeout(){await this.loadContent()}}n(me,"targets",["replace"]),n(me,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number,seconds:Number});class Qe extends h{get _eventMode(){if(this.hasEventModeValue){if(!["change","input","debounced"].includes(this.eventModeValue))throw new Error(`The modeValue provided '${this.eventModeValue}' is not one of the recognised configuration options`);return this.eventModeValue}else return"change"}get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:1e3}get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}else return"request"}get _cssSelector(){let e=["input","textarea","select"],s=":not([data-no-autosubmit])";return e.map(i=>i.concat(s)).join(",")}get inputElements(){return this.element.querySelectorAll(this._cssSelector)}connect(){this.inputElements.forEach(e=>c(this,e,this._eventMode=="change"?"change":"input",this.submit,{debounce:this._eventMode=="debounced"?this._debounceTimeout:void 0}))}submit(){let e=this.el;this._mode=="request"?ue(e):e.submit()}}n(Qe,"values",{submitMode:String,eventMode:String,debounceInterval:Number});class ds extends h{connect(){let{teardown:e}=fe(this,this.el,this.appear);if(this._unobserveIntersection=e,!$(this.el))throw new Error(`Expected controller to be attached to a textarea, but was a '${this.el.tagName}'`);requestAnimationFrame(()=>{this.el.style.resize="none",this.el.style.boxSizing="border-box",this._handler(),c(this,window,["resize"],this._handler),c(this,this.el,["input","change","focus"],this._handler,{debounce:100})})}appear(e){this.autosize(this.el),this._unobserveIntersection()}_handler(){this.autosize(this.el)}autosize(e){let s=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+s+"px"}}function H(t,e){const s=t[e];return typeof s=="function"?s:s!=null?()=>s:()=>{}}function j(t){return _.upperFirst(_.camelCase(t))}function fs(t,e){let s=t.element,i=()=>t[`has${j(e)}Class`]==!0,r=()=>t[`${e}Classes`],a=()=>H(t,`default${j(e)}Classes`).call(t)||[],o=()=>i()?r():a();t[`${e}Classes`]==null&&Object.defineProperty(t,`${e}Classes`,{get:()=>i()?t[`${e}Class`].split(" "):a()});let u={[`add${j(e)}Classes`]:(l=s)=>l.classList.add(...o()),[`remove${j(e)}Classes`]:(l=s)=>l.classList.remove(...o()),[`${e}ClassesPresent`]:(l=s)=>o().every(m=>l.classList.contains(m))};console.log(u),Object.assign(t,u)}function w(t){let e=t.constructor.classes||[];console.log(e),e.forEach(s=>fs(t,s))}class U extends h{connect(){w(this),requestAnimationFrame(()=>{c(this,this.inputTarget,"input",this._updateCharCount),this._updateCharCount()})}_updateCharCount(){let e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this._isValidCount(e)?this.removeErrorClasses(this.outputTarget):this.addErrorClasses(this.outputTarget)}_isValidCount(e){let s=0,i=99999;return this.hasMinValue&&(s=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=s&&e<=i}}n(U,"targets",["input","output"]),n(U,"values",{min:Number,max:Number}),n(U,"classes",["error"]);class ge extends h{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disable():this.enable()}disable(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.disableTargets.forEach((e,s)=>{e.disabled=!1})}}n(ge,"targets",["disabler","disable"]),n(ge,"values",{clear:Boolean});class pe extends h{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enable():this.disable()}disable(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.enableTargets.forEach((e,s)=>{e.disabled=!1})}}n(pe,"targets",["enabler","enable"]),n(pe,"values",{clear:Boolean});class et extends h{get _checked(){return this._enabled.filter(e=>e.checked)}get _enabled(){return this.checkboxTargets.filter(e=>!e.disabled&&!e.readOnly)}get _unchecked(){return this._enabled.filter(e=>!e.checked)}connect(){requestAnimationFrame(()=>{!this.hasSelectAllTarget||(c(this,this.selectAllTarget,"change",this._toggle),S(this,this.checkboxTargets,"change",this._refresh),this._refresh())})}_toggle(e){e.preventDefault();let s=e.target;this._enabled.forEach(i=>i.checked=i.disabled||i.readOnly?i.checked:s.checked)}_refresh(){const e=this._enabled.length,s=this._checked.length;this.selectAllTarget.checked=s>0,this.selectAllTarget.indeterminate=s>0&&s<e}}n(et,"targets",["selectAll","checkbox"]);class tt extends h{connect(){S(this,this.checkboxTargets,"change",this._update)}_otherCheckboxes(e){return Array.from(this.checkboxTargets).filter(s=>s!==e)}_update(e){const s=e.target;if(!s)throw new Error("No target found on event");let i=this._otherCheckboxes(s);s.checked&&i.forEach(r=>{r.checked=!1,this.dispatch(this.el,"change")})}}n(tt,"targets",["checkbox"]);class ms extends h{get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),c(this,e,["input","change"],this._checkDirty,{debounce:10})}restore(e){e==null||e.preventDefault(),this._restoreElementFromLoadValue()}_getElementValue(){let e=this.el;return T(e)?e.checked:e.value}_getElementLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);if(T(e))return s==null?e.defaultChecked:s=="true";if(k(e))Array.from(e.options).forEach(r=>{if(r.defaultSelected)return e.value=r.value,r.value});else if(s!==null)return s;return s}_elementHasCachedLoadValue(){return this.el.hasAttribute(this._cacheAttrName)}_checkDirty(){let e=this.el;g(e)&&e.type=="radio"&&he(e).forEach(s=>s.removeAttribute("data-dirty")),this._isElementDirty()?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(){return this._getElementValue()!==this._getElementLoadValue()}_restoreElementFromLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);T(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):k(e)?s==null?Array.from(e.options).forEach(r=>{if(r.defaultSelected){e.value=r.value;return}}):e.value=s:e.value=s==null?e.defaultValue:s}_cacheLoadValues(){let e=this.el;!this._elementHasCachedLoadValue()&&T(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}}function gs(t){return t.hasAttribute("data-dirty")}class ps extends h{get _formElements(){return Array.from(this.el.querySelectorAll("input, select, textarea"))}get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),c(this,e,["input","change"],this._checkDirty,{debounce:10})}restore(e){e==null||e.preventDefault(),this._formElements.forEach(s=>this._restoreElementFromLoadValue(s))}_getElementValue(e){return T(e)?e.checked:e.value}_getElementLoadValue(e){let s=e.getAttribute(this._cacheAttrName);if(T(e))return s==null?e.defaultChecked:s=="true";if(k(e))Array.from(e.options).forEach(r=>{if(r.defaultSelected)return e.value=r.value,r.value});else if(s!==null)return s;return s}_elementHasCachedLoadValue(e){return e.hasAttribute(this._cacheAttrName)}_checkElementDirty(e){g(e)&&e.type=="radio"&&he(e).forEach(s=>s.removeAttribute("data-dirty")),this._isElementDirty(e)?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(e){return this._getElementValue(e)!==this._getElementLoadValue(e)}_cacheElementLoadValue(e){!this._elementHasCachedLoadValue(e)&&T(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}_restoreElementFromLoadValue(e){let s=e.getAttribute(this._cacheAttrName);T(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):k(e)?s==null?Array.from(e.options).forEach(r=>{if(r.defaultSelected){e.value=r.value;return}}):e.value=s:e.value=s==null?e.defaultValue:s}_cacheLoadValues(){this._formElements.forEach(e=>this._cacheElementLoadValue(e))}_checkDirty(){this._formElements.forEach(e=>this._checkElementDirty(e)),this._formElements.some(e=>st(e))?this.el.setAttribute("data-dirty","true"):this.el.removeAttribute("data-dirty")}}function st(t){return t.hasAttribute("data-dirty")}class _e extends h{connect(){}disable(){let e=this.hasClearValue&&this.clearValue;this.inputTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.inputTargets.forEach((e,s)=>e.disabled=!1)}}n(_e,"targets",["input"]),n(_e,"values",{clear:Boolean});class it extends h{get _mode(){const e=["immediate","wait"];if(this.hasModeValue){if(e.includes(this.modeValue))return this.modeValue;throw new Error(`The given modeValue '${this.modeValue}' is not one of the supported modes: "${e.join('", "')}"`)}else return e[0]}connect(){this._mode=="immediate"&&this.steal()}steal(){this.el.focus()}}n(it,"values",{mode:String});class be extends h{get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}else return"request"}get form(){let e;if(this.hasFormSelectorValue){if(e=document.querySelector(this.formSelectorValue),!e)throw new Error(`Could not find a form on the page that matches selector '${this.formSelectorValue}'`)}else e=this.formTarget;return e}submit(e){e==null||e.preventDefault();let s=this.formTarget;this._mode=="request"?ue(s):s.submit()}reset(e){e==null||e.preventDefault(),Ke(this.form)}}n(be,"targets",["form"]),n(be,"values",{formSelector:String,submitMode:String});class rt extends h{get _formID(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(e!=="")return e;throw new Error(`No ID value to uniquely identify this form. Please either specify data-${this.identifier}-id-value or give this form an 'id' attribute. `)}get _formIdentifier(){return`${location.href} ${this._formID}`}get _formElements(){return this.el.elements}get _formData(){let e={[this._formIdentifier]:{}};for(const s of this._formElements){let i=s;i.name.length>0&&(g(i)&&i.type=="checkbox"?e[this._formIdentifier][i.name]=i.checked:g(i)&&i.type=="radio"?i.checked&&(e[this._formIdentifier][i.name]=i.value):e[this._formIdentifier][i.name]=i.value)}return e}get _restoreOnLoad(){return this.hasRestoreOnLoadValue?this.restoreOnLoadValue:!0}get _clearOnSubmit(){return this.hasClearOnSubmitValue?this.clearOnSubmitValue:!0}connect(){requestAnimationFrame(()=>{let e=this.el;if(!ae(e))throw new Error("Expected controller to be mounted on a form element.");this._restoreOnLoad&&this.restore(),this._clearOnSubmit&&c(this,this.el,"submit",this._clear)})}_clear(){localStorage.removeItem(this._formIdentifier),this.dispatch(this.el,"form-save:cleared")}clear(e){e==null||e.preventDefault(),this._clear()}save(e){e.preventDefault();let s=this._formData;localStorage.setItem(this._formIdentifier,JSON.stringify(s[this._formIdentifier])),this.dispatch(this.el,"form-save:save:success")}restore(e){if(e==null||e.preventDefault(),localStorage.getItem(this._formIdentifier)){const s=JSON.parse(localStorage.getItem(this._formIdentifier));for(const i of this._formElements){let r=i;r.name in s&&(g(r)&&r.type=="checkbox"?r.checked=s[r.name]:g(r)&&r.type=="radio"?r.value==s[r.name]&&(r.checked=!0):r.value=s[r.name])}this.dispatch(this.el,"form-save:restore:success")}else this.dispatch(this.el,"form-save:restore:empty")}}n(rt,"values",{id:String,restoreOnLoad:Boolean,clearOnSubmit:Boolean});class ve extends h{connect(){S(this,this.inputTargets,"change",this._handleInputs)}_handleInputs(e){let s=this.inputTargets.reduce((r,a)=>a.checked?r+1:r,0),i=e.target;s>this.maxValue?(e.preventDefault(),i.checked=!1,this.dispatch(i,"change"),this.dispatch(i,"limited-selection:too-many"),this.hasErrorTarget&&this.hasMessageValue&&(this.errorTarget.innerHTML=this.messageValue)):(this.dispatch(i,"limited-selection:selection"),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}n(ve,"targets",["input","error"]),n(ve,"values",{max:Number,message:String});class W extends h{constructor(){super(...arguments);n(this,"_errors",[]);n(this,"_firstClick",!1)}get defaultCurrentClasses(){return["currentError"]}get _errorCount(){return this._errors.length}get _previousIndex(){let e=this._index-1;return e<0?0:e}get _nextIndex(){let e=this._index+1;return e>this._errors.length-1?this._errors.length-1:e}get _index(){return _.clamp(this.hasIndexValue?this.indexValue:0,0,this._errors.length)}get _selector(){if(this.hasSelectorValue)return this.selectorValue;throw new Error("Expected `selectorValue` to be present")}get _currentError(){return this._errors[this._index]}get _otherErrors(){return this._errors.filter((e,s)=>s!==this._index)}connect(){w(this),requestAnimationFrame(()=>{this._firstClick=!0,this._toggleButtons(),this._toggleVisibility()})}async current(e){e==null||e.preventDefault(),this._firstClick&&(this._firstClick=!1,this._toggleButtons()),await C(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}async next(e){e==null||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._nextIndex,await C(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}async previous(e){e==null||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._previousIndex,await C(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}indexValueChanged(){this._toggleButtons()}selectorValueChanged(){this._errors=Array.from(document.querySelectorAll(this._selector)),this.indexValue=0,this._toggleButtons(),this._toggleVisibility()}_updateClasses(){this.addCurrentClasses(this._currentError),this._otherErrors.forEach(e=>this.removeCurrentClasses(e))}_toggleVisibility(){this._errorCount===0?this.el.style.display="none":this.el.style.display=""}_toggleButtons(){if(this.hasNextTarget)if(!this.hasCurrentTarget&&this._firstClick&&this.indexValue==this._errorCount-1){this.nextTarget.removeAttribute("disabled");return}else this.indexValue>=this._errorCount-1?this.nextTarget.setAttribute("disabled","true"):this.nextTarget.removeAttribute("disabled");this.hasPreviousTarget&&(this.indexValue<=0?this.previousTarget.setAttribute("disabled","true"):this.previousTarget.removeAttribute("disabled"))}}n(W,"values",{selector:String,index:Number}),n(W,"classes",["current"]),n(W,"targets",["next","current","previous"]);class we extends h{get _wrapperClass(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}get _insertMode(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}connect(){this._checkStructure()}add(e){e==null||e.preventDefault();const s=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this._generateID());this.targetTarget.insertAdjacentHTML(this._insertMode,s)}remove(e){e.preventDefault();const s=e.target.closest(`.${this._wrapperClass}`);if(s==null)throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class .${this._wrapperClass}`);if(s.dataset.newRecord==="true")s.remove();else{s.style.display="none";let i=s.querySelector("input[name*='_destroy']");if(i==null)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");i.value="1"}}_generateID(){return new Date().getTime().toString()+Math.random().toString().slice(2)}_checkStructure(){if(this.templateTarget.innerHTML.indexOf("NEW_RECORD"))throw new Error("Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`")}}n(we,"targets",["target","template"]),n(we,"values",{insertMode:String,wrapperClass:String});class ye extends h{connect(){w(this),S(this,this.passwordTargets,"change",this._checkPasswordsMatch)}_allPasswordsMatch(){let e=new Set(this.passwordTargets.map(s=>s.value));return e.has("")||e.size==1}_checkPasswordsMatch(){let e=this.el;this._allPasswordsMatch()?(this.dispatch(e,"password-confirm:match"),this.passwordTargets.forEach(s=>this.removeErrorClasses(s))):(this.dispatch(e,"password-confirm:no-match"),this.passwordTargets.forEach(s=>this.addErrorClasses(s)))}}n(ye,"targets",["password"]),n(ye,"classes",["error"]);class at extends h{peak(e){e==null||e.preventDefault(),this.passwordTarget.type="text"}hide(e){e==null||e.preventDefault(),this.passwordTarget.type="password"}toggle(e){e==null||e.preventDefault(),this.passwordTarget.type==="password"?this.peak():this.hide()}}n(at,"targets",["password"]);class Ee extends h{get _selector(){return this.hasSelectorValue?this.selectorValue:`[data-controller~="${this.identifier}"]`}replace(e){const[s,i,r]=e.detail;if(s instanceof Node){let a=s.querySelector(this._selector);if(a==null)throw new Error(`expected new form DOM with [data-controller="${this.identifier}"] to be present in returned payload`);let o=this.el.parentNode;if(o==null)throw new Error("expected form to have a DOM parent, could not execute replaceChild");o.replaceChild(a,this.el),this.dispatch(a,"remote-form:replace")}else console.log("Unknown",s)}}n(Ee,"targets",[]),n(Ee,"values",{selector:String});function K(t,e,s,i){let r=i;(r==null?void 0:r.debounce)?(s=_.debounce(s.bind(t),r.debounce),delete r.debounce):s=s.bind(t);let a=Je(e),o=()=>a.forEach(l=>x.on(l,s)),u=()=>a.forEach(l=>x.off(l,s));return b(t,o,u),{setup:o,teardown:u}}class nt extends h{get _eventName(){return`sync:${this._key}`}get _key(){if(this.hasKeyValue)return this.keyValue;throw new Error("Expected `keyValue` to be present")}get _value(){let e=this.el;return g(e)&&e.type==="checkbox"?e.checked:g(e)&&e.type==="radio"?e.checked?e.value:"":e.value}set _value(e){let s=this.el;g(s)&&s.type==="checkbox"?s.checked=e.toString()==="true":g(s)&&s.type==="radio"?s.checked=s.value===e:g(s)||$(s)||k(s)?s.value=e.toString():s.innerHTML=e.toString()}connect(){K(this,this._eventName,this._read),requestAnimationFrame(()=>{ze(this.el)&&(this._emit(),c(this,this.el,"input",this._emit))})}_emit(){x.emit(this._eventName,{value:this._value,dispatcher:this.el})}_read(e){if(e===void 0)throw new Error("No payload received");let{dispatcher:s,value:i}=e;s!==this.el&&(this._value=i)}}n(nt,"values",{key:String});class J extends h{get _maxMessage(){return this.hasMaxMessageValue?this.maxMessageValue:`Value must be less than ${this.maxValue}`}get _minMessage(){return this.hasMinMessageValue?this.minMessageValue:`Value must be greater than ${this.minValue}`}get defaultWarningHideClasses(){return["hide"]}connect(){w(this),this.addWarningHideClasses(this.warningTarget),c(this,this.inputTarget,"input",this._check),this._check()}_check(){this.hasMinValue&&Number.parseFloat(this.inputTarget.value)<this.minValue?(this.removeWarningHideClasses(this.warningTarget),this.addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._minMessage):this.hasMaxValue&&Number.parseFloat(this.inputTarget.value)>this.maxValue?(this.removeWarningHideClasses(this.warningTarget),this.addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._maxMessage):(this.addWarningHideClasses(this.warningTarget),this.removeInputWarningClasses(this.inputTarget),this.warningTarget.innerText="")}}n(J,"classes",["inputWarning","warningHide"]),n(J,"targets",["input","warning"]),n(J,"values",{max:Number,min:Number,minMessage:String,maxMessage:String});class G extends h{connect(){w(this),this._updateWordCount(),c(this,this.inputTarget,"input",this._updateWordCount)}_updateWordCount(){let e=0,i=this.inputTarget.value.match(/\S+/g);e=i&&i.length||0,this.outputTarget.innerText=e.toString(),this._isValidCount(e)?this.removeErrorClasses(this.outputTarget):this.addErrorClasses(this.outputTarget)}_isValidCount(e){let s=0,i=99999;return this.hasMinValue&&(s=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=s&&e<=i}}n(G,"targets",["input","output"]),n(G,"values",{min:Number,max:Number}),n(G,"classes",["error"]);class Te extends h{initialize(){this._hasLoadedSuccessfully=this._hasLoadedSuccessfully.bind(this),this._success=this._success.bind(this),this._fail=this._fail.bind(this)}connect(){let e=this.el;e.onerror=this._fail,e.complete&&!this._hasLoadedSuccessfully()?this._fail():this._success()}disconnect(){this.removeSuccessClasses(),this.removeFailClasses()}_success(){this.addSuccessClasses()}_fail(){let e=this.el;this.addFailClasses(),this.hasPlaceholderValue&&e.src!==this.placeholderValue?(this.dispatch(e,"fallback-image:placeholder"),e.src=this.placeholderValue,e.onerror=this._fail):(this.dispatch(e,"fallback-image:fail"),e.style.display="none")}_hasLoadedSuccessfully(){let e=this.el;return e.naturalHeight>0&&e.naturalWidth>0}}n(Te,"values",{placeholder:String}),n(Te,"classes",["success","fail"]);var D=window.CustomEvent;(!D||typeof D=="object")&&(D=function(e,s){s=s||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,!!s.bubbles,!!s.cancelable,s.detail||null),i},D.prototype=window.Event.prototype);function ot(t,e){var s="on"+e.type.toLowerCase();return typeof t[s]=="function"&&t[s](e),t.dispatchEvent(e)}function _s(t){for(;t&&t!==document.body;){var e=window.getComputedStyle(t),s=function(i,r){return!(e[i]===void 0||e[i]===r)};if(e.opacity<1||s("zIndex","auto")||s("transform","none")||s("mixBlendMode","normal")||s("filter","none")||s("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;t=t.parentElement}return!1}function O(t){for(;t;){if(t.localName==="dialog")return t;t.parentElement?t=t.parentElement:t.parentNode?t=t.parentNode.host:t=null}return null}function lt(t){for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;t&&t.blur&&t!==document.body&&t.blur()}function bs(t,e){for(var s=0;s<t.length;++s)if(t[s]===e)return!0;return!1}function Ce(t){return!t||!t.hasAttribute("method")?!1:t.getAttribute("method").toLowerCase()==="dialog"}function ht(t){var e=["button","input","keygen","select","textarea"],s=e.map(function(o){return o+":not([disabled])"});s.push('[tabindex]:not([disabled]):not([tabindex=""])');var i=t.querySelector(s.join(", "));if(!i&&"attachShadow"in Element.prototype)for(var r=t.querySelectorAll("*"),a=0;a<r.length&&!(r[a].tagName&&r[a].shadowRoot&&(i=ht(r[a].shadowRoot),i));a++);return i}function ut(t){return t.isConnected||document.body.contains(t)}function ct(t){if(t.submitter)return t.submitter;var e=t.target;if(!(e instanceof HTMLFormElement))return null;var s=d.formSubmitter;if(!s){var i=t.target,r="getRootNode"in i&&i.getRootNode()||document;s=r.activeElement}return!s||s.form!==e?null:s}function vs(t){if(!t.defaultPrevented){var e=t.target,s=d.imagemapUseValue,i=ct(t);s===null&&i&&(s=i.value);var r=O(e);if(!!r){var a=i&&i.getAttribute("formmethod")||e.getAttribute("method");a==="dialog"&&(t.preventDefault(),s!=null?r.close(s):r.close())}}}function dt(t){if(this.dialog_=t,this.replacedStyleTop_=!1,this.openAsModal_=!1,t.hasAttribute("role")||t.setAttribute("role","dialog"),t.show=this.show.bind(this),t.showModal=this.showModal.bind(this),t.close=this.close.bind(this),t.addEventListener("submit",vs,!1),"returnValue"in t||(t.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(t,{attributes:!0,attributeFilter:["open"]})}else{var s=!1,i=function(){s?this.downgradeModal():this.maybeHideModal(),s=!1}.bind(this),r,a=function(o){if(o.target===t){var u="DOMNodeRemoved";s|=o.type.substr(0,u.length)===u,window.clearTimeout(r),r=window.setTimeout(i,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(o){t.addEventListener(o,a)})}Object.defineProperty(t,"open",{set:this.setOpen.bind(this),get:t.hasAttribute.bind(t,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}dt.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&ut(this.dialog_)||this.downgradeModal()},downgradeModal:function(){!this.openAsModal_||(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),d.dm.removeDialog(this))},setOpen:function(t){t?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(t){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var s=document.createEvent("MouseEvents");s.initMouseEvent(t.type,t.bubbles,t.cancelable,window,t.detail,t.screenX,t.screenY,t.clientX,t.clientY,t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget),this.dialog_.dispatchEvent(s),t.stopPropagation()},focus_:function(){var t=this.dialog_.querySelector("[autofocus]:not([disabled])");!t&&this.dialog_.tabIndex>=0&&(t=this.dialog_),t||(t=ht(this.dialog_)),lt(document.activeElement),t&&t.focus()},updateZIndex:function(t,e){if(t<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=t,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!ut(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!d.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");_s(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,d.needsCentering(this.dialog_)?(d.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(t){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),t!==void 0&&(this.dialog_.returnValue=t);var e=new D("close",{bubbles:!1,cancelable:!1});ot(this.dialog_,e)}};var d={};d.reposition=function(t){var e=document.body.scrollTop||document.documentElement.scrollTop,s=e+(window.innerHeight-t.offsetHeight)/2;t.style.top=Math.max(e,s)+"px"};d.isInlinePositionSetByStylesheet=function(t){for(var e=0;e<document.styleSheets.length;++e){var s=document.styleSheets[e],i=null;try{i=s.cssRules}catch{}if(!!i)for(var r=0;r<i.length;++r){var a=i[r],o=null;try{o=document.querySelectorAll(a.selectorText)}catch{}if(!(!o||!bs(o,t))){var u=a.style.getPropertyValue("top"),l=a.style.getPropertyValue("bottom");if(u&&u!=="auto"||l&&l!=="auto")return!0}}}return!1};d.needsCentering=function(t){var e=window.getComputedStyle(t);return e.position!=="absolute"||t.style.top!=="auto"&&t.style.top!==""||t.style.bottom!=="auto"&&t.style.bottom!==""?!1:!d.isInlinePositionSetByStylesheet(t)};d.forceRegisterDialog=function(t){if((window.HTMLDialogElement||t.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",t),t.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new dt(t)};d.registerDialog=function(t){t.showModal||d.forceRegisterDialog(t)};d.DialogManager=function(){this.pendingDialogStack=[];var t=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",function(e){this.forwardTab_=void 0,e.stopPropagation(),t([])}.bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=1e5+150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var s=[];e.forEach(function(i){for(var r=0,a;a=i.removedNodes[r];++r){if(a instanceof Element)a.localName==="dialog"&&s.push(a);else continue;s=s.concat(a.querySelectorAll("dialog"))}}),s.length&&t(s)}))};d.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})};d.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()};d.DialogManager.prototype.updateStacking=function(){for(var t=this.zIndexHigh_,e=0,s;s=this.pendingDialogStack[e];++e)s.updateZIndex(--t,--t),e===0&&(this.overlay.style.zIndex=--t);var i=this.pendingDialogStack[0];if(i){var r=i.dialog.parentNode||document.body;r.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)};d.DialogManager.prototype.containedByTopDialog_=function(t){for(;t=O(t);){for(var e=0,s;s=this.pendingDialogStack[e];++e)if(s.dialog===t)return e===0;t=t.parentElement}return!1};d.DialogManager.prototype.handleFocus_=function(t){var e=t.composedPath?t.composedPath()[0]:t.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(t.preventDefault(),t.stopPropagation(),lt(e),this.forwardTab_!==void 0)){var s=this.pendingDialogStack[0],i=s.dialog,r=i.compareDocumentPosition(e);return r&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?s.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}};d.DialogManager.prototype.handleKey_=function(t){if(this.forwardTab_=void 0,t.keyCode===27){t.preventDefault(),t.stopPropagation();var e=new D("cancel",{bubbles:!1,cancelable:!0}),s=this.pendingDialogStack[0];s&&ot(s.dialog,e)&&s.dialog.close()}else t.keyCode===9&&(this.forwardTab_=!t.shiftKey)};d.DialogManager.prototype.checkDOM_=function(t){var e=this.pendingDialogStack.slice();e.forEach(function(s){t.indexOf(s.dialog)!==-1?s.downgradeModal():s.maybeHideModal()})};d.DialogManager.prototype.pushDialog=function(t){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(t)===1&&this.blockDocument(),this.updateStacking(),!0)};d.DialogManager.prototype.removeDialog=function(t){var e=this.pendingDialogStack.indexOf(t);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())};d.dm=new d.DialogManager;d.formSubmitter=null;d.imagemapUseValue=null;if(window.HTMLDialogElement===void 0){var ft=document.createElement("form");if(ft.setAttribute("method","dialog"),ft.method!=="dialog"){var I=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(I){var ws=I.get;I.get=function(){return Ce(this)?"dialog":ws.call(this)};var ys=I.set;I.set=function(t){return typeof t=="string"&&t.toLowerCase()==="dialog"?this.setAttribute("method",t):ys.call(this,t)},Object.defineProperty(HTMLFormElement.prototype,"method",I)}}document.addEventListener("click",function(t){if(d.formSubmitter=null,d.imagemapUseValue=null,!t.defaultPrevented){var e=t.target;if("composedPath"in t){var s=t.composedPath();e=s.shift()||e}if(!(!e||!Ce(e.form))){var i=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!i){if(!(e.localName==="input"&&e.type==="image"))return;d.imagemapUseValue=t.offsetX+","+t.offsetY}var r=O(e);!r||(d.formSubmitter=e)}}},!1),document.addEventListener("submit",function(t){var e=t.target,s=O(e);if(!s){var i=ct(t),r=i&&i.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&t.preventDefault()}});var Es=HTMLFormElement.prototype.submit,Ts=function(){if(!Ce(this))return Es.call(this);var t=O(this);t&&t.close()};HTMLFormElement.prototype.submit=Ts}class Se extends h{constructor(){super(...arguments);n(this,"_dialog",null)}get _src(){return this.hasSrcValue?this.srcValue:this.el.src}get _srcSet(){return this.hasSrcSetValue?this.srcSetValue:this.el.srcset}get _sizes(){return this.hasSizesValue?this.sizesValue:this.el.sizes}get _modalClassName(){return this.hasModalClass?this.modalClass:"image-lightbox-dialog"}get _imageClassName(){return this.hasImageClass?this.imageClass:"image-lightbox-image"}initialize(){this.open=this.open.bind(this),this.close=this.close.bind(this)}connect(){}disconnect(){this.close()}open(){let e=this.el;if(this._dialog)return;this._dialog=document.createElement("dialog");let s=document.createElement("img");s.className=this._imageClassName,s.src=this._src,s.srcset=this._srcSet,s.sizes=this._sizes,this._dialog.appendChild(s),e.insertAdjacentElement("afterend",this._dialog),d.registerDialog(this._dialog),this._dialog.className=this._modalClassName,this._dialog.showModal(),C(this._dialog,{behavior:"smooth",block:"end"}).catch(()=>this._dialog.scrollIntoView(!1)),c(this,this._dialog,"click",this.close),c(this,this._dialog,"cancel",this.close),c(this,this._dialog,"close",this.close)}close(){this._dialog&&(this._dialog.close(),this._dialog.remove(),this._dialog=null,C(this.el,{behavior:"smooth",block:"end"}).catch(()=>this.el.scrollIntoView(!1)))}}n(Se,"values",{src:String,srcSet:String,sizes:String}),n(Se,"classes",["modal","image"]);class mt extends h{async play(e){e==null||e.preventDefault(),await this.mediaTarget.play()}pause(e){e==null||e.preventDefault(),this.mediaTarget.pause()}restart(e){e==null||e.preventDefault(),this.mediaTarget.currentTime=0}seek(e){e==null||e.preventDefault(),this.mediaTarget.currentTime+=5}}n(mt,"targets",["media"]);class gt extends h{get _increment(){return this.hasIncrementValue?this.incrementValue:50}get _behaviour(){if(this.hasBehaviourValue){if(["auto","smooth"].includes(this.behaviourValue))return this.behaviourValue;throw new Error(`'${this.behaviourValue}' is not a recognised scroll behaviour`)}else return"auto"}async scrollTop(e){e==null||e.preventDefault(),await te(this.el,{behavior:this._behaviour})}async scrollBottom(e){e==null||e.preventDefault(),await se(this.el,{behavior:this._behaviour})}async scrollLeft(e){e==null||e.preventDefault(),await ie(this.el,{behavior:this._behaviour})}async scrollRight(e){e==null||e.preventDefault(),await ie(this.el,{behavior:this._behaviour})}async up(e){e==null||e.preventDefault(),await qe(this.el,this._increment,{behavior:this._behaviour})}async down(e){e==null||e.preventDefault(),await Re(this.el,this._increment,{behavior:this._behaviour})}async left(e){e==null||e.preventDefault(),await Pe(this.el,this._increment,{behavior:this._behaviour})}async right(e){e==null||e.preventDefault(),await $e(this.el,this._increment,{behavior:this._behaviour})}}n(gt,"values",{behaviour:String,increment:Number});class pt extends q{connect(){requestAnimationFrame(()=>{C(this.el,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>this.el.scrollIntoView()),this._cleanupSelf()})}}n(pt,"values",{behavior:String,block:String,inline:String});class _t extends h{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=R(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await se(this._scrollTarget)}}n(_t,"values",{mode:String});class bt extends h{scroll(){let e=document.querySelector(this.selectorValue);if(!e){console.warn(`Could not find target for '${this.selectorValue}'`);return}C(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>e.scrollIntoView())}}n(bt,"values",{selector:String,behavior:String,block:String,inline:String});class vt extends h{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=R(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await te(this._scrollTarget)}}n(vt,"values",{mode:String});function wt(t){t=t.trim();let e=t.includes("&&"),s=t.includes("||"),i=t.includes("(")||t.includes(")");if(e&&s)throw new Error("Cannot have both && and || in the same expression.");if(i)throw new Error("Cannot have logical groupings `(>3 && <= 9) || (>1 && <2)` in the expression. Only supports simple expressions like `>1 && <3`");let r=t.split(e?"&&":"||");return e?r.map(a=>Ve(a)):s?r.map(a=>Ve(a)):[Ve(t)]}function Ve(t){let s=[">=","<=","==","!=",">","<"].find(o=>t.includes(o));if(!s)throw new Error(`Could not find operator in expression: ${t}`);let i=t.split(s)[1].trim(),r=/^-?[0-9]\d*(\.\d+)?$/.test(i);if(i=r?parseFloat(i):i,i=="")throw new Error(`Could not find a value in expression: ${t}`);let a=o=>o!=="";switch(s){case">":return o=>r&&a(o)&&o>i;case"<":return o=>r&&a(o)&&o<i;case">=":return o=>r&&a(o)&&o>=i;case"<=":return o=>r&&a(o)&&o<=i;case"==":return o=>a(o)&&o==i;case"!=":return o=>a(o)&&o!=i;default:throw new Error(`Unknown operator ${s}`)}}function F(t,e){return`signal:${e}:${t}`}function xe(t){return F(t,"connect")}function ke(t){return F(t,"value")}class yt extends h{get _predicates(){return wt(this.whenValue)}connect(){x.emit(xe(this.nameValue)),K(this,ke(this.nameValue),this._onSignal)}_onSignal(e){let s=e.value;if(!this.hasWhenValue){this.dispatch(this.el,F(this.nameValue,"match"));return}this._predicates.every(i=>i(s))?this.dispatch(this.el,F(this.nameValue,"match"),{detail:{element:this.el,value:s}}):this.dispatch(this.el,F(this.nameValue,"no-match"),{detail:{element:this.el,value:s}})}}n(yt,"values",{name:String,when:String});class Et extends h{get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:null}get _name(){return this.hasNameValue?this.nameValue:this.element.name}connect(){K(this,xe(this._name),()=>this.emitValue()),c(this,this.el,"input",this.emitValue,{debounce:this._debounceTimeout||void 0}),c(this,this.el,"change",this.emitValue),requestAnimationFrame(()=>this.emitValue())}emitValue(){var s;let e=this.el.value;if(g(this.el)&&this.el.type==="checkbox")e=this.el.checked?"true":"false";else if(g(this.el)&&this.el.type==="radio"){let i=(s=le(this.el).find(r=>r.checked))==null?void 0:s.value;e=i||""}x.emit(ke(this._name),{element:this.el,value:e})}}n(Et,"values",{name:String,debounceInterval:Number});class Me extends h{get _predicates(){return wt(this.showValue)}get defaultHideClasses(){return["hide"]}connect(){w(this),x.emit(xe(this.nameValue)),K(this,ke(this.nameValue),this._onSignal)}_onSignal(e){let s=e.value;if(this.showValue=="default"){s==""?this.removeHideClasses(this.el):this.addHideClasses(this.el);return}this._predicates.every(i=>i(s))?this.removeHideClasses(this.el):this.addHideClasses(this.el)}}n(Me,"values",{name:String,show:String}),n(Me,"classes",["hide"]);class Tt extends h{constructor(){super(...arguments);n(this,"_lastIndex",null);n(this,"_reverse",!1)}get _tableHead(){let e=this.el.tHead;if(e==null)throw new Error("Expected table to have a <thead> element.");return e}get _tableHeaders(){let e=this._tableHead.rows;if(e.length==0)throw new Error("Expected table to have a <thead> element with at least one row.");return Array.from(e[0].cells)}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}connect(){requestAnimationFrame(()=>{S(this,this._tableHeaders,"click",this.sort),this.hasStartSortValue&&this._sortByColumn(this.startSortValue)})}sort(e){e.preventDefault();let s=e.target,i=this._indexOfHeaderCell(s);s.dataset.sortable!="false"&&(s.dataset.sort=="asc"?(this._reverse=!0,this._otherHeaderCells(s).forEach(r=>delete r.dataset.sort),s.dataset.sort="desc",this._sortByColumn(i)):(this._reverse=!1,this._otherHeaderCells(s).forEach(r=>delete r.dataset.sort),s.dataset.sort="asc",this._sortByColumn(i)))}_indexOfHeaderCell(e){return this._tableHeaders.indexOf(e)}_otherHeaderCells(e){return Array.from(this._tableHeaders).filter(s=>s!=e)}_sortByColumn(e){let s=document.createDocumentFragment();this._tableRows.sort((a,o)=>{var B,M;let u=Array.from(a.cells),l=Array.from(o.cells),m=((B=u[e])==null?void 0:B.innerText)||"",f=((M=l[e])==null?void 0:M.innerText)||"",p=m.localeCompare(f,"en",{sensitivity:"base",numeric:!0,caseFirst:"upper"});return a.dataset.sortTop||o.dataset.sortBottom?a.dataset.sortTop&&o.dataset.sortTop?p:-1:a.dataset.sortBottom||o.dataset.sortTop?a.dataset.sortBottom&&o.dataset.sortBottom?p:1:this._reverse?p>0?-1:1:p}).forEach(a=>s.appendChild(a)),this._tableBody.innerHTML="",this._tableBody.appendChild(s),this._lastIndex=e}}n(Tt,"values",{startSort:Number});function Ae(t,e,s,i){s=s.bind(t);let r=new MutationObserver(s),a=()=>r.observe(e,i),o=()=>r.disconnect();return b(t,a,o),o}class De extends h{get _truncated(){return this.hasTruncatedValue?this.truncatedValue:!1}set _truncated(e){this.truncatedValue=e}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}get _limit(){return this.hasLimitValue?this.limitValue:20}connect(){Ae(this,this._tableBody,this.mutate,{childList:!0}),requestAnimationFrame(()=>{this.truncate(),c(this,this.showMoreTarget,"click",this.expand)})}truncate(e){e==null||e.preventDefault(),this._truncated=!0,this._tableRows.length>=this._limit?(this._tableRows.slice(this._limit).forEach(s=>{s!==this.showMoreTarget&&this._hideElement(s)}),this._showElement(this.showMoreTarget)):this._hideElement(this.showMoreTarget)}expand(e){this._truncated=!1,e==null||e.preventDefault(),this._tableRows.slice(this._limit).forEach(s=>{s!==this.showMoreTarget&&this._showElement(s)}),this._hideElement(this.showMoreTarget)}mutate(e){this._truncated&&this._reTruncate()}_showElement(e){e.style.display=""}_hideElement(e){e.style.display="none"}_reTruncate(){this._tableRows.slice(0,this._limit).forEach(e=>{e!==this.showMoreTarget&&this._showElement(e)}),this._tableRows.slice(this._limit).forEach(e=>{e!==this.showMoreTarget&&this._hideElement(e)}),this._showElement(this.showMoreTarget)}}n(De,"targets",["showMore"]),n(De,"values",{limit:Number,truncated:Boolean});class Ct extends h{alert(){alert(this.messageValue)}}n(Ct,"values",{message:String});class Cs extends h{connect(){let{enter:e,exit:s,toggle:i}=Ge(this);this.enter=e,this.exit=s,this.toggle=i}}class St extends h{get _threshold(){return this.hasThresholdValue?this.thresholdValue.split(",").map(e=>Number.parseFloat(e.trim())).filter(e=>e>=0&&e<=1):[0,1]}connect(){fe(this,this.el,this.appear,this.disappear,{threshold:this._threshold})}appear(e){this.dispatch(this.el,"intersection:appear")}disappear(e){this.dispatch(this.el,"intersection:disappear")}}n(St,"values",{threshold:String});class Vt extends h{connect(){if(!this.hasSecondsValue)throw new Error("Expected `secondsValue` to be present");requestAnimationFrame(()=>{N(this,this._interval,this.secondsValue*1e3)})}_interval(){this.dispatch(this.el,"interval:action")}}n(Vt,"values",{seconds:Number});class xt extends h{get name(){return this.hasNameValue?this.nameValue:""}get _addedEventName(){return[this.name,"presence","added"].filter(e=>!!e).join(":")}get _removedEventName(){return[this.name,"presence","removed"].filter(e=>!!e).join(":")}connect(){this.dispatch(this.el,this._addedEventName)}disconnect(){this.dispatch(this.el,this._removedEventName)}}n(xt,"values",{name:String});class kt extends h{print(e){e==null||e.preventDefault(),window.print()}}class Mt extends h{connect(){requestAnimationFrame(()=>{V(this,this._timeout,this.secondsValue*1e3)})}_timeout(){this.dispatch(this.el,"timeout")}}n(Mt,"values",{seconds:Number});class Ss extends h{connect(){c(this,window,["focus","blur"],this._handleVisibility),c(this,document,"visibilitychange",this._handleVisibility),requestAnimationFrame(()=>{this._handleVisibility()})}appear(){this.dispatch(this.el,"user-focus:active")}away(){this.dispatch(this.el,"user-focus:away")}_handleVisibility(){this._documentIsActive()?this.appear():this.away()}_documentIsActive(){return document.visibilityState=="visible"&&document.hasFocus()}}class At extends h{get _tickInterval(){return this.hasMillisecondsTarget?1:this.hasSecondsTarget?1e3:this.hasMinutesTarget?15e3:3e5}connect(){requestAnimationFrame(()=>{N(this,this._tick,this._tickInterval)})}_tick(){let e=new Date;this.hasHoursTarget&&(this.hoursTarget.innerHTML=e.getHours().toString().padStart(2,"0")),this.hasMinutesTarget&&(this.minutesTarget.innerHTML=e.getMinutes().toString().padStart(2,"0")),this.hasSecondsTarget&&(this.secondsTarget.innerHTML=e.getSeconds().toString().padStart(2,"0")),this.hasMillisecondsTarget&&(this.millisecondsTarget.innerHTML=e.getMilliseconds().toString().padStart(3,"0"))}}n(At,"targets",["hours","minutes","seconds","milliseconds"]);class X extends h{constructor(){super(...arguments);n(this,"_interval",null)}get _removeUnused(){return this.hasRemoveUnusedValue?this.removeUnusedValue:!1}get _deadlineDate(){return new Date(this.deadlineValue)}connect(){this._interval=setInterval(this._tick.bind(this),1e3),this.addCountingDownClasses()}disconnect(){this._clearTick(),this.removeCountingDownClasses(),this.removeEndedClasses()}deadlineValueChanged(){this._interval==null&&(this._interval=setInterval(this._tick.bind(this),1e3))}_tick(){try{const e=new Date;let s={};v.isPast(this._deadlineDate)?(s={years:0,months:0,days:0,hours:0,minutes:0,seconds:0},this._clearTick(),this.removeCountingDownClasses(),this.addEndedClasses(),this.dispatch(this.el,"countdown:ended")):s=v.intervalToDuration({start:this._deadlineDate,end:e}),this.hasYearsTarget&&this._updateTarget(this.yearsTarget,this._years(s)),this.hasMonthsTarget&&this._updateTarget(this.monthsTarget,this._months(s)),this.hasDaysTarget&&this._updateTarget(this.daysTarget,this._days(s)),this.hasHoursTarget&&this._updateTarget(this.hoursTarget,this._hours(s)),this.hasMinutesTarget&&this._updateTarget(this.minutesTarget,this._minutes(s)),this.hasSecondsTarget&&this._updateTarget(this.secondsTarget,this._seconds(s))}catch(e){console.error(e),this._clearTick()}}_clearTick(){this._interval&&(clearInterval(this._interval),this._interval=null)}_updateTarget(e,s){this._removeTargetIfUnused(e,s),e.innerHTML=s.toString()}_removeTargetIfUnused(e,s){this._removeUnused&&(s===0&&e.dataset.unused?Number.parseInt(e.dataset.unused)>Date.now()+1500&&e.remove():s==0?e.dataset.unused=Date.now().toString():e.dataset.unused=void 0)}_years(e){return e.years||0}_months(e){return e.months||0}_days(e){return e.days||0}_hours(e){return e.hours||0}_minutes(e){return e.minutes||0}_seconds(e){return e.seconds||0}}n(X,"values",{deadline:String,removeUnused:Boolean}),n(X,"targets",["years","months","days","hours","minutes","seconds"]),n(X,"classes",["countingDown","ended"]);class Dt extends h{get _format(){return["years","months","weeks","days","hours",...this._minutes?["minutes"]:[],...this._seconds?["seconds"]:[]]}get _output(){let{years:e,months:s,weeks:i,days:r,hours:a,minutes:o,seconds:u}=this._duration;e||(e=0),s||(s=0),i||(i=0),r||(r=0),a||(a=0),o||(o=0),u||(u=0);let l=[e,s,i,r,a];return!this._minutes&&!this._seconds&&l.every(m=>m===0)?(o=o+u/60,`${(o/60).toFixed(1)} hours`):v.formatDuration(this._duration,{format:this._format,delimiter:", "})}get _seconds(){return this.hasSecondsValue?this.secondsValue:!0}get _minutes(){return this.hasMinutesValue?this.minutesValue:!0}get _timestamp(){if(this.hasTimestampValue)return v.toDate(this.timestampValue*1e3);throw new Error("Expected `timestampValue` to be present")}get _duration(){return v.intervalToDuration({start:new Date,end:this._timestamp})}get _tickInterval(){return this._seconds?1e3:this._minutes?15e3:12e4}connect(){this._clearInterval=N(this,this._update,this._tickInterval),this._update()}_update(){try{this.el.innerHTML=this._output}catch{this._clearInterval()}}}n(Dt,"values",{timestamp:Number,minutes:Boolean,seconds:Boolean});class Y extends h{get defaultHideClasses(){return["hide"]}get defaultActiveClasses(){return["is-active"]}get _currentTab(){return this.hasCurrentTabValue?this.currentTabValue:0}get _equalize(){return this.hasEqualizeValue?this.equalizeValue:!1}connect(){S(this,this.linkTargets,"click",this.switchTabs),this._equalize&&this._setMinHeight(),this.currentTabValue=this._currentTab}switchTabs(e){e.preventDefault(),this.currentTabValue=this.linkTargets.indexOf(e.currentTarget)}currentTabValueChanged(){let e=this._currentTab;e=this._clampIndex(e),this._selectTab(e)}_selectTab(e){e=this._clampIndex(e);let s=this.linkTargets,i=this.contentTargets,r=i[e],a=s[e],o=[...i.slice(0,e),...i.slice(e+1)],u=[...s.slice(0,e),...s.slice(e+1)];this.addActiveClasses(a),a.setAttribute("aria-selected","true"),this.addActiveClasses(r),this.removeHideClasses(r),u.forEach(l=>{l.removeAttribute("aria-selected"),this.removeActiveClasses(l)}),o.forEach(l=>{this.removeActiveClasses(l),this.addHideClasses(l)})}_clampIndex(e){return _.clamp(e,0,this.contentTargets.length-1)}_setMinHeight(){let e=0;this.contentTargets.forEach(s=>{let i=s.hasAttribute("tab-hidden");i&&this.removeHideClasses(s);let r=s.offsetHeight;r>e&&(e=r),i&&this.addHideClasses(s)}),this.contentTargets.forEach(s=>s.style.minHeight=e+"px")}}n(Y,"values",{currentTab:Number,equalize:Boolean}),n(Y,"targets",["link","content"]),n(Y,"classes",["active","hide"]);class It extends h{get _duration(){return v.isPast(this._timestamp)?v.intervalToDuration({start:this._timestamp,end:new Date}):v.intervalToDuration({start:new Date,end:this._timestamp})}get _nextUpdate(){let e=this._duration;return e.years&&e.years>0||e.months&&e.months>0||e.days&&e.days>0?null:e.hours&&e.hours>0?18e5:3e4}timestampValueChanged(){this._timestamp=v.toDate(this.timestampValue*1e3)}connect(){if(!this.hasTimestampValue)throw new Error("Expected `timestampValue` to be present");this._update()}_update(){this.el.innerHTML=v.formatDistanceToNow(this._timestamp,{addSuffix:!0,includeSeconds:!0}),this._nextUpdate&&V(this,this._update,this._nextUpdate)}}n(It,"values",{timestamp:Number});class Lt extends h{get defaultActiveClasses(){return["active"]}get defaultCollapsedClasses(){return["collapsed"]}initialize(){this._nodeClicked=this._nodeClicked.bind(this)}connect(){w(this),Ae(this,this.el,this.mutate,{subtree:!0,childList:!0}),this._setup()}disconnect(){this._teardown()}_setup(){this._setupNode(this.el)}_setupNode(e){const s=i=>{let r=i.parentElement;r&&(this._nodeActive(r)||this._hideNode(r),r.removeEventListener("click",this._nodeClicked),r.addEventListener("click",this._nodeClicked))};(e.tagName==="UL"||e.tagName==="OL")&&s(e),e.querySelectorAll("ul, ol").forEach(i=>s(i))}_teardown(){this.el.querySelectorAll("ul, ol, li").forEach(e=>this._teardownNode(e))}_teardownNode(e){[e,...Array.from(e.querySelectorAll("ul, ol, li"))].forEach(s=>{s.removeEventListener("click",this._nodeClicked),this.removeActiveClasses(s),this.removeCollapsedClasses(s)})}_nodeClicked(e){e&&e.stopImmediatePropagation();let s=e.target;!s||!this._hasNested(s)||(this._nodeActive(s)?this._hideNode(s):this._showNode(s))}_nodeActive(e){return this.activeClassesPresent(e)}_showNode(e){this.removeCollapsedClasses(e),this.addActiveClasses(e)}_hideNode(e){this.removeActiveClasses(e),this.addCollapsedClasses(e)}_hasNested(e){return e.querySelectorAll("ul, ol").length>0}mutate(e){console.log("mutate",e);for(const s of e)s.type==="childList"&&(Array.from(s.addedNodes||[]).forEach(i=>this._setupNode(i)),Array.from(s.removedNodes||[]).forEach(i=>this._teardownNode(i)))}}n(Lt,"classes",["active","collapsed"]);class Ie extends h{get defaultActiveClasses(){return["active"]}get defaultInactiveClasses(){return["inactive"]}get _key(){return this.keyValue.replaceAll("#","")}get _anchor(){return window.location.hash.substr(1)}set _anchor(e){window.location.hash=e}connect(){w(this),requestAnimationFrame(()=>{this._checkAnchor(),c(this,window,"hashchange",this._checkAnchor)})}write(e){e==null||e.preventDefault(),this._anchor=this._key}_checkAnchor(){this._key===this._anchor?(this.dispatch(this.el,"anchor-spy:active"),this.addActiveClasses(this.el),this.removeInactiveClasses(this.el)):(this.dispatch(this.el,"anchor-spy:inactive"),this.addInactiveClasses(this.el),this.removeActiveClasses(this.el))}}n(Ie,"values",{key:String}),n(Ie,"classes",["active","inactive"]);class Nt extends h{get _pages(){return this.hasPagesValue?Math.abs(this.pagesValue):1}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1500}connect(){c(this,this.el,"click",this.goBack)}goBack(e){e==null||e.preventDefault(),history.go(-this._pages),this.el.href&&V(this,this.fallback,this._timeout)}fallback(){window.location.href=this.el.href}}n(Nt,"values",{timeout:Number,pages:Number});class Le extends h{constructor(){super(...arguments);n(this,"_supported",!1)}connect(){this._supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this._supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())}select(e){e&&e.preventDefault(),this.sourceTarget.select()}copy(e){e&&e.preventDefault(),this.sourceTarget.select(),this._supported&&document.execCommand("copy")}}n(Le,"targets",["source","button","copy","fallback"]),n(Le,"values",{removeUnused:Boolean});class Ht extends h{get _message(){return this.hasMessageValue?this.messageValue:"Are you sure?"}get _eventType(){if(ae(this.el))return"submit";if(P(this.el))return"click";throw new Error("Can't handle confirmation on attached element")}connect(){requestAnimationFrame(()=>{c(this,this.el,this._eventType,this.confirm)})}confirm(e){window.confirm(this._message)||(e.preventDefault(),this.dispatch(this.el,"confirm:cancelled"))}}n(Ht,"values",{message:String});class Ot extends h{get _message(){return this.hasMessageValue?this.messageValue:"Do you want to leave this page? Changes you made may not be saved"}connect(){window.onbeforeunload=()=>this._message,c(this,window,"popstate",this.confirmNavigation),c(this,window,"submit",this.allowSubmit),c(this,window,["turbolinks:before-visit","turbo:before-visit"],this.confirmTurboNavigation)}disconnect(){window.onbeforeunload=null}allowSubmit(e){window.removeEventListener("popstate",this.confirmNavigation),window.onbeforeunload=null}confirmNavigation(e){return!1}confirmTurboNavigation(e){confirm(this._message)||e.preventDefault()}}n(Ot,"values",{message:String});class Ft extends h{connect(){console.log("Debug Controller",this,this.testTargets)}}n(Ft,"targets",["test"]);class Bt extends h{constructor(){super(...arguments);n(this,"_cacheText")}get _message(){return this.hasMessageValue?this.messageValue:"Submitting..."}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1e3}connect(){requestAnimationFrame(()=>{c(this,this.el,["click"],this.disable),c(this,window,["turbo:load","turbolinks:load"],this._enable)})}disable(e){let s=this.el;this._isDisabled(s)?(e==null||e.preventDefault(),e==null||e.stopImmediatePropagation()):(this._cacheText=this._getElText(s),this._setElText(s,this._message),this._disable(),V(this,this.enable,this._timeout))}enable(e){e==null||e.preventDefault();let s=this.el;this._isDisabled(s)&&(this._setElText(s,this._cacheText),this._enable())}_isDisabled(e){return g(e)&&e.type=="submit"||L(e)?e.disabled:e.dataset.disabled=="true"}_getElText(e){return g(e)&&e.type=="submit"?e.value:e.innerText}_setElText(e,s){g(e)&&e.type=="submit"?e.value=s:(L(e)||P(e))&&(e.innerText=s)}_disable(){let e=this.el;g(e)&&e.type=="submit"||L(e)?e.disabled=!0:e.dataset.disabled="true"}_enable(){let e=this.el;g(e)&&e.type=="submit"||L(e)?e.disabled=!1:e.dataset.disabled=void 0}}n(Bt,"values",{message:String,timeout:Number});class qt extends h{dismiss(){this.el.remove()}}class Vs extends qt{}class Ne extends h{get _id(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(e!=="")return e;throw new Error(`No ID value to uniquely identify this element. Please either specify data-${this.identifier}-id-value or give this element an 'id' attribute. `)}get _uniqueIdentifier(){return`${location.href} ${this._id}`}get _restoreOnLoad(){return this.hasRestoreOnLoadValue?this.restoreOnLoadValue:!0}get _element(){return this.hasElementTarget?this.elementTarget:this.el}connect(){requestAnimationFrame(()=>{this._restoreOnLoad&&this.restore()})}clear(e){e&&e.preventDefault(),localStorage.removeItem(this._uniqueIdentifier),this.dispatch(this._element,"element-save:cleared")}save(e){e&&e.preventDefault();let s=this._element,i=this.attributesValue.split(" "),r={};i.forEach(a=>r[a]=_.get(s,a)),localStorage.setItem(this._uniqueIdentifier,JSON.stringify(r)),this.dispatch(s,"element-save:save:success")}restore(e){e&&e.preventDefault();let s=this._element;if(localStorage.getItem(this._uniqueIdentifier)){const i=JSON.parse(localStorage.getItem(this._uniqueIdentifier));Object.keys(i).forEach(r=>{_.set(s,r,i[r])}),this.dispatch(s,"element-save:restore:success")}else this.dispatch(s,"element-save:restore:empty")}}n(Ne,"targets",["element"]),n(Ne,"values",{id:String,attributes:String,restoreOnLoad:Boolean});class Z extends h{get _container(){return this.hasContainerTarget?this.containerTarget:this.el}get _children(){let e=this._container;return this.hasScopeSelectorValue?Array.from(e.querySelectorAll(this.scopeSelectorValue)):Array.from(e.children)}connect(){w(this),Ae(this,this._container,this.mutate,{childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e=this._container,s=this._children;s.length===0?(this.removeNotEmptyClasses(),this.addEmptyClasses(),this.dispatch(e,"dom:empty")):(this.addNotEmptyClasses(),this.removeEmptyClasses(),this.dispatch(e,"dom:not-empty",{detail:{count:s.length}}))}}n(Z,"targets",["container"]),n(Z,"classes",["empty","notEmpty"]),n(Z,"values",{scopeSelector:String});class Rt extends h{get _mode(){return this.hasModeValue?this.modeValue:"mouseover"}get _supportsPrefetch(){var s,i;const e=document.createElement("link");return((s=e.relList)==null?void 0:s.supports)&&((i=e.relList)==null?void 0:i.supports("prefetch"))}get _href(){return this.el.href}get _existingPrefetch(){return(document.head.querySelectorAll(`link[rel="prefetch"][href="${this._href}"]`)||[]).length>0}get _connectionSuitable(){const e=navigator.connection;if(!e)return!0;if(e){if(e.saveData)return this.warn("Data Saving is enabled"),!1;if(/2g/.test(e.effectiveType))return this.warn("Network is too slow"),!1}return!0}connect(){if(!!this._supportsPrefetch)switch(this._mode){case"intersect":this._setupObserver();break;case"mouseover":c(this,this.el,"mouseover",this.prefetch,{once:!0});break;default:throw new Error(`'${this._mode}' is not a supported prefetch mode`)}}_setupObserver(){new IntersectionObserver(([s],i)=>{s.isIntersecting&&(this.prefetch(),i.unobserve(s.target))}).observe(this.element)}prefetch(){if(this._existingPrefetch||!this._connectionSuitable)return;const e=document.createElement("link");Object.assign(e,{rel:"prefetch",href:this._href,as:"document"}),document.head.appendChild(e)}}n(Rt,"values",{mode:String});class Pt extends kt{get defaultUnsupportedClasses(){return["unsupported"]}connect(){w(this),"print"in window||this.addUnsupportedClasses(),c(this,this.el,"click",this.print)}}n(Pt,"classes",["unsupported"]);class xs extends h{connect(){c(this,window,"message",this.messageReceived)}messageReceived(e){let s=e.data;s.hasOwnProperty("name")&&s.name==="iframe-body"&&s.hasOwnProperty("height")&&this.resize(s.height)}resize(e){this.el.style.height=`${e}px`}}class ks extends h{connect(){window.self!==window.top&&(c(this,window,"resize",this.postUpdate,{debounce:200}),this.postUpdate())}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,s=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight)}}class $t extends h{connect(){requestAnimationFrame(()=>{V(this,()=>this.el.remove(),this.secondsValue*1e3)})}}n($t,"values",{seconds:Number});class He extends h{constructor(){super(...arguments);n(this,"_magicElement",null)}get defaultStuckClasses(){return["stuck"]}get _mode(){if(this.hasModeValue){if(!["top","bottom"].includes(this.modeValue))throw new Error(`The modeValue provided '${this.modeValue}' is not one of the recognised configuration options`);if(this.modeValue==="top")return"beforebegin"}return"afterend"}connect(){this._magicElement=document.createElement("div"),Xe(this,this.el,this._mode,this._magicElement),new IntersectionObserver(s=>{s.forEach(i=>{i.target===this._magicElement&&(i.intersectionRatio===0?this.addStuckClasses():i.intersectionRatio===1&&this.removeStuckClasses())})},{threshold:[0,1]}).observe(this._magicElement)}}n(He,"classes",["stuck"]),n(He,"values",{mode:String});class zt extends q{connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()})}execute(e){e==null||e.preventDefault();let s=this.el,i=document.querySelector(this.targetValue);if(i==null){this.dispatch(s,"teleport:error");return}let r=s.cloneNode(!0);switch(this.cleanup(r),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":i.insertAdjacentHTML(this.insertValue,r.outerHTML);break;case"replaceOuter":i.outerHTML=r.outerHTML;break;case"replaceInner":i.innerHTML=r.outerHTML;break;case"prepend":i.insertAdjacentHTML("afterbegin",r.outerHTML);break;case"append":i.insertAdjacentHTML("beforeend",r.outerHTML);break;default:throw new Error("`insert` value was not specified")}s.remove()}}n(zt,"values",{target:String,insert:String,immediate:Boolean});class jt extends q{constructor(){super(...arguments);n(this,"_previousState",{})}get _value(){if(this.hasValueValue)return this.valueValue;throw new Error("Expected `valueValue` to be present")}get _attribute(){if(this.hasAttributeValue)return this.attributeValue;throw new Error("Expected `attributeValue` to be present")}get _seconds(){if(this.hasSecondsValue)return this.secondsValue*1e3;throw new Error("Expected `secondsValue` to be present")}connect(){this.setState(),V(this,this.removeState,this._seconds)}disconnect(){this.removeState()}setState(){this._previousState[this._attribute]=_.get(this.el,this._attribute),_.set(this.el,this._attribute,this.valueValue)}removeState(){_.set(this.el,this._attribute,this._previousState[this._attribute])}}n(jt,"values",{attribute:String,seconds:Number,value:String});function Ut(t,e,s,i,r="temporary-state"){var a;(!t.dataset.controller||!((a=t.dataset.controller)==null?void 0:a.includes(r)))&&(t.dataset.controller=(t.dataset.controller||` ${r} `).trim().replaceAll(" "," ")),t[_.camelCase(`${r}-attribute-value`)]=e,t[_.camelCase(`${r}-seconds-value`)]=i.toString()}function Ms(t,e,s){Ut(t,"className",e,s)}function As(t,e,s){s=s.bind(t);const i=a=>{e.contains(a.target)||!We(e)||s(a)};let{teardown:r}=c(t,window,["click","touchend"],i);return b(t,()=>{},r),{teardown:r}}function Ds(t,e,s,i){let r=null,a=null;if(s){s=s.bind(t);let{teardown:l}=c(t,e,"mouseenter",s);r=l}if(i){i=i.bind(t);let{teardown:l}=c(t,e,"mouseleave",i);a=l}let o=()=>{},u=()=>{r&&r(),a&&a()};return b(t,o,u),{teardown:u}}class Oe extends h{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&Ds(this,this.el,this.mouseEnter,this.mouseLeave),this.hasClickAwayValue&&this.clickAwayValue&&As(this,this.el,this.clickOutside),requestAnimationFrame(()=>{this.hasInitialValue&&(this.initialValue==="on"?this.toggleTargets.forEach(e=>this._elementOn(e)):this.toggleTargets.forEach(e=>this._elementOff(e)))})}clickOutside(){this.toggleTargets.forEach(e=>{this._elementWasToggled(e)&&(this._elementToggleStatus(e),this._elementToggle(e))})}mouseEnter(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle();break}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle();break}return{}}on(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementOn(s)})}off(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementOff(s)})}toggle(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementToggle(s)})}_elementWasToggled(e){return e.dataset.toggled=="true"}_elementToggleStatus(e){this._elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}_elementToggle(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i))}_elementOn(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i,!0))}_elementOff(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i,!1))}}n(Oe,"targets",["toggle"]),n(Oe,"values",{class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String});function Is(t){const e=t.disconnect.bind(t);let s=!1,i=(l,m)=>{l.forEach(f=>{f.type==="childList"&&Array.from(f.addedNodes).some(p=>p.tagName==="TRIX-TOOLBAR")&&(o(),m.disconnect())})},r=l=>H(t,"pasteEvent").call(t,l),a=new MutationObserver(i),o=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let l=t.element,m=t.element.parentElement;if(m==null)throw new Error("Could not traverse DOM tree from <trix-editor>");l.addEventListener("trix-paste",r);let f=m.querySelector("trix-toolbar");if(!s&&!f){s=!0,a.observe(m,{childList:!0});return}else if(f)a.disconnect();else throw new Error("Could not find an instance of <trix-toolbar> that is a sibling of this <trix-editor>");H(t,"install").call(t,{toolbar:f,editor:l})},u=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let l=t.element,m=t.element.parentElement;if(m==null)throw new Error("Could not traverse DOM tree from <trix-editor>");l.removeEventListener("trix-paste",r);let f=m.querySelector("trix-toolbar");if(!f)throw new Error("Could not find <trix-toolbar> that is a sibling of this <trix-editor> element");H(t,"uninstall").call(t,{toolbar:f,editor:l})};o(),Object.assign(t,{disconnect(){a.disconnect(),u(),H(t,"uninstall").call({toolbar,editor:t.element}),e()}})}class Ls extends h{get enabledBehaviours(){let e=i=>i!==void 0&&i!=="false",s=(i,r)=>e(i)?[r]:[];return[...s(this.el.dataset.noBold,this.bold),...s(this.el.dataset.noBulletList,this.bulletList),...s(this.el.dataset.noCode,this.code),...s(this.el.dataset.noHeading,this.heading),...s(this.el.dataset.noItalic,this.italic),...s(this.el.dataset.noStrikethrough,this.strikethrough),...s(this.el.dataset.noLink,this.link),...s(this.el.dataset.noIndents,this.indents),...s(this.el.dataset.noNumberList,this.numberList),...s(this.el.dataset.noQuote,this.quote),...s(this.el.dataset.noFileUploads,this.fileUploads)]}get bold(){return this.formattingHandlers(".trix-button--icon-bold","bold")}get bulletList(){return this.formattingHandlers(".trix-button--icon-bullet-list","bullet-list")}get code(){return this.formattingHandlers(".trix-button--icon-code","code")}get heading(){return this.formattingHandlers(".trix-button--icon-heading-1","heading")}get italic(){return this.formattingHandlers(".trix-button--icon-italic","italic")}get strikethrough(){return this.formattingHandlers(".trix-button--icon-strike","strike")}get link(){return this.formattingHandlers(".trix-button--icon-link","href")}get indents(){return this.simpleHideShowHandlers([".trix-button--icon-decrease-nesting-level, .trix-button--icon-increase-nesting-level",".trix-button--icon-decrease-nesting-level, .trix-button--icon-increase-nesting-level"].join(", "))}get numberList(){return this.simpleHideShowHandlers(".trix-button--icon-number-list")}get quote(){return this.simpleHideShowHandlers(".trix-button--icon-quote")}get fileUploads(){let e=".trix-button-group.trix-button-group--file-tools",s=a=>a==null?void 0:a.preventDefault(),i=this,r=this.el;return{install(a){i.simpleHideShowHandlers(e).install(a),i.el.addEventListener("trix-file-accept",s)},pasteEvent(a){let{dataTransfer:o,html:u}=a.paste,{editor:l}=r;(o.files.length>0||u.includes("<img"))&&(alert("The content you pasted contains images and/or files. File uploads are not supported."),l.undo())},uninstall(a){i.simpleHideShowHandlers(e).uninstall(a),i.el.removeEventListener("trix-file-accept",s)}}}connect(){Is(this)}install(e){this.enabledBehaviours.forEach(s=>s.install(e))}pasteEvent(e){this.enabledBehaviours.forEach(s=>s.pasteEvent&&s.pasteEvent(e))}uninstall(e){this.enabledBehaviours.forEach(s=>s.uninstall(e))}simpleHideShowHandlers(e){return{install:({toolbar:s})=>this.hideToolbarSelector(s,e),uninstall:({toolbar:s})=>this.showToolbarSelector(s,e)}}formattingHandlers(e,s){let i=this.el,{editor:r}=i;return{install:a=>{this.simpleHideShowHandlers(e).install(a)},pasteEvent(a){let{range:o}=a.paste,u=i.editor.getSelectedRange();r.setSelectedRange(o),r.deactivateAttribute(s),r.setSelectedRange(u)},uninstall:a=>{this.simpleHideShowHandlers(e).uninstall(a)}}}showToolbarSelector(e,s){e.querySelectorAll(s).forEach(i=>i.style.display="")}hideToolbarSelector(e,s){e.querySelectorAll(s).forEach(i=>i.style.display="none")}}class Wt extends h{toggle(e){e==null||e.preventDefault();let i=this._getFrame().src;i==null||i!==this._getSrc()?this._setSrc():this._clear()}setSrc(e){e==null||e.preventDefault(),this._setSrc()}clear(e){e==null||e.preventDefault(),this._clear()}_setSrc(){let e=this._getFrame();this.hasLoadingMessageValue&&(e.innerHTML=this.loadingMessageValue),e.src=this._getSrc()}_clear(){let e=this._getFrame();e.src="",e.innerHTML=""}_getFrame(){let e=document.getElementById(`${this.frameIdValue}`);if(e==null)throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);if(re(e))return e;throw new Error(`Element targeted by ID '${this.frameIdValue}'`)}_getSrc(){let e=this.el;if(this.hasSrcValue)return this.srcValue;if(P(e))return e.href;throw new Error("No link given to drive frame to")}}n(Wt,"values",{frameId:String,src:String,loadingMessage:String});class Kt extends h{get _poll(){return this.hasPollValue?this.pollValue:!1}connect(){let e=this.el;if(re(e)){if(e.src)throw new Error("The provided <turbo-frame> element has no `src` attribute.")}else throw new Error("Expected controller to be mounted on a <turbo-frame> element.");this._poll&&requestAnimationFrame(()=>V(this,this.refresh,this.intervalValue))}refresh(e){e==null||e.preventDefault();let s=this.el;s.src=s.src}}n(Kt,"values",{interval:Number,poll:Boolean});exports.AlertController=Ct;exports.AnchorSpyController=Ie;exports.AsyncBlockController=de;exports.AutoSubmitFormController=Qe;exports.AutosizeController=ds;exports.BackLinkController=Nt;exports.BaseController=h;exports.CharCountController=U;exports.CheckboxDisableInputsController=ge;exports.CheckboxEnableInputsController=pe;exports.CheckboxSelectAllController=et;exports.CheckboxXORController=tt;exports.ClipboardController=Le;exports.ClockController=At;exports.ConfirmController=Ht;exports.ConfirmNavigationController=Ot;exports.CountdownController=X;exports.DebugController=Ft;exports.DetectDirtyController=ms;exports.DetectDirtyFormController=ps;exports.DisableWithController=Bt;exports.DismissableController=qt;exports.DurationController=Dt;exports.ElementSaveController=Ne;exports.EmptyDomController=Z;exports.EnableInputsController=_e;exports.EphemeralController=q;exports.EventBus=x;exports.FallbackImageController=Te;exports.FocusStealController=it;exports.FormRcController=be;exports.FormSaveController=rt;exports.FullscreenController=Cs;exports.IntersectionController=St;exports.IntervalController=Vt;exports.LazyBlockController=cs;exports.LightboxImageController=Se;exports.LimitedSelectionCheckboxesController=ve;exports.LoadBlockController=A;exports.MediaPlayerController=mt;exports.NavigateFormErrorsController=W;exports.NestedFormController=we;exports.PasswordConfirmController=ye;exports.PasswordPeekController=at;exports.PollBlockController=me;exports.PrefetchController=Rt;exports.PresenceController=xt;exports.PrintButtonController=Pt;exports.PrintController=kt;exports.RemoteFormController=Ee;exports.RemoveController=Vs;exports.ResponsiveIframeBodyController=ks;exports.ResponsiveIframeWrapperController=xs;exports.ScrollContainerController=gt;exports.ScrollIntoFocusController=pt;exports.ScrollToBottomController=_t;exports.ScrollToController=bt;exports.ScrollToTopController=vt;exports.SelfDestructController=$t;exports.SignalActionController=yt;exports.SignalInputController=Et;exports.SignalVisibilityController=Me;exports.StickyController=He;exports.StorageSerializers=Ye;exports.SyncInputsController=nt;exports.TableSortController=Tt;exports.TableTruncateController=De;exports.TabsController=Y;exports.TeleportController=zt;exports.TemporaryStateController=jt;exports.TimeDistanceController=It;exports.TimeoutController=Mt;exports.ToggleClassController=Oe;exports.TreeViewController=Lt;exports.TrixModifierController=Ls;exports.TurboFrameRCController=Wt;exports.TurboFrameRefreshController=Kt;exports.UserFocusController=Ss;exports.ValueWarnController=J;exports.WordCountController=G;exports.applyTemporaryClass=Ms;exports.applyTemporaryState=Ut;exports.createHiddenButton=je;exports.createHiddenInput=Ue;exports.getAllRadiosInGroup=le;exports.getOtherRadiosInGroup=he;exports.getScrollParent=R;exports.insertElement=ne;exports.insertHiddenButton=oe;exports.insertHiddenInput=rs;exports.isDirty=gs;exports.isElementCheckable=T;exports.isElementInViewport=We;exports.isFormDirty=st;exports.isHTMLAnchorElement=P;exports.isHTMLButtonElement=L;exports.isHTMLFormElement=ae;exports.isHTMLImageElement=is;exports.isHTMLInputElement=g;exports.isHTMLLinkElement=ss;exports.isHTMLSelectElement=k;exports.isHTMLTextAreaElement=$;exports.isTurboFrame=re;exports.isTypeOfFormInputElement=ze;exports.requestReset=Ke;exports.requestSubmit=ue;exports.scrollAbsoluteBottom=se;exports.scrollAbsoluteLeft=ie;exports.scrollAbsoluteRight=es;exports.scrollAbsoluteTop=te;exports.scrollDown=Re;exports.scrollLeft=Pe;exports.scrollRight=$e;exports.scrollToElement=C;exports.scrollUp=qe;exports.useCollectionEventListener=S;exports.useCollectionEventListeners=ns;exports.useEventListener=c;exports.useEventListeners=as;exports.useFullscreen=Ge;exports.useGeolocation=os;exports.useInjectedElement=Xe;exports.useInjectedFragment=ce;exports.useInjectedHTML=ls;exports.useInterval=N;exports.useLocalStorage=hs;exports.useTimeout=V;
|
|
2
2
|
//# sourceMappingURL=stimulus-library.cjs.js.map
|