ariadne_view_components 0.0.3 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -7
  3. data/app/assets/builds/ariadne_view_components.css +1874 -0
  4. data/app/assets/config/manifest.js +2 -0
  5. data/app/assets/javascripts/ariadne.d.ts +1 -0
  6. data/app/assets/javascripts/ariadne_view_components.js +1 -1
  7. data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
  8. data/app/assets/javascripts/clipboard-copy-component.d.ts +4 -0
  9. data/app/assets/javascripts/slideover-component.d.ts +9 -0
  10. data/app/assets/javascripts/time_ago_component.d.ts +1 -0
  11. data/app/assets/javascripts/tooltip-component.d.ts +24 -0
  12. data/app/assets/stylesheets/application.ariadne_view_components.css +5 -0
  13. data/app/assets/stylesheets/tooltip-component.css +37 -0
  14. data/app/components/ariadne/ariadne.d.ts +1 -0
  15. data/app/components/ariadne/ariadne.js +9 -0
  16. data/app/components/ariadne/ariadne.ts +8 -9
  17. data/app/components/ariadne/base_button.rb +10 -8
  18. data/app/components/ariadne/blankslate_component.html.erb +26 -0
  19. data/app/components/ariadne/blankslate_component.rb +151 -0
  20. data/app/components/ariadne/body_component.rb +30 -0
  21. data/app/components/ariadne/button_component.html.erb +1 -1
  22. data/app/components/ariadne/button_component.rb +9 -11
  23. data/app/components/ariadne/clipboard-copy-component.d.ts +4 -0
  24. data/app/components/ariadne/clipboard-copy-component.js +18 -0
  25. data/app/components/ariadne/{clipboard_copy_component.ts → clipboard-copy-component.ts} +0 -0
  26. data/app/components/ariadne/clipboard_copy_component.d.ts +4 -0
  27. data/app/components/ariadne/clipboard_copy_component.html.erb +2 -2
  28. data/app/components/ariadne/clipboard_copy_component.js +18 -0
  29. data/app/components/ariadne/clipboard_copy_component.rb +45 -5
  30. data/app/components/ariadne/comment_component.html.erb +25 -0
  31. data/app/components/ariadne/comment_component.rb +45 -0
  32. data/app/components/ariadne/component.rb +6 -1
  33. data/app/components/ariadne/container_component.html.erb +3 -0
  34. data/app/components/ariadne/container_component.rb +25 -0
  35. data/app/components/ariadne/flash_component.rb +9 -9
  36. data/app/components/ariadne/flex_component.rb +51 -0
  37. data/app/components/ariadne/footer_component.html.erb +7 -0
  38. data/app/components/ariadne/footer_component.rb +23 -0
  39. data/app/components/ariadne/grid_component.html.erb +26 -0
  40. data/app/components/ariadne/grid_component.rb +66 -0
  41. data/app/components/ariadne/header_component.html.erb +29 -0
  42. data/app/components/ariadne/header_component.rb +114 -0
  43. data/app/components/ariadne/heading_component.rb +3 -3
  44. data/app/components/ariadne/heroicon_component.html.erb +2 -5
  45. data/app/components/ariadne/heroicon_component.rb +20 -7
  46. data/app/components/ariadne/image_component.rb +5 -3
  47. data/app/components/ariadne/inline_flex_component.html.erb +5 -0
  48. data/app/components/ariadne/inline_flex_component.rb +65 -0
  49. data/app/components/ariadne/link_component.rb +65 -0
  50. data/app/components/ariadne/list_component.html.erb +15 -0
  51. data/app/components/ariadne/list_component.rb +67 -0
  52. data/app/components/ariadne/main_component.rb +32 -0
  53. data/app/components/ariadne/pill_component.html.erb +3 -0
  54. data/app/components/ariadne/pill_component.rb +30 -0
  55. data/app/components/ariadne/slideover-component.d.ts +9 -0
  56. data/app/components/ariadne/slideover-component.js +20 -0
  57. data/app/components/ariadne/slideover-component.ts +26 -0
  58. data/app/components/ariadne/slideover_component.d.ts +9 -0
  59. data/app/components/ariadne/slideover_component.html.erb +11 -0
  60. data/app/components/ariadne/slideover_component.js +19 -0
  61. data/app/components/ariadne/slideover_component.rb +81 -0
  62. data/app/components/ariadne/time_ago_component.d.ts +1 -0
  63. data/app/components/ariadne/time_ago_component.js +1 -0
  64. data/app/components/ariadne/time_ago_component.rb +56 -0
  65. data/app/components/ariadne/time_ago_component.ts +1 -0
  66. data/app/components/ariadne/timeline_component.html.erb +19 -0
  67. data/app/components/ariadne/timeline_component.rb +34 -0
  68. data/app/components/ariadne/tooltip-component.d.ts +24 -0
  69. data/app/components/ariadne/tooltip-component.js +42 -0
  70. data/app/components/ariadne/tooltip-component.ts +57 -0
  71. data/app/components/ariadne/tooltip_component.html.erb +4 -0
  72. data/app/components/ariadne/tooltip_component.rb +34 -31
  73. data/app/lib/ariadne/action_view_extensions/form_helper.rb +23 -0
  74. data/app/lib/ariadne/form_builder.rb +71 -0
  75. data/lib/ariadne/classify.rb +4 -90
  76. data/lib/ariadne/view_components/engine.rb +8 -0
  77. data/lib/ariadne/view_components/version.rb +1 -1
  78. data/lib/ariadne/view_components.rb +31 -29
  79. data/lib/rubocop/cop/ariadne/ariadne_heroicon.rb +2 -2
  80. data/lib/tasks/docs.rake +52 -58
  81. data/static/arguments.yml +290 -17
  82. data/static/audited_at.json +18 -0
  83. data/static/classes.yml +189 -1
  84. data/static/constants.json +173 -30
  85. data/static/statuses.json +18 -0
  86. metadata +77 -9
  87. data/app/assets/stylesheets/application.tailwind.css +0 -3
  88. data/lib/tasks/tailwind.rake +0 -31
