stimulus-library 0.3.16 → 0.4.0

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +43 -43
  3. package/dist/controllers/ajax/async_block_controller.d.ts +18 -18
  4. package/dist/controllers/ajax/lazy_block_controller.d.ts +9 -9
  5. package/dist/controllers/ajax/load_block_controller.d.ts +19 -19
  6. package/dist/controllers/ajax/poll_block_controller.d.ts +16 -16
  7. package/dist/controllers/anchor_spy_controller.d.ts +15 -15
  8. package/dist/controllers/back_link_controller.d.ts +19 -19
  9. package/dist/controllers/clipboard_controller.d.ts +18 -18
  10. package/dist/controllers/confirm_controller.d.ts +13 -13
  11. package/dist/controllers/confirm_navigation_controller.d.ts +15 -15
  12. package/dist/controllers/debug_controller.d.ts +6 -6
  13. package/dist/controllers/disable_with_controller.d.ts +25 -25
  14. package/dist/controllers/dismissable_controller.d.ts +6 -6
  15. package/dist/controllers/element_save_controller.d.ts +25 -25
  16. package/dist/controllers/empty_dom_controller.d.ts +29 -29
  17. package/dist/controllers/forms/auto_submit_form_controller.d.ts +15 -13
  18. package/dist/controllers/forms/auto_submit_form_controller.d.ts.map +1 -1
  19. package/dist/controllers/forms/autosize_controller.d.ts +9 -9
  20. package/dist/controllers/forms/char_count_controller.d.ts +26 -26
  21. package/dist/controllers/forms/checkbox_select_all_controller.d.ts +14 -14
  22. package/dist/controllers/forms/detect_dirty_controller.d.ts +16 -16
  23. package/dist/controllers/forms/detect_dirty_form_controller.d.ts +19 -19
  24. package/dist/controllers/forms/disable_inputs_controller.d.ts +16 -16
  25. package/dist/controllers/forms/enable_inputs_controller.d.ts +16 -16
  26. package/dist/controllers/forms/form_rc_controller.d.ts +13 -7
  27. package/dist/controllers/forms/form_rc_controller.d.ts.map +1 -1
  28. package/dist/controllers/forms/form_save_controller.d.ts +33 -33
  29. package/dist/controllers/forms/limited_selection_checkboxes_controller.d.ts +17 -17
  30. package/dist/controllers/forms/navigate_form_errors_controller.d.ts +34 -34
  31. package/dist/controllers/forms/nested_form_controller.d.ts +21 -21
  32. package/dist/controllers/forms/password_confirm_controller.d.ts +17 -17
  33. package/dist/controllers/forms/password_peek_controller.d.ts +8 -8
  34. package/dist/controllers/forms/remote_form_controller.d.ts +13 -13
  35. package/dist/controllers/forms/remote_form_controller.d.ts.map +1 -1
  36. package/dist/controllers/forms/sync_inputs_controller.d.ts +21 -21
  37. package/dist/controllers/forms/value_warn_controller.d.ts +39 -39
  38. package/dist/controllers/forms/word_count_controller.d.ts +26 -26
  39. package/dist/controllers/media/fallback_image_controller.d.ts +27 -27
  40. package/dist/controllers/media/lightbox_image_controller.d.ts +29 -29
  41. package/dist/controllers/media/lightbox_image_controller.d.ts.map +1 -1
  42. package/dist/controllers/media/media_player_controller.d.ts +12 -12
  43. package/dist/controllers/prefetch_controller.d.ts +18 -18
  44. package/dist/controllers/prefetch_controller.d.ts.map +1 -1
  45. package/dist/controllers/responsive_iframe_controller.d.ts +23 -23
  46. package/dist/controllers/scroll/scroll_container_controller.d.ts +21 -21
  47. package/dist/controllers/scroll/scroll_into_focus_controller.d.ts +15 -15
  48. package/dist/controllers/scroll/scroll_to_bottom_controller.d.ts +11 -11
  49. package/dist/controllers/scroll/scroll_to_controller.d.ts +17 -17
  50. package/dist/controllers/scroll/scroll_to_top_controller.d.ts +11 -11
  51. package/dist/controllers/self_destruct_controller.d.ts +10 -10
  52. package/dist/controllers/sticky_controller.d.ts +19 -19
  53. package/dist/controllers/tables/table_sort_controller.d.ts +20 -20
  54. package/dist/controllers/tables/table_truncate_controller.d.ts +26 -26
  55. package/dist/controllers/teleport_controller.d.ts +15 -15
  56. package/dist/controllers/temporary_state_controller.d.ts +28 -28
  57. package/dist/controllers/toggle_class_controller.d.ts +35 -35
  58. package/dist/controllers/turbo_frame_rc_controller.d.ts +20 -20
  59. package/dist/controllers/turbo_frame_refresh_controller.d.ts +16 -16
  60. package/dist/controllers/utility/intersection_controller.d.ts +13 -13
  61. package/dist/controllers/utility/interval_controller.d.ts +13 -13
  62. package/dist/controllers/utility/presence_controller.d.ts +5 -5
  63. package/dist/controllers/utility/timeout_controller.d.ts +12 -12
  64. package/dist/controllers/utility/user_focus_controller.d.ts +10 -10
  65. package/dist/controllers/visual/clock_controller.d.ts +18 -18
  66. package/dist/controllers/visual/countdown_controller.d.ts +53 -53
  67. package/dist/controllers/visual/duration_controller.d.ts +27 -27
  68. package/dist/controllers/visual/tabs_controller.d.ts +37 -37
  69. package/dist/controllers/visual/time_distance_controller.d.ts +18 -18
  70. package/dist/controllers/visual/tree_view_controller.d.ts +29 -29
  71. package/dist/index.d.ts +66 -66
  72. package/dist/stimulus-library.cjs.js +2 -0
  73. package/dist/stimulus-library.cjs.js.map +1 -0
  74. package/dist/stimulus-library.es.js +2 -0
  75. package/dist/stimulus-library.es.js.map +1 -0
  76. package/dist/stimulus-library.umd.js +1 -1
  77. package/dist/stimulus-library.umd.js.map +1 -1
  78. package/dist/utilities/base_controller.d.ts +13 -13
  79. package/dist/utilities/base_controller.d.ts.map +1 -1
  80. package/dist/utilities/elements.d.ts +13 -12
  81. package/dist/utilities/elements.d.ts.map +1 -1
  82. package/dist/utilities/ephemeral_controller.d.ts +5 -5
  83. package/dist/utilities/event_bus.d.ts +3 -3
  84. package/dist/utilities/requestSubmit.d.ts +3 -0
  85. package/dist/utilities/requestSubmit.d.ts.map +1 -0
  86. package/dist/utilities/scroll.d.ts +10 -10
  87. package/dist/utilities/turbo.d.ts +1 -1
  88. package/package.json +18 -11
  89. package/dist/stimulus-library.js +0 -2
  90. package/dist/stimulus-library.js.map +0 -1
  91. package/dist/stimulus-library.modern.js +0 -2
  92. package/dist/stimulus-library.modern.js.map +0 -1
  93. package/dist/stimulus-library.module.js +0 -2
  94. package/dist/stimulus-library.module.js.map +0 -1
  95. package/tsconfig.json +0 -27
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("stimulus"),require("camelcase"),require("date-fns"),require("lodash-es"),require("dialog-polyfill"),require("mitt")):"function"==typeof define&&define.amd?define(["exports","stimulus","camelcase","date-fns","lodash-es","dialog-polyfill","mitt"],t):t((e||self).stimulusLibrary={},e.stimulus,e.camelcase,e.dateFns,e.lodashEs,e.dialogPolyfill,e.mitt)}(this,function(e,t,n,i,s,r,a){function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(n),u=o(r),c=o(a);function h(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function d(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),e}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,m(e,t)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function _(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var y=function(e){function t(t){var n;return(n=e.call(this,t)||this).application.debug?new Proxy(p(n),{get:function(e,t){var i=Reflect.get(e,t),s=p(n);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}return!(/^_.*?$/.test(e)||/^.*?Target(s)?$/.test(e)||/^.*?Value$/.test(e)||/^.*?ValueChanged$/.test(e)||/^.*?Class$/.test(e)||/^.*?Classes$/.test(e))}(t.toString())){if("function"==typeof i)return new Proxy(i,{apply:function(e,n,i){return s.log(t.toString(),{args:i}),Reflect.apply(e,n,i)}});n.log(t.toString())}return i}})||p(n):p(n)||p(n)}v(t,e);var n=t.prototype;return n.metaValue=function(e){var t=document.head.querySelector('meta[name="'+e+'"]');return(null==t?void 0:t.getAttribute("content"))||null},n.dispatch=function(e,t,n){void 0===n&&(n={});var i=Object.assign({},{bubbles:!0,cancelable:!0,detail:{target:e}},n);i.detail.target&&(i.detail.target=e);var s=new CustomEvent(t,i);this.logEvent(t,s,e),e.dispatchEvent(s)},n.log=function(e,t){if(void 0===t&&(t={}),this.application.debug){var n=console;n.groupCollapsed("%c"+this.identifier+" %c#"+e,"color: #3B82F6","color: unset"),n.log(f({element:this.element},t)),n.groupEnd()}},n.warn=function(e,t){if(void 0===t&&(t={}),this.application.debug){var n=console;n.groupCollapsed("%c"+this.identifier+" %c#"+e,"color: F39B1AFF","color: unset"),n.warn(f({element:this.element},t)),n.groupEnd()}},n.logEvent=function(e,t,n){if(this.application.debug){var i=console;i.groupCollapsed("%c"+this.identifier+" %c"+e+"%c","color: #3B82F6","color: #0be000","color: unset"),i.log({element:n}),i.groupEnd()}},d(t,[{key:"el",get:function(){return this.element}},{key:"isTurboPreview",get:function(){return document.documentElement.hasAttribute("data-turbo-preview")||document.documentElement.hasAttribute("data-turbolinks-preview")}},{key:"isTurbolinksPreview",get:function(){return this.isTurboPreview}},{key:"csrfToken",get:function(){return this.metaValue("csrf-token")}}]),t}(t.Controller),b=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n._cleanupSelf=function(){this.cleanup(this.el)},n.cleanup=function(e){var t,n,i,s=this;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;var r=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(r,""))||"",delete e.dataset[l.default(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(r,""))||"",delete e.dataset[l.default(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(t){return delete e.dataset[l.default(s.identifier+"-"+t+"-value")]});var o=this.constructor.classes;o&&Object.keys(o).forEach(function(t){return delete e.dataset[l.default(s.identifier+"-"+t+"-class")]})},t}(y),C=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._checkAnchor=this._checkAnchor.bind(this)},n.connect=function(){var e=this;requestAnimationFrame(function(){e._checkAnchor(),window.addEventListener("hashchange",e._checkAnchor)})},n.disconnect=function(){window.removeEventListener("hashchange",this._checkAnchor)},n.write=function(e){null==e||e.preventDefault(),this._anchor=this._key},n._checkAnchor=function(){this.dispatch(this.el,this._key===this._anchor?"anchor-spy:active":"anchor-spy:inactive")},d(t,[{key:"_key",get:function(){return this.keyValue.replaceAll("#","")}},{key:"_anchor",get:function(){return window.location.hash.substr(1)},set:function(e){window.location.hash=e}}]),t}(y);C.values={key:String};var E=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){},n.loadContent=function(e){void 0===e&&(e=null);try{var t,n=this;null==(t=e)||t.preventDefault();var i=n,s=n.hasReplaceTarget?n.replaceTarget:n.el,r=function(){s.replaceWith(n._errorMessage),i.dispatch(s,"ajax:error")},a=function(e,t){try{var a=function(e,t){try{var a=Promise.resolve(fetch(n.endpointValue)).then(function(e){return e.ok||r(),Promise.resolve(e.text()).then(function(e){var t=document.createElement("div");if(t.innerHTML=e,n.hasSelectorValue){var r=t.querySelectorAll(n.selectorValue);s.replaceWith.apply(s,r)}else s.replaceWith.apply(s,t.children);i.dispatch(s,"ajax:success")})})}catch(e){return t()}return a&&a.then?a.then(void 0,t):a}(0,function(){r()})}catch(e){return t(!0,e)}return a&&a.then?a.then(t.bind(null,!1),t.bind(null,!0)):t(!1,a)}(0,function(e,t){if(i.dispatch(s,"ajax:complete"),e)throw t;return t});return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},d(t,[{key:"_errorMessage",get:function(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}}]),t}(y);E.targets=["replace"],E.values={endpoint:String,errorMessage:String,selector:String};var w=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.connect=function(){try{return Promise.resolve(this.loadContent()).then(function(){})}catch(e){return Promise.reject(e)}},d(t,[{key:"_errorMessage",get:function(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}}]),t}(E);w.targets=["replace"],w.values={endpoint:String,errorMessage:String,selector:String};var k=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this.submit=this.submit.bind(this)},n.connect=function(){var e=this;this.el.querySelectorAll("input, select, textarea").forEach(function(t){return t.addEventListener("change",e.submit)})},n.disconnect=function(){var e=this;this.el.querySelectorAll("input, select, textarea").forEach(function(t){return t.removeEventListener("change",e.submit)})},n.submit=function(){var e=this.el;e.requestSubmit&&"request"==this._mode?e.requestSubmit():this.el.dataset.remote?this.dispatch(this.el,"submit"):(this.dispatch(this.el,"submit"),e.submit())},d(t,[{key:"_mode",get:function(){if(this.hasModeValue){if(!["direct","request"].includes(this.modeValue))throw new Error("The modeValue provided '"+this.modeValue+"' is not one of the recognised configuration options");return this.modeValue}return"request"}}]),t}(y);k.values={mode:String};const T=(e,t)=>{const n=e[t];return"function"==typeof n?n:(...e)=>{}},V=(e,t,n)=>{let i=e;return!0===n?i=`${t.identifier}:${e}`:"string"==typeof n&&(i=`${n}:${e}`),i},S=(e,t,n)=>{const{bubbles:i,cancelable:s,composed:r}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:i,cancelable:s,composed:r,detail:n})},L={dispatchEvent:!0,eventPrefix:!0},A=(e,t={})=>{const{dispatchEvent:n,eventPrefix:i}=Object.assign({},L,t),s=(null==t?void 0:t.element)||e.element,r=e.disconnect.bind(e),a=new IntersectionObserver(t=>{const[r]=t;r.isIntersecting?(t=>{if(e.isVisible=!0,T(e,"appear").call(e,t),n){const n=V("appear",e,i),r=S(n,null,{controller:e,entry:t});s.dispatchEvent(r)}})(r):e.isVisible&&(t=>{if(e.isVisible=!1,T(e,"disappear").call(e,t),n){const n=V("disappear",e,i),r=S(n,null,{controller:e,entry:t});s.dispatchEvent(r)}})(r)},t),o=()=>{a.observe(s)},l=()=>{a.unobserve(s)};return Object.assign(e,{isVisible:!1,disconnect(){l(),r()}}),o(),[o,l]},x={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},D={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class I{constructor(e,t={}){var n,i,s;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log({controllerId:this.controllerId,...t}),this.logger.groupEnd())},this.dispatch=(e,t={})=>{if(this.dispatchEvent){const{event:n,...i}=t,s=this.extendedEvent(e,n||null,i);this.targetElement.dispatchEvent(s),this.log("dispatchEvent",{eventName:s.type,...i})}},this.call=(e,t={})=>{const n=this.controller[e];if("function"==typeof n)return n.call(this.controller,t)},this.extendedEvent=(e,t,n)=>{const{bubbles:i,cancelable:s,composed:r}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(this.composeEventName(e),{bubbles:i,cancelable:s,composed:r,detail:n})},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!==(i=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==i?i:D.debug,this.logger=null!==(s=null==t?void 0:t.logger)&&void 0!==s?s:D.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.targetElement=(null==t?void 0:t.element)||e.element;const{dispatchEvent:r,eventPrefix:a}=Object.assign({},D,t);Object.assign(this,{dispatchEvent:r,eventPrefix:a}),this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class H extends I{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 N extends I{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 P=(e,t={})=>{const n=new N(e,t);return[n.observe,n.unobserve]},M=e=>{const t=t=>{const{innerWidth:n,innerHeight:i}=window,s={height:i||Infinity,width:n||Infinity,event:t};T(e,"windowResize").call(e,s)},n=e.disconnect.bind(e),i=()=>{window.addEventListener("resize",t),t()},s=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){s(),n()}}),i(),[i,s]};(class extends t.Controller{}).debounces=[];const O=(e,t=200)=>{let n=null;return function(){const i=arguments,s=this,r=()=>e.apply(s,i);n&&clearTimeout(n),n=setTimeout(r,t)}};var F=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._handler=this._handler.bind(this)},n.connect=function(){var e=this;M(this),requestAnimationFrame(function(){e._handler();var t=e.el;t.style.resize="none",t.style.boxSizing="border-box",t.addEventListener("input",e._handler),t.addEventListener("focus",e._handler)})},n.disconnect=function(){this.el.removeEventListener("input",this._handler),this.el.removeEventListener("focus",this._handler)},n.windowResize=function(){this._handler()},n._handler=function(){this.autosize(this.el)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(y),B=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._timeoutHandle=null,t}v(t,e);var n=t.prototype;return n.initialize=function(){this.goBack=this.goBack.bind(this),this.fallback=this.fallback.bind(this)},n.connect=function(){this.el.addEventListener("click",this.goBack)},n.disconnect=function(){this.el.removeEventListener("click",this.goBack),this._timeoutHandle&&clearTimeout(this._timeoutHandle)},n.goBack=function(e){null==e||e.preventDefault(),history.go(-this._pages),this.el.href&&(this._timeoutHandle=setTimeout(this.fallback,this._timeout))},n.fallback=function(){window.location.href=this.el.href},d(t,[{key:"_pages",get:function(){return this.hasPagesValue?Math.abs(this.pagesValue):1}},{key:"_timeout",get:function(){return this.hasTimeoutValue?this.timeoutValue:1500}}]),t}(y);B.values={timeout:Number,pages:Number};var j=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._updateCharCount=this._updateCharCount.bind(this)},n.connect=function(){var e=this;requestAnimationFrame(function(){e.inputTarget.addEventListener("input",e._updateCharCount),e._updateCharCount()})},n.disconnect=function(){this.inputTarget.removeEventListener("input",this._updateCharCount)},n._addErrorClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasErrorClass?(t=e.classList).add.apply(t,this._errorClasses):(n=e.classList).add.apply(n,this._defaultErrorClasses)},n._removeErrorClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasErrorClass?(t=e.classList).remove.apply(t,this._errorClasses):(n=e.classList).remove.apply(n,this._defaultErrorClasses)},n._updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this._isValidCount(e)?this._removeErrorClasses(this.outputTarget):this._addErrorClasses(this.outputTarget))},n._isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},d(t,[{key:"_errorClasses",get:function(){return this.errorClass.split(" ")}},{key:"_defaultErrorClasses",get:function(){return[]}}]),t}(y);j.targets=["input","output"],j.values={min:Number,max:Number},j.classes=["error"];var z=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._toggle=this._toggle.bind(this),this._refresh=this._refresh.bind(this)},n.connect=function(){var e=this;requestAnimationFrame(function(){e.hasSelectAllTarget&&(e.selectAllTarget.addEventListener("change",e._toggle),e.checkboxTargets.forEach(function(t){return t.addEventListener("change",e._refresh)}),e._refresh())})},n.disconnect=function(){var e=this;this.hasSelectAllTarget&&(this.selectAllTarget.removeEventListener("change",this._toggle),this.checkboxTargets.forEach(function(t){return t.removeEventListener("change",e._refresh)}))},n._toggle=function(e){e.preventDefault();var t=e.target;this.checkboxTargets.forEach(function(e){return e.checked=t.checked})},n._refresh=function(){var e=this.checkboxTargets.length,t=this._checked.length;this.selectAllTarget.checked=t>0,this.selectAllTarget.indeterminate=t>0&&t<e},d(t,[{key:"_checked",get:function(){return this.checkboxTargets.filter(function(e){return e.checked})}},{key:"_unchecked",get:function(){return this.checkboxTargets.filter(function(e){return!e.checked})}}]),t}(y);z.targets=["selectAll","checkbox"];var q=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._supported=!1,t}v(t,e);var n=t.prototype;return n.connect=function(){this._supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this._supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this._supported&&document.execCommand("copy")},t}(y);q.targets=["source","button","copy","fallback"],q.values={removeUnused:Boolean};var W=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._intervalHandle=null,t}v(t,e);var n=t.prototype;return n.initialize=function(){this._tick=this._tick.bind(this)},n.connect=function(){var e=this;requestAnimationFrame(function(){e._intervalHandle=window.setInterval(e._tick,e._tickInterval)})},n.disconnect=function(){this._intervalHandle&&window.clearInterval(this._intervalHandle)},n._tick=function(){var 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"))},d(t,[{key:"_tickInterval",get:function(){return this.hasMillisecondsTarget?1:this.hasSecondsTarget?1e3:this.hasMinutesTarget?15e3:3e5}}]),t}(y);function R(e){return"A"==e.nodeName}function U(e){return"FORM"==e.nodeName}function $(e){return"INPUT"==e.nodeName}function J(e){return"TEXTAREA"==e.nodeName}function Y(e){return"BUTTON"==e.nodeName}function K(e){return"SELECT"==e.nodeName}function X(e){return $(e)&&("radio"===e.type||"checkbox"===e.type)}function G(e){return $(e)||K(e)||J(e)}W.targets=["hours","minutes","seconds","milliseconds"];var Q=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this.confirm=this.confirm.bind(this)},n.connect=function(){var e=this;requestAnimationFrame(function(){var t=e.el;if(U(t))t.addEventListener("submit",e.confirm);else{if(!R(t))throw new Error("Can't handle confirmation on attached element");t.addEventListener("click",e.confirm)}})},n.disconnect=function(){var e=this.el;U(e)?e.removeEventListener("submit",this.confirm):R(e)&&e.removeEventListener("click",this.confirm)},n.confirm=function(e){window.confirm(this._message)||(e.preventDefault(),this.dispatch(this.el,"confirm:cancelled"))},d(t,[{key:"_message",get:function(){return this.hasMessageValue?this.messageValue:"Are you sure?"}}]),t}(y);Q.values={message:String};var Z=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this.allowSubmit=this.allowSubmit.bind(this),this.confirmNavigation=this.confirmNavigation.bind(this),this.confirmTurboNavigation=this.confirmTurboNavigation.bind(this)},n.connect=function(){var e=this;window.onbeforeunload=function(){return e._message},window.addEventListener("popstate",this.confirmNavigation),window.addEventListener("submit",this.allowSubmit),window.addEventListener("turbolinks:before-visit",this.confirmTurboNavigation),window.addEventListener("turbo:before-visit",this.confirmTurboNavigation)},n.disconnect=function(){window.removeEventListener("popstate",this.confirmNavigation),window.onbeforeunload=null,window.removeEventListener("submit",this.allowSubmit),window.removeEventListener("turbolinks:before-visit",this.confirmTurboNavigation),window.removeEventListener("turbo:before-visit",this.confirmTurboNavigation)},n.allowSubmit=function(e){window.removeEventListener("popstate",this.confirmNavigation),window.onbeforeunload=null},n.confirmNavigation=function(e){return!1},n.confirmTurboNavigation=function(e){confirm(this._message)||e.preventDefault()},d(t,[{key:"_message",get:function(){return this.hasMessageValue?this.messageValue:"Do you want to leave this page? Changes you made may not be saved"}}]),t}(y);Z.values={message:String};var ee=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._interval=null,t}v(t,e);var n=t.prototype;return n.connect=function(){this._interval=setInterval(this._tick.bind(this),1e3),this._addCountingDownClasses()},n.disconnect=function(){this._clearTick(),this._removeCountingDownClasses(),this._removeEndedClasses()},n.deadlineValueChanged=function(){null==this._interval&&(this._interval=setInterval(this._tick.bind(this),1e3))},n._tick=function(){try{var e=new Date,t={};i.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=i.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()}},n._clearTick=function(){this._interval&&(clearInterval(this._interval),this._interval=null)},n._updateTarget=function(e,t){this._removeTargetIfUnused(e,t),e.innerHTML=t.toString()},n._removeTargetIfUnused=function(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)},n._years=function(e){return e.years||0},n._months=function(e){return e.months||0},n._days=function(e){return e.days||0},n._hours=function(e){return e.hours||0},n._minutes=function(e){return e.minutes||0},n._seconds=function(e){return e.seconds||0},n._addEndedClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasEndedClass?(t=e.classList).add.apply(t,this._endedClasses):(n=e.classList).add.apply(n,this._defaultEndedClasses)},n._removeEndedClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasEndedClass?(t=e.classList).remove.apply(t,this._endedClasses):(n=e.classList).remove.apply(n,this._defaultEndedClasses)},n._addCountingDownClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasCountingDownClass?(t=e.classList).add.apply(t,this._countingDownClasses):(n=e.classList).add.apply(n,this._defaultCountingDownClasses)},n._removeCountingDownClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasCountingDownClass?(t=e.classList).remove.apply(t,this._countingDownClasses):(n=e.classList).remove.apply(n,this._defaultCountingDownClasses)},d(t,[{key:"_removeUnused",get:function(){return!!this.hasRemoveUnusedValue&&this.removeUnusedValue}},{key:"_endedClasses",get:function(){return this.endedClass.split(" ")}},{key:"_defaultEndedClasses",get:function(){return[]}},{key:"_countingDownClasses",get:function(){return this.countingDownClass.split(" ")}},{key:"_defaultCountingDownClasses",get:function(){return[]}},{key:"_deadlineDate",get:function(){return new Date(this.deadlineValue)}}]),t}(y);ee.values={deadline:String,removeUnused:Boolean},ee.targets=["years","months","days","hours","minutes","seconds"],ee.classes=["countingDown","ended"];var te=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(y);te.targets=["test"];var ne=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._checkDirty=this._checkDirty.bind(this)},n.connect=function(){var e=this.el;this._cacheLoadValues(),this._checkDirty(),e.addEventListener("input",this._checkDirty),e.addEventListener("change",this._checkDirty)},n.disconnect=function(){var e=this.el;e.removeEventListener("input",this._checkDirty),e.removeEventListener("change",this._checkDirty)},n.restore=function(e){null==e||e.preventDefault(),this._restoreElementFromLoadValue()},n._getElementValue=function(){var e=this.el;return X(e)?e.checked:e.value},n._getElementLoadValue=function(){var e=this.el,t=e.getAttribute(this._cacheAttrName);return X(e)?null==t?e.defaultChecked:"true"==t:(null!==t||K(e)&&Array.from(e.options).forEach(function(t){if(t.defaultSelected)return e.value=t.value,t.value}),t)},n._elementHasCachedLoadValue=function(){return this.el.hasAttribute(this._cacheAttrName)},n._checkDirty=function(){var e=this.el;this._isElementDirty()?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")},n._isElementDirty=function(){return this._getElementValue()!==this._getElementLoadValue()},n._restoreElementFromLoadValue=function(){var e=this.el,t=e.getAttribute(this._cacheAttrName);X(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=null==t?e.defaultChecked:"true"==t):K(e)?null==t?Array.from(e.options).forEach(function(t){t.defaultSelected&&(e.value=t.value)}):e.value=t:e.value=null==t?e.defaultValue:t},n._cacheLoadValues=function(){var e=this.el;!this._elementHasCachedLoadValue()&&X(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())},d(t,[{key:"_cacheAttrName",get:function(){return"detect-dirty-load-value"}}]),t}(y),ie=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._checkDirty=this._checkDirty.bind(this)},n.connect=function(){var e=this.el;this._cacheLoadValues(),this._checkDirty(),e.addEventListener("input",this._checkDirty),e.addEventListener("change",this._checkDirty)},n.disconnect=function(){var e=this.el;e.removeEventListener("input",this._checkDirty),e.removeEventListener("change",this._checkDirty)},n.restore=function(e){var t=this;null==e||e.preventDefault(),this._formElements.forEach(function(e){return t._restoreElementFromLoadValue(e)})},n._getElementValue=function(e){return X(e)?e.checked:e.value},n._getElementLoadValue=function(e){var t=e.getAttribute(this._cacheAttrName);return X(e)?null==t?e.defaultChecked:"true"==t:(null!==t||K(e)&&Array.from(e.options).forEach(function(t){if(t.defaultSelected)return e.value=t.value,t.value}),t)},n._elementHasCachedLoadValue=function(e){return e.hasAttribute(this._cacheAttrName)},n._checkElementDirty=function(e){this._isElementDirty(e)?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")},n._isElementDirty=function(e){return this._getElementValue(e)!==this._getElementLoadValue(e)},n._cacheElementLoadValue=function(e){!this._elementHasCachedLoadValue(e)&&X(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())},n._restoreElementFromLoadValue=function(e){var t=e.getAttribute(this._cacheAttrName);X(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=null==t?e.defaultChecked:"true"==t):K(e)?null==t?Array.from(e.options).forEach(function(t){t.defaultSelected&&(e.value=t.value)}):e.value=t:e.value=null==t?e.defaultValue:t},n._cacheLoadValues=function(){var e=this;this._formElements.forEach(function(t){return e._cacheElementLoadValue(t)})},n._checkDirty=function(){var e=this;this._formElements.forEach(function(t){return e._checkElementDirty(t)}),this._formElements.some(function(e){return se(e)})?this.el.setAttribute("data-dirty","true"):this.el.removeAttribute("data-dirty")},d(t,[{key:"_formElements",get:function(){return Array.from(this.el.querySelectorAll("input, select, textarea"))}},{key:"_cacheAttrName",get:function(){return"detect-dirty-load-value"}}]),t}(y);function se(e){return e.hasAttribute("data-dirty")}var re=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(y);re.targets=["disabler","disable"],re.values={clear:Boolean};var ae=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._cacheText=void 0,t._timeoutHandle=void 0,t}v(t,e);var n=t.prototype;return n.initialize=function(){this.enable=this.enable.bind(this),this.disable=this.disable.bind(this),this._enable=this._enable.bind(this),this._disable=this._disable.bind(this)},n.connect=function(){var e=this;requestAnimationFrame(function(){e.el.addEventListener("click",e.disable),window.addEventListener("turbo:load",e._enable),window.addEventListener("turbolinks:load",e._enable)})},n.disconnect=function(){this._timeoutHandle&&clearTimeout(this._timeoutHandle),this.el.removeEventListener("click",this.disable),window.addEventListener("turbo:load",this._enable),window.addEventListener("turbolinks:load",this._enable)},n.disable=function(e){var 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(),setTimeout(this.enable,this._timeout))},n.enable=function(e){null==e||e.preventDefault();var t=this.el;this._isDisabled(t)&&(this._setElText(t,this._cacheText),this._enable())},n._isDisabled=function(e){return $(e)&&"submit"==e.type||Y(e)?e.disabled:"true"==e.dataset.disabled},n._getElText=function(e){return $(e)&&"submit"==e.type?e.value:e.innerText},n._setElText=function(e,t){$(e)&&"submit"==e.type?e.value=t:(Y(e)||R(e))&&(e.innerText=t)},n._disable=function(){var e=this.el;$(e)&&"submit"==e.type||Y(e)?e.disabled=!0:e.dataset.disabled="true"},n._enable=function(){var e=this.el;$(e)&&"submit"==e.type||Y(e)?e.disabled=!1:e.dataset.disabled=void 0},d(t,[{key:"_message",get:function(){return this.hasMessageValue?this.messageValue:"Submitting..."}},{key:"_timeout",get:function(){return this.hasTimeoutValue?this.timeoutValue:1e3}}]),t}(y);ae.values={message:String,timeout:Number};var oe=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.dismiss=function(){this.el.remove()},t}(y),le=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t}(oe),ue=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._intervalHandle=null,t}v(t,e);var n=t.prototype;return n.initialize=function(){this._update=this._update.bind(this)},n.connect=function(){this._intervalHandle=window.setInterval(this._update,this._tickInterval),this._update()},n.disconnect=function(){this._intervalHandle&&window.clearInterval(this._intervalHandle)},n._update=function(){try{this.el.innerHTML=this._output}catch(e){this._intervalHandle&&window.clearInterval(this._intervalHandle)}},d(t,[{key:"_format",get:function(){return["years","months","weeks","days","hours"].concat(this._minutes?["minutes"]:[],this._seconds?["seconds"]:[])}},{key:"_output",get:function(){var e=this._duration,t=e.years,n=e.months,s=e.weeks,r=e.days,a=e.hours,o=e.minutes,l=e.seconds;return t||(t=0),n||(n=0),s||(s=0),r||(r=0),a||(a=0),o||(o=0),l||(l=0),this._minutes||this._seconds||![t,n,s,r,a].every(function(e){return 0===e})?i.formatDuration(this._duration,{format:this._format,delimiter:", "}):((o+=l/60)/60).toFixed(1)+" hours"}},{key:"_seconds",get:function(){return!this.hasSecondsValue||this.secondsValue}},{key:"_minutes",get:function(){return!this.hasMinutesValue||this.minutesValue}},{key:"_timestamp",get:function(){if(this.hasTimestampValue)return i.toDate(1e3*this.timestampValue);throw new Error("Expected `timestampValue` to be present")}},{key:"_duration",get:function(){return i.intervalToDuration({start:new Date,end:this._timestamp})}},{key:"_tickInterval",get:function(){return this._seconds?1e3:this._minutes?15e3:12e4}}]),t}(y);ue.values={timestamp:Number,minutes:Boolean,seconds:Boolean};var ce=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e._restoreOnLoad&&e.restore()})},n.clear=function(e){e&&e.preventDefault(),localStorage.removeItem(this._uniqueIdentifier),this.dispatch(this._element,"element-save:cleared")},n.save=function(e){e&&e.preventDefault();var t=this._element,n=this.attributesValue.split(" "),i={};n.forEach(function(e){return i[e]=s.get(t,e)}),localStorage.setItem(this._uniqueIdentifier,JSON.stringify(i)),this.dispatch(t,"element-save:save:success")},n.restore=function(e){e&&e.preventDefault();var t=this._element;if(localStorage.getItem(this._uniqueIdentifier)){var n=JSON.parse(localStorage.getItem(this._uniqueIdentifier));Object.keys(n).forEach(function(e){s.set(t,e,n[e])}),this.dispatch(t,"element-save:restore:success")}else this.dispatch(t,"element-save:restore:empty")},d(t,[{key:"_id",get:function(){if(this.hasIdValue)return this.idValue;var 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. ")}},{key:"_uniqueIdentifier",get:function(){return location.href+" "+this._id}},{key:"_restoreOnLoad",get:function(){return!this.hasRestoreOnLoadValue||this.restoreOnLoadValue}},{key:"_element",get:function(){return this.hasElementTarget?this.elementTarget:this.el}}]),t}(y);ce.targets=["element"],ce.values={id:String,attributes:String,restoreOnLoad:Boolean};var he=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){P(this,{element:this._container,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var 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}}))},n._addNotEmptyClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasNotEmptyClass?(t=e.classList).add.apply(t,this._notEmptyClasses):(n=e.classList).add.apply(n,this._defaultNotEmptyClasses)},n._removeNotEmptyClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasNotEmptyClass?(t=e.classList).remove.apply(t,this._notEmptyClasses):(n=e.classList).remove.apply(n,this._defaultNotEmptyClasses)},n._addEmptyClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasEmptyClass?(t=e.classList).add.apply(t,this._emptyClasses):(n=e.classList).add.apply(n,this._defaultEmptyClasses)},n._removeEmptyClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasEmptyClass?(t=e.classList).remove.apply(t,this._emptyClasses):(n=e.classList).remove.apply(n,this._defaultEmptyClasses)},d(t,[{key:"_container",get:function(){return this.hasContainerTarget?this.containerTarget:this.el}},{key:"_notEmptyClasses",get:function(){return this.notEmptyClass.split(" ")}},{key:"_defaultNotEmptyClasses",get:function(){return[]}},{key:"_emptyClasses",get:function(){return this.emptyClass.split(" ")}},{key:"_defaultEmptyClasses",get:function(){return[]}},{key:"_children",get:function(){var e=this._container;return Array.from(this.hasScopeSelectorValue?e.querySelectorAll(this.scopeSelectorValue):e.children)}}]),t}(y);he.targets=["container"],he.classes=["empty","notEmpty"],he.values={scopeSelector:String};var de=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(y);de.targets=["enabler","enable"],de.values={clear:Boolean};var fe=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._hasLoadedSuccessfully=this._hasLoadedSuccessfully.bind(this),this._success=this._success.bind(this),this._fail=this._fail.bind(this)},n.connect=function(){var e=this.el;e.onerror=this._fail,e.complete&&!this._hasLoadedSuccessfully()?this._fail():this._success()},n.disconnect=function(){this._removeSuccessClasses(),this._removeFailClasses()},n._success=function(){this._addSuccessClasses()},n._fail=function(){var 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")},n._hasLoadedSuccessfully=function(){var e=this.el;return e.naturalHeight>0&&e.naturalWidth>0},n._addFailClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasFailClass?(t=e.classList).add.apply(t,this._failClasses):(n=e.classList).add.apply(n,this._defaultFailClasses)},n._removeFailClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasFailClass?(t=e.classList).remove.apply(t,this._failClasses):(n=e.classList).remove.apply(n,this._defaultFailClasses)},n._addSuccessClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasSuccessClass?(t=e.classList).add.apply(t,this._successClasses):(n=e.classList).add.apply(n,this._defaultSuccessClasses)},n._removeSuccessClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasSuccessClass?(t=e.classList).remove.apply(t,this._successClasses):(n=e.classList).remove.apply(n,this._defaultSuccessClasses)},d(t,[{key:"_successClasses",get:function(){return this.successClass.split(" ")}},{key:"_defaultSuccessClasses",get:function(){return[]}},{key:"_failClasses",get:function(){return this.failClass.split(" ")}},{key:"_defaultFailClasses",get:function(){return[]}}]),t}(y);fe.values={placeholder:String},fe.classes=["success","fail"];var ve=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.submit=function(e){null==e||e.preventDefault(),this.dispatch(this.formTarget,"submit"),this.formTarget.submit()},n.reset=function(e){null==e||e.preventDefault(),this.dispatch(this.formTarget,"reset"),this.formTarget.reset()},t}(y);ve.targets=["form"];var me=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._clear=this._clear.bind(this)},n.connect=function(){var e=this;requestAnimationFrame(function(){if(!U(e.el))throw new Error("Expected controller to be mounted on a form element.");e._restoreOnLoad&&e.restore(),e._clearOnSubmit&&e.el.addEventListener("submit",e._clear)})},n.disconnect=function(){this._clearOnSubmit&&this.el.removeEventListener("submit",this._clear)},n._clear=function(){localStorage.removeItem(this._formIdentifier),this.dispatch(this.el,"form-save:cleared")},n.clear=function(e){null==e||e.preventDefault(),this._clear()},n.save=function(e){e.preventDefault(),localStorage.setItem(this._formIdentifier,JSON.stringify(this._formData[this._formIdentifier])),this.dispatch(this.el,"form-save:save:success")},n.restore=function(e){if(null==e||e.preventDefault(),localStorage.getItem(this._formIdentifier)){for(var t,n=JSON.parse(localStorage.getItem(this._formIdentifier)),i=_(this._formElements);!(t=i()).done;){var s=t.value;s.name in n&&($(s)&&"checkbox"==s.type?s.checked=n[s.name]:$(s)&&"radio"==s.type?s.value==n[s.name]&&(s.checked=!0):s.value=n[s.name])}this.dispatch(this.el,"form-save:restore:success")}else this.dispatch(this.el,"form-save:restore:empty")},d(t,[{key:"_formID",get:function(){if(this.hasIdValue)return this.idValue;var 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. ")}},{key:"_formIdentifier",get:function(){return location.href+" "+this._formID}},{key:"_formElements",get:function(){return this.el.elements}},{key:"_formData",get:function(){for(var e,t,n=((e={})[this._formIdentifier]={},e),i=_(this._formElements);!(t=i()).done;){var s=t.value;s.name.length>0&&($(s)&&"checkbox"==s.type?n[this._formIdentifier][s.name]=s.checked:$(s)&&"radio"==s.type?s.checked&&(n[this._formIdentifier][s.name]=s.value):n[this._formIdentifier][s.name]=s.value)}return n}},{key:"_restoreOnLoad",get:function(){return!this.hasRestoreOnLoadValue||this.restoreOnLoadValue}},{key:"_clearOnSubmit",get:function(){return!this.hasClearOnSubmitValue||this.clearOnSubmitValue}}]),t}(y);me.values={id:String,restoreOnLoad:Boolean,clearOnSubmit:Boolean};var pe=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){A(this,{threshold:this._threshold,element:this.el})},n.appear=function(e){this.dispatch(this.el,"intersection:appear",{detail:{element:this.el}})},n.disappear=function(e){this.dispatch(this.el,"intersection:disappear",{detail:{element:this.el}})},d(t,[{key:"_threshold",get:function(){return this.hasThresholdValue?this.thresholdValue.split(",").map(function(e){return Number.parseFloat(e.trim())}).filter(function(e){return e>=0&&e<=1}):[0,1]}}]),t}(y);pe.values={threshold:String};var ge=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._intervalHandle=null,t}v(t,e);var n=t.prototype;return n.initialize=function(){this._interval=this._interval.bind(this)},n.connect=function(){var e=this;if(!this.hasSecondsValue)throw new Error("Expected `secondsValue` to be present");requestAnimationFrame(function(){e._intervalHandle=window.setInterval(e._interval,1e3*e.secondsValue)})},n.disconnect=function(){this._intervalHandle&&window.clearInterval(this._intervalHandle)},n._interval=function(){this.dispatch(this.el,"interval:action")},t}(y);ge.values={seconds:Number};var _e,ye=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){try{var e=this,t=e.el,n=function(){if(!("IntersectionObserver"in window))return Promise.resolve(e.loadContent()).then(function(){});var n=A(e,{element:t,threshold:.3});e.observe=n[0],e.unobserve=n[1]}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},n.appear=function(e){try{var t=this,n=function(){if(e.target===t.el&&e.isIntersecting)return Promise.resolve(t.loadContent()).then(function(){t.unobserve&&t.unobserve()})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},t}(E),be=function(){try{return Promise.resolve(import("smoothscroll-polyfill")).then(function(e){_e||(_e=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}},Ce=function(e,t){var n=(void 0===t?{}:t).behavior,i=void 0===n?"smooth":n;try{var s=function(){e.scrollTo({left:0,behavior:i})},r=function(){if("smooth"==i&&!Te)return Promise.resolve(be()).then(function(){})}();return Promise.resolve(r&&r.then?r.then(s):s())}catch(e){return Promise.reject(e)}},Ee=function(e,t){var n=(void 0===t?{}:t).behavior,i=void 0===n?"smooth":n;try{var s=function(){e==window?e.scrollTo({top:document.body.scrollHeight,left:0,behavior:i}):e.scrollTo({top:e.scrollHeight,left:0,behavior:i})},r=function(){if("smooth"==i&&!Te)return Promise.resolve(be()).then(function(){})}();return Promise.resolve(r&&r.then?r.then(s):s())}catch(e){return Promise.reject(e)}},we=function(e,t){var n=(void 0===t?{}:t).behavior,i=void 0===n?"smooth":n;try{var s=function(){e.scrollTo({top:0,left:0,behavior:i})},r=function(){if("smooth"==i&&!Te)return Promise.resolve(be()).then(function(){})}();return Promise.resolve(r&&r.then?r.then(s):s())}catch(e){return Promise.reject(e)}},ke=function(e,t){var n=void 0===t?{}:t,i=n.behavior,s=void 0===i?"smooth":i,r=n.block,a=void 0===r?"start":r,o=n.inline,l=void 0===o?"nearest":o;try{var u=function(){e.scrollIntoView({behavior:s,block:a,inline:l})},c=function(){if("smooth"==s&&!Te)return Promise.resolve(be()).then(function(){})}();return Promise.resolve(c&&c.then?c.then(u):u())}catch(e){return Promise.reject(e)}},Te="scrollBehavior"in document.documentElement.style;function Ve(e){if(!e)return null;if(e==document.body)return window;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:Ve(e.parentElement)||document.body}var Se=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._dialog=null,t}v(t,e);var n=t.prototype;return n.initialize=function(){this.open=this.open.bind(this),this.close=this.close.bind(this)},n.connect=function(){},n.open=function(){var e=this,t=this.el;if(!this._dialog){this._dialog=document.createElement("dialog");var n=document.createElement("img");n.className=this._imageClassName,n.src=this._src,n.srcset=this._srcSet,n.sizes=this._sizes,this._dialog.appendChild(n),t.insertAdjacentElement("afterend",this._dialog),u.default.registerDialog(this._dialog),this._dialog.className=this._modalClassName,this._dialog.showModal(),ke(this._dialog,{behavior:"smooth",block:"end"}).catch(function(){return e._dialog.scrollIntoView(!1)}),this._dialog.addEventListener("click",this.close),this._dialog.addEventListener("cancel",this.close),this._dialog.addEventListener("close",this.close)}},n.close=function(){var e=this;this._dialog&&(this._dialog.close(),this._dialog.remove(),this._dialog=null,ke(this.el,{behavior:"smooth",block:"end"}).catch(function(){return e.el.scrollIntoView(!1)}))},d(t,[{key:"_src",get:function(){return this.hasSrcValue?this.srcValue:this.el.src}},{key:"_srcSet",get:function(){return this.hasSrcSetValue?this.srcSetValue:this.el.srcset}},{key:"_sizes",get:function(){return this.hasSizesValue?this.sizesValue:this.el.sizes}},{key:"_modalClassName",get:function(){return this.hasModalClass?this.modalClass:"image-lightbox-dialog"}},{key:"_imageClassName",get:function(){return this.hasImageClass?this.imageClass:"image-lightbox-image"}}]),t}(y);Se.values={src:String,srcSet:String,sizes:String},Se.classes=["modal","image"];var Le=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this.handleInputs=this.handleInputs.bind(this)},n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.handleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.handleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxValue?(e.preventDefault(),n.checked=!1,this.dispatch(n,"change"),this.dispatch(n,"limited-selection:too-many"),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(this.dispatch(n,"limited-selection:selection"),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(y);Le.targets=["input","error"],Le.values={max:Number,message:String};var Ae=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){},n.connect=function(){},n.disconnect=function(){},n.play=function(e){try{return null==e||e.preventDefault(),Promise.resolve(this.mediaTarget.play()).then(function(){})}catch(e){return Promise.reject(e)}},n.pause=function(e){null==e||e.preventDefault(),this.mediaTarget.pause()},n.restart=function(e){null==e||e.preventDefault(),this.mediaTarget.currentTime=0},n.seek=function(e){null==e||e.preventDefault(),this.mediaTarget.currentTime+=5},t}(y);Ae.targets=["media"];var xe=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._errors=[],t._firstClick=!1,t}v(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e._firstClick=!0,e._toggleButtons(),e._toggleVisibility()})},n.current=function(e){try{var t=this;return null==e||e.preventDefault(),t._firstClick&&(t._firstClick=!1,t._toggleButtons()),Promise.resolve(ke(t._currentError,{behavior:"smooth",block:"center",inline:"center"})).then(function(){})}catch(e){return Promise.reject(e)}},n.next=function(e){try{var t=this;return null==e||e.preventDefault(),t._firstClick?(t._firstClick=!1,t._toggleButtons()):t.indexValue=t._nextIndex,Promise.resolve(ke(t._currentError,{behavior:"smooth",block:"center",inline:"center"})).then(function(){})}catch(e){return Promise.reject(e)}},n.previous=function(e){try{var t=this;return null==e||e.preventDefault(),t._firstClick?(t._firstClick=!1,t._toggleButtons()):t.indexValue=t._previousIndex,Promise.resolve(ke(t._currentError,{behavior:"smooth",block:"center",inline:"center"})).then(function(){})}catch(e){return Promise.reject(e)}},n.indexValueChanged=function(){this._toggleButtons()},n.selectorValueChanged=function(){this._errors=Array.from(document.querySelectorAll(this._selector)),this.indexValue=0,this._toggleButtons(),this._toggleVisibility()},n._toggleVisibility=function(){this.el.style.display=0===this._errorCount?"none":""},n._toggleButtons=function(){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"))},d(t,[{key:"_errorCount",get:function(){return this._errors.length}},{key:"_previousIndex",get:function(){var e=this._index-1;return e<0?0:e}},{key:"_nextIndex",get:function(){var e=this._index+1;return e>this._errors.length-1?this._errors.length-1:e}},{key:"_index",get:function(){return s.clamp(this.hasIndexValue?this.indexValue:0,0,this._errors.length)}},{key:"_selector",get:function(){if(this.hasSelectorValue)return this.selectorValue;throw new Error("Expected `selectorValue` to be present")}},{key:"_currentError",get:function(){return this._errors[this._index]}}]),t}(y);xe.values={selector:String,index:Number},xe.targets=["next","current","previous"];var De=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){this._checkStructure()},n.add=function(e){null==e||e.preventDefault();var t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this._generateID());this.targetTarget.insertAdjacentHTML(this._insertMode,t)},n.remove=function(e){e.preventDefault();var 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";var n=t.querySelector("input[name*='_destroy']");if(null==n)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");n.value="1"}},n._generateID=function(){return(new Date).getTime().toString()+Math.random().toString().slice(2)},n._checkStructure=function(){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`")},d(t,[{key:"_wrapperClass",get:function(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}},{key:"_insertMode",get:function(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}}]),t}(y);De.targets=["target","template"],De.values={insertMode:String,wrapperClass:String};var Ie=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._checkPasswordsMatch=this._checkPasswordsMatch.bind(this)},n.connect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.addEventListener("change",e._checkPasswordsMatch)})},n.disconnect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.removeEventListener("change",e._checkPasswordsMatch)})},n._addErrorClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasErrorClass?(t=e.classList).add.apply(t,this._errorClasses):(n=e.classList).add.apply(n,this._defaultErrorClasses)},n._removeErrorClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasErrorClass?(t=e.classList).remove.apply(t,this._errorClasses):(n=e.classList).remove.apply(n,this._defaultErrorClasses)},n._allPasswordsMatch=function(){var e=new Set(this.passwordTargets.map(function(e){return e.value}));return e.has("")||1==e.size},n._checkPasswordsMatch=function(){var e=this,t=this.el;this._allPasswordsMatch()?(this.dispatch(t,"password-confirm:match"),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return e._removeErrorClasses(t)})):(this.dispatch(t,"password-confirm:no-match"),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return e._addErrorClasses(t)}))},d(t,[{key:"_errorClasses",get:function(){return this.errorClass.split(" ")}},{key:"_defaultErrorClasses",get:function(){return[]}}]),t}(y);Ie.targets=["password"],Ie.classes=["error"];var He=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.peak=function(e){null==e||e.preventDefault(),this.passwordTarget.type="text"},n.hide=function(e){null==e||e.preventDefault(),this.passwordTarget.type="password"},n.toggle=function(e){null==e||e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()},t}(y);He.targets=["password"];var Ne=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._intervalHandle=null,t}v(t,e);var n=t.prototype;return n.initialize=function(){this._timeout=this._timeout.bind(this)},n.connect=function(){var e=this;requestAnimationFrame(function(){e._timeout(),e._intervalHandle=window.setInterval(e._timeout,1e3*e.secondsValue)})},n.disconnect=function(){this._intervalHandle&&window.clearInterval(this._intervalHandle)},n._timeout=function(){try{return Promise.resolve(this.loadContent()).then(function(){})}catch(e){return Promise.reject(e)}},t}(E);Ne.targets=["replace"],Ne.values={endpoint:String,errorMessage:String,selector:String,seconds:Number};var Pe=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this.prefetch=this.prefetch.bind(this)},n.connect=function(){if(this._supportsPrefetch)switch(this._mode){case"intersect":this._setupObserver();break;case"mouseover":this.el.addEventListener("mouseover",this.prefetch,{once:!0});break;default:throw new Error("'"+this._mode+"' is not a supported prefetch mode")}},n.disconnect=function(){this.el.removeEventListener("mouseover",this.prefetch)},n._setupObserver=function(){var e=this;new IntersectionObserver(function(t,n){var i=t[0];i.isIntersecting&&(e.prefetch(),n.unobserve(i.target))}).observe(this.element)},n.prefetch=function(){if(!this._existingPrefetch&&this._connectionSuitable){var e=document.createElement("link");Object.assign(e,{rel:"prefetch",href:this._href,as:"document"}),document.head.appendChild(e)}},d(t,[{key:"_mode",get:function(){return this.hasModeValue?this.modeValue:"mouseover"}},{key:"_supportsPrefetch",get:function(){var e,t,n=document.createElement("link");return(null==(e=n.relList)?void 0:e.supports)&&(null==(t=n.relList)?void 0:t.supports("prefetch"))}},{key:"_href",get:function(){return this.el.href}},{key:"_existingPrefetch",get:function(){return(document.head.querySelectorAll('link[rel="prefetch"][href="'+this._href+'"]')||[]).length>0}},{key:"_connectionSuitable",get:function(){var 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}}]),t}(y);Pe.values={mode:String};var Me=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){this.dispatch(this.el,"presence:added")},n.disconnect=function(){this.dispatch(this.el,"presence:removed")},t}(y),Oe=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.replace=function(e){var t=e.detail[0];if(t instanceof Node){var n=t.querySelector(this._selector);if(null==n)throw new Error('expected new form DOM with [data-controller="'+this.identifier+'"] to be present in returned payload');var i=this.el.parentNode;if(null==i)throw new Error("expected form to have a DOM parent, could not execute replaceChild");i.replaceChild(n,this.el)}else console.log("Unknown",t)},d(t,[{key:"_selector",get:function(){return this.hasSelectorValue?this.selectorValue:'[data-controller~="'+this.identifier+'"]'}}]),t}(y);Oe.targets=[],Oe.values={selector:String};var Fe=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this.messageReceived=this.messageReceived.bind(this)},n.connect=function(){window.addEventListener("message",this.messageReceived)},n.disconnect=function(){window.removeEventListener("message",this.messageReceived)},n.messageReceived=function(e){var t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)},n.resize=function(e){this.el.style.height=e+"px"},t}(y),Be=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){var e,t,n;window.self!==window.top&&(M(this),t={},null===(n=(e=this).constructor.debounces)||void 0===n||n.forEach(n=>{if("string"==typeof n&&(e[n]=O(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:i,wait:s}=n;if(!i)return;e[i]=O(e[i],s||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(y);Be.debounces=["postUpdate"];var je=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.scrollTop=function(e){try{return null==e||e.preventDefault(),Promise.resolve(we(this.el,{behavior:this._behaviour})).then(function(){})}catch(e){return Promise.reject(e)}},n.scrollBottom=function(e){try{return null==e||e.preventDefault(),Promise.resolve(Ee(this.el,{behavior:this._behaviour})).then(function(){})}catch(e){return Promise.reject(e)}},n.scrollLeft=function(e){try{return null==e||e.preventDefault(),Promise.resolve(Ce(this.el,{behavior:this._behaviour})).then(function(){})}catch(e){return Promise.reject(e)}},n.scrollRight=function(e){try{return null==e||e.preventDefault(),Promise.resolve(Ce(this.el,{behavior:this._behaviour})).then(function(){})}catch(e){return Promise.reject(e)}},n.up=function(e){try{var t=this;return null==e||e.preventDefault(),Promise.resolve(function(e,t,n){var i=(void 0===n?{}:n).behavior,s=void 0===i?"smooth":i;try{var r=function(){e.scrollBy({top:-t,left:0,behavior:s})},a=function(){if("smooth"==s&&!Te)return Promise.resolve(be()).then(function(){})}();return Promise.resolve(a&&a.then?a.then(r):r())}catch(e){return Promise.reject(e)}}(t.el,t._increment,{behavior:t._behaviour})).then(function(){})}catch(e){return Promise.reject(e)}},n.down=function(e){try{var t=this;return null==e||e.preventDefault(),Promise.resolve(function(e,t,n){var i=(void 0===n?{}:n).behavior,s=void 0===i?"smooth":i;try{var r=function(){e.scrollBy({top:t,left:0,behavior:s})},a=function(){if("smooth"==s&&!Te)return Promise.resolve(be()).then(function(){})}();return Promise.resolve(a&&a.then?a.then(r):r())}catch(e){return Promise.reject(e)}}(t.el,t._increment,{behavior:t._behaviour})).then(function(){})}catch(e){return Promise.reject(e)}},n.left=function(e){try{var t=this;return null==e||e.preventDefault(),Promise.resolve(function(e,t,n){var i=(void 0===n?{}:n).behavior,s=void 0===i?"smooth":i;try{var r=function(){e.scrollBy({top:0,left:-t,behavior:s})},a=function(){if("smooth"==s&&!Te)return Promise.resolve(be()).then(function(){})}();return Promise.resolve(a&&a.then?a.then(r):r())}catch(e){return Promise.reject(e)}}(t.el,t._increment,{behavior:t._behaviour})).then(function(){})}catch(e){return Promise.reject(e)}},n.right=function(e){try{var t=this;return null==e||e.preventDefault(),Promise.resolve(function(e,t,n){var i=(void 0===n?{}:n).behavior,s=void 0===i?"smooth":i;try{var r=function(){e.scrollBy({top:0,left:t,behavior:s})},a=function(){if("smooth"==s&&!Te)return Promise.resolve(be()).then(function(){})}();return Promise.resolve(a&&a.then?a.then(r):r())}catch(e){return Promise.reject(e)}}(t.el,t._increment,{behavior:t._behaviour})).then(function(){})}catch(e){return Promise.reject(e)}},d(t,[{key:"_increment",get:function(){return this.hasIncrementValue?this.incrementValue:50}},{key:"_behaviour",get:function(){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"}}]),t}(y);je.values={behaviour:String,increment:Number};var ze=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){ke(e.el,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.el.scrollIntoView()}),e._cleanupSelf()})},t}(b);ze.values={behavior:String,block:String,inline:String};var qe=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.scroll=function(e){try{var t=this;null==e||e.preventDefault();var n=function(){if(t._scrollTarget)return Promise.resolve(Ee(t._scrollTarget)).then(function(){})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},d(t,[{key:"_mode",get:function(){return this.hasModeValue?this.modeValue:"document"}},{key:"_scrollTarget",get:function(){return"document"==this._mode?window:Ve(this.el)}}]),t}(y);qe.values={mode:String};var We=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?ke(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(y);We.values={selector:String,behavior:String,block:String,inline:String};var Re=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.scroll=function(e){try{var t=this;null==e||e.preventDefault();var n=function(){if(t._scrollTarget)return Promise.resolve(we(t._scrollTarget)).then(function(){})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},d(t,[{key:"_mode",get:function(){return this.hasModeValue?this.modeValue:"document"}},{key:"_scrollTarget",get:function(){return"document"==this._mode?window:Ve(this.el)}}]),t}(y);Re.values={mode:String};var Ue=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._timeout=null,t}v(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e._timeout=setTimeout(function(){return e.el.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this._timeout&&clearTimeout(this._timeout)},t}(y);Ue.values={seconds:Number};var $e=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._magicElement=null,t}v(t,e);var n=t.prototype;return n.createMagicElement=function(){if(null===this._magicElement)switch(this._magicElement=document.createElement("div"),this._mode){case"top":this.el.insertAdjacentElement("beforebegin",this._magicElement);break;case"bottom":this.el.insertAdjacentElement("afterend",this._magicElement)}},n.connect=function(){var e=this;this.createMagicElement(),new IntersectionObserver(function(t){t.forEach(function(t){t.target===e._magicElement&&(0===t.intersectionRatio?e._addStuckClasses():1===t.intersectionRatio&&e._removeStuckClasses())})},{threshold:[0,1]}).observe(this._magicElement)},n._addStuckClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasStuckClass?(t=e.classList).add.apply(t,this._stuckClasses):(n=e.classList).add.apply(n,this._defaultStuckClasses)},n._removeStuckClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasStuckClass?(t=e.classList).remove.apply(t,this._stuckClasses):(n=e.classList).remove.apply(n,this._defaultStuckClasses)},d(t,[{key:"_stuckClasses",get:function(){return this.stuckClass.split(" ")}},{key:"_defaultStuckClasses",get:function(){return["stuck"]}},{key:"_mode",get:function(){return this.hasModeValue?this.modeValue:"top"}}]),t}(y);$e.classes=["stuck"],$e.values={mode:String};var Je=c.default(),Ye=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._read=this._read.bind(this),this._emit=this._emit.bind(this)},n.connect=function(){var e=this;Je.on(this._eventName,this._read),requestAnimationFrame(function(){G(e.el)&&(e._emit(),e.el.addEventListener("input",e._emit))})},n.disconnect=function(){Je.off(this._eventName,this._read),G(this.el)&&this.el.removeEventListener("input",this._emit)},n._emit=function(){Je.emit(this._eventName,{value:this._value,dispatcher:this.el})},n._read=function(e){if(void 0===e)throw new Error("No payload received");e.dispatcher!==this.el&&(this._value=e.value)},d(t,[{key:"_eventName",get:function(){return"sync:"+this._key}},{key:"_key",get:function(){if(this.hasKeyValue)return this.keyValue;throw new Error("Expected `keyValue` to be present")}},{key:"_value",get:function(){var e=this.el;return $(e)&&"checkbox"===e.type?e.checked:$(e)&&"radio"===e.type?e.checked?e.value:"":e.value},set:function(e){var t=this.el;$(t)&&"checkbox"===t.type?t.checked="true"===e.toString():$(t)&&"radio"===t.type?t.checked=t.value===e:$(t)||J(t)||K(t)?t.value=e.toString():t.innerHTML=e.toString()}}]),t}(y);Ye.values={key:String};var Ke=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._lastIndex=null,t._reverse=!1,t}v(t,e);var n=t.prototype;return n.initialize=function(){this.sort=this.sort.bind(this)},n.connect=function(){var e=this;requestAnimationFrame(function(){e._tableHeaders.forEach(function(t){return t.addEventListener("click",e.sort)}),e.hasStartSortValue&&e._sortByColumn(e.startSortValue)})},n.disconnect=function(){var e=this;this._tableHeaders.forEach(function(t){return t.removeEventListener("click",e.sort)})},n.sort=function(e){e.preventDefault();var t=this._indexOfHeaderCell(e.target);this._sortByColumn(t)},n._indexOfHeaderCell=function(e){return this._tableHeaders.indexOf(e)},n._sortByColumn=function(e){var t=this;this._reverse=e===this._lastIndex&&!this._reverse;var n=document.createDocumentFragment();this._tableRows.sort(function(n,i){var s,r,a=Array.from(n.cells),o=Array.from(i.cells),l=(null==(s=a[e])?void 0:s.innerText)||"",u=(null==(r=o[e])?void 0:r.innerText)||"",c=l.localeCompare(u,"en",{sensitivity:"base",numeric:!0,caseFirst:"upper"});return n.dataset.sortTop||i.dataset.sortBottom?n.dataset.sortTop&&i.dataset.sortTop?c:-1:n.dataset.sortBottom||i.dataset.sortTop?n.dataset.sortBottom&&i.dataset.sortBottom?c:1:t._reverse?c>0?-1:1:c}).forEach(function(e){return n.appendChild(e)}),this._tableBody.innerHTML="",this._tableBody.appendChild(n),this._lastIndex=e},d(t,[{key:"_tableHead",get:function(){var e=this.el.tHead;if(null==e)throw new Error("Expected table to have a <thead> element.");return e}},{key:"_tableHeaders",get:function(){var 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)}},{key:"_tableBody",get:function(){return this.el.tBodies[0]}},{key:"_tableRows",get:function(){return Array.from(this._tableBody.rows)}}]),t}(y);Ke.values={startSort:Number};var Xe=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this.truncate=this.truncate.bind(this),this.expand=this.expand.bind(this)},n.connect=function(){var e=this;P(this,{childList:!0,element:this._tableBody}),requestAnimationFrame(function(){e.truncate(),e.showMoreTarget.addEventListener("click",e.expand)})},n.truncate=function(e){var t=this;null==e||e.preventDefault(),this._truncated=!0,this._tableRows.length>=this._limit?(this._tableRows.slice(this._limit).forEach(function(e){e!==t.showMoreTarget&&t._hideElement(e)}),this._showElement(this.showMoreTarget)):this._hideElement(this.showMoreTarget)},n.expand=function(e){var t=this;this._truncated=!1,null==e||e.preventDefault(),this._tableRows.slice(this._limit).forEach(function(e){e!==t.showMoreTarget&&t._showElement(e)}),this._hideElement(this.showMoreTarget)},n.mutate=function(e){this._truncated&&this._reTruncate()},n._showElement=function(e){e.style.display=""},n._hideElement=function(e){e.style.display="none"},n._reTruncate=function(){var e=this;this._tableRows.slice(0,this._limit).forEach(function(t){t!==e.showMoreTarget&&e._showElement(t)}),this._tableRows.slice(this._limit).forEach(function(t){t!==e.showMoreTarget&&e._hideElement(t)}),this._showElement(this.showMoreTarget)},d(t,[{key:"_truncated",get:function(){return!!this.hasTruncatedValue&&this.truncatedValue},set:function(e){this.truncatedValue=e}},{key:"_tableBody",get:function(){return this.el.tBodies[0]}},{key:"_tableRows",get:function(){return Array.from(this._tableBody.rows)}},{key:"_limit",get:function(){return this.hasLimitValue?this.limitValue:20}}]),t}(y);Xe.targets=["showMore"],Xe.values={limit:Number,truncated:Boolean};var Ge=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this.switchTabs=this.switchTabs.bind(this)},n.connect=function(){var e=this;this.linkTargets.forEach(function(t){return t.addEventListener("click",e.switchTabs)}),this._equalize&&this._setMinHeight(),this.currentTabValue=this._currentTab},n.disconnect=function(){var e=this;this.linkTargets.forEach(function(t){return t.removeEventListener("click",e.switchTabs)})},n.switchTabs=function(e){e.preventDefault(),this.currentTabValue=this.linkTargets.indexOf(e.currentTarget)},n.currentTabValueChanged=function(){var e=this._currentTab;e=this._clampIndex(e),this._selectTab(e)},n._selectTab=function(e){var t=this;e=this._clampIndex(e);var n=this.linkTargets,i=this.contentTargets,s=i[e],r=n[e],a=[].concat(i.slice(0,e),i.slice(e+1)),o=[].concat(n.slice(0,e),n.slice(e+1));this._addActiveClasses(r),r.setAttribute("aria-selected","true"),this._addActiveClasses(s),this._removeHideClasses(s),o.forEach(function(e){e.removeAttribute("aria-selected"),t._removeActiveClasses(e)}),a.forEach(function(e){t._removeActiveClasses(e),t._addHideClasses(e)})},n._clampIndex=function(e){return s.clamp(e,0,this.contentTargets.length-1)},n._setMinHeight=function(){var e=this,t=0;this.contentTargets.forEach(function(n){var i=n.hasAttribute("tab-hidden");i&&e._removeHideClasses(n);var s=n.offsetHeight;s>t&&(t=s),i&&e._addHideClasses(n)}),this.contentTargets.forEach(function(e){return e.style.minHeight=t+"px"})},n._addHideClasses=function(e){var t,n;void 0===e&&(e=this.el),e.setAttribute("tab-hidden","true"),this.hasHideClass?(t=e.classList).add.apply(t,this._hideClasses):(n=e.classList).add.apply(n,this._defaultHideClasses)},n._removeHideClasses=function(e){var t,n;void 0===e&&(e=this.el),e.removeAttribute("tab-hidden"),this.hasHideClass?(t=e.classList).remove.apply(t,this._hideClasses):(n=e.classList).remove.apply(n,this._defaultHideClasses)},n._addActiveClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasActiveClass?(t=e.classList).add.apply(t,this._activeClasses):(n=e.classList).add.apply(n,this._defaultActiveClasses)},n._removeActiveClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasActiveClass?(t=e.classList).remove.apply(t,this._activeClasses):(n=e.classList).remove.apply(n,this._defaultActiveClasses)},d(t,[{key:"_hideClasses",get:function(){return this.hideClass.split(" ")}},{key:"_defaultHideClasses",get:function(){return["hide"]}},{key:"_activeClasses",get:function(){return this.activeClass.split(" ")}},{key:"_defaultActiveClasses",get:function(){return["is-active"]}},{key:"_currentTab",get:function(){return this.hasCurrentTabValue?this.currentTabValue:0}},{key:"_equalize",get:function(){return!!this.hasEqualizeValue&&this.equalizeValue}}]),t}(y);Ge.values={currentTab:Number,equalize:Boolean},Ge.targets=["link","content"],Ge.classes=["active","hide"];var Qe=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){null==e||e.preventDefault();var t=this.el,n=document.querySelector(this.targetValue);if(null!=n){var i=t.cloneNode(!0);switch(this.cleanup(i),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":n.insertAdjacentHTML(this.insertValue,i.outerHTML);break;case"replaceOuter":n.outerHTML=i.outerHTML;break;case"replaceInner":n.innerHTML=i.outerHTML;break;case"prepend":n.insertAdjacentHTML("afterbegin",i.outerHTML);break;case"append":n.insertAdjacentHTML("beforeend",i.outerHTML);break;default:throw new Error("`insert` value was not specified")}t.remove()}else this.dispatch(t,"teleport:error")},t}(b);Qe.values={target:String,insert:String,immediate:Boolean};var Ze=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._timeout=null,t._previousState={},t}v(t,e);var n=t.prototype;return n.initialize=function(){this.setState=this.setState.bind(this),this.removeState=this.removeState.bind(this)},n.connect=function(){this.setState(),this._timeout=setTimeout(this.removeState,this._seconds)},n.disconnect=function(){this.removeState(),this._timeout&&clearTimeout(this._timeout)},n.setState=function(){this._previousState[this._attribute]=s.get(this.el,this._attribute),s.set(this.el,this._attribute,this.valueValue)},n.removeState=function(){s.set(this.el,this._attribute,this._previousState[this._attribute])},d(t,[{key:"_value",get:function(){if(this.hasValueValue)return this.valueValue;throw new Error("Expected `valueValue` to be present")}},{key:"_attribute",get:function(){if(this.hasAttributeValue)return this.attributeValue;throw new Error("Expected `attributeValue` to be present")}},{key:"_seconds",get:function(){if(this.hasSecondsValue)return 1e3*this.secondsValue;throw new Error("Expected `secondsValue` to be present")}}]),t}(b);function et(e,t,n,i,r){var a;void 0===r&&(r="temporary-state"),e.dataset.controller&&null!=(a=e.dataset.controller)&&a.includes(r)||(e.dataset.controller=(e.dataset.controller||" "+r+" ").trim().replaceAll(" "," ")),e[s.camelCase(r+"-attribute-value")]=t,e[s.camelCase(r+"-seconds-value")]=i.toString()}Ze.values={attribute:String,seconds:Number,value:String};var tt=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._timeout=null,t}v(t,e);var n=t.prototype;return n.timestampValueChanged=function(){this._timestamp=i.toDate(1e3*this.timestampValue)},n.initialize=function(){this._update=this._update.bind(this)},n.connect=function(){if(!this.hasTimestampValue)throw new Error("Expected `timestampValue` to be present");this._update()},n.disconnect=function(){this._timeout&&window.clearTimeout(this._timeout)},n._update=function(){this.el.innerHTML=i.formatDistanceToNow(this._timestamp,{addSuffix:!0,includeSeconds:!0}),this._nextUpdate&&(this._timeout=window.setTimeout(this._update,this._nextUpdate))},d(t,[{key:"_duration",get:function(){return i.isPast(this._timestamp)?i.intervalToDuration({start:this._timestamp,end:new Date}):i.intervalToDuration({start:new Date,end:this._timestamp})}},{key:"_nextUpdate",get:function(){var 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}}]),t}(y);tt.values={timestamp:Number};var nt=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._timeoutHandle=null,t}v(t,e);var n=t.prototype;return n.initialize=function(){this._timeout=this._timeout.bind(this)},n.connect=function(){var e=this;requestAnimationFrame(function(){e._timeoutHandle=window.setTimeout(e._timeout,1e3*e.secondsValue)})},n.disconnect=function(){this._timeoutHandle&&window.clearTimeout(this._timeoutHandle)},n._timeout=function(){this.dispatch(this.el,"timeout")},t}(y);nt.values={seconds:Number};var it=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new H(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:i,events:s,eventPrefix:r}=Object.assign({},x,t),a=s=>{const a=(null==t?void 0:t.element)||e.element;if(!(a.contains(s.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=i&&t.left+t.width>=0}(a)&&n)&&(e.clickOutside&&e.clickOutside(s),i)){const t=V("click:outside",e,r),n=S(t,s,{controller:e});a.dispatchEvent(n)}},o=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==s||s.forEach(e=>{window.removeEventListener(e,a,!1)}),o()}}),null==s||s.forEach(e=>{window.addEventListener(e,a,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e._elementOn(t)}:function(t){return e._elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e._elementWasToggled(t)&&(e._elementToggleStatus(t),e._elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t._elementToggleStatus(e),t._elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t._elementToggleStatus(e),t._elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t._elementToggleStatus(e),t._elementToggle(e)})},n._elementWasToggled=function(e){return"true"==e.dataset.toggled},n._elementToggleStatus=function(e){this._elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n._elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n._elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n._elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(y);it.targets=["toggle"],it.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var st=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._nodeClicked=this._nodeClicked.bind(this)},n.connect=function(){this._setup(),P(this,{subtree:!0,childList:!0})},n.disconnect=function(){this._teardown()},n._setup=function(){this._setupNode(this.el)},n._setupNode=function(e){var t=this,n=function(e){var n=e.parentElement;n&&(t._nodeActive(n)||t._hideNode(n),n.removeEventListener("click",t._nodeClicked),n.addEventListener("click",t._nodeClicked))};"UL"!==e.tagName&&"OL"!==e.tagName||n(e),e.querySelectorAll("ul, ol").forEach(function(e){return n(e)})},n._teardown=function(){var e=this;this.el.querySelectorAll("ul, ol, li").forEach(function(t){return e._teardownNode(t)})},n._teardownNode=function(e){var t=this;[e].concat(Array.from(e.querySelectorAll("ul, ol, li"))).forEach(function(e){e.removeEventListener("click",t._nodeClicked),t._removeActiveClasses(e),t._removeCollapsedClasses(e)})},n._nodeClicked=function(e){e&&e.stopImmediatePropagation();var t=e.target;t&&this._hasNested(t)&&(this._nodeActive(t)?this._hideNode(t):this._showNode(t))},n._nodeActive=function(e){return this._activeClasses.every(function(t){return e.classList.contains(t)})},n._showNode=function(e){this._removeCollapsedClasses(e),this._addActiveClasses(e)},n._hideNode=function(e){this._removeActiveClasses(e),this._addCollapsedClasses(e)},n._hasNested=function(e){return e.querySelectorAll("ul, ol").length>0},n.mutate=function(e){for(var t,n=this,i=_(e);!(t=i()).done;){var s=t.value;"childList"===s.type&&(Array.from(s.addedNodes||[]).forEach(function(e){return n._setupNode(e)}),Array.from(s.removedNodes||[]).forEach(function(e){return n._teardownNode(e)}))}},n._addCollapsedClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasCollapsedClass?(t=e.classList).add.apply(t,this._collapsedClasses):(n=e.classList).add.apply(n,this._defaultCollapsedClasses)},n._removeCollapsedClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasCollapsedClass?(t=e.classList).remove.apply(t,this._collapsedClasses):(n=e.classList).remove.apply(n,this._defaultCollapsedClasses)},n._addActiveClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasActiveClass?(t=e.classList).add.apply(t,this._activeClasses):(n=e.classList).add.apply(n,this._defaultActiveClasses)},n._removeActiveClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasActiveClass?(t=e.classList).remove.apply(t,this._activeClasses):(n=e.classList).remove.apply(n,this._defaultActiveClasses)},d(t,[{key:"_collapsedClasses",get:function(){return this.hasCollapsedClass?this.collapsedClass.split(" "):this._defaultCollapsedClasses}},{key:"_defaultCollapsedClasses",get:function(){return["collapsed"]}},{key:"_activeClasses",get:function(){return this.hasActiveClass?this.activeClass.split(" "):this._defaultActiveClasses}},{key:"_defaultActiveClasses",get:function(){return["active"]}}]),t}(y);function rt(e){return"TURBO-FRAME"==e.nodeName}st.classes=["active","collapsed"];var at=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.toggle=function(e){null==e||e.preventDefault();var t=this._getFrame().src;null==t||t!==this._getSrc()?this._setSrc():this._clear()},n.setSrc=function(e){null==e||e.preventDefault(),this._setSrc()},n.clear=function(e){null==e||e.preventDefault(),this._clear()},n._setSrc=function(){var e=this._getFrame();this.hasLoadingMessageValue&&(e.innerHTML=this.loadingMessageValue),e.src=this._getSrc()},n._clear=function(){var e=this._getFrame();e.src="",e.innerHTML=""},n._getFrame=function(){var e=document.getElementById(""+this.frameIdValue);if(null==e)throw new Error("Could not find frame with ID '"+this.frameIdValue+"'");if(rt(e))return e;throw new Error("Element targeted by ID '"+this.frameIdValue+"'")},n._getSrc=function(){var e=this.el;if(this.hasSrcValue)return this.srcValue;if(R(e))return e.href;throw new Error("No link given to drive frame to")},t}(y);at.values={frameId:String,src:String,loadingMessage:String};var ot=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(t=e.call.apply(e,[this].concat(i))||this)._timeoutHandle=null,t}v(t,e);var n=t.prototype;return n.initialize=function(){this.refresh=this.refresh.bind(this)},n.connect=function(){var e=this,t=this.el;if(!rt(t))throw new Error("Expected controller to be mounted on a <turbo-frame> element.");if(t.src)throw new Error("The provided <turbo-frame> element has no `src` attribute.");this._poll&&requestAnimationFrame(function(){return e._timeoutHandle=setTimeout(function(){return e.refresh()},e.intervalValue)})},n.disconnect=function(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)},n.refresh=function(e){null==e||e.preventDefault();var t=this.el;t.src=t.src},d(t,[{key:"_poll",get:function(){return!!this.hasPollValue&&this.pollValue}}]),t}(y);ot.values={interval:Number,poll:Boolean};var lt=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._handleVisibility=this._handleVisibility.bind(this)},n.connect=function(){var e=this;window.addEventListener("focus",this._handleVisibility),window.addEventListener("blur",this._handleVisibility),document.addEventListener("visibilitychange",this._handleVisibility),requestAnimationFrame(function(){e._handleVisibility()})},n.disconnect=function(){window.removeEventListener("focus",this._handleVisibility),window.removeEventListener("blur",this._handleVisibility),document.removeEventListener("visibilitychange",this._handleVisibility)},n.appear=function(){this.dispatch(this.el,"user-focus:active")},n.away=function(){this.dispatch(this.el,"user-focus:away")},n._handleVisibility=function(){this._documentIsActive()?this.appear():this.away()},n._documentIsActive=function(){return"visible"==document.visibilityState&&document.hasFocus()},t}(y),ut=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._check=this._check.bind(this)},n.connect=function(){this._addWarningHideClasses(this.warningTarget),this.inputTarget.addEventListener("input",this._check),this._check()},n.disconnect=function(){this.inputTarget.removeEventListener("input",this._check)},n._check=function(){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._addWarningHideClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasWarningHideClass?(t=e.classList).add.apply(t,this._warningHideClasses):(n=e.classList).add.apply(n,this._defaultWarningHideClasses)},n._removeWarningHideClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasWarningHideClass?(t=e.classList).remove.apply(t,this._warningHideClasses):(n=e.classList).remove.apply(n,this._defaultWarningHideClasses)},n._addInputWarningClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasInputWarningClass?(t=e.classList).add.apply(t,this._inputWarningClasses):(n=e.classList).add.apply(n,this._defaultInputWarningClasses)},n._removeInputWarningClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasInputWarningClass?(t=e.classList).remove.apply(t,this._inputWarningClasses):(n=e.classList).remove.apply(n,this._defaultInputWarningClasses)},d(t,[{key:"_maxMessage",get:function(){return this.hasMaxMessageValue?this.maxMessageValue:"Value must be less than "+this.maxValue}},{key:"_minMessage",get:function(){return this.hasMinMessageValue?this.minMessageValue:"Value must be greater than "+this.minValue}},{key:"_warningHideClasses",get:function(){return this.warningHideClass.split(" ")}},{key:"_defaultWarningHideClasses",get:function(){return["hide"]}},{key:"_inputWarningClasses",get:function(){return this.inputWarningClass.split(" ")}},{key:"_defaultInputWarningClasses",get:function(){return[""]}}]),t}(y);ut.classes=["inputWarning","warningHide"],ut.targets=["input","warning"],ut.values={max:Number,min:Number,minMessage:String,maxMessage:String};var ct=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.initialize=function(){this._updateWordCount=this._updateWordCount.bind(this)},n.connect=function(){this._updateWordCount(),this.inputTarget.addEventListener("input",this._updateWordCount)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this._updateWordCount)},n._updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this._isValidCount(e)?this._removeErrorClasses(this.outputTarget):this._addErrorClasses(this.outputTarget))},n._addErrorClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasErrorClass?(t=e.classList).add.apply(t,this._errorClasses):(n=e.classList).add.apply(n,this._defaultErrorClasses)},n._removeErrorClasses=function(e){var t,n;void 0===e&&(e=this.el),this.hasErrorClass?(t=e.classList).remove.apply(t,this._errorClasses):(n=e.classList).remove.apply(n,this._defaultErrorClasses)},n._isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},d(t,[{key:"_errorClasses",get:function(){return this.errorClass.split(" ")}},{key:"_defaultErrorClasses",get:function(){return[]}}]),t}(y);ct.targets=["input","output"],ct.values={min:Number,max:Number},ct.classes=["error"],e.AnchorSpyController=C,e.AsyncBlockController=w,e.AutoSubmitFormController=k,e.AutosizeController=F,e.BackLinkController=B,e.BaseController=y,e.CharCountController=j,e.CheckboxSelectAllController=z,e.ClipboardController=q,e.ClockController=W,e.ConfirmController=Q,e.ConfirmNavigationController=Z,e.CountdownController=ee,e.DebugController=te,e.DetectDirtyController=ne,e.DetectDirtyFormController=ie,e.DisableInputsController=re,e.DisableWithController=ae,e.DismissableController=oe,e.DurationController=ue,e.ElementSaveController=ce,e.EmptyDomController=he,e.EnableInputsController=de,e.EphemeralController=b,e.FallbackImageController=fe,e.FormRcController=ve,e.FormSaveController=me,e.IntersectionController=pe,e.IntervalController=ge,e.LazyBlockController=ye,e.LightboxImageController=Se,e.LimitedSelectionCheckboxesController=Le,e.LoadBlockController=E,e.MediaPlayerController=Ae,e.NavigateFormErrorsController=xe,e.NestedFormController=De,e.PasswordConfirmController=Ie,e.PasswordPeekController=He,e.PollBlockController=Ne,e.PrefetchController=Pe,e.PresenceController=Me,e.RemoteFormController=Oe,e.RemoveController=le,e.ResponsiveIframeBodyController=Be,e.ResponsiveIframeWrapperController=Fe,e.ScrollContainerController=je,e.ScrollIntoFocusController=ze,e.ScrollToBottomController=qe,e.ScrollToController=We,e.ScrollToTopController=Re,e.SelfDestructController=Ue,e.StickyController=$e,e.SyncInputsController=Ye,e.TableSortController=Ke,e.TableTruncateController=Xe,e.TabsController=Ge,e.TeleportController=Qe,e.TemporaryStateController=Ze,e.TimeDistanceController=tt,e.TimeoutController=nt,e.ToggleClassController=it,e.TreeViewController=st,e.TurboFrameRCController=at,e.TurboFrameRefreshController=ot,e.UserFocusController=lt,e.ValueWarnController=ut,e.WordCountController=ct,e.applyTemporaryClass=function(e,t,n){et(e,"className",0,n)},e.applyTemporaryState=et,e.isDirty=function(e){return e.hasAttribute("data-dirty")},e.isFormDirty=se});
1
+ var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,i)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,__spreadValues=(e,t)=>{for(var i in t||(t={}))__hasOwnProp.call(t,i)&&__defNormalProp(e,i,t[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(t))__propIsEnum.call(t,i)&&__defNormalProp(e,i,t[i]);return e},__objRest=(e,t)=>{var i={};for(var s in e)__hasOwnProp.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&__getOwnPropSymbols)for(var s of __getOwnPropSymbols(e))t.indexOf(s)<0&&__propIsEnum.call(e,s)&&(i[s]=e[s]);return i},__publicField=(e,t,i)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,i),i);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("date-fns"),require("lodash-es")):"function"==typeof define&&define.amd?define(["exports","date-fns","lodash-es"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["Stimulus-Library"]={},e.dateFns,e.lodashEs)}(this,(function(e,t,i){"use strict";var s=function(){function e(e,t,i){this.eventTarget=e,this.eventName=t,this.eventOptions=i,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),i=0,s=this.bindings;i<s.length;i++){var r=s[i];if(t.immediatePropagationStopped)break;r.handleEvent(t)}},Object.defineProperty(e.prototype,"bindings",{get:function(){return Array.from(this.unorderedBindings).sort((function(e,t){var i=e.index,s=t.index;return i<s?-1:i>s?1:0}))},enumerable:!1,configurable:!0}),e}();var r=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,i){void 0===i&&(i={}),this.application.handleError(e,"Error "+t,i)},e.prototype.fetchEventListenerForBinding=function(e){var t=e.eventTarget,i=e.eventName,s=e.eventOptions;return this.fetchEventListener(t,i,s)},e.prototype.fetchEventListener=function(e,t,i){var s=this.fetchEventListenerMapForEventTarget(e),r=this.cacheKey(t,i),n=s.get(r);return n||(n=this.createEventListener(e,t,i),s.set(r,n)),n},e.prototype.createEventListener=function(e,t,i){var r=new s(e,t,i);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 i=[e];return Object.keys(t).sort().forEach((function(e){i.push((t[e]?"":"!")+e)})),i.join(":")},e}(),n=/^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;function o(e){return"window"==e?window:"document"==e?document:void 0}var a=function(){function e(e,t,i){this.element=e,this.index=t,this.eventTarget=i.eventTarget||e,this.eventName=i.eventName||function(e){var t=e.tagName.toLowerCase();if(t in l)return l[t](e)}(e)||c("missing event name"),this.eventOptions=i.eventOptions||{},this.identifier=i.identifier||c("missing identifier"),this.methodName=i.methodName||c("missing method name")}return e.forToken=function(e){return new this(e.element,e.index,(t=e.content,{eventTarget:o((s=t.trim().match(n)||[])[4]),eventName:s[2],eventOptions:s[9]?(i=s[9],i.split(":").reduce((function(e,t){var i;return Object.assign(e,((i={})[t.replace(/^!/,"")]=!/^!/.test(t),i))}),{})):{},identifier:s[5],methodName:s[7]}));var t,i,s},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}(),l={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 c(e){throw new Error(e)}var h=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(s){var t=this,i={identifier:t.identifier,controller:t.controller,element:t.element,index:t.index,event:e};this.context.handleError(s,'invoking action "'+this.action+'"',i)}},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}(),u=function(){function e(e,t){var i=this;this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver((function(e){return i.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,i=Array.from(this.elements);t<i.length;t++){var s=i[t];e.has(s)||this.removeElement(s)}for(var r=0,n=Array.from(e);r<n.length;r++){s=n[r];this.addElement(s)}}},e.prototype.processMutations=function(e){if(this.started)for(var t=0,i=e;t<i.length;t++){var s=i[t];this.processMutation(s)}},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 i=e;this.elements.has(i)?this.delegate.elementAttributeChanged&&this.matchElement(i)?this.delegate.elementAttributeChanged(i,t):this.removeElement(i):this.matchElement(i)&&this.addElement(i)},e.prototype.processRemovedNodes=function(e){for(var t=0,i=Array.from(e);t<i.length;t++){var s=i[t],r=this.elementFromNode(s);r&&this.processTree(r,this.removeElement)}},e.prototype.processAddedNodes=function(e){for(var t=0,i=Array.from(e);t<i.length;t++){var s=i[t],r=this.elementFromNode(s);r&&this.elementIsActive(r)&&this.processTree(r,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 i=0,s=this.matchElementsInTree(e);i<s.length;i++){var r=s[i];t.call(this,r)}},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}(),d=function(){function e(e,t,i){this.attributeName=t,this.delegate=i,this.elementObserver=new u(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]:[],i=Array.from(e.querySelectorAll(this.selector));return t.concat(i)},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}(),p=function(){function e(e,t){var i=this;this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((function(e){return i.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 i=t[e];this.refreshAttribute(i)}},e.prototype.processMutations=function(e){if(this.started)for(var t=0,i=e;t<i.length;t++){var s=i[t];this.processMutation(s)}},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 i=this.element.getAttribute(e);this.stringMap.get(e)!=i&&this.stringMapValueChanged(i,t),null==i?(this.stringMap.delete(e),this.stringMapKeyRemoved(t,e)):this.stringMap.set(e,i)}},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 m(e,t,i){g(e,t).add(i)}function f(e,t,i){g(e,t).delete(i),function(e,t){var i=e.get(t);null!=i&&0==i.size&&e.delete(t)}(e,t)}function g(e,t){var i=e.get(t);return i||(i=new Set,e.set(t,i)),i}var b,v=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){m(this.valuesByKey,e,t)},e.prototype.delete=function(e,t){f(this.valuesByKey,e,t)},e.prototype.has=function(e,t){var i=this.valuesByKey.get(e);return null!=i&&i.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}(),_=(b=function(e,t){return(b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});!function(e){function t(){var t=e.call(this)||this;return t.keysByValue=new Map,t}_(t,e),Object.defineProperty(t.prototype,"values",{get:function(){return Array.from(this.keysByValue.keys())},enumerable:!1,configurable:!0}),t.prototype.add=function(t,i){e.prototype.add.call(this,t,i),m(this.keysByValue,i,t)},t.prototype.delete=function(t,i){e.prototype.delete.call(this,t,i),f(this.keysByValue,i,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):[]}}(v);var y=function(){function e(e,t,i){this.attributeObserver=new d(e,t,this),this.delegate=i,this.tokensByElement=new v}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),i=t[0],s=t[1];this.tokensUnmatched(i),this.tokensMatched(s)},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,i,s,r=this.tokensByElement.getValuesForKey(e),n=this.readTokensForElement(e),o=(t=r,i=n,s=Math.max(t.length,i.length),Array.from({length:s},(function(e,s){return[t[s],i[s]]}))).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?[[],[]]:[r.slice(o),n.slice(o)]},e.prototype.readTokensForElement=function(e){var t=this.attributeName;return function(e,t,i){return e.trim().split(/\s+/).filter((function(e){return e.length})).map((function(e,s){return{element:t,attributeName:i,content:e,index:s}}))}(e.getAttribute(t)||"",e,t)},e}();var w=function(){function e(e,t,i){this.tokenListObserver=new y(e,t,this),this.delegate=i,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,i=this.fetchParseResultForToken(e).value;i&&(this.fetchValuesByTokenForElement(t).set(e,i),this.delegate.elementMatchedValue(t,i))},e.prototype.tokenUnmatched=function(e){var t=e.element,i=this.fetchParseResultForToken(e).value;i&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,i))},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}(),E=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 w(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 h(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=a.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}(),C=function(){function e(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new p(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 i=t[e],s=i.key,r=i.name;null==i.defaultValue||this.controller.data.has(s)||this.invokeChangedCallbackForValue(r)}},e.prototype.invokeChangedCallbackForValue=function(e){var t=e+"Changed",i=this.receiver[t];if("function"==typeof i){var s=this.receiver[e];i.call(this.receiver,s)}},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}(),T=function(){function e(e,t){this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new E(this,this.dispatcher),this.valueObserver=new C(this,this.controller);try{this.controller.initialize()}catch(i){this.handleError(i,"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,i){void 0===i&&(i={});var s=this,r=s.identifier,n=s.controller,o=s.element;i=Object.assign({identifier:r,controller:n,element:o},i),this.application.handleError(e,"Error "+t,i)},e}();function k(e,t){var i=A(e);return Array.from(i.reduce((function(e,i){return function(e,t){var i=e[t];return Array.isArray(i)?i:[]}(i,t).forEach((function(t){return e.add(t)})),e}),new Set))}function S(e,t){return A(e).reduce((function(e,i){return e.push.apply(e,function(e,t){var i=e[t];return i?Object.keys(i).map((function(e){return[e,i[e]]})):[]}(i,t)),e}),[])}function A(e){for(var t=[];e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}var L=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}();function V(e){return function(e,t){var i=O(e),s=function(e,t){return x(t).reduce((function(i,s){var r,n=function(e,t,i){var s=Object.getOwnPropertyDescriptor(e,i);if(!s||!("value"in s)){var r=Object.getOwnPropertyDescriptor(t,i).value;return s&&(r.get=s.get||r.get,r.set=s.set||r.set),r}}(e,t,s);return n&&Object.assign(i,((r={})[s]=n,r)),i}),{})}(e.prototype,t);return Object.defineProperties(i.prototype,s),i}(e,function(e){return k(e,"blessings").reduce((function(t,i){var s=i(e);for(var r in s){var n=t[r]||{};t[r]=Object.assign(n,s[r])}return t}),{})}(e))}var x="function"==typeof Object.getOwnPropertySymbols?function(e){return function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var s=Array(e),r=0;for(t=0;t<i;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,r++)s[r]=n[o];return s}(Object.getOwnPropertyNames(e),Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,O=function(){function e(e){function t(){var i=this&&this instanceof t?this.constructor:void 0;return Reflect.construct(e,arguments,i)}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(i){return function(e){return function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return L(t,e),t}(e)}}var t}();var M=function(){function e(e,t){this.application=e,this.definition=function(e){return{identifier:e.identifier,controllerConstructor:V(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 T(this,e),this.contextsByScope.set(e,t)),t},e}(),F=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 D(e){return e.replace(/(?:[_-])([a-z0-9])/g,(function(e,t){return t.toUpperCase()}))}function N(e){return e.charAt(0).toUpperCase()+e.slice(1)}function I(e){return e.replace(/([A-Z])/g,(function(e,t){return"-"+t.toLowerCase()}))}var P=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 i=this.getAttributeNameForKey(e);return this.element.setAttribute(i,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+"-"+I(e)},e}(),B=function(){function e(e){this.warnedKeysByObject=new WeakMap,this.logger=e}return e.prototype.warn=function(e,t,i){var s=this.warnedKeysByObject.get(e);s||(s=new Set,this.warnedKeysByObject.set(e,s)),s.has(t)||(s.add(t),this.logger.warn(i,e))},e}();function j(e,t){return"["+e+'~="'+t+'"]'}var H=function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var s=Array(e),r=0;for(t=0;t<i;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,r++)s[r]=n[o];return s},R=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=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return t.reduce((function(t,i){return t||e.findTarget(i)||e.findLegacyTarget(i)}),void 0)},e.prototype.findAll=function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return t.reduce((function(t,i){return H(t,e.findAllTargets(i),e.findAllLegacyTargets(i))}),[])},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 j("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,i=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(i).map((function(i){return t.deprecate(i,e)}))},e.prototype.getLegacySelectorForTargetName=function(e){var t=this.identifier+"."+e;return j(this.schema.targetAttribute,t)},e.prototype.deprecate=function(e,t){if(e){var i=this.identifier,s=this.schema.targetAttribute;this.guide.warn(e,"target:"+t,"Please replace "+s+'="'+i+"."+t+'" with data-'+i+'-target="'+t+'". The '+s+" 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}(),z=function(){function e(e,t,i,s){var r=this;this.targets=new R(this),this.classes=new F(this),this.data=new P(this),this.containsElement=function(e){return e.closest(r.controllerSelector)===r.element},this.schema=e,this.element=t,this.identifier=i,this.guide=new B(s)}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,i=arguments.length;t<i;t++)e+=arguments[t].length;var s=Array(e),r=0;for(t=0;t<i;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,r++)s[r]=n[o];return s}(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 j(this.schema.controllerAttribute,this.identifier)},enumerable:!1,configurable:!0}),e}(),q=function(){function e(e,t,i){this.element=e,this.schema=t,this.delegate=i,this.valueListObserver=new w(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,i=e.content,s=this.fetchScopesByIdentifierForElement(t),r=s.get(i);return r||(r=this.delegate.createScopeForElementAndIdentifier(t,i),s.set(i,r)),r},e.prototype.elementMatchedValue=function(e,t){var i=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,i),1==i&&this.delegate.scopeConnected(t)},e.prototype.elementUnmatchedValue=function(e,t){var i=this.scopeReferenceCounts.get(t);i&&(this.scopeReferenceCounts.set(t,i-1),1==i&&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}(),$=function(){function e(e){this.application=e,this.scopeObserver=new q(this.element,this.schema,this),this.scopesByIdentifier=new v,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 M(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 i=this.modulesByIdentifier.get(t);if(i)return i.contexts.find((function(t){return t.element==e}))},e.prototype.handleError=function(e,t,i){this.application.handleError(e,t,i)},e.prototype.createScopeForElementAndIdentifier=function(e,t){return new z(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}(),W={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target"},U=function(e,t,i,s){return new(i||(i=Promise))((function(r,n){function o(e){try{l(s.next(e))}catch(t){n(t)}}function a(e){try{l(s.throw(e))}catch(t){n(t)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))},K=function(e,t){var i,s,r,n,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,s&&(r=2&n[0]?s.return:n[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,n[1])).done)return r;switch(s=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,s=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){o.label=n[1];break}if(6===n[0]&&o.label<r[1]){o.label=r[1],r=n;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(n);break}r[2]&&o.ops.pop(),o.trys.pop();continue}n=t.call(e,o)}catch(a){n=[6,a],s=0}finally{i=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}},J=function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var s=Array(e),r=0;for(t=0;t<i;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,r++)s[r]=n[o];return s};function Y(e){return k(e,"classes").reduce((function(e,t){return Object.assign(e,((s={})[r=(i=t)+"Class"]={get:function(){var e=this.classes;if(e.has(i))return e.get(i);var t=e.getAttributeName(i);throw new Error('Missing attribute "'+t+'"')}},s["has"+N(r)]={get:function(){return this.classes.has(i)}},s));var i,s,r}),{})}function Z(e){return k(e,"targets").reduce((function(e,t){return Object.assign(e,((s={})[(i=t)+"Target"]={get:function(){var e=this.targets.find(i);if(e)return e;throw new Error('Missing target element "'+this.identifier+"."+i+'"')}},s[i+"Targets"]={get:function(){return this.targets.findAll(i)}},s["has"+N(i)+"Target"]={get:function(){return this.targets.has(i)}},s));var i,s}),{})}function X(e){var t=S(e,"values"),i={valueDescriptorMap:{get:function(){var e=this;return t.reduce((function(t,i){var s,r=G(i),n=e.data.getAttributeNameForKey(r.key);return Object.assign(t,((s={})[n]=r,s))}),{})}}};return t.reduce((function(e,t){return Object.assign(e,function(e){var t,i=G(e),s=i.type,r=i.key,n=i.name,o=ee[s],a=te[s]||te.default;return(t={})[n]={get:function(){var e=this.data.get(r);return null!==e?o(e):i.defaultValue},set:function(e){void 0===e?this.data.delete(r):this.data.set(r,a(e))}},t["has"+N(n)]={get:function(){return this.data.has(r)}},t}(t))}),i)}function G(e){return function(e,t){var i=I(e)+"-value";return{type:t,key:i,name:D(i),get defaultValue(){return Q[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=W),this.logger=console,this.element=e,this.schema=t,this.dispatcher=new r(this),this.router=new $(this)}e.start=function(t,i){var s=new e(t,i);return s.start(),s},e.prototype.start=function(){return U(this,void 0,void 0,(function(){return K(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,i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];var r=Array.isArray(e)?e:J([e],i);r.forEach((function(e){return t.router.loadDefinition(e)}))},e.prototype.unload=function(e){for(var t=this,i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];var r=Array.isArray(e)?e:J([e],i);r.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 i=this.router.getContextForElementAndIdentifier(e,t);return i?i.controller:null},e.prototype.handleError=function(e,t,i){this.logger.error("%s\n\n%o\n\n%o",t,e,i)}}();var Q={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},ee={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}},te={default:function(e){return""+e},array:ie,object:ie};function ie(e){return JSON.stringify(e)}var se=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=[Y,Z,X],e.targets=[],e.values={},e}();class re extends se{constructor(e){return super(e),this.application.debug?new Proxy(this,{get:(e,t)=>{let i=Reflect.get(e,t),s=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 i)return new Proxy(i,{apply:(e,i,r)=>(s.log(t.toString(),{args:r}),Reflect.apply(e,i,r))});this.log(t.toString())}return i}}):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,i={}){let s=Object.assign({},{bubbles:!0,cancelable:!0,detail:{target:e}},i);s.detail.target&&(s.detail.target=e);let r=new CustomEvent(t,s);this.logEvent(t,r,e),e.dispatchEvent(r)}log(e,t={}){if(!this.application.debug)return;let i=console;i.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: #3B82F6","color: unset"),i.log(__spreadValues({element:this.element,controller:this},t)),i.groupEnd()}warn(e,t={}){if(!this.application.debug)return;let i=console;i.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: F39B1AFF","color: unset"),i.warn(__spreadValues({element:this.element,controller:this},t)),i.groupEnd()}logEvent(e,t,i){if(!this.application.debug)return;let s=console;s.groupCollapsed(`%c${this.identifier} %c${e}%c`,"color: #3B82F6","color: #0be000","color: unset"),s.log({element:i}),s.groupEnd()}}var ne={exports:{}};const oe=(e,t)=>{if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");if(t=__spreadValues({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 i=!1,s=!1,r=!1;for(let n=0;n<e.length;n++){const o=e[n];i&&/[\p{Lu}]/u.test(o)?(e=e.slice(0,n)+"-"+e.slice(n),i=!1,r=s,s=!0,n++):s&&r&&/[\p{Ll}]/u.test(o)?(e=e.slice(0,n-1)+"-"+e.slice(n-1),r=s,s=!1,i=!0):(i=o.toLocaleLowerCase(t)===o&&o.toLocaleUpperCase(t)!==o,r=s,s=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,i)=>i.toLocaleUpperCase(t.locale))).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(e=>e.toLocaleUpperCase(t.locale))))(e,t)};ne.exports=oe,ne.exports.default=oe;var ae=ne.exports;class le extends re{_cleanupSelf(){this.cleanup(this.el)}cleanup(e){var t,i,s;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 r=new RegExp(`(s|^)${this.identifier}\\..+?(s|$)`,"g");e.dataset.target=(null==(i=e.dataset.target)?void 0:i.replaceAll(r,""))||"",delete e.dataset[ae(`${this.identifier}-target`)],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(s=e.dataset.target)?void 0:s.replaceAll(r,""))||"",delete e.dataset[ae(`${this.identifier}-action`)],""==e.dataset.action&&delete e.dataset.action;let n=this.constructor.values;n&&Object.keys(n).forEach((t=>delete e.dataset[ae(`${this.identifier}-${t}-value`)]));let o=this.constructor.classes;o&&Object.keys(o).forEach((t=>delete e.dataset[ae(`${this.identifier}-${t}-class`)]))}}class ce extends re{get _key(){return this.keyValue.replaceAll("#","")}get _anchor(){return window.location.hash.substr(1)}set _anchor(e){window.location.hash=e}initialize(){this._checkAnchor=this._checkAnchor.bind(this)}connect(){requestAnimationFrame((()=>{this._checkAnchor(),window.addEventListener("hashchange",this._checkAnchor)}))}disconnect(){window.removeEventListener("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")}}__publicField(ce,"values",{key:String});class he extends re{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}connect(){}async loadContent(e=null){null==e||e.preventDefault();let t=this,i=this.hasReplaceTarget?this.replaceTarget:this.el,s=()=>{i.replaceWith(this._errorMessage),t.dispatch(i,"ajax:error")};try{let e=await fetch(this.endpointValue);e.ok||s();let r=await e.text(),n=document.createElement("div");if(n.innerHTML=r,this.hasSelectorValue){let e=n.querySelectorAll(this.selectorValue);i.replaceWith(...e)}else i.replaceWith(...n.children);t.dispatch(i,"ajax:success")}catch(r){s()}finally{t.dispatch(i,"ajax:complete")}}}__publicField(he,"targets",["replace"]),__publicField(he,"values",{endpoint:String,errorMessage:String,selector:String});class ue extends he{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}async connect(){await this.loadContent()}}function de(e){return"A"==e.nodeName}function pe(e){return"FORM"==e.nodeName}function me(e){return"INPUT"==e.nodeName}function fe(e){return"TEXTAREA"==e.nodeName}function ge(e){return"BUTTON"==e.nodeName}function be(e){return"SELECT"==e.nodeName}function ve(e){return me(e)&&("radio"===e.type||"checkbox"===e.type)}function _e(e){return me(e)||be(e)||fe(e)}function ye(e){let t=document.createElement("button");return t.type=e,t.style.display="none",t.dataset.sythentic="true",t}function we(e){if(e.requestSubmit)e.requestSubmit();else{let t=e.querySelector('button[type="submit"]');t||(t=t=ye("submit"),e.insertAdjacentElement("beforeend",t)),t.click()}}__publicField(ue,"targets",["replace"]),__publicField(ue,"values",{endpoint:String,errorMessage:String,selector:String});class Ee extends re{get _mode(){if(this.hasModeValue){if(!["direct","request"].includes(this.modeValue))throw new Error(`The modeValue provided '${this.modeValue}' is not one of the recognised configuration options`);return this.modeValue}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)}initialize(){this.submit=this.submit.bind(this)}connect(){this.inputElements.forEach((e=>e.addEventListener("change",this.submit)))}disconnect(){this.inputElements.forEach((e=>e.removeEventListener("change",this.submit)))}submit(){let e=this.el;"request"==this._mode?we(e):e.submit()}}__publicField(Ee,"values",{mode:String});const Ce=(e,t)=>{const i=e[t];return"function"==typeof i?i:(...e)=>{}},Te=(e,t,i)=>{let s=e;return!0===i?s=`${t.identifier}:${e}`:"string"==typeof i&&(s=`${i}:${e}`),s},ke=(e,t,i)=>{const{bubbles:s,cancelable:r,composed:n}=t||{bubbles:!0,cancelable:!0,composed:!0};t&&Object.assign(i,{originalEvent:t});return new CustomEvent(e,{bubbles:s,cancelable:r,composed:n,detail:i})};const Se={dispatchEvent:!0,eventPrefix:!0},Ae=(e,t={})=>{const{dispatchEvent:i,eventPrefix:s}=Object.assign({},Se,t),r=(null==t?void 0:t.element)||e.element,n=t=>{if(e.isVisible=!0,Ce(e,"appear").call(e,t),i){const i=Te("appear",e,s),n=ke(i,null,{controller:e,entry:t});r.dispatchEvent(n)}},o=t=>{if(e.isVisible=!1,Ce(e,"disappear").call(e,t),i){const i=Te("disappear",e,s),n=ke(i,null,{controller:e,entry:t});r.dispatchEvent(n)}},a=e.disconnect.bind(e),l=new IntersectionObserver((t=>{const[i]=t;i.isIntersecting?n(i):e.isVisible&&o(i)}),t),c=()=>{l.observe(r)},h=()=>{l.unobserve(r)};return Object.assign(e,{isVisible:!1,disconnect(){h(),a()}}),c(),[c,h]},Le={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},Ve=(e,t={})=>{const{onlyVisible:i,dispatchEvent:s,events:r,eventPrefix:n}=Object.assign({},Le,t),o=r=>{const o=(null==t?void 0:t.element)||e.element;if(!(o.contains(r.target)||!function(e){const t=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,r=t.top<=i&&t.top+t.height>=0,n=t.left<=s&&t.left+t.width>=0;return r&&n}(o)&&i)&&(e.clickOutside&&e.clickOutside(r),s)){const t=Te("click:outside",e,n),i=ke(t,r,{controller:e});o.dispatchEvent(i)}},a=()=>{null==r||r.forEach((e=>{window.addEventListener(e,o,!1)}))},l=()=>{null==r||r.forEach((e=>{window.removeEventListener(e,o,!1)}))},c=e.disconnect.bind(e);return Object.assign(e,{disconnect(){l(),c()}}),a(),[a,l]},xe={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class Oe{constructor(e,t={}){var i,s,r;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(__spreadValues({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.dispatch=(e,t={})=>{if(this.dispatchEvent){const i=t,{event:s}=i,r=__objRest(i,["event"]),n=this.extendedEvent(e,s||null,r);this.targetElement.dispatchEvent(n),this.log("dispatchEvent",__spreadValues({eventName:n.type},r))}},this.call=(e,t={})=>{const i=this.controller[e];if("function"==typeof i)return i.call(this.controller,t)},this.extendedEvent=(e,t,i)=>{const{bubbles:s,cancelable:r,composed:n}=t||{bubbles:!0,cancelable:!0,composed:!0};t&&Object.assign(i,{originalEvent:t});return new CustomEvent(this.composeEventName(e),{bubbles:s,cancelable:r,composed:n,detail:i})},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!==(s=null!==(i=null==t?void 0:t.debug)&&void 0!==i?i:e.application.stimulusUseDebug)&&void 0!==s?s:xe.debug,this.logger=null!==(r=null==t?void 0:t.logger)&&void 0!==r?r:xe.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.targetElement=(null==t?void 0:t.element)||e.element;const{dispatchEvent:n,eventPrefix:o}=Object.assign({},xe,t);Object.assign(this,{dispatchEvent:n,eventPrefix:o}),this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class Me extends Oe{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 Fe extends Oe{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 De=(e,t={})=>{const i=new Fe(e,t);return[i.observe,i.unobserve]},Ne=e=>{const t=t=>{const{innerWidth:i,innerHeight:s}=window,r={height:s||1/0,width:i||1/0,event:t};Ce(e,"windowResize").call(e,r)},i=e.disconnect.bind(e),s=()=>{window.addEventListener("resize",t),t()},r=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){r(),i()}}),s(),[s,r]};(class extends se{}).debounces=[];const Ie=(e,t=200)=>{let i=null;return function(){const s=arguments,r=this,n=()=>e.apply(r,s);i&&clearTimeout(i),i=setTimeout(n,t)}};class Pe extends re{constructor(){super(...arguments),__publicField(this,"_timeoutHandle",null)}get _pages(){return this.hasPagesValue?Math.abs(this.pagesValue):1}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1500}initialize(){this.goBack=this.goBack.bind(this),this.fallback=this.fallback.bind(this)}connect(){this.el.addEventListener("click",this.goBack)}disconnect(){this.el.removeEventListener("click",this.goBack),this._timeoutHandle&&clearTimeout(this._timeoutHandle)}goBack(e){null==e||e.preventDefault(),history.go(-this._pages),this.el.href&&(this._timeoutHandle=setTimeout(this.fallback,this._timeout))}fallback(){window.location.href=this.el.href}}__publicField(Pe,"values",{timeout:Number,pages:Number});class Be extends re{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}initialize(){this._updateCharCount=this._updateCharCount.bind(this)}connect(){requestAnimationFrame((()=>{this.inputTarget.addEventListener("input",this._updateCharCount),this._updateCharCount()}))}disconnect(){this.inputTarget.removeEventListener("input",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,i=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=t&&e<=i}}__publicField(Be,"targets",["input","output"]),__publicField(Be,"values",{min:Number,max:Number}),__publicField(Be,"classes",["error"]);class je extends re{get _checked(){return this.checkboxTargets.filter((e=>e.checked))}get _unchecked(){return this.checkboxTargets.filter((e=>!e.checked))}initialize(){this._toggle=this._toggle.bind(this),this._refresh=this._refresh.bind(this)}connect(){requestAnimationFrame((()=>{this.hasSelectAllTarget&&(this.selectAllTarget.addEventListener("change",this._toggle),this.checkboxTargets.forEach((e=>e.addEventListener("change",this._refresh))),this._refresh())}))}disconnect(){this.hasSelectAllTarget&&(this.selectAllTarget.removeEventListener("change",this._toggle),this.checkboxTargets.forEach((e=>e.removeEventListener("change",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}}__publicField(je,"targets",["selectAll","checkbox"]);class He extends re{constructor(){super(...arguments),__publicField(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")}}__publicField(He,"targets",["source","button","copy","fallback"]),__publicField(He,"values",{removeUnused:Boolean});class Re extends re{constructor(){super(...arguments),__publicField(this,"_intervalHandle",null)}get _tickInterval(){return this.hasMillisecondsTarget?1:this.hasSecondsTarget?1e3:this.hasMinutesTarget?15e3:3e5}initialize(){this._tick=this._tick.bind(this)}connect(){requestAnimationFrame((()=>{this._intervalHandle=window.setInterval(this._tick,this._tickInterval)}))}disconnect(){this._intervalHandle&&window.clearInterval(this._intervalHandle)}_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"))}}__publicField(Re,"targets",["hours","minutes","seconds","milliseconds"]);class ze extends re{get _message(){return this.hasMessageValue?this.messageValue:"Are you sure?"}initialize(){this.confirm=this.confirm.bind(this)}connect(){requestAnimationFrame((()=>{let e=this.el;if(pe(e))e.addEventListener("submit",this.confirm);else{if(!de(e))throw new Error("Can't handle confirmation on attached element");e.addEventListener("click",this.confirm)}}))}disconnect(){let e=this.el;pe(e)?e.removeEventListener("submit",this.confirm):de(e)&&e.removeEventListener("click",this.confirm)}confirm(e){window.confirm(this._message)||(e.preventDefault(),this.dispatch(this.el,"confirm:cancelled"))}}__publicField(ze,"values",{message:String});class qe extends re{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,window.addEventListener("popstate",this.confirmNavigation),window.addEventListener("submit",this.allowSubmit),window.addEventListener("turbolinks:before-visit",this.confirmTurboNavigation),window.addEventListener("turbo:before-visit",this.confirmTurboNavigation)}disconnect(){window.removeEventListener("popstate",this.confirmNavigation),window.onbeforeunload=null,window.removeEventListener("submit",this.allowSubmit),window.removeEventListener("turbolinks:before-visit",this.confirmTurboNavigation),window.removeEventListener("turbo:before-visit",this.confirmTurboNavigation)}allowSubmit(e){window.removeEventListener("popstate",this.confirmNavigation),window.onbeforeunload=null}confirmNavigation(e){return!1}confirmTurboNavigation(e){confirm(this._message)||e.preventDefault()}}__publicField(qe,"values",{message:String});class $e extends re{constructor(){super(...arguments),__publicField(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 i={};t.isPast(this._deadlineDate)?(i={years:0,months:0,days:0,hours:0,minutes:0,seconds:0},this._clearTick(),this._removeCountingDownClasses(),this._addEndedClasses(),this.dispatch(this.el,"countdown:ended")):i=t.intervalToDuration({start:this._deadlineDate,end:e}),this.hasYearsTarget&&this._updateTarget(this.yearsTarget,this._years(i)),this.hasMonthsTarget&&this._updateTarget(this.monthsTarget,this._months(i)),this.hasDaysTarget&&this._updateTarget(this.daysTarget,this._days(i)),this.hasHoursTarget&&this._updateTarget(this.hoursTarget,this._hours(i)),this.hasMinutesTarget&&this._updateTarget(this.minutesTarget,this._minutes(i)),this.hasSecondsTarget&&this._updateTarget(this.secondsTarget,this._seconds(i))}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)}}__publicField($e,"values",{deadline:String,removeUnused:Boolean}),__publicField($e,"targets",["years","months","days","hours","minutes","seconds"]),__publicField($e,"classes",["countingDown","ended"]);class We extends re{connect(){console.log("Debug Controller",this,this.testTargets)}}__publicField(We,"targets",["test"]);function Ue(e){return e.hasAttribute("data-dirty")}class Ke extends re{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()}disableInputs(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(((t,i)=>{e&&(t.value=""),t.disabled=!0}))}enableInputs(){this.disableTargets.forEach(((e,t)=>{e.disabled=!1}))}}__publicField(Ke,"targets",["disabler","disable"]),__publicField(Ke,"values",{clear:Boolean});class Je extends re{constructor(){super(...arguments),__publicField(this,"_cacheText"),__publicField(this,"_timeoutHandle")}get _message(){return this.hasMessageValue?this.messageValue:"Submitting..."}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1e3}initialize(){this.enable=this.enable.bind(this),this.disable=this.disable.bind(this),this._enable=this._enable.bind(this),this._disable=this._disable.bind(this)}connect(){requestAnimationFrame((()=>{this.el.addEventListener("click",this.disable),window.addEventListener("turbo:load",this._enable),window.addEventListener("turbolinks:load",this._enable)}))}disconnect(){this._timeoutHandle&&clearTimeout(this._timeoutHandle),this.el.removeEventListener("click",this.disable),window.addEventListener("turbo:load",this._enable),window.addEventListener("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(),setTimeout(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 me(e)&&"submit"==e.type||ge(e)?e.disabled:"true"==e.dataset.disabled}_getElText(e){return me(e)&&"submit"==e.type?e.value:e.innerText}_setElText(e,t){me(e)&&"submit"==e.type?e.value=t:(ge(e)||de(e))&&(e.innerText=t)}_disable(){let e=this.el;me(e)&&"submit"==e.type||ge(e)?e.disabled=!0:e.dataset.disabled="true"}_enable(){let e=this.el;me(e)&&"submit"==e.type||ge(e)?e.disabled=!1:e.dataset.disabled=void 0}}__publicField(Je,"values",{message:String,timeout:Number});class Ye extends re{dismiss(){this.el.remove()}}class Ze extends re{constructor(){super(...arguments),__publicField(this,"_intervalHandle",null)}get _format(){return["years","months","weeks","days","hours",...this._minutes?["minutes"]:[],...this._seconds?["seconds"]:[]]}get _output(){let{years:e,months:i,weeks:s,days:r,hours:n,minutes:o,seconds:a}=this._duration;e||(e=0),i||(i=0),s||(s=0),r||(r=0),n||(n=0),o||(o=0),a||(a=0);let l=[e,i,s,r,n];return this._minutes||this._seconds||!l.every((e=>0===e))?t.formatDuration(this._duration,{format:this._format,delimiter:", "}):(o+=a/60,`${(o/60).toFixed(1)} hours`)}get _seconds(){return!this.hasSecondsValue||this.secondsValue}get _minutes(){return!this.hasMinutesValue||this.minutesValue}get _timestamp(){if(this.hasTimestampValue)return t.toDate(1e3*this.timestampValue);throw new Error("Expected `timestampValue` to be present")}get _duration(){return t.intervalToDuration({start:new Date,end:this._timestamp})}get _tickInterval(){return this._seconds?1e3:this._minutes?15e3:12e4}initialize(){this._update=this._update.bind(this)}connect(){this._intervalHandle=window.setInterval(this._update,this._tickInterval),this._update()}disconnect(){this._intervalHandle&&window.clearInterval(this._intervalHandle)}_update(){try{this.el.innerHTML=this._output}catch{this._intervalHandle&&window.clearInterval(this._intervalHandle)}}}__publicField(Ze,"values",{timestamp:Number,minutes:Boolean,seconds:Boolean});class Xe extends re{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]=i.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=>{i.set(t,s,e[s])})),this.dispatch(t,"element-save:restore:success")}else this.dispatch(t,"element-save:restore:empty")}}__publicField(Xe,"targets",["element"]),__publicField(Xe,"values",{id:String,attributes:String,restoreOnLoad:Boolean});class Ge extends re{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(){De(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)}}__publicField(Ge,"targets",["container"]),__publicField(Ge,"classes",["empty","notEmpty"]),__publicField(Ge,"values",{scopeSelector:String});class Qe extends re{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()}disableInputs(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(((t,i)=>{e&&(t.value=""),t.disabled=!0}))}enableInputs(){this.enableTargets.forEach(((e,t)=>{e.disabled=!1}))}}__publicField(Qe,"targets",["enabler","enable"]),__publicField(Qe,"values",{clear:Boolean});class et extends re{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)}}__publicField(et,"values",{placeholder:String}),__publicField(et,"classes",["success","fail"]);class tt extends re{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(),we(this.form)}reset(e){null==e||e.preventDefault(),function(e){let t=e.querySelector('button[type="reset"]');t||(t=ye("reset"),e.insertAdjacentElement("beforeend",t)),t.click()}(this.form)}}__publicField(tt,"targets",["form"]),__publicField(tt,"values",{formSelector:String});class it extends re{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 i=t;i.name.length>0&&(me(i)&&"checkbox"==i.type?e[this._formIdentifier][i.name]=i.checked:me(i)&&"radio"==i.type?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}get _clearOnSubmit(){return!this.hasClearOnSubmitValue||this.clearOnSubmitValue}initialize(){this._clear=this._clear.bind(this)}connect(){requestAnimationFrame((()=>{if(!pe(this.el))throw new Error("Expected controller to be mounted on a form element.");this._restoreOnLoad&&this.restore(),this._clearOnSubmit&&this.el.addEventListener("submit",this._clear)}))}disconnect(){this._clearOnSubmit&&this.el.removeEventListener("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 i=t;i.name in e&&(me(i)&&"checkbox"==i.type?i.checked=e[i.name]:me(i)&&"radio"==i.type?i.value==e[i.name]&&(i.checked=!0):i.value=e[i.name])}this.dispatch(this.el,"form-save:restore:success")}else this.dispatch(this.el,"form-save:restore:empty")}}__publicField(it,"values",{id:String,restoreOnLoad:Boolean,clearOnSubmit:Boolean});class st extends re{get _threshold(){return this.hasThresholdValue?this.thresholdValue.split(",").map((e=>Number.parseFloat(e.trim()))).filter((e=>e>=0&&e<=1)):[0,1]}connect(){Ae(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}})}}__publicField(st,"values",{threshold:String});class rt extends re{constructor(){super(...arguments),__publicField(this,"_intervalHandle",null)}initialize(){this._interval=this._interval.bind(this)}connect(){if(!this.hasSecondsValue)throw new Error("Expected `secondsValue` to be present");requestAnimationFrame((()=>{this._intervalHandle=window.setInterval(this._interval,1e3*this.secondsValue)}))}disconnect(){this._intervalHandle&&window.clearInterval(this._intervalHandle)}_interval(){this.dispatch(this.el,"interval:action")}}__publicField(rt,"values",{seconds:Number});var nt=window.CustomEvent;function ot(e,t){var i="on"+t.type.toLowerCase();return"function"==typeof e[i]&&e[i](t),e.dispatchEvent(t)}function at(e){for(;e;){if("dialog"===e.localName)return e;e=e.parentElement?e.parentElement:e.parentNode?e.parentNode.host:null}return null}function lt(e){for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;e&&e.blur&&e!==document.body&&e.blur()}function ct(e,t){for(var i=0;i<e.length;++i)if(e[i]===t)return!0;return!1}function ht(e){return!(!e||!e.hasAttribute("method"))&&"dialog"===e.getAttribute("method").toLowerCase()}function ut(e){var t=["button","input","keygen","select","textarea"].map((function(e){return e+":not([disabled])"}));t.push('[tabindex]:not([disabled]):not([tabindex=""])');var i=e.querySelector(t.join(", "));if(!i&&"attachShadow"in Element.prototype)for(var s=e.querySelectorAll("*"),r=0;r<s.length&&!(s[r].tagName&&s[r].shadowRoot&&(i=ut(s[r].shadowRoot)));r++);return i}function dt(e){return e.isConnected||document.body.contains(e)}function pt(e){if(e.submitter)return e.submitter;var t=e.target;if(!(t instanceof HTMLFormElement))return null;var i=gt.formSubmitter;if(!i){var s=e.target;i=("getRootNode"in s&&s.getRootNode()||document).activeElement}return i&&i.form===t?i:null}function mt(e){if(!e.defaultPrevented){var t=e.target,i=gt.imagemapUseValue,s=pt(e);null===i&&s&&(i=s.value);var r=at(t);if(r)"dialog"===(s&&s.getAttribute("formmethod")||t.getAttribute("method"))&&(e.preventDefault(),null!=i?r.close(i):r.close())}}function ft(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",mt,!1),"returnValue"in e||(e.returnValue=""),"MutationObserver"in window){new MutationObserver(this.maybeHideModal.bind(this)).observe(e,{attributes:!0,attributeFilter:["open"]})}else{var t,i=!1,s=function(){i?this.downgradeModal():this.maybeHideModal(),i=!1}.bind(this),r=function(r){if(r.target===e){var n="DOMNodeRemoved";i|=r.type.substr(0,n.length)===n,window.clearTimeout(t),t=window.setTimeout(s,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach((function(t){e.addEventListener(t,r)}))}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))}nt&&"object"!=typeof nt||((nt=function(e,t){t=t||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail||null),i}).prototype=window.Event.prototype),ft.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&dt(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_),gt.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 i=document.createEvent("MouseEvents");i.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(i),e.stopPropagation()},focus_:function(){var e=this.dialog_.querySelector("[autofocus]:not([disabled])");!e&&this.dialog_.tabIndex>=0&&(e=this.dialog_),e||(e=ut(this.dialog_)),lt(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(!dt(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!gt.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),i=function(e,i){return!(void 0===t[e]||t[e]===i)};if(t.opacity<1||i("zIndex","auto")||i("transform","none")||i("mixBlendMode","normal")||i("filter","none")||i("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,gt.needsCentering(this.dialog_)?(gt.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 nt("close",{bubbles:!1,cancelable:!1});ot(this.dialog_,t)}};var gt={reposition:function(e){var t=document.body.scrollTop||document.documentElement.scrollTop,i=t+(window.innerHeight-e.offsetHeight)/2;e.style.top=Math.max(t,i)+"px"},isInlinePositionSetByStylesheet:function(e){for(var t=0;t<document.styleSheets.length;++t){var i=document.styleSheets[t],s=null;try{s=i.cssRules}catch(c){}if(s)for(var r=0;r<s.length;++r){var n=s[r],o=null;try{o=document.querySelectorAll(n.selectorText)}catch(c){}if(o&&ct(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)&&!gt.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 ft(e)},registerDialog:function(e){e.showModal||gt.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 i=[];t.forEach((function(e){for(var t,s=0;t=e.removedNodes[s];++s)t instanceof Element&&("dialog"===t.localName&&i.push(t),i=i.concat(t.querySelectorAll("dialog")))})),i.length&&e(i)})))}};if(gt.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})},gt.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},gt.DialogManager.prototype.updateStacking=function(){for(var e,t=this.zIndexHigh_,i=0;e=this.pendingDialogStack[i];++i)e.updateZIndex(--t,--t),0===i&&(this.overlay.style.zIndex=--t);var s=this.pendingDialogStack[0];s?(s.dialog.parentNode||document.body).appendChild(this.overlay):this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},gt.DialogManager.prototype.containedByTopDialog_=function(e){for(;e=at(e);){for(var t,i=0;t=this.pendingDialogStack[i];++i)if(t.dialog===e)return 0===i;e=e.parentElement}return!1},gt.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(),lt(t),void 0!==this.forwardTab_)){var i=this.pendingDialogStack[0];return i.dialog.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?i.focus_():t!==document.documentElement&&document.documentElement.focus()),!1}},gt.DialogManager.prototype.handleKey_=function(e){if(this.forwardTab_=void 0,27===e.keyCode){e.preventDefault(),e.stopPropagation();var t=new nt("cancel",{bubbles:!1,cancelable:!0}),i=this.pendingDialogStack[0];i&&ot(i.dialog,t)&&i.dialog.close()}else 9===e.keyCode&&(this.forwardTab_=!e.shiftKey)},gt.DialogManager.prototype.checkDOM_=function(e){this.pendingDialogStack.slice().forEach((function(t){-1!==e.indexOf(t.dialog)?t.downgradeModal():t.maybeHideModal()}))},gt.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)},gt.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())},gt.dm=new gt.DialogManager,gt.formSubmitter=null,gt.imagemapUseValue=null,void 0===window.HTMLDialogElement){var bt=document.createElement("form");if(bt.setAttribute("method","dialog"),"dialog"!==bt.method){var vt=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(vt){var _t=vt.get;vt.get=function(){return ht(this)?"dialog":_t.call(this)};var yt=vt.set;vt.set=function(e){return"string"==typeof e&&"dialog"===e.toLowerCase()?this.setAttribute("method",e):yt.call(this,e)},Object.defineProperty(HTMLFormElement.prototype,"method",vt)}}document.addEventListener("click",(function(e){if(gt.formSubmitter=null,gt.imagemapUseValue=null,!e.defaultPrevented){var t=e.target;if("composedPath"in e)t=e.composedPath().shift()||t;if(t&&ht(t.form)){if(!("submit"===t.type&&["button","input"].indexOf(t.localName)>-1)){if("input"!==t.localName||"image"!==t.type)return;gt.imagemapUseValue=e.offsetX+","+e.offsetY}at(t)&&(gt.formSubmitter=t)}}}),!1),document.addEventListener("submit",(function(e){var t=e.target;if(!at(t)){var i=pt(e);"dialog"===(i&&i.getAttribute("formmethod")||t.getAttribute("method"))&&e.preventDefault()}}));var wt=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(){if(!ht(this))return wt.call(this);var e=at(this);e&&e.close()}}const Et="scrollBehavior"in document.documentElement.style;let Ct;async function Tt(e,{behavior:t="smooth",block:i="start",inline:s="nearest"}={}){"smooth"!=t||Et||await Lt(),e.scrollIntoView({behavior:t,block:i,inline:s})}async function kt(e,{behavior:t="smooth"}={}){"smooth"!=t||Et||await Lt(),e.scrollTo({top:0,left:0,behavior:t})}async function St(e,{behavior:t="smooth"}={}){"smooth"!=t||Et||await Lt(),e==window?e.scrollTo({top:document.body.scrollHeight,left:0,behavior:t}):e.scrollTo({top:e.scrollHeight,left:0,behavior:t})}async function At(e,{behavior:t="smooth"}={}){"smooth"!=t||Et||await Lt(),e.scrollTo({left:0,behavior:t})}async function Lt(){const{polyfill:e}=await import("smoothscroll-polyfill");Ct||(Ct=!0,e())}function Vt(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:Vt(e.parentElement)||document.body}class xt extends re{constructor(){super(...arguments),__publicField(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),gt.registerDialog(this._dialog),this._dialog.className=this._modalClassName,this._dialog.showModal(),Tt(this._dialog,{behavior:"smooth",block:"end"}).catch((()=>this._dialog.scrollIntoView(!1))),this._dialog.addEventListener("click",this.close),this._dialog.addEventListener("cancel",this.close),this._dialog.addEventListener("close",this.close)}close(){this._dialog&&(this._dialog.close(),this._dialog.remove(),this._dialog=null,Tt(this.el,{behavior:"smooth",block:"end"}).catch((()=>this.el.scrollIntoView(!1))))}}__publicField(xt,"values",{src:String,srcSet:String,sizes:String}),__publicField(xt,"classes",["modal","image"]);class Ot extends re{initialize(){this.handleInputs=this.handleInputs.bind(this)}connect(){this.inputTargets.forEach((e=>e.addEventListener("change",this.handleInputs)))}disconnect(){this.inputTargets.forEach((e=>e.removeEventListener("change",this.handleInputs)))}handleInputs(e){let t=this.inputTargets.reduce(((e,t)=>t.checked?e+1:e),0),i=e.target;t>this.maxValue?(e.preventDefault(),i.checked=!1,this.dispatch(i,"change"),this.dispatch(i,"limited-selection:too-many"),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(this.dispatch(i,"limited-selection:selection"),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}__publicField(Ot,"targets",["input","error"]),__publicField(Ot,"values",{max:Number,message:String});class Mt extends re{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}}__publicField(Mt,"targets",["media"]);class Ft extends re{constructor(){super(...arguments),__publicField(this,"_errors",[]),__publicField(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 i.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 Tt(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 Tt(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 Tt(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"))}}__publicField(Ft,"values",{selector:String,index:Number}),__publicField(Ft,"targets",["next","current","previous"]);class Dt extends re{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`")}}__publicField(Dt,"targets",["target","template"]),__publicField(Dt,"values",{insertMode:String,wrapperClass:String});class Nt extends re{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}initialize(){this._checkPasswordsMatch=this._checkPasswordsMatch.bind(this)}connect(){this.passwordTargets.forEach((e=>e.addEventListener("change",this._checkPasswordsMatch)))}disconnect(){this.passwordTargets.forEach((e=>e.removeEventListener("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))))}}__publicField(Nt,"targets",["password"]),__publicField(Nt,"classes",["error"]);class It extends re{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()}}__publicField(It,"targets",["password"]);class Pt extends he{constructor(){super(...arguments),__publicField(this,"_intervalHandle",null)}initialize(){this._timeout=this._timeout.bind(this)}connect(){requestAnimationFrame((()=>{this._timeout(),this._intervalHandle=window.setInterval(this._timeout,1e3*this.secondsValue)}))}disconnect(){this._intervalHandle&&window.clearInterval(this._intervalHandle)}async _timeout(){await this.loadContent()}}__publicField(Pt,"targets",["replace"]),__publicField(Pt,"values",{endpoint:String,errorMessage:String,selector:String,seconds:Number});class Bt extends re{get _mode(){return this.hasModeValue?this.modeValue:"mouseover"}get _supportsPrefetch(){var e,t;const i=document.createElement("link");return(null==(e=i.relList)?void 0:e.supports)&&(null==(t=i.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}initialize(){this.prefetch=this.prefetch.bind(this)}connect(){if(this._supportsPrefetch)switch(this._mode){case"intersect":this._setupObserver();break;case"mouseover":this.el.addEventListener("mouseover",this.prefetch,{once:!0});break;default:throw new Error(`'${this._mode}' is not a supported prefetch mode`)}}disconnect(){this.el.removeEventListener("mouseover",this.prefetch)}_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)}}__publicField(Bt,"values",{mode:String});class jt extends re{get _selector(){return this.hasSelectorValue?this.selectorValue:`[data-controller~="${this.identifier}"]`}replace(e){const[t,i,s]=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 i=this.el.parentNode;if(null==i)throw new Error("expected form to have a DOM parent, could not execute replaceChild");i.replaceChild(e,this.el),this.dispatch(e,"remote-form:replace")}else console.log("Unknown",t)}}__publicField(jt,"targets",[]),__publicField(jt,"values",{selector:String});class Ht extends re{connect(){var e,t,i;window.self!==window.top&&(Ne(this),t={},null===(i=(e=this).constructor.debounces)||void 0===i||i.forEach((i=>{if("string"==typeof i&&(e[i]=Ie(e[i],null==t?void 0:t.wait)),"object"==typeof i){const{name:s,wait:r}=i;if(!s)return;e[s]=Ie(e[s],r||(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)}}__publicField(Ht,"debounces",["postUpdate"]);class Rt extends re{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 kt(this.el,{behavior:this._behaviour})}async scrollBottom(e){null==e||e.preventDefault(),await St(this.el,{behavior:this._behaviour})}async scrollLeft(e){null==e||e.preventDefault(),await At(this.el,{behavior:this._behaviour})}async scrollRight(e){null==e||e.preventDefault(),await At(this.el,{behavior:this._behaviour})}async up(e){null==e||e.preventDefault(),await async function(e,t,{behavior:i="smooth"}={}){"smooth"!=i||Et||await Lt(),e.scrollBy({top:-t,left:0,behavior:i})}(this.el,this._increment,{behavior:this._behaviour})}async down(e){null==e||e.preventDefault(),await async function(e,t,{behavior:i="smooth"}={}){"smooth"!=i||Et||await Lt(),e.scrollBy({top:t,left:0,behavior:i})}(this.el,this._increment,{behavior:this._behaviour})}async left(e){null==e||e.preventDefault(),await async function(e,t,{behavior:i="smooth"}={}){"smooth"!=i||Et||await Lt(),e.scrollBy({top:0,left:-t,behavior:i})}(this.el,this._increment,{behavior:this._behaviour})}async right(e){null==e||e.preventDefault(),await async function(e,t,{behavior:i="smooth"}={}){"smooth"!=i||Et||await Lt(),e.scrollBy({top:0,left:t,behavior:i})}(this.el,this._increment,{behavior:this._behaviour})}}__publicField(Rt,"values",{behaviour:String,increment:Number});class zt extends le{connect(){requestAnimationFrame((()=>{Tt(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()}))}}__publicField(zt,"values",{behavior:String,block:String,inline:String});class qt extends re{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return e="document"==this._mode?window:Vt(this.el),e}async scroll(e){null==e||e.preventDefault(),this._scrollTarget&&await St(this._scrollTarget)}}__publicField(qt,"values",{mode:String});class $t extends re{scroll(){let e=document.querySelector(this.selectorValue);e?Tt(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}'`)}}__publicField($t,"values",{selector:String,behavior:String,block:String,inline:String});class Wt extends re{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return e="document"==this._mode?window:Vt(this.el),e}async scroll(e){null==e||e.preventDefault(),this._scrollTarget&&await kt(this._scrollTarget)}}__publicField(Wt,"values",{mode:String});class Ut extends re{constructor(){super(...arguments),__publicField(this,"_timeout",null)}connect(){requestAnimationFrame((()=>{this._timeout=setTimeout((()=>this.el.remove()),1e3*this.secondsValue)}))}disconnect(){this._timeout&&clearTimeout(this._timeout)}}__publicField(Ut,"values",{seconds:Number});class Kt extends re{constructor(){super(...arguments),__publicField(this,"_magicElement",null)}get _stuckClasses(){return this.stuckClass.split(" ")}get _defaultStuckClasses(){return["stuck"]}get _mode(){return this.hasModeValue?this.modeValue:"top"}createMagicElement(){if(null===this._magicElement)switch(this._magicElement=document.createElement("div"),this._mode){case"top":this.el.insertAdjacentElement("beforebegin",this._magicElement);break;case"bottom":this.el.insertAdjacentElement("afterend",this._magicElement)}}connect(){this.el,this.createMagicElement();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)}}__publicField(Kt,"classes",["stuck"]),__publicField(Kt,"values",{mode:String});const Jt={all:Yt=Yt||new Map,on:function(e,t){var i=Yt.get(e);i?i.push(t):Yt.set(e,[t])},off:function(e,t){var i=Yt.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):Yt.set(e,[]))},emit:function(e,t){var i=Yt.get(e);i&&i.slice().map((function(e){e(t)})),(i=Yt.get("*"))&&i.slice().map((function(i){i(e,t)}))}};var Yt;class Zt extends re{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 me(e)&&"checkbox"===e.type?e.checked:me(e)&&"radio"===e.type?e.checked?e.value:"":e.value}set _value(e){let t=this.el;me(t)&&"checkbox"===t.type?t.checked="true"===e.toString():me(t)&&"radio"===t.type?t.checked=t.value===e:me(t)||fe(t)||be(t)?t.value=e.toString():t.innerHTML=e.toString()}initialize(){this._read=this._read.bind(this),this._emit=this._emit.bind(this)}connect(){Jt.on(this._eventName,this._read),requestAnimationFrame((()=>{_e(this.el)&&(this._emit(),this.el.addEventListener("input",this._emit))}))}disconnect(){Jt.off(this._eventName,this._read),_e(this.el)&&this.el.removeEventListener("input",this._emit)}_emit(){Jt.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:i}=e;t!==this.el&&(this._value=i)}}__publicField(Zt,"values",{key:String});class Xt extends re{constructor(){super(...arguments),__publicField(this,"_lastIndex",null),__publicField(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)}initialize(){this.sort=this.sort.bind(this)}connect(){requestAnimationFrame((()=>{this._tableHeaders.forEach((e=>e.addEventListener("click",this.sort))),this.hasStartSortValue&&this._sortByColumn(this.startSortValue)}))}disconnect(){this._tableHeaders.forEach((e=>e.removeEventListener("click",this.sort)))}sort(e){e.preventDefault();let t=e.target,i=this._indexOfHeaderCell(t);this._sortByColumn(i)}_indexOfHeaderCell(e){return this._tableHeaders.indexOf(e)}_sortByColumn(e){this._reverse=e===this._lastIndex&&!this._reverse;let t=document.createDocumentFragment();this._tableRows.sort(((t,i)=>{var s,r;let n=Array.from(t.cells),o=Array.from(i.cells),a=(null==(s=n[e])?void 0:s.innerText)||"",l=(null==(r=o[e])?void 0:r.innerText)||"",c=a.localeCompare(l,"en",{sensitivity:"base",numeric:!0,caseFirst:"upper"});return t.dataset.sortTop||i.dataset.sortBottom?t.dataset.sortTop&&i.dataset.sortTop?c:-1:t.dataset.sortBottom||i.dataset.sortTop?t.dataset.sortBottom&&i.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}}__publicField(Xt,"values",{startSort:Number});class Gt extends re{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(){De(this,{childList:!0,element:this._tableBody}),requestAnimationFrame((()=>{this.truncate(),this.showMoreTarget.addEventListener("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)}}__publicField(Gt,"targets",["showMore"]),__publicField(Gt,"values",{limit:Number,truncated:Boolean});class Qt extends re{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}initialize(){this.switchTabs=this.switchTabs.bind(this)}connect(){this.linkTargets.forEach((e=>e.addEventListener("click",this.switchTabs))),this._equalize&&this._setMinHeight(),this.currentTabValue=this._currentTab}disconnect(){this.linkTargets.forEach((e=>e.removeEventListener("click",this.switchTabs)))}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,i=this.contentTargets,s=i[e],r=t[e],n=[...i.slice(0,e),...i.slice(e+1)],o=[...t.slice(0,e),...t.slice(e+1)];this._addActiveClasses(r),r.setAttribute("aria-selected","true"),this._addActiveClasses(s),this._removeHideClasses(s),o.forEach((e=>{e.removeAttribute("aria-selected"),this._removeActiveClasses(e)})),n.forEach((e=>{this._removeActiveClasses(e),this._addHideClasses(e)}))}_clampIndex(e){return i.clamp(e,0,this.contentTargets.length-1)}_setMinHeight(){let e=0;this.contentTargets.forEach((t=>{let i=t.hasAttribute("tab-hidden");i&&this._removeHideClasses(t);let s=t.offsetHeight;s>e&&(e=s),i&&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)}}__publicField(Qt,"values",{currentTab:Number,equalize:Boolean}),__publicField(Qt,"targets",["link","content"]),__publicField(Qt,"classes",["active","hide"]);class ei extends le{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,i=document.querySelector(this.targetValue);if(null==i)return void this.dispatch(t,"teleport:error");let s=t.cloneNode(!0);switch(this.cleanup(s),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":i.insertAdjacentHTML(this.insertValue,s.outerHTML);break;case"replaceOuter":i.outerHTML=s.outerHTML;break;case"replaceInner":i.innerHTML=s.outerHTML;break;case"prepend":i.insertAdjacentHTML("afterbegin",s.outerHTML);break;case"append":i.insertAdjacentHTML("beforeend",s.outerHTML);break;default:throw new Error("`insert` value was not specified")}t.remove()}}__publicField(ei,"values",{target:String,insert:String,immediate:Boolean});class ti extends le{constructor(){super(...arguments),__publicField(this,"_timeout",null),__publicField(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(),this._timeout=setTimeout(this.removeState,this._seconds)}disconnect(){this.removeState(),this._timeout&&clearTimeout(this._timeout)}setState(){this._previousState[this._attribute]=i.get(this.el,this._attribute),i.set(this.el,this._attribute,this.valueValue)}removeState(){i.set(this.el,this._attribute,this._previousState[this._attribute])}}function ii(e,t,s,r,n="temporary-state"){var o;e.dataset.controller&&(null==(o=e.dataset.controller)?void 0:o.includes(n))||(e.dataset.controller=(e.dataset.controller||` ${n} `).trim().replaceAll(" "," ")),e[i.camelCase(`${n}-attribute-value`)]=t,e[i.camelCase(`${n}-seconds-value`)]=r.toString()}__publicField(ti,"values",{attribute:String,seconds:Number,value:String});class si extends re{constructor(){super(...arguments),__publicField(this,"_timeout",null)}get _duration(){return t.isPast(this._timestamp)?t.intervalToDuration({start:this._timestamp,end:new Date}):t.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=t.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()}disconnect(){this._timeout&&window.clearTimeout(this._timeout)}_update(){this.el.innerHTML=t.formatDistanceToNow(this._timestamp,{addSuffix:!0,includeSeconds:!0}),this._nextUpdate&&(this._timeout=window.setTimeout(this._update,this._nextUpdate))}}__publicField(si,"values",{timestamp:Number});class ri extends re{constructor(){super(...arguments),__publicField(this,"_timeoutHandle",null)}initialize(){this._timeout=this._timeout.bind(this)}connect(){requestAnimationFrame((()=>{this._timeoutHandle=window.setTimeout(this._timeout,1e3*this.secondsValue)}))}disconnect(){this._timeoutHandle&&window.clearTimeout(this._timeoutHandle)}_timeout(){this.dispatch(this.el,"timeout")}}__publicField(ri,"values",{seconds:Number});class ni extends re{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{const i=new Me(e,t);i.observe,i.unobserve})(this),this.hasClickAwayValue&&this.clickAwayValue&&Ve(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)))}}__publicField(ni,"targets",["toggle"]),__publicField(ni,"values",{class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String});class oi extends re{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(),De(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)}}function ai(e){return"TURBO-FRAME"==e.nodeName}__publicField(oi,"classes",["active","collapsed"]);class li extends re{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(ai(e))return e;throw new Error(`Element targeted by ID '${this.frameIdValue}'`)}_getSrc(){let e=this.el;if(this.hasSrcValue)return this.srcValue;if(de(e))return e.href;throw new Error("No link given to drive frame to")}}__publicField(li,"values",{frameId:String,src:String,loadingMessage:String});class ci extends re{constructor(){super(...arguments),__publicField(this,"_timeoutHandle",null)}get _poll(){return!!this.hasPollValue&&this.pollValue}initialize(){this.refresh=this.refresh.bind(this)}connect(){let e=this.el;if(!ai(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((()=>this._timeoutHandle=setTimeout((()=>this.refresh()),this.intervalValue)))}disconnect(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}refresh(e){null==e||e.preventDefault();let t=this.el;t.src=t.src}}__publicField(ci,"values",{interval:Number,poll:Boolean});class hi extends re{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[""]}initialize(){this._check=this._check.bind(this)}connect(){this._addWarningHideClasses(this.warningTarget),this.inputTarget.addEventListener("input",this._check),this._check()}disconnect(){this.inputTarget.removeEventListener("input",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)}}__publicField(hi,"classes",["inputWarning","warningHide"]),__publicField(hi,"targets",["input","warning"]),__publicField(hi,"values",{max:Number,min:Number,minMessage:String,maxMessage:String});class ui extends re{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}initialize(){this._updateWordCount=this._updateWordCount.bind(this)}connect(){this._updateWordCount(),this.inputTarget.addEventListener("input",this._updateWordCount)}disconnect(){this.inputTarget.removeEventListener("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,i=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=t&&e<=i}}__publicField(ui,"targets",["input","output"]),__publicField(ui,"values",{min:Number,max:Number}),__publicField(ui,"classes",["error"]),e.AnchorSpyController=ce,e.AsyncBlockController=ue,e.AutoSubmitFormController=Ee,e.AutosizeController=class extends re{initialize(){this._handler=this._handler.bind(this)}connect(){Ne(this),requestAnimationFrame((()=>{this._handler();let e=this.el;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this._handler),e.addEventListener("focus",this._handler)}))}disconnect(){this.el.removeEventListener("input",this._handler),this.el.removeEventListener("focus",this._handler)}windowResize(){this._handler()}_handler(){this.autosize(this.el)}autosize(e){let t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"}},e.BackLinkController=Pe,e.BaseController=re,e.CharCountController=Be,e.CheckboxSelectAllController=je,e.ClipboardController=He,e.ClockController=Re,e.ConfirmController=ze,e.ConfirmNavigationController=qe,e.CountdownController=$e,e.DebugController=We,e.DetectDirtyController=class extends re{get _cacheAttrName(){return"detect-dirty-load-value"}initialize(){this._checkDirty=this._checkDirty.bind(this)}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),e.addEventListener("input",this._checkDirty),e.addEventListener("change",this._checkDirty)}disconnect(){let e=this.el;e.removeEventListener("input",this._checkDirty),e.removeEventListener("change",this._checkDirty)}restore(e){null==e||e.preventDefault(),this._restoreElementFromLoadValue()}_getElementValue(){let e=this.el;return ve(e)?e.checked:e.value}_getElementLoadValue(){let e=this.el,t=e.getAttribute(this._cacheAttrName);if(ve(e))return null==t?e.defaultChecked:"true"==t;if(null!==t)return t;if(be(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(ve(e))e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=null==t?e.defaultChecked:"true"==t;else if(be(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()&&ve(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}},e.DetectDirtyFormController=class extends re{get _formElements(){return Array.from(this.el.querySelectorAll("input, select, textarea"))}get _cacheAttrName(){return"detect-dirty-load-value"}initialize(){this._checkDirty=this._checkDirty.bind(this)}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),e.addEventListener("input",this._checkDirty),e.addEventListener("change",this._checkDirty)}disconnect(){let e=this.el;e.removeEventListener("input",this._checkDirty),e.removeEventListener("change",this._checkDirty)}restore(e){null==e||e.preventDefault(),this._formElements.forEach((e=>this._restoreElementFromLoadValue(e)))}_getElementValue(e){return ve(e)?e.checked:e.value}_getElementLoadValue(e){let t=e.getAttribute(this._cacheAttrName);if(ve(e))return null==t?e.defaultChecked:"true"==t;if(null!==t)return t;if(be(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)&&ve(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}_restoreElementFromLoadValue(e){let t=e.getAttribute(this._cacheAttrName);if(ve(e))e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=null==t?e.defaultChecked:"true"==t;else if(be(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=>Ue(e)))?this.el.setAttribute("data-dirty","true"):this.el.removeAttribute("data-dirty")}},e.DisableInputsController=Ke,e.DisableWithController=Je,e.DismissableController=Ye,e.DurationController=Ze,e.ElementSaveController=Xe,e.EmptyDomController=Ge,e.EnableInputsController=Qe,e.EphemeralController=le,e.FallbackImageController=et,e.FormRcController=tt,e.FormSaveController=it,e.IntersectionController=st,e.IntervalController=rt,e.LazyBlockController=class extends he{async connect(){let e=this.el;"IntersectionObserver"in window?[this.observe,this.unobserve]=Ae(this,{element:e,threshold:.3}):await this.loadContent()}async appear(e){e.target===this.el&&e.isIntersecting&&(await this.loadContent(),this.unobserve&&this.unobserve())}},e.LightboxImageController=xt,e.LimitedSelectionCheckboxesController=Ot,e.LoadBlockController=he,e.MediaPlayerController=Mt,e.NavigateFormErrorsController=Ft,e.NestedFormController=Dt,e.PasswordConfirmController=Nt,e.PasswordPeekController=It,e.PollBlockController=Pt,e.PrefetchController=Bt,e.PresenceController=class extends re{connect(){this.dispatch(this.el,"presence:added")}disconnect(){this.dispatch(this.el,"presence:removed")}},e.RemoteFormController=jt,e.RemoveController=class extends Ye{},e.ResponsiveIframeBodyController=Ht,e.ResponsiveIframeWrapperController=class extends re{initialize(){this.messageReceived=this.messageReceived.bind(this)}connect(){window.addEventListener("message",this.messageReceived)}disconnect(){window.removeEventListener("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`}},e.ScrollContainerController=Rt,e.ScrollIntoFocusController=zt,e.ScrollToBottomController=qt,e.ScrollToController=$t,e.ScrollToTopController=Wt,e.SelfDestructController=Ut,e.StickyController=Kt,e.SyncInputsController=Zt,e.TableSortController=Xt,e.TableTruncateController=Gt,e.TabsController=Qt,e.TeleportController=ei,e.TemporaryStateController=ti,e.TimeDistanceController=si,e.TimeoutController=ri,e.ToggleClassController=ni,e.TreeViewController=oi,e.TurboFrameRCController=li,e.TurboFrameRefreshController=ci,e.UserFocusController=class extends re{initialize(){this._handleVisibility=this._handleVisibility.bind(this)}connect(){window.addEventListener("focus",this._handleVisibility),window.addEventListener("blur",this._handleVisibility),document.addEventListener("visibilitychange",this._handleVisibility),requestAnimationFrame((()=>{this._handleVisibility()}))}disconnect(){window.removeEventListener("focus",this._handleVisibility),window.removeEventListener("blur",this._handleVisibility),document.removeEventListener("visibilitychange",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()}},e.ValueWarnController=hi,e.WordCountController=ui,e.applyTemporaryClass=function(e,t,i){ii(e,"className",0,i)},e.applyTemporaryState=ii,e.isDirty=function(e){return e.hasAttribute("data-dirty")},e.isFormDirty=Ue,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
2
2
  //# sourceMappingURL=stimulus-library.umd.js.map