@@ -0,0 +1,2 @@
1
+ //= link_directory ../builds .css
2
+ //= link_directory ../javascripts .js
@@ -0,0 +1 @@
1
+ import './time_ago_component';
@@ -1,2 +1,2 @@
1
- class e{constructor(e,t,r){this.eventTarget=e,this.eventName=t,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){const t=function(e){if("immediatePropagationStopped"in e)return e;{const{stopImmediatePropagation:t}=e;return Object.assign(e,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}(e);for(const e of this.bindings){if(t.immediatePropagationStopped)break;e.handleEvent(t)}}get bindings(){return Array.from(this.unorderedBindings).sort(((e,t)=>{const r=e.index,s=t.index;return r<s?-1:r>s?1:0}))}}class t{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach((e=>e.connect())))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach((e=>e.disconnect())))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((e,t)=>e.concat(Array.from(t.values()))),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e){this.fetchEventListenerForBinding(e).bindingDisconnected(e)}handleError(e,t,r={}){this.application.handleError(e,`Error ${t}`,r)}fetchEventListenerForBinding(e){const{eventTarget:t,eventName:r,eventOptions:s}=e;return this.fetchEventListener(t,r,s)}fetchEventListener(e,t,r){const s=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,r);let i=s.get(n);return i||(i=this.createEventListener(e,t,r),s.set(n,i)),i}createEventListener(t,r,s){const n=new e(t,r,s);return this.started&&n.connect(),n}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){const r=[e];return Object.keys(t).sort().forEach((e=>{r.push(`${t[e]?"":"!"}${e}`)})),r.join(":")}}const r=/^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;function s(e){return"window"==e?window:"document"==e?document:void 0}function n(e){return e.replace(/(?:[_-])([a-z0-9])/g,((e,t)=>t.toUpperCase()))}function i(e){return e.charAt(0).toUpperCase()+e.slice(1)}function o(e){return e.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`))}const a={a:e=>"click",button:e=>"click",form:e=>"submit",details:e=>"toggle",input:e=>"submit"==e.getAttribute("type")?"click":"input",select:e=>"change",textarea:e=>"input"};function c(e){throw new Error(e)}function h(e){try{return JSON.parse(e)}catch(t){return e}}class l{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){this.willBeInvokedByEvent(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){const e=this.controller[this.methodName];if("function"==typeof e)return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}invokeWithEvent(e){const{target:t,currentTarget:r}=e;try{const{params:s}=this.action,n=Object.assign(e,{params:s});this.method.call(this.controller,n),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(t){const{identifier:r,controller:s,element:n,index:i}=this,o={identifier:r,controller:s,element:n,index:i,event:e};this.context.handleError(t,`invoking action "${this.action}"`,o)}}willBeInvokedByEvent(e){const t=e.target;return this.element===t||(t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class u{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const e=new Set(this.matchElementsInTree());for(const t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(const t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){"attributes"==e.type?this.processAttributeChange(e.target,e.attributeName):"childList"==e.type&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){const r=e;this.elements.has(r)?this.delegate.elementAttributeChanged&&this.matchElement(r)?this.delegate.elementAttributeChanged(r,t):this.removeElement(r):this.matchElement(r)&&this.addElement(r)}processRemovedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.processTree(e,this.removeElement)}}processAddedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.elementIsActive(e)&&this.processTree(e,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(const r of this.matchElementsInTree(e))t.call(this,r)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected==this.element.isConnected&&this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}}class d{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new u(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){const t=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}}class g{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){const t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){const r=this.delegate.getStringMapKeyForAttribute(e);if(null!=r){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);const s=this.element.getAttribute(e);if(this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,r,t),null==s){const t=this.stringMap.get(e);this.stringMap.delete(e),t&&this.stringMapKeyRemoved(r,e,t)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((e=>e.name))}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}function m(e,t){let r=e.get(t);return r||(r=new Set,e.set(t,r)),r}class p{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce(((e,t)=>e.concat(Array.from(t))),[])}get size(){return Array.from(this.valuesByKey.values()).reduce(((e,t)=>e+t.size),0)}add(e,t){!function(e,t,r){m(e,t).add(r)}(this.valuesByKey,e,t)}delete(e,t){!function(e,t,r){m(e,t).delete(r),function(e,t){const r=e.get(t);null!=r&&0==r.size&&e.delete(t)}(e,t)}(this.valuesByKey,e,t)}has(e,t){const r=this.valuesByKey.get(e);return null!=r&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some((t=>t.has(e)))}getValuesForKey(e){const t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter((([t,r])=>r.has(e))).map((([e,t])=>e))}}class f{constructor(e,t,r){this.attributeObserver=new d(e,t,this),this.delegate=r,this.tokensByElement=new p}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){const[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach((e=>this.tokenMatched(e)))}tokensUnmatched(e){e.forEach((e=>this.tokenUnmatched(e)))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){const t=this.tokensByElement.getValuesForKey(e),r=this.readTokensForElement(e),s=function(e,t){const r=Math.max(e.length,t.length);return Array.from({length:r},((r,s)=>[e[s],t[s]]))}(t,r).findIndex((([e,t])=>{return s=t,!((r=e)&&s&&r.index==s.index&&r.content==s.content);var r,s}));return-1==s?[[],[]]:[t.slice(s),r.slice(s)]}readTokensForElement(e){const t=this.attributeName;return function(e,t,r){return e.trim().split(/\s+/).filter((e=>e.length)).map(((e,s)=>({element:t,attributeName:r,content:e,index:s})))}(e.getAttribute(t)||"",e,t)}}class b{constructor(e,t,r){this.tokenListObserver=new f(e,t,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){const{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).set(e,r),this.delegate.elementMatchedValue(t,r))}tokenUnmatched(e){const{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,r))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(e){return{error:e}}}}class v{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new b(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){const t=new l(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){const t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach((e=>this.delegate.bindingDisconnected(e))),this.bindingsByAction.clear()}parseValueForToken(e){const t=class{constructor(e,t,r){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||function(e){const t=e.tagName.toLowerCase();if(t in a)return a[t](e)}(e)||c("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||c("missing identifier"),this.methodName=r.methodName||c("missing method name")}static forToken(e){return new this(e.element,e.index,function(e){const t=e.trim().match(r)||[];return{eventTarget:s(t[4]),eventName:t[2],eventOptions:t[9]?(n=t[9],n.split(":").reduce(((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)})),{})):{},identifier:t[5],methodName:t[7]};var n}(e.content))}toString(){const e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}->${this.identifier}#${this.methodName}`}get params(){return this.eventTarget instanceof Element?this.getParamsFromEventTargetAttributes(this.eventTarget):{}}getParamsFromEventTargetAttributes(e){const t={},r=new RegExp(`^data-${this.identifier}-(.+)-param$`);return Array.from(e.attributes).forEach((({name:e,value:s})=>{const i=e.match(r),o=i&&i[1];o&&Object.assign(t,{[n(o)]:h(s)})})),t}get eventTargetName(){return(e=this.eventTarget)==window?"window":e==document?"document":void 0;var e}}.forToken(e);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}}class y{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new g(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap,this.invokeChangedCallbacksForDefaultValues()}start(){this.stringMapObserver.start()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){const r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){const s=this.valueDescriptorNameMap[t];null!==e&&(null===r&&(r=s.writer(s.defaultValue)),this.invokeChangedCallback(t,e,r))}stringMapKeyRemoved(e,t,r){const s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),r):this.invokeChangedCallback(e,s.writer(s.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(const{key:e,name:t,defaultValue:r,writer:s}of this.valueDescriptors)null==r||this.controller.data.has(e)||this.invokeChangedCallback(t,s(r),void 0)}invokeChangedCallback(e,t,r){const s=`${e}Changed`,n=this.receiver[s];if("function"==typeof n){const s=this.valueDescriptorNameMap[e],i=s.reader(t);let o=r;r&&(o=s.reader(r)),n.call(this.receiver,i,o)}}get valueDescriptors(){const{valueDescriptorMap:e}=this;return Object.keys(e).map((t=>e[t]))}get valueDescriptorNameMap(){const e={};return Object.keys(this.valueDescriptorMap).forEach((t=>{const r=this.valueDescriptorMap[t];e[r.name]=r})),e}hasValue(e){const t=`has${i(this.valueDescriptorNameMap[e].name)}`;return this.receiver[t]}}class A{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new p}start(){this.tokenListObserver||(this.tokenListObserver=new f(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var r;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),null===(r=this.tokenListObserver)||void 0===r||r.pause((()=>this.delegate.targetConnected(e,t))))}disconnectTarget(e,t){var r;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),null===(r=this.tokenListObserver)||void 0===r||r.pause((()=>this.delegate.targetDisconnected(e,t))))}disconnectAllTargets(){for(const e of this.targetsByName.keys)for(const t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}class E{constructor(e,t){this.logDebugActivity=(e,t={})=>{const{identifier:r,controller:s,element:n}=this;t=Object.assign({identifier:r,controller:s,element:n},t),this.application.logDebugActivity(this.identifier,e,t)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new v(this,this.dispatcher),this.valueObserver=new y(this,this.controller),this.targetObserver=new A(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(e){this.handleError(e,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,r={}){const{identifier:s,controller:n,element:i}=this;r=Object.assign({identifier:s,controller:n,element:i},r),this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}invokeControllerMethod(e,...t){const r=this.controller;"function"==typeof r[e]&&r[e](...t)}}function O(e,t){const r=k(e);return Array.from(r.reduce(((e,r)=>(function(e,t){const r=e[t];return Array.isArray(r)?r:[]}(r,t).forEach((t=>e.add(t))),e)),new Set))}function w(e,t){return k(e).reduce(((e,r)=>(e.push(...function(e,t){const r=e[t];return r?Object.keys(r).map((e=>[e,r[e]])):[]}(r,t)),e)),[])}function k(e){const t=[];for(;e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}function M(e){return function(e,t){const r=T(e),s=function(e,t){return N(t).reduce(((r,s)=>{const n=function(e,t,r){const s=Object.getOwnPropertyDescriptor(e,r);if(!s||!("value"in s)){const e=Object.getOwnPropertyDescriptor(t,r).value;return s&&(e.get=s.get||e.get,e.set=s.set||e.set),e}}(e,t,s);return n&&Object.assign(r,{[s]:n}),r}),{})}(e.prototype,t);return Object.defineProperties(r.prototype,s),r}(e,function(e){return O(e,"blessings").reduce(((t,r)=>{const s=r(e);for(const e in s){const r=t[e]||{};t[e]=Object.assign(r,s[e])}return t}),{})}(e))}const N="function"==typeof Object.getOwnPropertySymbols?e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)]:Object.getOwnPropertyNames,T=(()=>{function e(e){function t(){return Reflect.construct(e,arguments,new.target)}return t.prototype=Object.create(e.prototype,{constructor:{value:t}}),Reflect.setPrototypeOf(t,e),t}try{return function(){const t=e((function(){this.a.call(this)}));t.prototype.a=function(){},new t}(),e}catch(e){return e=>class extends e{}}})();class C{constructor(e,t){this.application=e,this.definition=function(e){return{identifier:e.identifier,controllerConstructor:M(e.controllerConstructor)}}(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){const t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){const t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new E(this,e),this.contextsByScope.set(e,t)),t}}class B{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){const t=this.data.get(this.getDataKey(e))||"";return t.match(/[^\s]+/g)||[]}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}}class x{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){const t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){const r=this.getAttributeNameForKey(e);return this.element.setAttribute(r,t),this.get(e)}has(e){const t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){const t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${o(e)}`}}class F{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,r){let s=this.warnedKeysByObject.get(e);s||(s=new Set,this.warnedKeysByObject.set(e,s)),s.has(t)||(s.add(t),this.logger.warn(r,e))}}function L(e,t){return`[${e}~="${t}"]`}class ${constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce(((e,t)=>e||this.findTarget(t)||this.findLegacyTarget(t)),void 0)}findAll(...e){return e.reduce(((e,t)=>[...e,...this.findAllTargets(t),...this.findAllLegacyTargets(t)]),[])}findTarget(e){const t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){const t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){return L(this.schema.targetAttributeForScope(this.identifier),e)}findLegacyTarget(e){const t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){const t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map((t=>this.deprecate(t,e)))}getLegacySelectorForTargetName(e){const t=`${this.identifier}.${e}`;return L(this.schema.targetAttribute,t)}deprecate(e,t){if(e){const{identifier:r}=this,s=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${r}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}}class S{constructor(e,t,r,s){this.targets=new $(this),this.classes=new B(this),this.data=new x(this),this.containsElement=e=>e.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new F(s)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return L(this.schema.controllerAttribute,this.identifier)}}class D{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new b(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){const{element:t,content:r}=e,s=this.fetchScopesByIdentifierForElement(t);let n=s.get(r);return n||(n=this.delegate.createScopeForElementAndIdentifier(t,r),s.set(r,n)),n}elementMatchedValue(e,t){const r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r),1==r&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){const r=this.scopeReferenceCounts.get(t);r&&(this.scopeReferenceCounts.set(t,r-1),1==r&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}}class K{constructor(e){this.application=e,this.scopeObserver=new D(this.element,this.schema,this),this.scopesByIdentifier=new p,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce(((e,t)=>e.concat(t.contexts)),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);const t=new C(this.application,e);this.connectModule(t)}unloadIdentifier(e){const t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){const r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find((t=>t.element==e))}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new S(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e);this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((t=>e.connectContextForScope(t)))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier);this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((t=>e.disconnectContextForScope(t)))}}const I={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:e=>`data-${e}-target`};class V{constructor(e=document.documentElement,r=I){this.logger=console,this.debug=!1,this.logDebugActivity=(e,t,r={})=>{this.debug&&this.logFormattedMessage(e,t,r)},this.element=e,this.schema=r,this.dispatcher=new t(this),this.router=new K(this)}static start(e,t){const r=new V(e,t);return r.start(),r}async start(){await new Promise((e=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",(()=>e())):e()})),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){t.shouldLoad&&this.load({identifier:e,controllerConstructor:t})}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach((e=>this.router.loadDefinition(e)))}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach((e=>this.router.unloadIdentifier(e)))}get controllers(){return this.router.contexts.map((e=>e.controller))}getControllerForElementAndIdentifier(e,t){const r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var s;this.logger.error("%s\n\n%o\n\n%o",t,e,r),null===(s=window.onerror)||void 0===s||s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}}function j([e,t]){return function(e,t){const r=`${o(e)}-value`,s=function(e){const t=function(e){const t=R(e.type);if(t){const r=P(e.default);if(t!==r)throw new Error(`Type "${t}" must match the type of the default value. Given default value: "${e.default}" as "${r}"`);return t}}(e),r=P(e),s=R(e),n=t||r||s;if(n)return n;throw new Error(`Unknown value type "${e}"`)}(t);return{type:s,key:r,name:n(r),get defaultValue(){return function(e){const t=R(e);if(t)return U[t];const r=e.default;return void 0!==r?r:e}(t)},get hasCustomDefaultValue(){return void 0!==P(t)},reader:z[s],writer:W[s]||W.default}}(e,t)}function R(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function P(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(e)?"array":"[object Object]"===Object.prototype.toString.call(e)?"object":void 0}const U={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},z={array(e){const t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError("Expected array");return t},boolean:e=>!("0"==e||"false"==e),number:e=>Number(e),object(e){const t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError("Expected object");return t},string:e=>e},W={default:function(e){return`${e}`},array:q,object:q};function q(e){return JSON.stringify(e)}class J{constructor(e){this.context=e}static get shouldLoad(){return!0}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:s=this.identifier,bubbles:n=!0,cancelable:i=!0}={}){const o=new CustomEvent(s?`${s}:${e}`:e,{detail:r,bubbles:n,cancelable:i});return t.dispatchEvent(o),o}}J.blessings=[function(e){return O(e,"classes").reduce(((e,t)=>{return Object.assign(e,{[`${r=t}Class`]:{get(){const{classes:e}=this;if(e.has(r))return e.get(r);{const t=e.getAttributeName(r);throw new Error(`Missing attribute "${t}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${i(r)}Class`]:{get(){return this.classes.has(r)}}});var r}),{})},function(e){return O(e,"targets").reduce(((e,t)=>{return Object.assign(e,{[`${r=t}Target`]:{get(){const e=this.targets.find(r);if(e)return e;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${i(r)}Target`]:{get(){return this.targets.has(r)}}});var r}),{})},function(e){const t=w(e,"values"),r={valueDescriptorMap:{get(){return t.reduce(((e,t)=>{const r=j(t),s=this.data.getAttributeNameForKey(r.key);return Object.assign(e,{[s]:r})}),{})}}};return t.reduce(((e,t)=>Object.assign(e,function(e){const t=j(e),{key:r,name:s,reader:n,writer:o}=t;return{[s]:{get(){const e=this.data.get(r);return null!==e?n(e):t.defaultValue},set(e){void 0===e?this.data.delete(r):this.data.set(r,o(e))}},[`has${i(s)}`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}(t))),r)}],J.targets=[],J.values={};V.start().register("clipboard_copy_component",class extends J{copy(){const e=this.element.attributes.getNamedItem("value"),t=this.element.attributes.getNamedItem("for");if(e)navigator.clipboard.writeText(e.value);else if(t){const e=document.getElementById(t.value);navigator.clipboard.writeText((null==e?void 0:e.textContent)||"")}else navigator.clipboard.writeText(this.element.textContent||"")}});
1
+ class e{constructor(e,t,n){this.eventTarget=e,this.eventName=t,this.eventOptions=n,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){const t=function(e){if("immediatePropagationStopped"in e)return e;{const{stopImmediatePropagation:t}=e;return Object.assign(e,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}(e);for(const e of this.bindings){if(t.immediatePropagationStopped)break;e.handleEvent(t)}}get bindings(){return Array.from(this.unorderedBindings).sort(((e,t)=>{const n=e.index,r=t.index;return n<r?-1:n>r?1:0}))}}class t{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach((e=>e.connect())))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach((e=>e.disconnect())))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((e,t)=>e.concat(Array.from(t.values()))),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e){this.fetchEventListenerForBinding(e).bindingDisconnected(e)}handleError(e,t,n={}){this.application.handleError(e,`Error ${t}`,n)}fetchEventListenerForBinding(e){const{eventTarget:t,eventName:n,eventOptions:r}=e;return this.fetchEventListener(t,n,r)}fetchEventListener(e,t,n){const r=this.fetchEventListenerMapForEventTarget(e),i=this.cacheKey(t,n);let s=r.get(i);return s||(s=this.createEventListener(e,t,n),r.set(i,s)),s}createEventListener(t,n,r){const i=new e(t,n,r);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){const n=[e];return Object.keys(t).sort().forEach((e=>{n.push(`${t[e]?"":"!"}${e}`)})),n.join(":")}}const n=/^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;function r(e){return"window"==e?window:"document"==e?document:void 0}function i(e){return e.replace(/(?:[_-])([a-z0-9])/g,((e,t)=>t.toUpperCase()))}function s(e){return e.charAt(0).toUpperCase()+e.slice(1)}function o(e){return e.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`))}const a={a:e=>"click",button:e=>"click",form:e=>"submit",details:e=>"toggle",input:e=>"submit"==e.getAttribute("type")?"click":"input",select:e=>"change",textarea:e=>"input"};function c(e){throw new Error(e)}function l(e){try{return JSON.parse(e)}catch(t){return e}}class u{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){this.willBeInvokedByEvent(e)&&this.shouldBeInvokedPerSelf(e)&&(this.processStopPropagation(e),this.processPreventDefault(e),this.invokeWithEvent(e))}get eventName(){return this.action.eventName}get method(){const e=this.controller[this.methodName];if("function"==typeof e)return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}processStopPropagation(e){this.eventOptions.stop&&e.stopPropagation()}processPreventDefault(e){this.eventOptions.prevent&&e.preventDefault()}invokeWithEvent(e){const{target:t,currentTarget:n}=e;try{const{params:r}=this.action,i=Object.assign(e,{params:r});this.method.call(this.controller,i),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:n,action:this.methodName})}catch(t){const{identifier:n,controller:r,element:i,index:s}=this,o={identifier:n,controller:r,element:i,index:s,event:e};this.context.handleError(t,`invoking action "${this.action}"`,o)}}shouldBeInvokedPerSelf(e){return!0!==this.action.eventOptions.self||this.action.element===e.target}willBeInvokedByEvent(e){const t=e.target;return this.element===t||(t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class h{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const e=new Set(this.matchElementsInTree());for(const t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(const t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){"attributes"==e.type?this.processAttributeChange(e.target,e.attributeName):"childList"==e.type&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){const n=e;this.elements.has(n)?this.delegate.elementAttributeChanged&&this.matchElement(n)?this.delegate.elementAttributeChanged(n,t):this.removeElement(n):this.matchElement(n)&&this.addElement(n)}processRemovedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.processTree(e,this.removeElement)}}processAddedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.elementIsActive(e)&&this.processTree(e,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(const n of this.matchElementsInTree(e))t.call(this,n)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected==this.element.isConnected&&this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}}class d{constructor(e,t,n){this.attributeName=t,this.delegate=n,this.elementObserver=new h(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){const t=this.matchElement(e)?[e]:[],n=Array.from(e.querySelectorAll(this.selector));return t.concat(n)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}}class f{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){const t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){const n=this.delegate.getStringMapKeyForAttribute(e);if(null!=n){this.stringMap.has(e)||this.stringMapKeyAdded(n,e);const r=this.element.getAttribute(e);if(this.stringMap.get(e)!=r&&this.stringMapValueChanged(r,n,t),null==r){const t=this.stringMap.get(e);this.stringMap.delete(e),t&&this.stringMapKeyRemoved(n,e,t)}else this.stringMap.set(e,r)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,n){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,n)}stringMapKeyRemoved(e,t,n){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,n)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((e=>e.name))}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}function m(e,t){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n}class p{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce(((e,t)=>e.concat(Array.from(t))),[])}get size(){return Array.from(this.valuesByKey.values()).reduce(((e,t)=>e+t.size),0)}add(e,t){!function(e,t,n){m(e,t).add(n)}(this.valuesByKey,e,t)}delete(e,t){!function(e,t,n){m(e,t).delete(n),function(e,t){const n=e.get(t);null!=n&&0==n.size&&e.delete(t)}(e,t)}(this.valuesByKey,e,t)}has(e,t){const n=this.valuesByKey.get(e);return null!=n&&n.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some((t=>t.has(e)))}getValuesForKey(e){const t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter((([t,n])=>n.has(e))).map((([e,t])=>e))}}class g{constructor(e,t,n){this.attributeObserver=new d(e,t,this),this.delegate=n,this.tokensByElement=new p}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){const[t,n]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(n)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach((e=>this.tokenMatched(e)))}tokensUnmatched(e){e.forEach((e=>this.tokenUnmatched(e)))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){const t=this.tokensByElement.getValuesForKey(e),n=this.readTokensForElement(e),r=function(e,t){const n=Math.max(e.length,t.length);return Array.from({length:n},((n,r)=>[e[r],t[r]]))}(t,n).findIndex((([e,t])=>!function(e,t){return e&&t&&e.index==t.index&&e.content==t.content}(e,t)));return-1==r?[[],[]]:[t.slice(r),n.slice(r)]}readTokensForElement(e){const t=this.attributeName;return function(e,t,n){return e.trim().split(/\s+/).filter((e=>e.length)).map(((e,r)=>({element:t,attributeName:n,content:e,index:r})))}(e.getAttribute(t)||"",e,t)}}class v{constructor(e,t,n){this.tokenListObserver=new g(e,t,this),this.delegate=n,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){const{element:t}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(t).set(e,n),this.delegate.elementMatchedValue(t,n))}tokenUnmatched(e){const{element:t}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,n))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(e){return{error:e}}}}class b{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new v(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){const t=new u(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){const t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach((e=>this.delegate.bindingDisconnected(e))),this.bindingsByAction.clear()}parseValueForToken(e){const t=class{constructor(e,t,n){this.element=e,this.index=t,this.eventTarget=n.eventTarget||e,this.eventName=n.eventName||function(e){const t=e.tagName.toLowerCase();if(t in a)return a[t](e)}(e)||c("missing event name"),this.eventOptions=n.eventOptions||{},this.identifier=n.identifier||c("missing identifier"),this.methodName=n.methodName||c("missing method name")}static forToken(e){return new this(e.element,e.index,function(e){const t=e.trim().match(n)||[];return{eventTarget:r(t[4]),eventName:t[2],eventOptions:t[9]?(i=t[9],i.split(":").reduce(((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)})),{})):{},identifier:t[5],methodName:t[7]};var i}(e.content))}toString(){const e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}->${this.identifier}#${this.methodName}`}get params(){const e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`);for(const{name:n,value:r}of Array.from(this.element.attributes)){const s=n.match(t),o=s&&s[1];o&&(e[i(o)]=l(r))}return e}get eventTargetName(){return(e=this.eventTarget)==window?"window":e==document?"document":void 0;var e}}.forToken(e);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}}class y{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new f(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){const n=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,n.writer(this.receiver[e]),n.writer(n.defaultValue))}stringMapValueChanged(e,t,n){const r=this.valueDescriptorNameMap[t];null!==e&&(null===n&&(n=r.writer(r.defaultValue)),this.invokeChangedCallback(t,e,n))}stringMapKeyRemoved(e,t,n){const r=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,r.writer(this.receiver[e]),n):this.invokeChangedCallback(e,r.writer(r.defaultValue),n)}invokeChangedCallbacksForDefaultValues(){for(const{key:e,name:t,defaultValue:n,writer:r}of this.valueDescriptors)null==n||this.controller.data.has(e)||this.invokeChangedCallback(t,r(n),void 0)}invokeChangedCallback(e,t,n){const r=`${e}Changed`,i=this.receiver[r];if("function"==typeof i){const r=this.valueDescriptorNameMap[e];try{const e=r.reader(t);let s=n;n&&(s=r.reader(n)),i.call(this.receiver,e,s)}catch(e){if(!(e instanceof TypeError))throw e;throw new TypeError(`Stimulus Value "${this.context.identifier}.${r.name}" - ${e.message}`)}}}get valueDescriptors(){const{valueDescriptorMap:e}=this;return Object.keys(e).map((t=>e[t]))}get valueDescriptorNameMap(){const e={};return Object.keys(this.valueDescriptorMap).forEach((t=>{const n=this.valueDescriptorMap[t];e[n.name]=n})),e}hasValue(e){const t=`has${s(this.valueDescriptorNameMap[e].name)}`;return this.receiver[t]}}class w{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new p}start(){this.tokenListObserver||(this.tokenListObserver=new g(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var n;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),null===(n=this.tokenListObserver)||void 0===n||n.pause((()=>this.delegate.targetConnected(e,t))))}disconnectTarget(e,t){var n;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),null===(n=this.tokenListObserver)||void 0===n||n.pause((()=>this.delegate.targetDisconnected(e,t))))}disconnectAllTargets(){for(const e of this.targetsByName.keys)for(const t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}class A{constructor(e,t){this.logDebugActivity=(e,t={})=>{const{identifier:n,controller:r,element:i}=this;t=Object.assign({identifier:n,controller:r,element:i},t),this.application.logDebugActivity(this.identifier,e,t)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new b(this,this.dispatcher),this.valueObserver=new y(this,this.controller),this.targetObserver=new w(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(e){this.handleError(e,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,n={}){const{identifier:r,controller:i,element:s}=this;n=Object.assign({identifier:r,controller:i,element:s},n),this.application.handleError(e,`Error ${t}`,n)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}invokeControllerMethod(e,...t){const n=this.controller;"function"==typeof n[e]&&n[e](...t)}}function O(e,t){const n=E(e);return Array.from(n.reduce(((e,n)=>(function(e,t){const n=e[t];return Array.isArray(n)?n:[]}(n,t).forEach((t=>e.add(t))),e)),new Set))}function x(e,t){return E(e).reduce(((e,n)=>(e.push(...function(e,t){const n=e[t];return n?Object.keys(n).map((e=>[e,n[e]])):[]}(n,t)),e)),[])}function E(e){const t=[];for(;e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}function M(e){return function(e,t){const n=T(e),r=function(e,t){return k(t).reduce(((n,r)=>{const i=function(e,t,n){const r=Object.getOwnPropertyDescriptor(e,n);if(!r||!("value"in r)){const e=Object.getOwnPropertyDescriptor(t,n).value;return r&&(e.get=r.get||e.get,e.set=r.set||e.set),e}}(e,t,r);return i&&Object.assign(n,{[r]:i}),n}),{})}(e.prototype,t);return Object.defineProperties(n.prototype,r),n}(e,function(e){return O(e,"blessings").reduce(((t,n)=>{const r=n(e);for(const e in r){const n=t[e]||{};t[e]=Object.assign(n,r[e])}return t}),{})}(e))}const k="function"==typeof Object.getOwnPropertySymbols?e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)]:Object.getOwnPropertyNames,T=(()=>{function e(e){function t(){return Reflect.construct(e,arguments,new.target)}return t.prototype=Object.create(e.prototype,{constructor:{value:t}}),Reflect.setPrototypeOf(t,e),t}try{return function(){const t=e((function(){this.a.call(this)}));t.prototype.a=function(){},new t}(),e}catch(e){return e=>class extends e{}}})();class D{constructor(e,t){this.application=e,this.definition=function(e){return{identifier:e.identifier,controllerConstructor:M(e.controllerConstructor)}}(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){const t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){const t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new A(this,e),this.contextsByScope.set(e,t)),t}}class C{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){const t=this.data.get(this.getDataKey(e))||"";return t.match(/[^\s]+/g)||[]}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}}class N{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){const t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){const n=this.getAttributeNameForKey(e);return this.element.setAttribute(n,t),this.get(e)}has(e){const t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){const t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${o(e)}`}}class B{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,n){let r=this.warnedKeysByObject.get(e);r||(r=new Set,this.warnedKeysByObject.set(e,r)),r.has(t)||(r.add(t),this.logger.warn(n,e))}}function F(e,t){return`[${e}~="${t}"]`}class ${constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce(((e,t)=>e||this.findTarget(t)||this.findLegacyTarget(t)),void 0)}findAll(...e){return e.reduce(((e,t)=>[...e,...this.findAllTargets(t),...this.findAllLegacyTargets(t)]),[])}findTarget(e){const t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){const t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){return F(this.schema.targetAttributeForScope(this.identifier),e)}findLegacyTarget(e){const t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){const t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map((t=>this.deprecate(t,e)))}getLegacySelectorForTargetName(e){const t=`${this.identifier}.${e}`;return F(this.schema.targetAttribute,t)}deprecate(e,t){if(e){const{identifier:n}=this,r=this.schema.targetAttribute,i=this.schema.targetAttributeForScope(n);this.guide.warn(e,`target:${t}`,`Please replace ${r}="${n}.${t}" with ${i}="${t}". The ${r} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}}class S{constructor(e,t,n,r){this.targets=new $(this),this.classes=new C(this),this.data=new N(this),this.containsElement=e=>e.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=n,this.guide=new B(r)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return F(this.schema.controllerAttribute,this.identifier)}}class L{constructor(e,t,n){this.element=e,this.schema=t,this.delegate=n,this.valueListObserver=new v(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){const{element:t,content:n}=e,r=this.fetchScopesByIdentifierForElement(t);let i=r.get(n);return i||(i=this.delegate.createScopeForElementAndIdentifier(t,n),r.set(n,i)),i}elementMatchedValue(e,t){const n=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,n),1==n&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){const n=this.scopeReferenceCounts.get(t);n&&(this.scopeReferenceCounts.set(t,n-1),1==n&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}}class j{constructor(e){this.application=e,this.scopeObserver=new L(this.element,this.schema,this),this.scopesByIdentifier=new p,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce(((e,t)=>e.concat(t.contexts)),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);const t=new D(this.application,e);this.connectModule(t)}unloadIdentifier(e){const t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){const n=this.modulesByIdentifier.get(t);if(n)return n.contexts.find((t=>t.element==e))}handleError(e,t,n){this.application.handleError(e,t,n)}createScopeForElementAndIdentifier(e,t){return new S(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e);this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((t=>e.connectContextForScope(t)))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier);this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((t=>e.disconnectContextForScope(t)))}}const I={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:e=>`data-${e}-target`};class V{constructor(e=document.documentElement,n=I){this.logger=console,this.debug=!1,this.logDebugActivity=(e,t,n={})=>{this.debug&&this.logFormattedMessage(e,t,n)},this.element=e,this.schema=n,this.dispatcher=new t(this),this.router=new j(this)}static start(e,t){const n=new V(e,t);return n.start(),n}async start(){await new Promise((e=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",(()=>e())):e()})),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach((e=>{e.controllerConstructor.shouldLoad&&this.router.loadDefinition(e)}))}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach((e=>this.router.unloadIdentifier(e)))}get controllers(){return this.router.contexts.map((e=>e.controller))}getControllerForElementAndIdentifier(e,t){const n=this.router.getContextForElementAndIdentifier(e,t);return n?n.controller:null}handleError(e,t,n){var r;this.logger.error("%s\n\n%o\n\n%o",t,e,n),null===(r=window.onerror)||void 0===r||r.call(window,t,"",0,0,e)}logFormattedMessage(e,t,n={}){n=Object.assign({application:this},n),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},n)),this.logger.groupEnd()}}function P([e,t],n){return function(e){const t=`${o(e.token)}-value`,n=function(e){const t=function(e){const t=K(e.typeObject.type);if(!t)return;const n=R(e.typeObject.default);if(t!==n){const r=e.controller?`${e.controller}.${e.token}`:e.token;throw new Error(`The specified default value for the Stimulus Value "${r}" must match the defined type "${t}". The provided default value of "${e.typeObject.default}" is of type "${n}".`)}return t}({controller:e.controller,token:e.token,typeObject:e.typeDefinition}),n=R(e.typeDefinition),r=K(e.typeDefinition),i=t||n||r;if(i)return i;const s=e.controller?`${e.controller}.${e.typeDefinition}`:e.token;throw new Error(`Unknown value type "${s}" for "${e.token}" value`)}(e);return{type:n,key:t,name:i(t),get defaultValue(){return function(e){const t=K(e);if(t)return W[t];const n=e.default;return void 0!==n?n:e}(e.typeDefinition)},get hasCustomDefaultValue(){return void 0!==R(e.typeDefinition)},reader:U[n],writer:H[n]||H.default}}({controller:n,token:e,typeDefinition:t})}function K(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function R(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(e)?"array":"[object Object]"===Object.prototype.toString.call(e)?"object":void 0}const W={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},U={array(e){const t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${e}" of type "${R(t)}"`);return t},boolean:e=>!("0"==e||"false"==String(e).toLowerCase()),number:e=>Number(e),object(e){const t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${e}" of type "${R(t)}"`);return t},string:e=>e},H={default:function(e){return`${e}`},array:q,object:q};function q(e){return JSON.stringify(e)}class z{constructor(e){this.context=e}static get shouldLoad(){return!0}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:n={},prefix:r=this.identifier,bubbles:i=!0,cancelable:s=!0}={}){const o=new CustomEvent(r?`${r}:${e}`:e,{detail:n,bubbles:i,cancelable:s});return t.dispatchEvent(o),o}}z.blessings=[function(e){return O(e,"classes").reduce(((e,t)=>{return Object.assign(e,{[`${n=t}Class`]:{get(){const{classes:e}=this;if(e.has(n))return e.get(n);{const t=e.getAttributeName(n);throw new Error(`Missing attribute "${t}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${s(n)}Class`]:{get(){return this.classes.has(n)}}});var n}),{})},function(e){return O(e,"targets").reduce(((e,t)=>{return Object.assign(e,{[`${n=t}Target`]:{get(){const e=this.targets.find(n);if(e)return e;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${s(n)}Target`]:{get(){return this.targets.has(n)}}});var n}),{})},function(e){const t=x(e,"values"),n={valueDescriptorMap:{get(){return t.reduce(((e,t)=>{const n=P(t,this.identifier),r=this.data.getAttributeNameForKey(n.key);return Object.assign(e,{[r]:n})}),{})}}};return t.reduce(((e,t)=>Object.assign(e,function(e,t){const n=P(e,t),{key:r,name:i,reader:o,writer:a}=n;return{[i]:{get(){const e=this.data.get(r);return null!==e?o(e):n.defaultValue},set(e){void 0===e?this.data.delete(r):this.data.set(r,a(e))}},[`has${s(i)}`]:{get(){return this.data.has(r)||n.hasCustomDefaultValue}}}}(t))),n)}],z.targets=[],z.values={};class Y extends z{toggle(){var e;this.expandableTarget.classList.toggle("hidden"),this.expandWrapperTarget.classList.toggle("bg-filter-panel");for(const e of this.slidePanelTargets)e.classList.toggle("hidden");if(this.buttonWrapperTarget.classList.toggle("bg-filter-panel"),null===(e=document.getElementById("btnClose"))||void 0===e?void 0:e.classList.contains("hidden")){const e=this.buttonWrapperTarget.getAttribute("data-slideover-component-form-id");if(e){const t=document.getElementById(e);null==t||t.submit()}}}}Y.targets=["expandable","expandWrapper","slidePanel","buttonWrapper"];var J="top",Z="bottom",_="right",X="left",G=[J,Z,_,X],Q=G.reduce((function(e,t){return e.concat([t+"-start",t+"-end"])}),[]),ee=[].concat(G,["auto"]).reduce((function(e,t){return e.concat([t,t+"-start",t+"-end"])}),[]),te=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function ne(e){return e?(e.nodeName||"").toLowerCase():null}function re(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ie(e){return e instanceof re(e).Element||e instanceof Element}function se(e){return e instanceof re(e).HTMLElement||e instanceof HTMLElement}function oe(e){return"undefined"!=typeof ShadowRoot&&(e instanceof re(e).ShadowRoot||e instanceof ShadowRoot)}var ae={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];se(i)&&ne(i)&&(Object.assign(i.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],i=t.attributes[e]||{},s=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});se(r)&&ne(r)&&(Object.assign(r.style,s),Object.keys(i).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]};function ce(e){return e.split("-")[0]}var le=Math.max,ue=Math.min,he=Math.round;function de(e,t){void 0===t&&(t=!1);var n=e.getBoundingClientRect(),r=1,i=1;if(se(e)&&t){var s=e.offsetHeight,o=e.offsetWidth;o>0&&(r=he(n.width)/o||1),s>0&&(i=he(n.height)/s||1)}return{width:n.width/r,height:n.height/i,top:n.top/i,right:n.right/r,bottom:n.bottom/i,left:n.left/r,x:n.left/r,y:n.top/i}}function fe(e){var t=de(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function me(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&oe(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function pe(e){return re(e).getComputedStyle(e)}function ge(e){return["table","td","th"].indexOf(ne(e))>=0}function ve(e){return((ie(e)?e.ownerDocument:e.document)||window.document).documentElement}function be(e){return"html"===ne(e)?e:e.assignedSlot||e.parentNode||(oe(e)?e.host:null)||ve(e)}function ye(e){return se(e)&&"fixed"!==pe(e).position?e.offsetParent:null}function we(e){for(var t=re(e),n=ye(e);n&&ge(n)&&"static"===pe(n).position;)n=ye(n);return n&&("html"===ne(n)||"body"===ne(n)&&"static"===pe(n).position)?t:n||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&se(e)&&"fixed"===pe(e).position)return null;var n=be(e);for(oe(n)&&(n=n.host);se(n)&&["html","body"].indexOf(ne(n))<0;){var r=pe(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}function Ae(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Oe(e,t,n){return le(e,ue(t,n))}function xe(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function Ee(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}var Me={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,i=e.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=ce(n.placement),c=Ae(a),l=[X,_].indexOf(a)>=0?"height":"width";if(s&&o){var u=function(e,t){return xe("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:Ee(e,G))}(i.padding,n),h=fe(s),d="y"===c?J:X,f="y"===c?Z:_,m=n.rects.reference[l]+n.rects.reference[c]-o[c]-n.rects.popper[l],p=o[c]-n.rects.reference[c],g=we(s),v=g?"y"===c?g.clientHeight||0:g.clientWidth||0:0,b=m/2-p/2,y=u[d],w=v-h[l]-u[f],A=v/2-h[l]/2+b,O=Oe(y,A,w),x=c;n.modifiersData[r]=((t={})[x]=O,t.centerOffset=O-A,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&me(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ke(e){return e.split("-")[1]}var Te={top:"auto",right:"auto",bottom:"auto",left:"auto"};function De(e){var t,n=e.popper,r=e.popperRect,i=e.placement,s=e.variation,o=e.offsets,a=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,h=e.isFixed,d=o.x,f=void 0===d?0:d,m=o.y,p=void 0===m?0:m,g="function"==typeof u?u({x:f,y:p}):{x:f,y:p};f=g.x,p=g.y;var v=o.hasOwnProperty("x"),b=o.hasOwnProperty("y"),y=X,w=J,A=window;if(l){var O=we(n),x="clientHeight",E="clientWidth";if(O===re(n)&&"static"!==pe(O=ve(n)).position&&"absolute"===a&&(x="scrollHeight",E="scrollWidth"),i===J||(i===X||i===_)&&"end"===s)w=Z,p-=(h&&O===A&&A.visualViewport?A.visualViewport.height:O[x])-r.height,p*=c?1:-1;if(i===X||(i===J||i===Z)&&"end"===s)y=_,f-=(h&&O===A&&A.visualViewport?A.visualViewport.width:O[E])-r.width,f*=c?1:-1}var M,k=Object.assign({position:a},l&&Te),T=!0===u?function(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:he(t*r)/r||0,y:he(n*r)/r||0}}({x:f,y:p}):{x:f,y:p};return f=T.x,p=T.y,c?Object.assign({},k,((M={})[w]=b?"0":"",M[y]=v?"0":"",M.transform=(A.devicePixelRatio||1)<=1?"translate("+f+"px, "+p+"px)":"translate3d("+f+"px, "+p+"px, 0)",M)):Object.assign({},k,((t={})[w]=b?p+"px":"",t[y]=v?f+"px":"",t.transform="",t))}var Ce={passive:!0};var Ne={left:"right",right:"left",bottom:"top",top:"bottom"};function Be(e){return e.replace(/left|right|bottom|top/g,(function(e){return Ne[e]}))}var Fe={start:"end",end:"start"};function $e(e){return e.replace(/start|end/g,(function(e){return Fe[e]}))}function Se(e){var t=re(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Le(e){return de(ve(e)).left+Se(e).scrollLeft}function je(e){var t=pe(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Ie(e){return["html","body","#document"].indexOf(ne(e))>=0?e.ownerDocument.body:se(e)&&je(e)?e:Ie(be(e))}function Ve(e,t){var n;void 0===t&&(t=[]);var r=Ie(e),i=r===(null==(n=e.ownerDocument)?void 0:n.body),s=re(r),o=i?[s].concat(s.visualViewport||[],je(r)?r:[]):r,a=t.concat(o);return i?a:a.concat(Ve(be(o)))}function Pe(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Ke(e,t){return"viewport"===t?Pe(function(e){var t=re(e),n=ve(e),r=t.visualViewport,i=n.clientWidth,s=n.clientHeight,o=0,a=0;return r&&(i=r.width,s=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(o=r.offsetLeft,a=r.offsetTop)),{width:i,height:s,x:o+Le(e),y:a}}(e)):ie(t)?function(e){var t=de(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):Pe(function(e){var t,n=ve(e),r=Se(e),i=null==(t=e.ownerDocument)?void 0:t.body,s=le(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=le(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Le(e),c=-r.scrollTop;return"rtl"===pe(i||n).direction&&(a+=le(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:c}}(ve(e)))}function Re(e,t,n){var r="clippingParents"===t?function(e){var t=Ve(be(e)),n=["absolute","fixed"].indexOf(pe(e).position)>=0&&se(e)?we(e):e;return ie(n)?t.filter((function(e){return ie(e)&&me(e,n)&&"body"!==ne(e)})):[]}(e):[].concat(t),i=[].concat(r,[n]),s=i[0],o=i.reduce((function(t,n){var r=Ke(e,n);return t.top=le(r.top,t.top),t.right=ue(r.right,t.right),t.bottom=ue(r.bottom,t.bottom),t.left=le(r.left,t.left),t}),Ke(e,s));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function We(e){var t,n=e.reference,r=e.element,i=e.placement,s=i?ce(i):null,o=i?ke(i):null,a=n.x+n.width/2-r.width/2,c=n.y+n.height/2-r.height/2;switch(s){case J:t={x:a,y:n.y-r.height};break;case Z:t={x:a,y:n.y+n.height};break;case _:t={x:n.x+n.width,y:c};break;case X:t={x:n.x-r.width,y:c};break;default:t={x:n.x,y:n.y}}var l=s?Ae(s):null;if(null!=l){var u="y"===l?"height":"width";switch(o){case"start":t[l]=t[l]-(n[u]/2-r[u]/2);break;case"end":t[l]=t[l]+(n[u]/2-r[u]/2)}}return t}function Ue(e,t){void 0===t&&(t={});var n=t,r=n.placement,i=void 0===r?e.placement:r,s=n.boundary,o=void 0===s?"clippingParents":s,a=n.rootBoundary,c=void 0===a?"viewport":a,l=n.elementContext,u=void 0===l?"popper":l,h=n.altBoundary,d=void 0!==h&&h,f=n.padding,m=void 0===f?0:f,p=xe("number"!=typeof m?m:Ee(m,G)),g="popper"===u?"reference":"popper",v=e.rects.popper,b=e.elements[d?g:u],y=Re(ie(b)?b:b.contextElement||ve(e.elements.popper),o,c),w=de(e.elements.reference),A=We({reference:w,element:v,strategy:"absolute",placement:i}),O=Pe(Object.assign({},v,A)),x="popper"===u?O:w,E={top:y.top-x.top+p.top,bottom:x.bottom-y.bottom+p.bottom,left:y.left-x.left+p.left,right:x.right-y.right+p.right},M=e.modifiersData.offset;if("popper"===u&&M){var k=M[i];Object.keys(E).forEach((function(e){var t=[_,Z].indexOf(e)>=0?1:-1,n=[J,Z].indexOf(e)>=0?"y":"x";E[e]+=k[n]*t}))}return E}function He(e,t){void 0===t&&(t={});var n=t,r=n.placement,i=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,l=void 0===c?ee:c,u=ke(r),h=u?a?Q:Q.filter((function(e){return ke(e)===u})):G,d=h.filter((function(e){return l.indexOf(e)>=0}));0===d.length&&(d=h);var f=d.reduce((function(t,n){return t[n]=Ue(e,{placement:n,boundary:i,rootBoundary:s,padding:o})[ce(n)],t}),{});return Object.keys(f).sort((function(e,t){return f[e]-f[t]}))}var qe={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,s=void 0===i||i,o=n.altAxis,a=void 0===o||o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,h=n.rootBoundary,d=n.altBoundary,f=n.flipVariations,m=void 0===f||f,p=n.allowedAutoPlacements,g=t.options.placement,v=ce(g),b=c||(v===g||!m?[Be(g)]:function(e){if("auto"===ce(e))return[];var t=Be(e);return[$e(e),t,$e(t)]}(g)),y=[g].concat(b).reduce((function(e,n){return e.concat("auto"===ce(n)?He(t,{placement:n,boundary:u,rootBoundary:h,padding:l,flipVariations:m,allowedAutoPlacements:p}):n)}),[]),w=t.rects.reference,A=t.rects.popper,O=new Map,x=!0,E=y[0],M=0;M<y.length;M++){var k=y[M],T=ce(k),D="start"===ke(k),C=[J,Z].indexOf(T)>=0,N=C?"width":"height",B=Ue(t,{placement:k,boundary:u,rootBoundary:h,altBoundary:d,padding:l}),F=C?D?_:X:D?Z:J;w[N]>A[N]&&(F=Be(F));var $=Be(F),S=[];if(s&&S.push(B[T]<=0),a&&S.push(B[F]<=0,B[$]<=0),S.every((function(e){return e}))){E=k,x=!1;break}O.set(k,S)}if(x)for(var L=function(e){var t=y.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return E=t,"break"},j=m?3:1;j>0;j--){if("break"===L(j))break}t.placement!==E&&(t.modifiersData[r]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function ze(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Ye(e){return[J,_,Z,X].some((function(t){return e[t]>=0}))}var Je={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.offset,s=void 0===i?[0,0]:i,o=ee.reduce((function(e,n){return e[n]=function(e,t,n){var r=ce(e),i=[X,J].indexOf(r)>=0?-1:1,s="function"==typeof n?n(Object.assign({},t,{placement:e})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[X,_].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}(n,t.rects,s),e}),{}),a=o[t.placement],c=a.x,l=a.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}};var Ze={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,s=void 0===i||i,o=n.altAxis,a=void 0!==o&&o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,h=n.padding,d=n.tether,f=void 0===d||d,m=n.tetherOffset,p=void 0===m?0:m,g=Ue(t,{boundary:c,rootBoundary:l,padding:h,altBoundary:u}),v=ce(t.placement),b=ke(t.placement),y=!b,w=Ae(v),A="x"===w?"y":"x",O=t.modifiersData.popperOffsets,x=t.rects.reference,E=t.rects.popper,M="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,k="number"==typeof M?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,D={x:0,y:0};if(O){if(s){var C,N="y"===w?J:X,B="y"===w?Z:_,F="y"===w?"height":"width",$=O[w],S=$+g[N],L=$-g[B],j=f?-E[F]/2:0,I="start"===b?x[F]:E[F],V="start"===b?-E[F]:-x[F],P=t.elements.arrow,K=f&&P?fe(P):{width:0,height:0},R=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},W=R[N],U=R[B],H=Oe(0,x[F],K[F]),q=y?x[F]/2-j-H-W-k.mainAxis:I-H-W-k.mainAxis,z=y?-x[F]/2+j+H+U+k.mainAxis:V+H+U+k.mainAxis,Y=t.elements.arrow&&we(t.elements.arrow),G=Y?"y"===w?Y.clientTop||0:Y.clientLeft||0:0,Q=null!=(C=null==T?void 0:T[w])?C:0,ee=$+z-Q,te=Oe(f?ue(S,$+q-Q-G):S,$,f?le(L,ee):L);O[w]=te,D[w]=te-$}if(a){var ne,re="x"===w?J:X,ie="x"===w?Z:_,se=O[A],oe="y"===A?"height":"width",ae=se+g[re],he=se-g[ie],de=-1!==[J,X].indexOf(v),me=null!=(ne=null==T?void 0:T[A])?ne:0,pe=de?ae:se-x[oe]-E[oe]-me+k.altAxis,ge=de?se+x[oe]+E[oe]-me-k.altAxis:he,ve=f&&de?function(e,t,n){var r=Oe(e,t,n);return r>n?n:r}(pe,se,ge):Oe(f?pe:ae,se,f?ge:he);O[A]=ve,D[A]=ve-se}t.modifiersData[r]=D}},requiresIfExists:["offset"]};function _e(e,t,n){void 0===n&&(n=!1);var r,i,s=se(t),o=se(t)&&function(e){var t=e.getBoundingClientRect(),n=he(t.width)/e.offsetWidth||1,r=he(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(t),a=ve(t),c=de(e,o),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(s||!s&&!n)&&(("body"!==ne(t)||je(a))&&(l=(r=t)!==re(r)&&se(r)?{scrollLeft:(i=r).scrollLeft,scrollTop:i.scrollTop}:Se(r)),se(t)?((u=de(t,!0)).x+=t.clientLeft,u.y+=t.clientTop):a&&(u.x=Le(a))),{x:c.left+l.scrollLeft-u.x,y:c.top+l.scrollTop-u.y,width:c.width,height:c.height}}function Xe(e){var t=new Map,n=new Set,r=[];function i(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&i(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||i(e)})),r}var Ge={placement:"bottom",modifiers:[],strategy:"absolute"};function Qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function et(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,r=void 0===n?[]:n,i=t.defaultOptions,s=void 0===i?Ge:i;return function(e,t,n){void 0===n&&(n=s);var i,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ge,s),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},c=[],l=!1,u={state:a,setOptions:function(n){var i="function"==typeof n?n(a.options):n;h(),a.options=Object.assign({},s,a.options,i),a.scrollParents={reference:ie(e)?Ve(e):e.contextElement?Ve(e.contextElement):[],popper:Ve(t)};var o,l,d=function(e){var t=Xe(e);return te.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}((o=[].concat(r,a.options.modifiers),l=o.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{}),Object.keys(l).map((function(e){return l[e]}))));return a.orderedModifiers=d.filter((function(e){return e.enabled})),a.orderedModifiers.forEach((function(e){var t=e.name,n=e.options,r=void 0===n?{}:n,i=e.effect;if("function"==typeof i){var s=i({state:a,name:t,instance:u,options:r}),o=function(){};c.push(s||o)}})),u.update()},forceUpdate:function(){if(!l){var e=a.elements,t=e.reference,n=e.popper;if(Qe(t,n)){a.rects={reference:_e(t,we(n),"fixed"===a.options.strategy),popper:fe(n)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach((function(e){return a.modifiersData[e.name]=Object.assign({},e.data)}));for(var r=0;r<a.orderedModifiers.length;r++)if(!0!==a.reset){var i=a.orderedModifiers[r],s=i.fn,o=i.options,c=void 0===o?{}:o,h=i.name;"function"==typeof s&&(a=s({state:a,options:c,name:h,instance:u})||a)}else a.reset=!1,r=-1}}},update:(i=function(){return new Promise((function(e){u.forceUpdate(),e(a)}))},function(){return o||(o=new Promise((function(e){Promise.resolve().then((function(){o=void 0,e(i())}))}))),o}),destroy:function(){h(),l=!0}};if(!Qe(e,t))return u;function h(){c.forEach((function(e){return e()})),c=[]}return u.setOptions(n).then((function(e){!l&&n.onFirstUpdate&&n.onFirstUpdate(e)})),u}}var tt=et({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,s=void 0===i||i,o=r.resize,a=void 0===o||o,c=re(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&l.forEach((function(e){e.addEventListener("scroll",n.update,Ce)})),a&&c.addEventListener("resize",n.update,Ce),function(){s&&l.forEach((function(e){e.removeEventListener("scroll",n.update,Ce)})),a&&c.removeEventListener("resize",n.update,Ce)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=We({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=void 0===r||r,s=n.adaptive,o=void 0===s||s,a=n.roundOffsets,c=void 0===a||a,l={placement:ce(t.placement),variation:ke(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,De(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,De(Object.assign({},l,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},ae,Je,qe,Ze,Me,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,s=t.modifiersData.preventOverflow,o=Ue(t,{elementContext:"reference"}),a=Ue(t,{altBoundary:!0}),c=ze(o,r),l=ze(a,i,s),u=Ye(c),h=Ye(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":h})}}]});class nt extends z{connect(){this.popperInstance=tt(this.triggerTarget,this.tooltipTarget,{placement:this.placementValue,modifiers:[{name:"offset",options:{offset:this.offsetValue}}]})}disconnect(){this.popperInstance&&this.popperInstance.destroy()}show(){this.tooltipTarget.setAttribute("data-tooltip-show",""),this.tooltipTarget.classList.remove("invisible"),this.popperInstance.update(),this.dispatch("shown",{detail:{trigger:this.triggerTarget,tooltip:this.tooltipTarget}})}hide(){this.tooltipTarget.removeAttribute("data-tooltip-show"),this.tooltipTarget.classList.add("invisible"),this.dispatch("hidden",{detail:{trigger:this.triggerTarget,tooltip:this.tooltipTarget}})}}nt.targets=["trigger","tooltip"],nt.values={placement:{type:String,default:"top"},offset:{type:Array,default:[0,8]}};const rt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],it=["January","February","March","April","May","June","July","August","September","October","November","December"];function st(e){return`0${e}`.slice(-2)}function ot(e,t){const n=e.getDay(),r=e.getDate(),i=e.getMonth(),s=e.getFullYear(),o=e.getHours(),a=e.getMinutes(),c=e.getSeconds();return t.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,(function(t){let l;switch(t[1]){case"%":return"%";case"a":return rt[n].slice(0,3);case"A":return rt[n];case"b":return it[i].slice(0,3);case"B":return it[i];case"c":return e.toString();case"d":return st(r);case"e":return String(r);case"H":return st(o);case"I":return st(ot(e,"%l"));case"l":return String(0===o||12===o?12:(o+12)%12);case"m":return st(i+1);case"M":return st(a);case"p":return o>11?"PM":"AM";case"P":return o>11?"pm":"am";case"S":return st(c);case"w":return String(n);case"y":return st(s%100);case"Y":return String(s);case"Z":return l=e.toString().match(/\((\w+)\)$/),l?l[1]:"";case"z":return l=e.toString().match(/\w([+-]\d\d\d\d) /),l?l[1]:""}return""}))}function at(e){let t;return function(){if(t)return t;if("Intl"in window)try{return t=new Intl.DateTimeFormat(void 0,e),t}catch(e){if(!(e instanceof RangeError))throw e}}}let ct=null;const lt=at({day:"numeric",month:"short"});function ut(){if(null!==ct)return ct;const e=lt();if(e){const t=e.format(new Date(0));return ct=!!t.match(/^\d/),ct}return!1}let ht=null;const dt=at({day:"numeric",month:"short",year:"numeric"});function ft(e){const t=e.closest("[lang]");return t instanceof HTMLElement&&t.lang?t.lang:"default"}const mt=new WeakMap;class pt extends HTMLElement{static get observedAttributes(){return["datetime","day","format","lang","hour","minute","month","second","title","weekday","year","time-zone-name"]}connectedCallback(){const e=this.getFormattedTitle();e&&!this.hasAttribute("title")&&this.setAttribute("title",e);const t=this.getFormattedDate();t&&(this.textContent=t)}attributeChangedCallback(e,t,n){const r=this.getFormattedTitle();if("datetime"===e){const e=Date.parse(n);isNaN(e)?mt.delete(this):mt.set(this,new Date(e))}const i=this.getFormattedTitle(),s=this.getAttribute("title");"title"===e||!i||s&&s!==r||this.setAttribute("title",i);const o=this.getFormattedDate();o&&(this.textContent=o)}get date(){return mt.get(this)}getFormattedTitle(){const e=this.date;if(!e)return;const t=gt();if(t)return t.format(e);try{return e.toLocaleString()}catch(t){if(t instanceof RangeError)return e.toString();throw t}}getFormattedDate(){}}const gt=at({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),vt=new WeakMap;class bt extends pt{attributeChangedCallback(e,t,n){"hour"!==e&&"minute"!==e&&"second"!==e&&"time-zone-name"!==e||vt.delete(this),super.attributeChangedCallback(e,t,n)}getFormattedDate(){const e=this.date;if(!e)return;const t=function(e,t){const n={weekday:{short:"%a",long:"%A"},day:{numeric:"%e","2-digit":"%d"},month:{short:"%b",long:"%B"},year:{numeric:"%Y","2-digit":"%y"}};let r=ut()?"weekday day month year":"weekday month day, year";for(const t in n){const i=n[t][e.getAttribute(t)||""];r=r.replace(t,i||"")}return r=r.replace(/(\s,)|(,\s$)/,""),ot(t,r).replace(/\s+/," ").trim()}(this,e)||"",n=function(e,t){const n={},r=e.getAttribute("hour");"numeric"!==r&&"2-digit"!==r||(n.hour=r);const i=e.getAttribute("minute");"numeric"!==i&&"2-digit"!==i||(n.minute=i);const s=e.getAttribute("second");"numeric"!==s&&"2-digit"!==s||(n.second=s);const o=e.getAttribute("time-zone-name");"short"!==o&&"long"!==o||(n.timeZoneName=o);if(0===Object.keys(n).length)return;let a=vt.get(e);a||(a=at(n),vt.set(e,a));const c=a();if(c)return c.format(t);return ot(t,n.second?"%H:%M:%S":"%H:%M")}(this,e)||"";return`${t} ${n}`.trim()}}window.customElements.get("local-time")||(window.LocalTimeElement=bt,window.customElements.define("local-time",bt));class yt{constructor(e,t){this.date=e,this.locale=t}toString(){const e=this.timeElapsed();if(e)return e;{const e=this.timeAhead();return e||`on ${this.formatDate()}`}}timeElapsed(){const e=(new Date).getTime()-this.date.getTime(),t=Math.round(e/1e3),n=Math.round(t/60),r=Math.round(n/60),i=Math.round(r/24);return e>=0&&i<30?this.timeAgoFromMs(e):null}timeAhead(){const e=this.date.getTime()-(new Date).getTime(),t=Math.round(e/1e3),n=Math.round(t/60),r=Math.round(n/60),i=Math.round(r/24);return e>=0&&i<30?this.timeUntil():null}timeAgo(){const e=(new Date).getTime()-this.date.getTime();return this.timeAgoFromMs(e)}timeAgoFromMs(e){const t=Math.round(e/1e3),n=Math.round(t/60),r=Math.round(n/60),i=Math.round(r/24),s=Math.round(i/30),o=Math.round(s/12);return e<0||t<10?wt(this.locale,0,"second"):t<45?wt(this.locale,-t,"second"):t<90||n<45?wt(this.locale,-n,"minute"):n<90||r<24?wt(this.locale,-r,"hour"):r<36||i<30?wt(this.locale,-i,"day"):s<18?wt(this.locale,-s,"month"):wt(this.locale,-o,"year")}microTimeAgo(){const e=(new Date).getTime()-this.date.getTime(),t=Math.round(e/1e3),n=Math.round(t/60),r=Math.round(n/60),i=Math.round(r/24),s=Math.round(i/30),o=Math.round(s/12);return n<1?"1m":n<60?`${n}m`:r<24?`${r}h`:i<365?`${i}d`:`${o}y`}timeUntil(){const e=this.date.getTime()-(new Date).getTime();return this.timeUntilFromMs(e)}timeUntilFromMs(e){const t=Math.round(e/1e3),n=Math.round(t/60),r=Math.round(n/60),i=Math.round(r/24),s=Math.round(i/30),o=Math.round(s/12);return s>=18||s>=12?wt(this.locale,o,"year"):i>=45||i>=30?wt(this.locale,s,"month"):r>=36||r>=24?wt(this.locale,i,"day"):n>=90||n>=45?wt(this.locale,r,"hour"):t>=90||t>=45?wt(this.locale,n,"minute"):wt(this.locale,t>=10?t:0,"second")}microTimeUntil(){const e=this.date.getTime()-(new Date).getTime(),t=Math.round(e/1e3),n=Math.round(t/60),r=Math.round(n/60),i=Math.round(r/24),s=Math.round(i/30),o=Math.round(s/12);return i>=365?`${o}y`:r>=24?`${i}d`:n>=60?`${r}h`:n>1?`${n}m`:"1m"}formatDate(){let e=ut()?"%e %b":"%b %e";var t;return t=this.date,(new Date).getUTCFullYear()!==t.getUTCFullYear()&&(e+=function(){if(null!==ht)return ht;const e=dt();if(e){const t=e.format(new Date(0));return ht=!!t.match(/\d,/),ht}return!0}()?", %Y":" %Y"),ot(this.date,e)}formatTime(){const e=At();return e?e.format(this.date):ot(this.date,"%l:%M%P")}}function wt(e,t,n){const r=function(e,t){if("Intl"in window&&"RelativeTimeFormat"in window.Intl)try{return new Intl.RelativeTimeFormat(e,t)}catch(e){if(!(e instanceof RangeError))throw e}}(e,{numeric:"auto"});return r?r.format(t,n):function(e,t){if(0===e)switch(t){case"year":case"quarter":case"month":case"week":return`this ${t}`;case"day":return"today";case"hour":case"minute":return`in 0 ${t}s`;case"second":return"now"}else if(1===e)switch(t){case"year":case"quarter":case"month":case"week":return`next ${t}`;case"day":return"tomorrow";case"hour":case"minute":case"second":return`in 1 ${t}`}else if(-1===e)switch(t){case"year":case"quarter":case"month":case"week":return`last ${t}`;case"day":return"yesterday";case"hour":case"minute":case"second":return`1 ${t} ago`}else if(e>1)switch(t){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return`in ${e} ${t}s`}else if(e<-1)switch(t){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return`${-e} ${t}s ago`}throw new RangeError(`Invalid unit argument for format() '${t}'`)}(t,n)}const At=at({hour:"numeric",minute:"2-digit"});class Ot extends pt{getFormattedDate(){const e=this.date;if(e)return new yt(e,ft(this)).toString()}connectedCallback(){xt.push(this),Et||(Mt(),Et=window.setInterval(Mt,6e4)),super.connectedCallback()}disconnectedCallback(){const e=xt.indexOf(this);-1!==e&&xt.splice(e,1),xt.length||Et&&(clearInterval(Et),Et=null)}}const xt=[];let Et;function Mt(){let e,t,n;for(t=0,n=xt.length;t<n;t++)e=xt[t],e.textContent=e.getFormattedDate()||""}window.customElements.get("relative-time")||(window.RelativeTimeElement=Ot,window.customElements.define("relative-time",Ot));class kt extends Ot{getFormattedDate(){const e=this.getAttribute("format"),t=this.date;if(t)return"micro"===e?new yt(t,ft(this)).microTimeAgo():new yt(t,ft(this)).timeAgo()}}window.customElements.get("time-ago")||(window.TimeAgoElement=kt,window.customElements.define("time-ago",kt));class Tt extends Ot{getFormattedDate(){const e=this.getAttribute("format"),t=this.date;if(t)return"micro"===e?new yt(t,ft(this)).microTimeUntil():new yt(t,ft(this)).timeUntil()}}window.customElements.get("time-until")||(window.TimeUntilElement=Tt,window.customElements.define("time-until",Tt));const Dt=V.start();Dt.register("clipboard-copy-component",class extends z{copy(){const e=this.element.attributes.getNamedItem("value"),t=this.element.attributes.getNamedItem("for");if(e)navigator.clipboard.writeText(e.value);else if(t){const e=document.getElementById(t.value);navigator.clipboard.writeText((null==e?void 0:e.textContent)||"")}else navigator.clipboard.writeText(this.element.textContent||"")}}),Dt.register("slideover-component",Y),Dt.register("tooltip-component",nt);
2
2
  //# sourceMappingURL=ariadne_view_components.js.map