ariadne_view_components 0.0.85 → 0.0.86.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/app/assets/javascripts/ariadne_view_components.js +14 -14
- data/app/assets/javascripts/ariadne_view_components.js.br +0 -0
- data/app/assets/javascripts/ariadne_view_components.js.gz +0 -0
- data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
- data/app/assets/stylesheets/ariadne_view_components.css +1 -1
- data/app/assets/stylesheets/ariadne_view_components.css.br +0 -0
- data/app/assets/stylesheets/ariadne_view_components.css.gz +0 -0
- data/app/components/ariadne/base_component.rb +15 -5
- data/app/components/ariadne/form/base_component.rb +1 -1
- data/app/components/ariadne/form/checkbox/component.html.erb +1 -1
- data/app/components/ariadne/form/checkbox/component.rb +15 -3
- data/app/components/ariadne/form/radio_button/component.html.erb +1 -3
- data/app/components/ariadne/form/select/component.html.erb +4 -2
- data/app/components/ariadne/form/select/component.rb +50 -2
- data/app/components/ariadne/form/toggle_group/component.html.erb +7 -0
- data/app/components/ariadne/form/toggle_group/component.rb +35 -0
- data/app/components/ariadne/form/toggle_group/option/component.html.erb +8 -0
- data/app/components/ariadne/form/toggle_group/option/component.rb +46 -0
- data/app/components/ariadne/layout/label_block/component.html.erb +12 -0
- data/app/components/ariadne/layout/label_block/component.rb +39 -0
- data/app/components/ariadne/layout/nav_bar/component.rb +4 -4
- data/app/components/ariadne/layout/section_block/component.html.erb +4 -0
- data/app/components/ariadne/layout/section_block/component.rb +12 -0
- data/app/components/ariadne/layout/section_block/header/component.html.erb +4 -0
- data/app/components/ariadne/layout/section_block/header/component.rb +14 -0
- data/app/components/ariadne/ui/avatar/component.html.erb +7 -0
- data/app/components/ariadne/ui/avatar/component.rb +54 -0
- data/app/components/ariadne/ui/badge/component.rb +8 -0
- data/app/components/ariadne/ui/card/body/component.html.erb +3 -0
- data/app/components/ariadne/ui/card/body/component.rb +25 -0
- data/app/components/ariadne/ui/card/component.html.erb +2 -6
- data/app/components/ariadne/ui/card/component.rb +1 -0
- data/app/components/ariadne/ui/combobox/component.rb +2 -0
- data/app/components/ariadne/ui/list/component.html.erb +2 -2
- data/app/components/ariadne/ui/list/component.rb +11 -12
- data/app/components/ariadne/ui/pagination/component.html.erb +29 -0
- data/app/components/ariadne/ui/pagination/component.rb +30 -0
- data/app/components/ariadne/ui/stats_panel/component.html.erb +7 -0
- data/app/components/ariadne/ui/stats_panel/component.rb +12 -0
- data/app/components/ariadne/ui/stats_panel/item/component.html.erb +4 -0
- data/app/components/ariadne/ui/stats_panel/item/component.rb +27 -0
- data/app/components/ariadne/ui/time_ago/component.html.erb +1 -0
- data/app/components/ariadne/ui/time_ago/component.rb +155 -0
- data/app/components/ariadne/ui/time_ago/component.ts +8 -0
- data/app/components/ariadne/ui/time_ago/en.yml +12 -0
- data/app/frontend/ariadne/index.ts +0 -3
- data/app/lib/ariadne/fetch_or_fallback_helper.rb +23 -0
- data/lib/ariadne/view_components/engine.rb +4 -0
- data/lib/ariadne/view_components/version.rb +1 -1
- metadata +28 -3
- data/static/audited_at.json +0 -58
@@ -1,4 +1,4 @@
|
|
1
|
-
function Di(n,t=0,{start:e=!0,middle:s=!0,once:i=!1}={}){let r=e,o=0,a,c=!1;function l(...u){if(c)return;const h=Date.now()-o;o=Date.now(),e&&s&&h>=t&&(r=!0),r?(r=!1,n.apply(this,u),i&&l.cancel()):(s&&h<t||!s)&&(clearTimeout(a),a=setTimeout(()=>{o=Date.now(),n.apply(this,u),i&&l.cancel()},s?t-h:t))}return l.cancel=()=>{clearTimeout(a),c=!0},l}function Bi(n,t=0,{start:e=!1,middle:s=!1,once:i=!1}={}){return Di(n,t,{start:e,middle:s,once:i})}var Ae=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},Pi=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},lt;const $t=new WeakMap;class ve extends Event{constructor(t){super(`auto-check-${t}`,{bubbles:!0}),this.phase=t}get detail(){return this}}class Ls extends ve{constructor(t,e=""){super(t),this.phase=t,this.message=e,this.setValidity=s=>{this.message=s}}}class Tn extends ve{constructor(){super("complete")}}class $i extends ve{constructor(t){super("success"),this.response=t}}class Ri extends Ls{constructor(){super("start","Verifying…")}}class Ii extends Ls{constructor(t){super("error","Validation failed"),this.response=t}}class Ni extends ve{constructor(t){super("send"),this.body=t}}class Fs extends HTMLElement{constructor(){super(...arguments),lt.set(this,null)}static define(t="auto-check",e=customElements){return e.define(t,this),this}get onloadend(){return Ae(this,lt,"f")}set onloadend(t){Ae(this,lt,"f")&&this.removeEventListener("loadend",Ae(this,lt,"f")),Pi(this,lt,typeof t=="object"||typeof t=="function"?t:null,"f"),typeof t=="function"&&this.addEventListener("loadend",t)}connectedCallback(){const t=this.input;if(!t)return;const e=Bi(Hi.bind(null,this),300),s={check:e,controller:null};$t.set(this,s),t.addEventListener("input",xn),t.addEventListener("input",e),t.autocomplete="off",t.spellcheck=!1}disconnectedCallback(){const t=this.input;if(!t)return;const e=$t.get(this);e&&($t.delete(this),t.removeEventListener("input",xn),t.removeEventListener("input",e.check),t.setCustomValidity(""))}attributeChangedCallback(t){if(t==="required"){const e=this.input;if(!e)return;e.required=this.required}}static get observedAttributes(){return["required"]}get input(){return this.querySelector("input")}get src(){const t=this.getAttribute("src");if(!t)return"";const e=this.ownerDocument.createElement("a");return e.href=t,e.href}set src(t){this.setAttribute("src",t)}get csrf(){const t=this.querySelector("[data-csrf]");return this.getAttribute("csrf")||t instanceof HTMLInputElement&&t.value||""}set csrf(t){this.setAttribute("csrf",t)}get required(){return this.hasAttribute("required")}set required(t){t?this.setAttribute("required",""):this.removeAttribute("required")}get csrfField(){return this.getAttribute("csrf-field")||"authenticity_token"}set csrfField(t){this.setAttribute("csrf-field",t)}}lt=new WeakMap;function xn(n){const t=n.currentTarget;if(!(t instanceof HTMLInputElement))return;const e=t.closest("auto-check");if(!(e instanceof Fs))return;const s=e.src,i=e.csrf,r=$t.get(e);if(!s||!i||!r)return;const o=new Ri;t.dispatchEvent(o),e.required&&t.setCustomValidity(o.message)}function Vi(){return"AbortController"in window?new AbortController:{signal:null,abort(){}}}async function ji(n,t,e){try{const s=await fetch(t,e);return n.dispatchEvent(new Event("load")),n.dispatchEvent(new Event("loadend")),s}catch(s){throw s.name!=="AbortError"&&(n.dispatchEvent(new Event("error")),n.dispatchEvent(new Event("loadend"))),s}}async function Hi(n){const t=n.input;if(!t)return;const e=n.csrfField,s=n.src,i=n.csrf,r=$t.get(n);if(!s||!i||!r){n.required&&t.setCustomValidity("");return}if(!t.value.trim()){n.required&&t.setCustomValidity("");return}const o=new FormData;o.append(e,i),o.append("value",t.value),t.dispatchEvent(new Ni(o)),r.controller?r.controller.abort():n.dispatchEvent(new Event("loadstart")),r.controller=Vi();try{const a=await ji(n,s,{credentials:"same-origin",signal:r.controller.signal,method:"POST",body:o});if(a.ok)n.required&&t.setCustomValidity(""),t.dispatchEvent(new $i(a.clone()));else{const c=new Ii(a.clone());t.dispatchEvent(c),n.required&&t.setCustomValidity(c.message)}r.controller=null,t.dispatchEvent(new Tn)}catch(a){a.name!=="AbortError"&&(r.controller=null,t.dispatchEvent(new Tn))}}const On=typeof globalThis<"u"?globalThis:window;try{On.AutoCheckElement=Fs.define()}catch(n){if(!(On.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class Wi{constructor(t,e,{tabInsertsSuggestions:s,defaultFirstOption:i}={}){this.input=t,this.list=e,this.tabInsertsSuggestions=s??!0,this.defaultFirstOption=i??!1,this.isComposing=!1,e.id||(e.id=`combobox-${Math.random().toString().slice(2,6)}`),this.ctrlBindings=!!navigator.userAgent.match(/Macintosh/),this.keyboardEventHandler=r=>Ui(r,this),this.compositionEventHandler=r=>qi(r,this),this.inputHandler=this.clearSelection.bind(this),t.setAttribute("role","combobox"),t.setAttribute("aria-controls",e.id),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-haspopup","listbox")}destroy(){this.clearSelection(),this.stop(),this.input.removeAttribute("role"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-haspopup")}start(){this.input.setAttribute("aria-expanded","true"),this.input.addEventListener("compositionstart",this.compositionEventHandler),this.input.addEventListener("compositionend",this.compositionEventHandler),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keyboardEventHandler),this.list.addEventListener("click",Sn),this.indicateDefaultOption()}stop(){this.clearSelection(),this.input.setAttribute("aria-expanded","false"),this.input.removeEventListener("compositionstart",this.compositionEventHandler),this.input.removeEventListener("compositionend",this.compositionEventHandler),this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keyboardEventHandler),this.list.removeEventListener("click",Sn)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(Te)[0])===null||t===void 0||t.setAttribute("data-combobox-option-default","true"))}navigate(t=1){const e=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(Te)[0],s=Array.from(this.list.querySelectorAll('[role="option"]')).filter(Te),i=s.indexOf(e);if(i===s.length-1&&t===1||i===0&&t===-1){this.clearSelection(),this.input.focus();return}let r=t===1?0:s.length-1;if(e&&i>=0){const a=i+t;a>=0&&a<s.length&&(r=a)}const o=s[r];if(o)for(const a of s)a.removeAttribute("data-combobox-option-default"),o===a?(this.input.setAttribute("aria-activedescendant",o.id),o.setAttribute("aria-selected","true"),zi(this.list,o)):a.removeAttribute("aria-selected")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const t of this.list.querySelectorAll('[aria-selected="true"]'))t.removeAttribute("aria-selected");this.indicateDefaultOption()}}function Ui(n,t){if(!(n.shiftKey||n.metaKey||n.altKey)&&!(!t.ctrlBindings&&n.ctrlKey)&&!t.isComposing)switch(n.key){case"Enter":Mn(t.input,t.list)&&n.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&Mn(t.input,t.list)&&n.preventDefault();break;case"Escape":t.clearSelection();break;case"ArrowDown":t.navigate(1),n.preventDefault();break;case"ArrowUp":t.navigate(-1),n.preventDefault();break;case"n":t.ctrlBindings&&n.ctrlKey&&(t.navigate(1),n.preventDefault());break;case"p":t.ctrlBindings&&n.ctrlKey&&(t.navigate(-1),n.preventDefault());break;default:if(n.ctrlKey)break;t.clearSelection()}}function Sn(n){if(!(n.target instanceof Element))return;const t=n.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&Ki(t,{event:n})}function Mn(n,t){const e=t.querySelector('[aria-selected="true"], [data-combobox-option-default="true"]');return e?(e.getAttribute("aria-disabled")==="true"||e.click(),!0):!1}function Ki(n,t){n.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0,detail:t}))}function Te(n){return!n.hidden&&!(n instanceof HTMLInputElement&&n.type==="hidden")&&(n.offsetWidth>0||n.offsetHeight>0)}function qi(n,t){t.isComposing=n.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function zi(n,t){Yi(n,t)||(n.scrollTop=t.offsetTop)}function Yi(n,t){const e=n.scrollTop,s=e+n.clientHeight,i=t.offsetTop,r=i+t.clientHeight;return i>=e&&r<=s}function Xi(n,t=0){let e;return function(...s){clearTimeout(e),e=window.setTimeout(()=>{clearTimeout(e),n(...s)},t)}}const Gi=window.testScreenReaderDelay||100;class Zi{constructor(t,e,s,i=!1){var r;if(this.container=t,this.input=e,this.results=s,this.combobox=new Wi(e,s,{defaultFirstOption:i}),this.feedback=t.getRootNode().getElementById(`${this.results.id}-feedback`),this.autoselectEnabled=i,this.clearButton=t.getRootNode().getElementById(`${this.input.id||this.input.name}-clear`),this.clientOptions=s.querySelectorAll("[role=option]"),this.feedback&&(this.feedback.setAttribute("aria-live","polite"),this.feedback.setAttribute("aria-atomic","true")),this.clearButton&&!this.clearButton.getAttribute("aria-label")){const o=document.querySelector(`label[for="${this.input.name}"]`);this.clearButton.setAttribute("aria-label","clear:"),this.clearButton.setAttribute("aria-labelledby",`${this.clearButton.id} ${(o==null?void 0:o.id)||""}`)}this.input.getAttribute("aria-expanded")||this.input.setAttribute("aria-expanded","false"),this.results.popover?this.results.matches(":popover-open")&&this.results.hidePopover():this.results.hidden=!0,this.results.getAttribute("aria-label")||this.results.setAttribute("aria-label","results"),this.input.setAttribute("autocomplete","off"),this.input.setAttribute("spellcheck","false"),this.interactingWithList=!1,this.onInputChange=Xi(this.onInputChange.bind(this),300),this.onResultsMouseDown=this.onResultsMouseDown.bind(this),this.onInputBlur=this.onInputBlur.bind(this),this.onInputFocus=this.onInputFocus.bind(this),this.onKeydown=this.onKeydown.bind(this),this.onCommit=this.onCommit.bind(this),this.handleClear=this.handleClear.bind(this),this.input.addEventListener("keydown",this.onKeydown),this.input.addEventListener("focus",this.onInputFocus),this.input.addEventListener("blur",this.onInputBlur),this.input.addEventListener("input",this.onInputChange),this.results.addEventListener("mousedown",this.onResultsMouseDown),this.results.addEventListener("combobox-commit",this.onCommit),(r=this.clearButton)===null||r===void 0||r.addEventListener("click",this.handleClear)}destroy(){this.input.removeEventListener("keydown",this.onKeydown),this.input.removeEventListener("focus",this.onInputFocus),this.input.removeEventListener("blur",this.onInputBlur),this.input.removeEventListener("input",this.onInputChange),this.results.removeEventListener("mousedown",this.onResultsMouseDown),this.results.removeEventListener("combobox-commit",this.onCommit)}handleClear(t){t.preventDefault(),this.input.getAttribute("aria-expanded")==="true"&&(this.input.setAttribute("aria-expanded","false"),this.updateFeedbackForScreenReaders("Results hidden.")),this.input.value="",this.container.value="",this.input.focus(),this.input.dispatchEvent(new Event("change")),this.close()}onKeydown(t){if(t.key==="Escape"&&this.container.open)this.close(),t.stopPropagation(),t.preventDefault();else if(t.altKey&&t.key==="ArrowUp"&&this.container.open)this.close(),t.stopPropagation(),t.preventDefault();else if(t.altKey&&t.key==="ArrowDown"&&!this.container.open){if(!this.input.value.trim())return;this.open(),t.stopPropagation(),t.preventDefault()}}onInputFocus(){this.interactingWithList||this.fetchResults()}onInputBlur(){this.interactingWithList||this.close()}onCommit({target:t}){const e=t;if(!(e instanceof HTMLElement)||(this.close(),e instanceof HTMLAnchorElement))return;const s=e.getAttribute("data-autocomplete-value")||e.textContent;this.updateFeedbackForScreenReaders(`${e.textContent||""} selected.`),this.container.value=s,s||this.updateFeedbackForScreenReaders("Results hidden.")}onResultsMouseDown(){this.interactingWithList=!0}onInputChange(){this.feedback&&this.feedback.textContent&&(this.feedback.textContent=""),this.container.removeAttribute("value"),this.fetchResults()}identifyOptions(){let t=0;for(const e of this.results.querySelectorAll('[role="option"]:not([id])'))e.id=`${this.results.id}-option-${t++}`}updateFeedbackForScreenReaders(t){setTimeout(()=>{this.feedback&&(this.feedback.textContent=t)},Gi)}fetchResults(){const t=this.input.value.trim();if(!t&&!this.container.fetchOnEmpty){this.close();return}const e=this.container.src;if(!e)return;const s=new URL(e,window.location.href),i=new URLSearchParams(s.search.slice(1));i.append("q",t),s.search=i.toString(),this.container.dispatchEvent(new CustomEvent("loadstart")),this.container.fetchResult(s).then(r=>{this.results.innerHTML=r,this.identifyOptions(),this.combobox.indicateDefaultOption();const o=this.results.querySelectorAll('[role="option"]'),a=!!o.length,c=o.length,[l]=o,u=l==null?void 0:l.textContent;this.autoselectEnabled&&u?this.updateFeedbackForScreenReaders(`${c} results. ${u} is the top result: Press Enter to activate.`):this.updateFeedbackForScreenReaders(`${c||"No"} results.`),a?this.open():this.close(),this.container.dispatchEvent(new CustomEvent("load")),this.container.dispatchEvent(new CustomEvent("loadend"))}).catch(()=>{this.container.dispatchEvent(new CustomEvent("error")),this.container.dispatchEvent(new CustomEvent("loadend"))})}open(){(this.results.popover?!this.results.matches(":popover-open"):this.results.hidden)&&(this.combobox.start(),this.results.popover?this.results.showPopover():this.results.hidden=!1),this.container.open=!0,this.interactingWithList=!0}close(){(this.results.popover?this.results.matches(":popover-open"):!this.results.hidden)&&(this.combobox.stop(),this.results.popover?this.results.hidePopover():this.results.hidden=!0),this.container.open=!1,this.interactingWithList=!1}}var H=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},xe=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},Ji=function(n,t){var e={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&t.indexOf(s)<0&&(e[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(n);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(n,s[i])&&(e[s[i]]=n[s[i]]);return e},ut,kt,Ct,Lt,ne;const Qi=globalThis.HTMLElement||null;class tr extends Event{constructor(t,e){var{relatedTarget:s}=e,i=Ji(e,["relatedTarget"]);super(t,i),this.relatedTarget=s}}const Y=new WeakMap;let Oe=null;class er extends Qi{constructor(){super(...arguments),ut.add(this),kt.set(this,null),Ct.set(this,null),ne.set(this,void 0)}static define(t="auto-complete",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){Oe=t===null?t:Promise.resolve(t)}get forElement(){var t;if(!((t=H(this,kt,"f"))===null||t===void 0)&&t.isConnected)return H(this,kt,"f");const e=this.getAttribute("for"),s=this.getRootNode();return e&&(s instanceof Document||s instanceof ShadowRoot)?s.getElementById(e):null}set forElement(t){xe(this,kt,t,"f"),this.setAttribute("for","")}get inputElement(){var t;return!((t=H(this,Ct,"f"))===null||t===void 0)&&t.isConnected?H(this,Ct,"f"):this.querySelector("input")}set inputElement(t){xe(this,Ct,t,"f"),H(this,ut,"m",Lt).call(this)}connectedCallback(){this.isConnected&&(H(this,ut,"m",Lt).call(this),new MutationObserver(()=>{Y.get(this)||H(this,ut,"m",Lt).call(this)}).observe(this,{subtree:!0,childList:!0}))}disconnectedCallback(){const t=Y.get(this);t&&(t.destroy(),Y.delete(this))}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}get fetchOnEmpty(){return this.hasAttribute("fetch-on-empty")}set fetchOnEmpty(t){this.toggleAttribute("fetch-on-empty",t)}async fetchResult(t){var e;(e=H(this,ne,"f"))===null||e===void 0||e.abort();const{signal:s}=xe(this,ne,new AbortController,"f"),i=await fetch(t.toString(),{signal:s,headers:{Accept:"text/fragment+html"}});if(!i.ok)throw new Error(await i.text());return Oe?(await Oe).createHTML(await i.text(),i):await i.text()}static get observedAttributes(){return["open","value","for"]}attributeChangedCallback(t,e,s){var i,r;if(e===s)return;const o=Y.get(this);if(o)switch((this.forElement!==((i=Y.get(this))===null||i===void 0?void 0:i.results)||this.inputElement!==((r=Y.get(this))===null||r===void 0?void 0:r.input))&&H(this,ut,"m",Lt).call(this),t){case"open":s===null?o.close():o.open();break;case"value":s!==null&&(o.input.value=s),this.dispatchEvent(new tr("auto-complete-change",{bubbles:!0,relatedTarget:o.input}));break}}}kt=new WeakMap,Ct=new WeakMap,ne=new WeakMap,ut=new WeakSet,Lt=function(){var t;(t=Y.get(this))===null||t===void 0||t.destroy();const{forElement:e,inputElement:s}=this;if(!e||!s)return;const i=this.getAttribute("data-autoselect")==="true";Y.set(this,new Zi(this,s,e,i)),e.setAttribute("role","listbox")};const Se=typeof globalThis<"u"?globalThis:window;try{Se.AutocompleteElement=Se.AutoCompleteElement=er.define()}catch(n){if(!(Se.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class Ne extends HTMLElement{get preload(){return this.hasAttribute("preload")}set preload(t){t?this.setAttribute("preload",""):this.removeAttribute("preload")}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","menu");const t=this.parentElement;if(!t)return;const e=t.querySelector("summary");e&&(e.setAttribute("aria-haspopup","menu"),e.hasAttribute("role")||e.setAttribute("role","button"));const s=[N(t,"compositionstart",i=>_n(this,i)),N(t,"compositionend",i=>_n(this,i)),N(t,"click",i=>Ln(t,i)),N(t,"change",i=>Ln(t,i)),N(t,"keydown",i=>ar(t,this,i)),N(t,"toggle",()=>kn(t,this),{once:!0}),N(t,"toggle",()=>ir(t)),this.preload?N(t,"mouseover",()=>kn(t,this),{once:!0}):nr,...sr(t)];pt.set(this,{subscriptions:s,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=pt.get(this);if(t){pt.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const pt=new WeakMap,nr={unsubscribe(){}};function N(n,t,e,s=!1){return n.addEventListener(t,e,s),{unsubscribe:()=>{n.removeEventListener(t,e,s)}}}function kn(n,t){const e=t.getAttribute("src");if(!e)return;const s=pt.get(t);if(!s||s.loaded)return;s.loaded=!0;const i=t.querySelector("include-fragment");i&&!i.hasAttribute("src")&&(i.addEventListener("loadend",()=>_s(n)),i.setAttribute("src",e))}function sr(n){let t=!1;const e=()=>t=!0,s=()=>t=!1,i=()=>{n.hasAttribute("open")&&(_s(n)||t||rr(n))};return[N(n,"mousedown",e),N(n,"keydown",s),N(n,"toggle",i)]}function ir(n){if(n.hasAttribute("open"))for(const t of document.querySelectorAll("details[open] > details-menu")){const e=t.closest("details");e&&e!==n&&!e.contains(n)&&e.removeAttribute("open")}}function _s(n){if(!n.hasAttribute("open"))return!1;const t=n.querySelector("details-menu [autofocus]");return t?(t.focus(),!0):!1}function rr(n){const t=document.activeElement;if(t&&Ds(t)&&n.contains(t))return;const e=Ft(n,!0);e&&e.focus()}function Ft(n,t){const e=Array.from(n.querySelectorAll('[role^="menuitem"]:not([hidden]):not([disabled])')),s=document.activeElement,i=s instanceof HTMLElement?e.indexOf(s):-1,r=t?e[i+1]:e[i-1],o=t?e[0]:e[e.length-1];return r||o}const Cn=navigator.userAgent.match(/Macintosh/);function Ln(n,t){const e=t.target;if(e instanceof Element&&e.closest("details")===n){if(t.type==="click"){const s=e.closest('[role="menuitem"], [role="menuitemradio"]');if(!s)return;const i=s.querySelector("input");if(s.tagName==="LABEL"&&e===i)return;s.tagName==="LABEL"&&i&&!i.checked||Fn(s,n)}else if(t.type==="change"){const s=e.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');s&&Fn(s,n)}}}function or(n,t){for(const e of t.querySelectorAll('[role="menuitemradio"], [role="menuitemcheckbox"]')){const s=e.querySelector('input[type="radio"], input[type="checkbox"]');let i=(e===n).toString();s instanceof HTMLInputElement&&(i=s.indeterminate?"mixed":s.checked.toString()),e.setAttribute("aria-checked",i)}}function Fn(n,t){if(n.hasAttribute("disabled")||n.getAttribute("aria-disabled")==="true")return;const e=n.closest("details-menu");!e||!e.dispatchEvent(new CustomEvent("details-menu-select",{cancelable:!0,detail:{relatedTarget:n}}))||(cr(n,t),or(n,t),n.getAttribute("role")!=="menuitemcheckbox"&&Bs(t),e.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:n}})))}function ar(n,t,e){if(!(e instanceof KeyboardEvent)||n.querySelector("details[open]"))return;const s=pt.get(t);if(!s||s.isComposing)return;const i=e.target instanceof Element&&e.target.tagName==="SUMMARY";switch(e.key){case"Escape":n.hasAttribute("open")&&(Bs(n),e.preventDefault(),e.stopPropagation());break;case"ArrowDown":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=Ft(n,!0);r&&r.focus(),e.preventDefault()}break;case"ArrowUp":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=Ft(n,!1);r&&r.focus(),e.preventDefault()}break;case"n":if(Cn&&e.ctrlKey){const r=Ft(n,!0);r&&r.focus(),e.preventDefault()}break;case"p":if(Cn&&e.ctrlKey){const r=Ft(n,!1);r&&r.focus(),e.preventDefault()}break;case" ":case"Enter":{const r=document.activeElement;r instanceof HTMLElement&&Ds(r)&&r.closest("details")===n&&(e.preventDefault(),e.stopPropagation(),r.click())}break}}function Ds(n){const t=n.getAttribute("role");return t==="menuitem"||t==="menuitemcheckbox"||t==="menuitemradio"}function Bs(n){if(!n.hasAttribute("open"))return;n.removeAttribute("open");const e=n.querySelector("summary");e&&e.focus()}function cr(n,t){const e=t.querySelector("[data-menu-button]");if(!e)return;const s=lr(n);if(s)e.textContent=s;else{const i=ur(n);i&&(e.innerHTML=i)}}function lr(n){if(!n)return null;const t=n.hasAttribute("data-menu-button-text")?n:n.querySelector("[data-menu-button-text]");return t?t.getAttribute("data-menu-button-text")||t.textContent:null}function ur(n){if(!n)return null;const t=n.hasAttribute("data-menu-button-contents")?n:n.querySelector("[data-menu-button-contents]");return t?t.innerHTML:null}function _n(n,t){const e=pt.get(n);e&&(e.isComposing=t.type==="compositionstart")}window.customElements.get("details-menu")||(window.DetailsMenuElement=Ne,window.customElements.define("details-menu",Ne));const gt=new WeakMap,et=new WeakMap,W=new WeakMap;function jt(n){const t=n.currentTarget;if(!(t instanceof wt))return;const{box:e,image:s}=W.get(t)||{};if(!e||!s)return;let i=0,r=0;if(n instanceof KeyboardEvent)n.key==="ArrowUp"?r=-1:n.key==="ArrowDown"?r=1:n.key==="ArrowLeft"?i=-1:n.key==="ArrowRight"&&(i=1);else if(et.has(t)&&n instanceof MouseEvent){const o=et.get(t);i=n.pageX-o.dragStartX,r=n.pageY-o.dragStartY}else if(et.has(t)&&n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0],{dragStartX:c,dragStartY:l}=et.get(t);i=o-c,r=a-l}if(i!==0||r!==0){const o=Math.min(Math.max(0,e.offsetLeft+i),s.width-e.offsetWidth),a=Math.min(Math.max(0,e.offsetTop+r),s.height-e.offsetHeight);e.style.left=`${o}px`,e.style.top=`${a}px`,Is(t,{x:o,y:a,width:e.offsetWidth,height:e.offsetHeight})}if(n instanceof MouseEvent)et.set(t,{dragStartX:n.pageX,dragStartY:n.pageY});else if(n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0];et.set(t,{dragStartX:o,dragStartY:a})}}function bt(n){const t=n.target;if(!(t instanceof HTMLElement))return;const e=Ps(t);if(!(e instanceof wt))return;const{box:s}=W.get(e)||{};if(!s)return;const i=e.getBoundingClientRect();let r,o,a;if(n instanceof KeyboardEvent){if(n.key==="Escape")return Rs(e);if(n.key==="-"&&(a=-10),n.key==="="&&(a=10),!a)return;r=s.offsetWidth+a,o=s.offsetHeight+a,gt.set(e,{startX:s.offsetLeft,startY:s.offsetTop})}else if(n instanceof MouseEvent){const c=gt.get(e);if(!c)return;r=n.pageX-c.startX-i.left-window.pageXOffset,o=n.pageY-c.startY-i.top-window.pageYOffset}else if(n instanceof TouchEvent){const c=gt.get(e);if(!c)return;r=n.changedTouches[0].pageX-c.startX-i.left-window.pageXOffset,o=n.changedTouches[0].pageY-c.startY-i.top-window.pageYOffset}r&&o&&$s(e,r,o,!(n instanceof KeyboardEvent))}function Ps(n){const t=n.getRootNode();return t instanceof ShadowRoot?t.host:n}function Dn(n){const t=n.currentTarget;if(!(t instanceof HTMLElement))return;const e=Ps(t);if(!(e instanceof wt))return;const{box:s}=W.get(e)||{};if(!s)return;const i=n.target;if(i instanceof HTMLElement)if(i.hasAttribute("data-direction")){const r=i.getAttribute("data-direction")||"";e.addEventListener("mousemove",bt),e.addEventListener("touchmove",bt,{passive:!0}),["nw","se"].indexOf(r)>=0&&e.classList.add("nwse"),["ne","sw"].indexOf(r)>=0&&e.classList.add("nesw"),gt.set(e,{startX:s.offsetLeft+(["se","ne"].indexOf(r)>=0?0:s.offsetWidth),startY:s.offsetTop+(["se","sw"].indexOf(r)>=0?0:s.offsetHeight)}),bt(n)}else e.addEventListener("mousemove",jt),e.addEventListener("touchmove",jt,{passive:!0})}function $s(n,t,e,s=!0){let i=Math.max(Math.abs(t),Math.abs(e),10);const r=gt.get(n);if(!r)return;const{box:o,image:a}=W.get(n)||{};if(!o||!a)return;i=Math.min(i,e>0?a.height-r.startY:r.startY,t>0?a.width-r.startX:r.startX);const c=s?Math.round(Math.max(0,t>0?r.startX:r.startX-i)):o.offsetLeft,l=s?Math.round(Math.max(0,e>0?r.startY:r.startY-i)):o.offsetTop;o.style.left=`${c}px`,o.style.top=`${l}px`,o.style.width=`${i}px`,o.style.height=`${i}px`,Is(n,{x:c,y:l,width:i,height:i})}function Rs(n){const{image:t}=W.get(n)||{};if(!t)return;const e=Math.round(t.clientWidth>t.clientHeight?t.clientHeight:t.clientWidth);gt.set(n,{startX:(t.clientWidth-e)/2,startY:(t.clientHeight-e)/2}),$s(n,e,e)}function Me(n){const t=n.currentTarget;t instanceof wt&&(et.delete(t),t.classList.remove("nwse","nesw"),t.removeEventListener("mousemove",bt),t.removeEventListener("mousemove",jt),t.removeEventListener("touchmove",bt),t.removeEventListener("touchmove",jt))}function Is(n,t){const{image:e}=W.get(n)||{};if(!e)return;const s=e.naturalWidth/e.width;for(const i in t){const r=Math.round(t[i]*s);t[i]=r;const o=n.querySelector(`[data-image-crop-input='${i}']`);o instanceof HTMLInputElement&&(o.value=r.toString())}n.dispatchEvent(new CustomEvent("image-crop-change",{bubbles:!0,detail:t}))}class wt extends HTMLElement{connectedCallback(){if(W.has(this))return;const t=this.attachShadow({mode:"open"});t.innerHTML=`
|
1
|
+
class mi{constructor(t,e,{tabInsertsSuggestions:s,defaultFirstOption:i,scrollIntoViewOptions:r}={}){this.input=t,this.list=e,this.tabInsertsSuggestions=s??!0,this.defaultFirstOption=i??!1,this.scrollIntoViewOptions=r??{block:"nearest",inline:"nearest"},this.isComposing=!1,e.id||(e.id=`combobox-${Math.random().toString().slice(2,6)}`),this.ctrlBindings=!!navigator.userAgent.match(/Macintosh/),this.keyboardEventHandler=o=>pi(o,this),this.compositionEventHandler=o=>vi(o,this),this.inputHandler=this.clearSelection.bind(this),t.setAttribute("role","combobox"),t.setAttribute("aria-controls",e.id),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-haspopup","listbox")}destroy(){this.clearSelection(),this.stop(),this.input.removeAttribute("role"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-haspopup")}start(){this.input.setAttribute("aria-expanded","true"),this.input.addEventListener("compositionstart",this.compositionEventHandler),this.input.addEventListener("compositionend",this.compositionEventHandler),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keyboardEventHandler),this.list.addEventListener("click",dn),this.indicateDefaultOption()}stop(){this.clearSelection(),this.input.setAttribute("aria-expanded","false"),this.input.removeEventListener("compositionstart",this.compositionEventHandler),this.input.removeEventListener("compositionend",this.compositionEventHandler),this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keyboardEventHandler),this.list.removeEventListener("click",dn)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(pe)[0])===null||t===void 0||t.setAttribute("data-combobox-option-default","true"))}navigate(t=1){const e=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(pe)[0],s=Array.from(this.list.querySelectorAll('[role="option"]')).filter(pe),i=s.indexOf(e);if(i===s.length-1&&t===1||i===0&&t===-1){this.clearSelection(),this.input.focus();return}let r=t===1?0:s.length-1;if(e&&i>=0){const a=i+t;a>=0&&a<s.length&&(r=a)}const o=s[r];if(o)for(const a of s)a.removeAttribute("data-combobox-option-default"),o===a?(this.input.setAttribute("aria-activedescendant",o.id),o.setAttribute("aria-selected","true"),bi(o),o.scrollIntoView(this.scrollIntoViewOptions)):a.removeAttribute("aria-selected")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const t of this.list.querySelectorAll('[aria-selected="true"]'))t.removeAttribute("aria-selected");this.indicateDefaultOption()}}function pi(n,t){if(!(n.shiftKey||n.metaKey||n.altKey)&&!(!t.ctrlBindings&&n.ctrlKey)&&!t.isComposing)switch(n.key){case"Enter":fn(t.input,t.list)&&n.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&fn(t.input,t.list)&&n.preventDefault();break;case"Escape":t.clearSelection();break;case"ArrowDown":t.navigate(1),n.preventDefault();break;case"ArrowUp":t.navigate(-1),n.preventDefault();break;case"n":t.ctrlBindings&&n.ctrlKey&&(t.navigate(1),n.preventDefault());break;case"p":t.ctrlBindings&&n.ctrlKey&&(t.navigate(-1),n.preventDefault());break;default:if(n.ctrlKey)break;t.clearSelection()}}function dn(n){if(!(n.target instanceof Element))return;const t=n.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&gi(t,{event:n})}function fn(n,t){const e=t.querySelector('[aria-selected="true"], [data-combobox-option-default="true"]');return e?(e.getAttribute("aria-disabled")==="true"||e.click(),!0):!1}function gi(n,t){n.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0,detail:t}))}function bi(n){n.dispatchEvent(new Event("combobox-select",{bubbles:!0}))}function pe(n){return!n.hidden&&!(n instanceof HTMLInputElement&&n.type==="hidden")&&(n.offsetWidth>0||n.offsetHeight>0)}function vi(n,t){t.isComposing=n.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function yi(n,t=0){let e;return function(...s){clearTimeout(e),e=window.setTimeout(()=>{clearTimeout(e),n(...s)},t)}}const wi=window.testScreenReaderDelay||100;class Ei{constructor(t,e,s,i=!1){var r;if(this.container=t,this.input=e,this.results=s,this.combobox=new mi(e,s,{defaultFirstOption:i}),this.feedback=t.getRootNode().getElementById(`${this.results.id}-feedback`),this.autoselectEnabled=i,this.clearButton=t.getRootNode().getElementById(`${this.input.id||this.input.name}-clear`),this.clientOptions=s.querySelectorAll("[role=option]"),this.feedback&&(this.feedback.setAttribute("aria-live","polite"),this.feedback.setAttribute("aria-atomic","true")),this.clearButton&&!this.clearButton.getAttribute("aria-label")){const o=document.querySelector(`label[for="${this.input.name}"]`);this.clearButton.setAttribute("aria-label","clear:"),this.clearButton.setAttribute("aria-labelledby",`${this.clearButton.id} ${(o==null?void 0:o.id)||""}`)}this.input.getAttribute("aria-expanded")||this.input.setAttribute("aria-expanded","false"),this.results.popover?this.results.matches(":popover-open")&&this.results.hidePopover():this.results.hidden=!0,this.results.getAttribute("aria-label")||this.results.setAttribute("aria-label","results"),this.input.setAttribute("autocomplete","off"),this.input.setAttribute("spellcheck","false"),this.interactingWithList=!1,this.onInputChange=yi(this.onInputChange.bind(this),300),this.onResultsMouseDown=this.onResultsMouseDown.bind(this),this.onInputBlur=this.onInputBlur.bind(this),this.onInputFocus=this.onInputFocus.bind(this),this.onKeydown=this.onKeydown.bind(this),this.onCommit=this.onCommit.bind(this),this.handleClear=this.handleClear.bind(this),this.input.addEventListener("keydown",this.onKeydown),this.input.addEventListener("focus",this.onInputFocus),this.input.addEventListener("blur",this.onInputBlur),this.input.addEventListener("input",this.onInputChange),this.results.addEventListener("mousedown",this.onResultsMouseDown),this.results.addEventListener("combobox-commit",this.onCommit),(r=this.clearButton)===null||r===void 0||r.addEventListener("click",this.handleClear)}destroy(){this.input.removeEventListener("keydown",this.onKeydown),this.input.removeEventListener("focus",this.onInputFocus),this.input.removeEventListener("blur",this.onInputBlur),this.input.removeEventListener("input",this.onInputChange),this.results.removeEventListener("mousedown",this.onResultsMouseDown),this.results.removeEventListener("combobox-commit",this.onCommit)}handleClear(t){t.preventDefault(),this.input.getAttribute("aria-expanded")==="true"&&(this.input.setAttribute("aria-expanded","false"),this.updateFeedbackForScreenReaders("Results hidden.")),this.input.value="",this.container.value="",this.input.focus(),this.input.dispatchEvent(new Event("change")),this.close()}onKeydown(t){if(t.key==="Escape"&&this.container.open)this.close(),t.stopPropagation(),t.preventDefault();else if(t.altKey&&t.key==="ArrowUp"&&this.container.open)this.close(),t.stopPropagation(),t.preventDefault();else if(t.altKey&&t.key==="ArrowDown"&&!this.container.open){if(!this.input.value.trim())return;this.open(),t.stopPropagation(),t.preventDefault()}}onInputFocus(){this.interactingWithList||this.fetchResults()}onInputBlur(){this.interactingWithList||this.close()}onCommit({target:t}){const e=t;if(!(e instanceof HTMLElement)||(this.close(),e instanceof HTMLAnchorElement))return;const s=e.getAttribute("data-autocomplete-value")||e.textContent;this.updateFeedbackForScreenReaders(`${e.textContent||""} selected.`),this.container.value=s,s||this.updateFeedbackForScreenReaders("Results hidden.")}onResultsMouseDown(){this.interactingWithList=!0}onInputChange(){this.feedback&&this.feedback.textContent&&(this.feedback.textContent=""),this.container.removeAttribute("value"),this.fetchResults()}identifyOptions(){let t=0;for(const e of this.results.querySelectorAll('[role="option"]:not([id])'))e.id=`${this.results.id}-option-${t++}`}updateFeedbackForScreenReaders(t){setTimeout(()=>{this.feedback&&(this.feedback.textContent=t)},wi)}fetchResults(){const t=this.input.value.trim();if(!t&&!this.container.fetchOnEmpty){this.close();return}const e=this.container.src;if(!e)return;const s=new URL(e,window.location.href),i=new URLSearchParams(s.search.slice(1));i.append("q",t),s.search=i.toString(),this.container.dispatchEvent(new CustomEvent("loadstart")),this.container.fetchResult(s).then(r=>{this.results.innerHTML=r,this.identifyOptions(),this.combobox.indicateDefaultOption();const o=this.results.querySelectorAll('[role="option"]'),a=!!o.length,c=o.length,[l]=o,u=l==null?void 0:l.textContent;this.autoselectEnabled&&u?this.updateFeedbackForScreenReaders(`${c} results. ${u} is the top result: Press Enter to activate.`):this.updateFeedbackForScreenReaders(`${c||"No"} results.`),a?this.open():this.close(),this.container.dispatchEvent(new CustomEvent("load")),this.container.dispatchEvent(new CustomEvent("loadend"))}).catch(()=>{this.container.dispatchEvent(new CustomEvent("error")),this.container.dispatchEvent(new CustomEvent("loadend"))})}open(){(this.results.popover?!this.results.matches(":popover-open"):this.results.hidden)&&(this.combobox.start(),this.results.popover?this.results.showPopover():this.results.hidden=!1),this.container.open=!0,this.interactingWithList=!0}close(){(this.results.popover?this.results.matches(":popover-open"):!this.results.hidden)&&(this.combobox.stop(),this.results.popover?this.results.hidePopover():this.results.hidden=!0),this.container.open=!1,this.interactingWithList=!1}}var W=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},ge=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},Ai=function(n,t){var e={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&t.indexOf(s)<0&&(e[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(n);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(n,s[i])&&(e[s[i]]=n[s[i]]);return e},ht,St,Mt,kt,Gt;const Ti=globalThis.HTMLElement||null;class xi extends Event{constructor(t,e){var{relatedTarget:s}=e,i=Ai(e,["relatedTarget"]);super(t,i),this.relatedTarget=s}}const G=new WeakMap;let be=null;class Oi extends Ti{constructor(){super(...arguments),ht.add(this),St.set(this,null),Mt.set(this,null),Gt.set(this,void 0)}static define(t="auto-complete",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){be=t===null?t:Promise.resolve(t)}get forElement(){var t;if(!((t=W(this,St,"f"))===null||t===void 0)&&t.isConnected)return W(this,St,"f");const e=this.getAttribute("for"),s=this.getRootNode();return e&&(s instanceof Document||s instanceof ShadowRoot)?s.getElementById(e):null}set forElement(t){ge(this,St,t,"f"),this.setAttribute("for","")}get inputElement(){var t;return!((t=W(this,Mt,"f"))===null||t===void 0)&&t.isConnected?W(this,Mt,"f"):this.querySelector("input")}set inputElement(t){ge(this,Mt,t,"f"),W(this,ht,"m",kt).call(this)}connectedCallback(){this.isConnected&&(W(this,ht,"m",kt).call(this),new MutationObserver(()=>{G.get(this)||W(this,ht,"m",kt).call(this)}).observe(this,{subtree:!0,childList:!0}))}disconnectedCallback(){const t=G.get(this);t&&(t.destroy(),G.delete(this))}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}get fetchOnEmpty(){return this.hasAttribute("fetch-on-empty")}set fetchOnEmpty(t){this.toggleAttribute("fetch-on-empty",t)}async fetchResult(t){var e;(e=W(this,Gt,"f"))===null||e===void 0||e.abort();const{signal:s}=ge(this,Gt,new AbortController,"f"),i=await fetch(t.toString(),{signal:s,headers:{Accept:"text/fragment+html"}});if(!i.ok)throw new Error(await i.text());return be?(await be).createHTML(await i.text(),i):await i.text()}static get observedAttributes(){return["open","value","for"]}attributeChangedCallback(t,e,s){var i,r;if(e===s)return;const o=G.get(this);if(o)switch((this.forElement!==((i=G.get(this))===null||i===void 0?void 0:i.results)||this.inputElement!==((r=G.get(this))===null||r===void 0?void 0:r.input))&&W(this,ht,"m",kt).call(this),t){case"open":s===null?o.close():o.open();break;case"value":s!==null&&(o.input.value=s),this.dispatchEvent(new xi("auto-complete-change",{bubbles:!0,relatedTarget:o.input}));break}}}St=new WeakMap,Mt=new WeakMap,Gt=new WeakMap,ht=new WeakSet,kt=function(){var t;(t=G.get(this))===null||t===void 0||t.destroy();const{forElement:e,inputElement:s}=this;if(!e||!s)return;const i=this.getAttribute("data-autoselect")==="true";G.set(this,new Ei(this,s,e,i)),e.setAttribute("role","listbox")};const ve=typeof globalThis<"u"?globalThis:window;try{ve.AutocompleteElement=ve.AutoCompleteElement=Oi.define()}catch(n){if(!(ve.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class Le extends HTMLElement{get preload(){return this.hasAttribute("preload")}set preload(t){t?this.setAttribute("preload",""):this.removeAttribute("preload")}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","menu");const t=this.parentElement;if(!t)return;const e=t.querySelector("summary");e&&(e.setAttribute("aria-haspopup","menu"),e.hasAttribute("role")||e.setAttribute("role","button"));const s=[$(t,"compositionstart",i=>vn(this,i)),$(t,"compositionend",i=>vn(this,i)),$(t,"click",i=>gn(t,i)),$(t,"change",i=>gn(t,i)),$(t,"keydown",i=>Fi(t,this,i)),$(t,"toggle",()=>mn(t,this),{once:!0}),$(t,"toggle",()=>ki(t)),this.preload?$(t,"mouseover",()=>mn(t,this),{once:!0}):Si,...Mi(t)];mt.set(this,{subscriptions:s,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=mt.get(this);if(t){mt.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const mt=new WeakMap,Si={unsubscribe(){}};function $(n,t,e,s=!1){return n.addEventListener(t,e,s),{unsubscribe:()=>{n.removeEventListener(t,e,s)}}}function mn(n,t){const e=t.getAttribute("src");if(!e)return;const s=mt.get(t);if(!s||s.loaded)return;s.loaded=!0;const i=t.querySelector("include-fragment");i&&!i.hasAttribute("src")&&(i.addEventListener("loadend",()=>ms(n)),i.setAttribute("src",e))}function Mi(n){let t=!1;const e=()=>t=!0,s=()=>t=!1,i=()=>{n.hasAttribute("open")&&(ms(n)||t||Ci(n))};return[$(n,"mousedown",e),$(n,"keydown",s),$(n,"toggle",i)]}function ki(n){if(n.hasAttribute("open"))for(const t of document.querySelectorAll("details[open] > details-menu")){const e=t.closest("details");e&&e!==n&&!e.contains(n)&&e.removeAttribute("open")}}function ms(n){if(!n.hasAttribute("open"))return!1;const t=n.querySelector("details-menu [autofocus]");return t?(t.focus(),!0):!1}function Ci(n){const t=document.activeElement;if(t&&ps(t)&&n.contains(t))return;const e=Ct(n,!0);e&&e.focus()}function Ct(n,t){const e=Array.from(n.querySelectorAll('[role^="menuitem"]:not([hidden]):not([disabled])')),s=document.activeElement,i=s instanceof HTMLElement?e.indexOf(s):-1,r=t?e[i+1]:e[i-1],o=t?e[0]:e[e.length-1];return r||o}const pn=navigator.userAgent.match(/Macintosh/);function gn(n,t){const e=t.target;if(e instanceof Element&&e.closest("details")===n){if(t.type==="click"){const s=e.closest('[role="menuitem"], [role="menuitemradio"]');if(!s)return;const i=s.querySelector("input");if(s.tagName==="LABEL"&&e===i)return;s.tagName==="LABEL"&&i&&!i.checked||bn(s,n)}else if(t.type==="change"){const s=e.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');s&&bn(s,n)}}}function Li(n,t){for(const e of t.querySelectorAll('[role="menuitemradio"], [role="menuitemcheckbox"]')){const s=e.querySelector('input[type="radio"], input[type="checkbox"]');let i=(e===n).toString();s instanceof HTMLInputElement&&(i=s.indeterminate?"mixed":s.checked.toString()),e.setAttribute("aria-checked",i)}}function bn(n,t){if(n.hasAttribute("disabled")||n.getAttribute("aria-disabled")==="true")return;const e=n.closest("details-menu");!e||!e.dispatchEvent(new CustomEvent("details-menu-select",{cancelable:!0,detail:{relatedTarget:n}}))||(Di(n,t),Li(n,t),n.getAttribute("role")!=="menuitemcheckbox"&&gs(t),e.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:n}})))}function Fi(n,t,e){if(!(e instanceof KeyboardEvent)||n.querySelector("details[open]"))return;const s=mt.get(t);if(!s||s.isComposing)return;const i=e.target instanceof Element&&e.target.tagName==="SUMMARY";switch(e.key){case"Escape":n.hasAttribute("open")&&(gs(n),e.preventDefault(),e.stopPropagation());break;case"ArrowDown":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=Ct(n,!0);r&&r.focus(),e.preventDefault()}break;case"ArrowUp":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=Ct(n,!1);r&&r.focus(),e.preventDefault()}break;case"n":if(pn&&e.ctrlKey){const r=Ct(n,!0);r&&r.focus(),e.preventDefault()}break;case"p":if(pn&&e.ctrlKey){const r=Ct(n,!1);r&&r.focus(),e.preventDefault()}break;case" ":case"Enter":{const r=document.activeElement;r instanceof HTMLElement&&ps(r)&&r.closest("details")===n&&(e.preventDefault(),e.stopPropagation(),r.click())}break}}function ps(n){const t=n.getAttribute("role");return t==="menuitem"||t==="menuitemcheckbox"||t==="menuitemradio"}function gs(n){if(!n.hasAttribute("open"))return;n.removeAttribute("open");const e=n.querySelector("summary");e&&e.focus()}function Di(n,t){const e=t.querySelector("[data-menu-button]");if(!e)return;const s=_i(n);if(s)e.textContent=s;else{const i=Bi(n);i&&(e.innerHTML=i)}}function _i(n){if(!n)return null;const t=n.hasAttribute("data-menu-button-text")?n:n.querySelector("[data-menu-button-text]");return t?t.getAttribute("data-menu-button-text")||t.textContent:null}function Bi(n){if(!n)return null;const t=n.hasAttribute("data-menu-button-contents")?n:n.querySelector("[data-menu-button-contents]");return t?t.innerHTML:null}function vn(n,t){const e=mt.get(n);e&&(e.isComposing=t.type==="compositionstart")}window.customElements.get("details-menu")||(window.DetailsMenuElement=Le,window.customElements.define("details-menu",Le));const pt=new WeakMap,st=new WeakMap,U=new WeakMap;function Pt(n){const t=n.currentTarget;if(!(t instanceof yt))return;const{box:e,image:s}=U.get(t)||{};if(!e||!s)return;let i=0,r=0;if(n instanceof KeyboardEvent)n.key==="ArrowUp"?r=-1:n.key==="ArrowDown"?r=1:n.key==="ArrowLeft"?i=-1:n.key==="ArrowRight"&&(i=1);else if(st.has(t)&&n instanceof MouseEvent){const o=st.get(t);i=n.pageX-o.dragStartX,r=n.pageY-o.dragStartY}else if(st.has(t)&&n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0],{dragStartX:c,dragStartY:l}=st.get(t);i=o-c,r=a-l}if(i!==0||r!==0){const o=Math.min(Math.max(0,e.offsetLeft+i),s.width-e.offsetWidth),a=Math.min(Math.max(0,e.offsetTop+r),s.height-e.offsetHeight);e.style.left=`${o}px`,e.style.top=`${a}px`,ws(t,{x:o,y:a,width:e.offsetWidth,height:e.offsetHeight})}if(n instanceof MouseEvent)st.set(t,{dragStartX:n.pageX,dragStartY:n.pageY});else if(n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0];st.set(t,{dragStartX:o,dragStartY:a})}}function gt(n){const t=n.target;if(!(t instanceof HTMLElement))return;const e=bs(t);if(!(e instanceof yt))return;const{box:s}=U.get(e)||{};if(!s)return;const i=e.getBoundingClientRect();let r,o,a;if(n instanceof KeyboardEvent){if(n.key==="Escape")return ys(e);if(n.key==="-"&&(a=-10),n.key==="="&&(a=10),!a)return;r=s.offsetWidth+a,o=s.offsetHeight+a,pt.set(e,{startX:s.offsetLeft,startY:s.offsetTop})}else if(n instanceof MouseEvent){const c=pt.get(e);if(!c)return;r=n.pageX-c.startX-i.left-window.pageXOffset,o=n.pageY-c.startY-i.top-window.pageYOffset}else if(n instanceof TouchEvent){const c=pt.get(e);if(!c)return;r=n.changedTouches[0].pageX-c.startX-i.left-window.pageXOffset,o=n.changedTouches[0].pageY-c.startY-i.top-window.pageYOffset}r&&o&&vs(e,r,o,!(n instanceof KeyboardEvent))}function bs(n){const t=n.getRootNode();return t instanceof ShadowRoot?t.host:n}function yn(n){const t=n.currentTarget;if(!(t instanceof HTMLElement))return;const e=bs(t);if(!(e instanceof yt))return;const{box:s}=U.get(e)||{};if(!s)return;const i=n.target;if(i instanceof HTMLElement)if(i.hasAttribute("data-direction")){const r=i.getAttribute("data-direction")||"";e.addEventListener("mousemove",gt),e.addEventListener("touchmove",gt,{passive:!0}),["nw","se"].indexOf(r)>=0&&e.classList.add("nwse"),["ne","sw"].indexOf(r)>=0&&e.classList.add("nesw"),pt.set(e,{startX:s.offsetLeft+(["se","ne"].indexOf(r)>=0?0:s.offsetWidth),startY:s.offsetTop+(["se","sw"].indexOf(r)>=0?0:s.offsetHeight)}),gt(n)}else e.addEventListener("mousemove",Pt),e.addEventListener("touchmove",Pt,{passive:!0})}function vs(n,t,e,s=!0){let i=Math.max(Math.abs(t),Math.abs(e),10);const r=pt.get(n);if(!r)return;const{box:o,image:a}=U.get(n)||{};if(!o||!a)return;i=Math.min(i,e>0?a.height-r.startY:r.startY,t>0?a.width-r.startX:r.startX);const c=s?Math.round(Math.max(0,t>0?r.startX:r.startX-i)):o.offsetLeft,l=s?Math.round(Math.max(0,e>0?r.startY:r.startY-i)):o.offsetTop;o.style.left=`${c}px`,o.style.top=`${l}px`,o.style.width=`${i}px`,o.style.height=`${i}px`,ws(n,{x:c,y:l,width:i,height:i})}function ys(n){const{image:t}=U.get(n)||{};if(!t)return;const e=Math.round(t.clientWidth>t.clientHeight?t.clientHeight:t.clientWidth);pt.set(n,{startX:(t.clientWidth-e)/2,startY:(t.clientHeight-e)/2}),vs(n,e,e)}function ye(n){const t=n.currentTarget;t instanceof yt&&(st.delete(t),t.classList.remove("nwse","nesw"),t.removeEventListener("mousemove",gt),t.removeEventListener("mousemove",Pt),t.removeEventListener("touchmove",gt),t.removeEventListener("touchmove",Pt))}function ws(n,t){const{image:e}=U.get(n)||{};if(!e)return;const s=e.naturalWidth/e.width;for(const i in t){const r=Math.round(t[i]*s);t[i]=r;const o=n.querySelector(`[data-image-crop-input='${i}']`);o instanceof HTMLInputElement&&(o.value=r.toString())}n.dispatchEvent(new CustomEvent("image-crop-change",{bubbles:!0,detail:t}))}class yt extends HTMLElement{connectedCallback(){if(U.has(this))return;const t=this.attachShadow({mode:"open"});t.innerHTML=`
|
2
2
|
<style>
|
3
3
|
:host { touch-action: none; display: block; }
|
4
4
|
:host(.nesw) { cursor: nesw-resize; }
|
@@ -76,24 +76,24 @@ function Di(n,t=0,{start:e=!0,middle:s=!0,once:i=!1}={}){let r=e,o=0,a,c=!1;func
|
|
76
76
|
</div>
|
77
77
|
</div>
|
78
78
|
</div>
|
79
|
-
`;const e=t.querySelector("[data-crop-box]");if(!(e instanceof HTMLElement))return;const s=t.querySelector("img");s instanceof HTMLImageElement&&(W.set(this,{box:e,image:s}),s.addEventListener("load",()=>{this.loaded=!0,Rs(this)}),this.addEventListener("mouseleave",Me),this.addEventListener("touchend",Me),this.addEventListener("mouseup",Me),e.addEventListener("mousedown",Dn),e.addEventListener("touchstart",Dn,{passive:!0}),this.addEventListener("keydown",jt),this.addEventListener("keydown",bt),this.src&&(s.src=this.src))}static get observedAttributes(){return["src"]}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get loaded(){return this.hasAttribute("loaded")}set loaded(t){t?this.setAttribute("loaded",""):this.removeAttribute("loaded")}attributeChangedCallback(t,e,s){const{image:i}=W.get(this)||{};t==="src"&&(this.loaded=!1,i&&(i.src=s))}}window.customElements.get("image-crop")||(window.ImageCropElement=wt,window.customElements.define("image-crop",wt));var M=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},ke=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},k,dt,Rt,ht,Ce,Ve,Zt,Bn;const je=new WeakMap;function dr(n){return n&&!!n.split(",").find(t=>t.match(/^\s*\*\/\*/))}let He=null;class on extends HTMLElement{constructor(){super(...arguments),k.add(this),dt.set(this,!1),Rt.set(this,new IntersectionObserver(t=>{for(const e of t)if(e.isIntersecting){const{target:s}=e;if(M(this,Rt,"f").unobserve(s),!(s instanceof on))return;s.loading==="lazy"&&M(this,k,"m",ht).call(this)}},{rootMargin:"0px 0px 256px 0px",threshold:.01}))}static define(t="include-fragment",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){He=t===null?t:Promise.resolve(t)}static get observedAttributes(){return["src","loading"]}get src(){const t=this.getAttribute("src");if(t){const e=this.ownerDocument.createElement("a");return e.href=t,e.href}else return""}set src(t){this.setAttribute("src",t)}get loading(){return this.getAttribute("loading")==="lazy"?"lazy":"eager"}set loading(t){this.setAttribute("loading",t)}get accept(){return this.getAttribute("accept")||""}set accept(t){this.setAttribute("accept",t)}get data(){return M(this,k,"m",Ve).call(this)}attributeChangedCallback(t,e){t==="src"?this.isConnected&&this.loading==="eager"&&M(this,k,"m",ht).call(this):t==="loading"&&this.isConnected&&e!=="eager"&&this.loading==="eager"&&M(this,k,"m",ht).call(this)}connectedCallback(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=":host {display: block;}",this.shadowRoot.append(t,document.createElement("slot"))}this.src&&this.loading==="eager"&&M(this,k,"m",ht).call(this),this.loading==="lazy"&&M(this,Rt,"f").observe(this)}request(){const t=this.src;if(!t)throw new Error("missing src");return new Request(t,{method:"GET",credentials:"same-origin",headers:{Accept:this.accept||"text/html"}})}load(){return M(this,k,"m",Ve).call(this)}fetch(t){return fetch(t)}refetch(){je.delete(this),M(this,k,"m",ht).call(this)}}dt=new WeakMap,Rt=new WeakMap,k=new WeakSet,ht=async function(){if(!M(this,dt,"f")){ke(this,dt,!0,"f"),M(this,Rt,"f").unobserve(this);try{const t=await M(this,k,"m",Ce).call(this);if(t instanceof Error)throw t;const e=t,s=document.createElement("template");s.innerHTML=e;const i=document.importNode(s.content,!0);if(!this.dispatchEvent(new CustomEvent("include-fragment-replace",{cancelable:!0,detail:{fragment:i}}))){ke(this,dt,!1,"f");return}this.replaceWith(i),this.dispatchEvent(new CustomEvent("include-fragment-replaced"))}catch{this.classList.add("is-error")}finally{ke(this,dt,!1,"f")}}},Ce=async function(){const t=this.src,e=je.get(this);if(e&&e.src===t)return e.data;{let s;return t?s=M(this,k,"m",Bn).call(this):s=Promise.reject(new Error("missing src")),je.set(this,{src:t,data:s}),s}},Ve=async function(){const t=await M(this,k,"m",Ce).call(this);if(t instanceof Error)throw t;return t.toString()},Zt=async function(t){await new Promise(e=>setTimeout(e,0));for(const e of t)this.dispatchEvent(new Event(e))},Bn=async function(){try{await M(this,k,"m",Zt).call(this,["loadstart"]);const t=await this.fetch(this.request());if(t.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${t.status}`);const e=t.headers.get("Content-Type");if(!dr(this.accept)&&(!e||!e.includes(this.accept?this.accept:"text/html")))throw new Error(`Failed to load resource: expected ${this.accept||"text/html"} but was ${e}`);const s=await t.text();let i=s;return He&&(i=(await He).createHTML(s,t)),M(this,k,"m",Zt).call(this,["load","loadend"]),i}catch(t){throw M(this,k,"m",Zt).call(this,["error","loadend"]),t}};const Pn=typeof globalThis<"u"?globalThis:window;try{Pn.IncludeFragmentElement=on.define()}catch(n){if(!(Pn.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}var $n=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},se,We;const hr=["[data-md-button]","md-header","md-bold","md-italic","md-quote","md-code","md-link","md-image","md-unordered-list","md-ordered-list","md-task-list","md-mention","md-ref","md-strikethrough"];function Ns(n){const t=[];for(const e of n.querySelectorAll(hr.join(", ")))e.hidden||e.offsetWidth<=0&&e.offsetHeight<=0||e.closest("markdown-toolbar")===n&&t.push(e);return t}function Vs(n){return function(t){(t.key===" "||t.key==="Enter")&&n(t)}}const C=new WeakMap,fr={"header-1":{prefix:"# "},"header-2":{prefix:"## "},"header-3":{prefix:"### "},"header-4":{prefix:"#### "},"header-5":{prefix:"##### "},"header-6":{prefix:"###### "},bold:{prefix:"**",suffix:"**",trimFirst:!0},italic:{prefix:"_",suffix:"_",trimFirst:!0},quote:{prefix:"> ",multiline:!0,surroundWithNewlines:!0},code:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"},link:{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"},image:{prefix:"",replaceNext:"url",scanFor:"https?://"},"unordered-list":{prefix:"- ",multiline:!0,unorderedList:!0},"ordered-list":{prefix:"1. ",multiline:!0,orderedList:!0},"task-list":{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0},mention:{prefix:"@",prefixSpace:!0},ref:{prefix:"#",prefixSpace:!0},strikethrough:{prefix:"~~",suffix:"~~",trimFirst:!0}};class P extends HTMLElement{constructor(){super();const t=e=>{const s=C.get(this);s&&(e.preventDefault(),Ke(this,s))};this.addEventListener("keydown",Vs(t)),this.addEventListener("click",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","button")}click(){const t=C.get(this);t&&Ke(this,t)}}class Rn extends P{constructor(){super(...arguments),se.add(this)}connectedCallback(){const t=parseInt(this.getAttribute("level")||"3",10);$n(this,se,"m",We).call(this,t)}static get observedAttributes(){return["level"]}attributeChangedCallback(t,e,s){if(t!=="level")return;const i=parseInt(s||"3",10);$n(this,se,"m",We).call(this,i)}}se=new WeakSet,We=function(t){if(t<1||t>6)return;const e=`${"#".repeat(t)} `;C.set(this,{prefix:e})};window.customElements.get("md-header")||(window.MarkdownHeaderButtonElement=Rn,window.customElements.define("md-header",Rn));class In extends P{connectedCallback(){C.set(this,{prefix:"**",suffix:"**",trimFirst:!0})}}window.customElements.get("md-bold")||(window.MarkdownBoldButtonElement=In,window.customElements.define("md-bold",In));class Nn extends P{connectedCallback(){C.set(this,{prefix:"_",suffix:"_",trimFirst:!0})}}window.customElements.get("md-italic")||(window.MarkdownItalicButtonElement=Nn,window.customElements.define("md-italic",Nn));class Vn extends P{connectedCallback(){C.set(this,{prefix:"> ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-quote")||(window.MarkdownQuoteButtonElement=Vn,window.customElements.define("md-quote",Vn));class jn extends P{connectedCallback(){C.set(this,{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"})}}window.customElements.get("md-code")||(window.MarkdownCodeButtonElement=jn,window.customElements.define("md-code",jn));class Hn extends P{connectedCallback(){C.set(this,{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-link")||(window.MarkdownLinkButtonElement=Hn,window.customElements.define("md-link",Hn));class Wn extends P{connectedCallback(){C.set(this,{prefix:"",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-image")||(window.MarkdownImageButtonElement=Wn,window.customElements.define("md-image",Wn));class Un extends P{connectedCallback(){C.set(this,{prefix:"- ",multiline:!0,unorderedList:!0})}}window.customElements.get("md-unordered-list")||(window.MarkdownUnorderedListButtonElement=Un,window.customElements.define("md-unordered-list",Un));class Kn extends P{connectedCallback(){C.set(this,{prefix:"1. ",multiline:!0,orderedList:!0})}}window.customElements.get("md-ordered-list")||(window.MarkdownOrderedListButtonElement=Kn,window.customElements.define("md-ordered-list",Kn));class qn extends P{connectedCallback(){C.set(this,{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-task-list")||(window.MarkdownTaskListButtonElement=qn,window.customElements.define("md-task-list",qn));class zn extends P{connectedCallback(){C.set(this,{prefix:"@",prefixSpace:!0})}}window.customElements.get("md-mention")||(window.MarkdownMentionButtonElement=zn,window.customElements.define("md-mention",zn));class Yn extends P{connectedCallback(){C.set(this,{prefix:"#",prefixSpace:!0})}}window.customElements.get("md-ref")||(window.MarkdownRefButtonElement=Yn,window.customElements.define("md-ref",Yn));class Xn extends P{connectedCallback(){C.set(this,{prefix:"~~",suffix:"~~",trimFirst:!0})}}window.customElements.get("md-strikethrough")||(window.MarkdownStrikethroughButtonElement=Xn,window.customElements.define("md-strikethrough",Xn));function Gn(n){const{target:t,currentTarget:e}=n;if(!(t instanceof Element))return;const s=t.closest("[data-md-button]");if(!s||s.closest("markdown-toolbar")!==e)return;const i=s.getAttribute("data-md-button"),r=fr[i];r&&(n.preventDefault(),Ke(t,r))}function Zn(n){n.addEventListener("keydown",Hs),n.setAttribute("tabindex","0"),n.addEventListener("focus",js,{once:!0})}function Jn(n){n.removeEventListener("keydown",Hs),n.removeAttribute("tabindex"),n.removeEventListener("focus",js)}class ie extends HTMLElement{connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","toolbar"),this.hasAttribute("data-no-focus")||Zn(this),this.addEventListener("keydown",Vs(Gn)),this.addEventListener("click",Gn)}attributeChangedCallback(t,e,s){t==="data-no-focus"&&(s===null?Zn(this):Jn(this))}disconnectedCallback(){Jn(this)}get field(){const t=this.getAttribute("for");if(!t)return null;const e="getRootNode"in this?this.getRootNode():document;let s;return(e instanceof Document||e instanceof ShadowRoot)&&(s=e.getElementById(t)),s instanceof HTMLTextAreaElement?s:null}}ie.observedAttributes=["data-no-focus"];function js({target:n}){if(!(n instanceof Element))return;n.removeAttribute("tabindex");let t="0";for(const e of Ns(n))e.setAttribute("tabindex",t),t==="0"&&(e.focus(),t="-1")}function Hs(n){const t=n.key;if(t!=="ArrowRight"&&t!=="ArrowLeft"&&t!=="Home"&&t!=="End")return;const e=n.currentTarget;if(!(e instanceof HTMLElement))return;const s=Ns(e),i=s.indexOf(n.target),r=s.length;if(i===-1)return;let o=0;t==="ArrowLeft"&&(o=i-1),t==="ArrowRight"&&(o=i+1),t==="End"&&(o=r-1),o<0&&(o=r-1),o>r-1&&(o=0);for(let a=0;a<r;a+=1)s[a].setAttribute("tabindex",a===o?"0":"-1");n.preventDefault(),s[o].focus()}window.customElements.get("markdown-toolbar")||(window.MarkdownToolbarElement=ie,window.customElements.define("markdown-toolbar",ie));function Ue(n){return n.trim().split(`
|
80
|
-
`).length>1}function
|
81
|
-
`);let e=0;for(let s=0;s<t.length;s++){const i=t[s].length+1;n.selectionStart>=e&&n.selectionStart<e+i&&(n.selectionStart=e),n.selectionEnd>=e&&n.selectionEnd<e+i&&(n.selectionEnd=e+i-1),e+=i}}function
|
82
|
-
`,2-r)),e.match(/\S/)&&o<2&&(c=
|
83
|
-
`,2-o)),a==null&&(a=""),c==null&&(c=""),{newlinesToAppend:a,newlinesToPrepend:c}}function
|
84
|
-
`:i,
|
85
|
-
${a}`:r;if(l){const
|
79
|
+
`;const e=t.querySelector("[data-crop-box]");if(!(e instanceof HTMLElement))return;const s=t.querySelector("img");s instanceof HTMLImageElement&&(U.set(this,{box:e,image:s}),s.addEventListener("load",()=>{this.loaded=!0,ys(this)}),this.addEventListener("mouseleave",ye),this.addEventListener("touchend",ye),this.addEventListener("mouseup",ye),e.addEventListener("mousedown",yn),e.addEventListener("touchstart",yn,{passive:!0}),this.addEventListener("keydown",Pt),this.addEventListener("keydown",gt),this.src&&(s.src=this.src))}static get observedAttributes(){return["src"]}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get loaded(){return this.hasAttribute("loaded")}set loaded(t){t?this.setAttribute("loaded",""):this.removeAttribute("loaded")}attributeChangedCallback(t,e,s){const{image:i}=U.get(this)||{};t==="src"&&(this.loaded=!1,i&&(i.src=s))}}window.customElements.get("image-crop")||(window.ImageCropElement=yt,window.customElements.define("image-crop",yt));var wn=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},Zt,Fe;const Ri=["[data-md-button]","md-header","md-bold","md-italic","md-quote","md-code","md-link","md-image","md-unordered-list","md-ordered-list","md-task-list","md-mention","md-ref","md-strikethrough"];function Es(n){const t=[];for(const e of n.querySelectorAll(Ri.join(", ")))e.hidden||e.offsetWidth<=0&&e.offsetHeight<=0||e.closest("markdown-toolbar")===n&&t.push(e);return t}function As(n){return function(t){(t.key===" "||t.key==="Enter")&&n(t)}}const M=new WeakMap,$i={"header-1":{prefix:"# "},"header-2":{prefix:"## "},"header-3":{prefix:"### "},"header-4":{prefix:"#### "},"header-5":{prefix:"##### "},"header-6":{prefix:"###### "},bold:{prefix:"**",suffix:"**",trimFirst:!0},italic:{prefix:"_",suffix:"_",trimFirst:!0},quote:{prefix:"> ",multiline:!0,surroundWithNewlines:!0},code:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"},link:{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"},image:{prefix:"",replaceNext:"url",scanFor:"https?://"},"unordered-list":{prefix:"- ",multiline:!0,unorderedList:!0},"ordered-list":{prefix:"1. ",multiline:!0,orderedList:!0},"task-list":{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0},mention:{prefix:"@",prefixSpace:!0},ref:{prefix:"#",prefixSpace:!0},strikethrough:{prefix:"~~",suffix:"~~",trimFirst:!0}};class F extends HTMLElement{constructor(){super();const t=e=>{const s=M.get(this);s&&(e.preventDefault(),_e(this,s))};this.addEventListener("keydown",As(t)),this.addEventListener("click",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","button")}click(){const t=M.get(this);t&&_e(this,t)}}class En extends F{constructor(){super(...arguments),Zt.add(this)}connectedCallback(){const t=parseInt(this.getAttribute("level")||"3",10);wn(this,Zt,"m",Fe).call(this,t)}static get observedAttributes(){return["level"]}attributeChangedCallback(t,e,s){if(t!=="level")return;const i=parseInt(s||"3",10);wn(this,Zt,"m",Fe).call(this,i)}}Zt=new WeakSet,Fe=function(t){if(t<1||t>6)return;const e=`${"#".repeat(t)} `;M.set(this,{prefix:e})};window.customElements.get("md-header")||(window.MarkdownHeaderButtonElement=En,window.customElements.define("md-header",En));class An extends F{connectedCallback(){M.set(this,{prefix:"**",suffix:"**",trimFirst:!0})}}window.customElements.get("md-bold")||(window.MarkdownBoldButtonElement=An,window.customElements.define("md-bold",An));class Tn extends F{connectedCallback(){M.set(this,{prefix:"_",suffix:"_",trimFirst:!0})}}window.customElements.get("md-italic")||(window.MarkdownItalicButtonElement=Tn,window.customElements.define("md-italic",Tn));class xn extends F{connectedCallback(){M.set(this,{prefix:"> ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-quote")||(window.MarkdownQuoteButtonElement=xn,window.customElements.define("md-quote",xn));class On extends F{connectedCallback(){M.set(this,{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"})}}window.customElements.get("md-code")||(window.MarkdownCodeButtonElement=On,window.customElements.define("md-code",On));class Sn extends F{connectedCallback(){M.set(this,{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-link")||(window.MarkdownLinkButtonElement=Sn,window.customElements.define("md-link",Sn));class Mn extends F{connectedCallback(){M.set(this,{prefix:"",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-image")||(window.MarkdownImageButtonElement=Mn,window.customElements.define("md-image",Mn));class kn extends F{connectedCallback(){M.set(this,{prefix:"- ",multiline:!0,unorderedList:!0})}}window.customElements.get("md-unordered-list")||(window.MarkdownUnorderedListButtonElement=kn,window.customElements.define("md-unordered-list",kn));class Cn extends F{connectedCallback(){M.set(this,{prefix:"1. ",multiline:!0,orderedList:!0})}}window.customElements.get("md-ordered-list")||(window.MarkdownOrderedListButtonElement=Cn,window.customElements.define("md-ordered-list",Cn));class Ln extends F{connectedCallback(){M.set(this,{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-task-list")||(window.MarkdownTaskListButtonElement=Ln,window.customElements.define("md-task-list",Ln));class Fn extends F{connectedCallback(){M.set(this,{prefix:"@",prefixSpace:!0})}}window.customElements.get("md-mention")||(window.MarkdownMentionButtonElement=Fn,window.customElements.define("md-mention",Fn));class Dn extends F{connectedCallback(){M.set(this,{prefix:"#",prefixSpace:!0})}}window.customElements.get("md-ref")||(window.MarkdownRefButtonElement=Dn,window.customElements.define("md-ref",Dn));class _n extends F{connectedCallback(){M.set(this,{prefix:"~~",suffix:"~~",trimFirst:!0})}}window.customElements.get("md-strikethrough")||(window.MarkdownStrikethroughButtonElement=_n,window.customElements.define("md-strikethrough",_n));function Bn(n){const{target:t,currentTarget:e}=n;if(!(t instanceof Element))return;const s=t.closest("[data-md-button]");if(!s||s.closest("markdown-toolbar")!==e)return;const i=s.getAttribute("data-md-button"),r=$i[i];r&&(n.preventDefault(),_e(t,r))}function Rn(n){n.addEventListener("keydown",xs),n.setAttribute("tabindex","0"),n.addEventListener("focus",Ts,{once:!0})}function $n(n){n.removeEventListener("keydown",xs),n.removeAttribute("tabindex"),n.removeEventListener("focus",Ts)}class Jt extends HTMLElement{connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","toolbar"),this.hasAttribute("data-no-focus")||Rn(this),this.addEventListener("keydown",As(Bn)),this.addEventListener("click",Bn)}attributeChangedCallback(t,e,s){t==="data-no-focus"&&(s===null?Rn(this):$n(this))}disconnectedCallback(){$n(this)}get field(){const t=this.getAttribute("for");if(!t)return null;const e="getRootNode"in this?this.getRootNode():document;let s;return(e instanceof Document||e instanceof ShadowRoot)&&(s=e.getElementById(t)),s instanceof HTMLTextAreaElement?s:null}}Jt.observedAttributes=["data-no-focus"];function Ts({target:n}){if(!(n instanceof Element))return;n.removeAttribute("tabindex");let t="0";for(const e of Es(n))e.setAttribute("tabindex",t),t==="0"&&(e.focus(),t="-1")}function xs(n){const t=n.key;if(t!=="ArrowRight"&&t!=="ArrowLeft"&&t!=="Home"&&t!=="End")return;const e=n.currentTarget;if(!(e instanceof HTMLElement))return;const s=Es(e),i=s.indexOf(n.target),r=s.length;if(i===-1)return;let o=0;t==="ArrowLeft"&&(o=i-1),t==="ArrowRight"&&(o=i+1),t==="End"&&(o=r-1),o<0&&(o=r-1),o>r-1&&(o=0);for(let a=0;a<r;a+=1)s[a].setAttribute("tabindex",a===o?"0":"-1");n.preventDefault(),s[o].focus()}window.customElements.get("markdown-toolbar")||(window.MarkdownToolbarElement=Jt,window.customElements.define("markdown-toolbar",Jt));function De(n){return n.trim().split(`
|
80
|
+
`).length>1}function Pn(n,t){return Array(t+1).join(n)}function Pi(n,t){let e=t;for(;n[e]&&n[e-1]!=null&&!n[e-1].match(/\s/);)e--;return e}function Ni(n,t,e){let s=t;const i=e?/\n/:/\s/;for(;n[s]&&!n[s].match(i);)s++;return s}let nt=null;function Ii(n,{text:t,selectionStart:e,selectionEnd:s}){const i=n.selectionStart,r=n.value.slice(0,i),o=n.value.slice(n.selectionEnd);if(nt===null||nt===!0){n.contentEditable="true";try{nt=document.execCommand("insertText",!1,t)}catch{nt=!1}n.contentEditable="false"}if(nt&&!n.value.slice(0,n.selectionStart).endsWith(t)&&(nt=!1),!nt){try{document.execCommand("ms-beginUndoUnit")}catch{}n.value=r+t+o;try{document.execCommand("ms-endUndoUnit")}catch{}n.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0}))}e!=null&&s!=null?n.setSelectionRange(e,s):n.setSelectionRange(i,n.selectionEnd)}function ji(n,t){const e=n.value.slice(n.selectionStart,n.selectionEnd);let s;t.orderedList||t.unorderedList?s=zi(n,t):t.multiline&&De(e)?s=Ui(n,t):s=Wi(n,t),Ii(n,s)}function Vi(n){const t=n.value.split(`
|
81
|
+
`);let e=0;for(let s=0;s<t.length;s++){const i=t[s].length+1;n.selectionStart>=e&&n.selectionStart<e+i&&(n.selectionStart=e),n.selectionEnd>=e&&n.selectionEnd<e+i&&(n.selectionEnd=e+i-1),e+=i}}function Hi(n,t,e,s=!1){if(n.selectionStart===n.selectionEnd)n.selectionStart=Pi(n.value,n.selectionStart),n.selectionEnd=Ni(n.value,n.selectionEnd,s);else{const i=n.selectionStart-t.length,r=n.selectionEnd+e.length,o=n.value.slice(i,n.selectionStart)===t,a=n.value.slice(n.selectionEnd,r)===e;o&&a&&(n.selectionStart=i,n.selectionEnd=r)}return n.value.slice(n.selectionStart,n.selectionEnd)}function Ye(n){const t=n.value.slice(0,n.selectionStart),e=n.value.slice(n.selectionEnd),s=t.match(/\n*$/),i=e.match(/^\n*/),r=s?s[0].length:0,o=i?i[0].length:0;let a,c;return t.match(/\S/)&&r<2&&(a=Pn(`
|
82
|
+
`,2-r)),e.match(/\S/)&&o<2&&(c=Pn(`
|
83
|
+
`,2-o)),a==null&&(a=""),c==null&&(c=""),{newlinesToAppend:a,newlinesToPrepend:c}}function Wi(n,t){let e,s;const{prefix:i,suffix:r,blockPrefix:o,blockSuffix:a,replaceNext:c,prefixSpace:l,scanFor:u,surroundWithNewlines:d}=t,h=n.selectionStart,m=n.selectionEnd;let f=n.value.slice(n.selectionStart,n.selectionEnd),g=De(f)&&o.length>0?`${o}
|
84
|
+
`:i,b=De(f)&&a.length>0?`
|
85
|
+
${a}`:r;if(l){const v=n.value[n.selectionStart-1];n.selectionStart!==0&&v!=null&&!v.match(/\s/)&&(g=` ${g}`)}f=Hi(n,g,b,t.multiline);let p=n.selectionStart,w=n.selectionEnd;const E=c.length>0&&b.indexOf(c)>-1&&f.length>0;if(d){const v=Ye(n);e=v.newlinesToAppend,s=v.newlinesToPrepend,g=e+i,b+=s}if(f.startsWith(g)&&f.endsWith(b)){const v=f.slice(g.length,f.length-b.length);if(h===m){let y=h-g.length;y=Math.max(y,p),y=Math.min(y,p+v.length),p=w=y}else w=p+v.length;return{text:v,selectionStart:p,selectionEnd:w}}else if(E)if(u.length>0&&f.match(u)){b=b.replace(c,f);const v=g+b;return p=w=p+g.length,{text:v,selectionStart:p,selectionEnd:w}}else{const v=g+f+b;return p=p+g.length+f.length+b.indexOf(c),w=p+c.length,{text:v,selectionStart:p,selectionEnd:w}}else{let v=g+f+b;p=h+g.length,w=m+g.length;const y=f.match(/^\s*|\s*$/g);if(t.trimFirst&&y){const x=y[0]||"",S=y[1]||"";v=x+g+f.trim()+b+S,p+=x.length,w-=S.length}return{text:v,selectionStart:p,selectionEnd:w}}}function Ui(n,t){const{prefix:e,suffix:s,surroundWithNewlines:i}=t;let r=n.value.slice(n.selectionStart,n.selectionEnd),o=n.selectionStart,a=n.selectionEnd;const c=r.split(`
|
86
86
|
`);if(c.every(u=>u.startsWith(e)&&u.endsWith(s)))r=c.map(u=>u.slice(e.length,u.length-s.length)).join(`
|
87
87
|
`),a=o+r.length;else if(r=c.map(u=>e+u+s).join(`
|
88
|
-
`),i){const{newlinesToAppend:u,newlinesToPrepend:
|
88
|
+
`),i){const{newlinesToAppend:u,newlinesToPrepend:d}=Ye(n);o+=u.length,a=o+r.length,r=u+r+d}return{text:r,selectionStart:o,selectionEnd:a}}function Nn(n){const t=n.split(`
|
89
89
|
`),e=/^\d+\.\s+/,s=t.every(r=>e.test(r));let i=t;return s&&(i=t.map(r=>r.replace(e,""))),{text:i.join(`
|
90
|
-
`),processed:s}}function
|
90
|
+
`),processed:s}}function In(n){const t=n.split(`
|
91
91
|
`),e="- ",s=t.every(r=>r.startsWith(e));let i=t;return s&&(i=t.map(r=>r.slice(e.length,r.length))),{text:i.join(`
|
92
|
-
`),processed:s}}function
|
93
|
-
`).map((g,
|
94
|
-
`)+p;return e?(s=Math.max(s+St(0,t.unorderedList).length+d.length,0),i=s):a.processed?(s=Math.max(n.selectionStart+d.length,0),i=n.selectionEnd+d.length+u-h):(s=Math.max(n.selectionStart+d.length,0),i=n.selectionEnd+d.length+u),{text:f,selectionStart:s,selectionEnd:i}}function Ke(n,t){const e=n.closest("markdown-toolbar");if(!(e instanceof ie))return;const i=Object.assign(Object.assign({},{prefix:"",suffix:"",blockPrefix:"",blockSuffix:"",multiline:!1,replaceNext:"",prefixSpace:!1,scanFor:"",surroundWithNewlines:!1,orderedList:!1,unorderedList:!1,trimFirst:!1}),t),r=e.field;r&&(r.focus(),br(r,i))}var xr=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},ns=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},_t;class Or{formatToParts(t){const e=[];for(const s of t)e.push({type:"element",value:s}),e.push({type:"literal",value:", "});return e.slice(0,-1)}}const Sr=typeof Intl<"u"&&Intl.ListFormat||Or,Mr=[["years","year"],["months","month"],["weeks","week"],["days","day"],["hours","hour"],["minutes","minute"],["seconds","second"],["milliseconds","millisecond"]],kr={minimumIntegerDigits:2};class Cr{constructor(t,e={}){_t.set(this,void 0);let s=String(e.style||"short");s!=="long"&&s!=="short"&&s!=="narrow"&&s!=="digital"&&(s="short");let i=s==="digital"?"numeric":s;const r=e.hours||i;i=r==="2-digit"?"numeric":r;const o=e.minutes||i;i=o==="2-digit"?"numeric":o;const a=e.seconds||i;i=a==="2-digit"?"numeric":a;const c=e.milliseconds||i;xr(this,_t,{locale:t,style:s,years:e.years||s==="digital"?"short":s,yearsDisplay:e.yearsDisplay==="always"?"always":"auto",months:e.months||s==="digital"?"short":s,monthsDisplay:e.monthsDisplay==="always"?"always":"auto",weeks:e.weeks||s==="digital"?"short":s,weeksDisplay:e.weeksDisplay==="always"?"always":"auto",days:e.days||s==="digital"?"short":s,daysDisplay:e.daysDisplay==="always"?"always":"auto",hours:r,hoursDisplay:e.hoursDisplay==="always"||s==="digital"?"always":"auto",minutes:o,minutesDisplay:e.minutesDisplay==="always"||s==="digital"?"always":"auto",seconds:a,secondsDisplay:e.secondsDisplay==="always"||s==="digital"?"always":"auto",milliseconds:c,millisecondsDisplay:e.millisecondsDisplay==="always"?"always":"auto"},"f")}resolvedOptions(){return ns(this,_t,"f")}formatToParts(t){const e=[],s=ns(this,_t,"f"),i=s.style,r=s.locale;for(const[o,a]of Mr){const c=t[o];if(s[`${o}Display`]==="auto"&&!c)continue;const l=s[o],u=l==="2-digit"?kr:l==="numeric"?{}:{style:"unit",unit:a,unitDisplay:l};e.push(new Intl.NumberFormat(r,u).format(c))}return new Sr(r,{type:"unit",style:i==="digital"?"short":i}).formatToParts(e)}format(t){return this.formatToParts(t).map(e=>e.value).join("")}}_t=new WeakMap;const Ws=/^[-+]?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,re=["year","month","week","day","hour","minute","second","millisecond"],Lr=n=>Ws.test(n);class _{constructor(t=0,e=0,s=0,i=0,r=0,o=0,a=0,c=0){this.years=t,this.months=e,this.weeks=s,this.days=i,this.hours=r,this.minutes=o,this.seconds=a,this.milliseconds=c,this.years||(this.years=0),this.sign||(this.sign=Math.sign(this.years)),this.months||(this.months=0),this.sign||(this.sign=Math.sign(this.months)),this.weeks||(this.weeks=0),this.sign||(this.sign=Math.sign(this.weeks)),this.days||(this.days=0),this.sign||(this.sign=Math.sign(this.days)),this.hours||(this.hours=0),this.sign||(this.sign=Math.sign(this.hours)),this.minutes||(this.minutes=0),this.sign||(this.sign=Math.sign(this.minutes)),this.seconds||(this.seconds=0),this.sign||(this.sign=Math.sign(this.seconds)),this.milliseconds||(this.milliseconds=0),this.sign||(this.sign=Math.sign(this.milliseconds)),this.blank=this.sign===0}abs(){return new _(Math.abs(this.years),Math.abs(this.months),Math.abs(this.weeks),Math.abs(this.days),Math.abs(this.hours),Math.abs(this.minutes),Math.abs(this.seconds),Math.abs(this.milliseconds))}static from(t){var e;if(typeof t=="string"){const s=String(t).trim(),i=s.startsWith("-")?-1:1,r=(e=s.match(Ws))===null||e===void 0?void 0:e.slice(1).map(o=>(Number(o)||0)*i);return r?new _(...r):new _}else if(typeof t=="object"){const{years:s,months:i,weeks:r,days:o,hours:a,minutes:c,seconds:l,milliseconds:u}=t;return new _(s,i,r,o,a,c,l,u)}throw new RangeError("invalid duration")}static compare(t,e){const s=Date.now(),i=Math.abs(ss(s,_.from(t)).getTime()-s),r=Math.abs(ss(s,_.from(e)).getTime()-s);return i>r?-1:i<r?1:0}toLocaleString(t,e){return new Cr(t,e).format(this)}}function ss(n,t){const e=new Date(n);return e.setFullYear(e.getFullYear()+t.years),e.setMonth(e.getMonth()+t.months),e.setDate(e.getDate()+t.weeks*7+t.days),e.setHours(e.getHours()+t.hours),e.setMinutes(e.getMinutes()+t.minutes),e.setSeconds(e.getSeconds()+t.seconds),e}function Fr(n,t="second",e=Date.now()){const s=n.getTime()-e;if(s===0)return new _;const i=Math.sign(s),r=Math.abs(s),o=Math.floor(r/1e3),a=Math.floor(o/60),c=Math.floor(a/60),l=Math.floor(c/24),u=Math.floor(l/30),h=Math.floor(u/12),d=re.indexOf(t)||re.length;return new _(d>=0?h*i:0,d>=1?(u-h*12)*i:0,0,d>=3?(l-u*30)*i:0,d>=4?(c-l*24)*i:0,d>=5?(a-c*60)*i:0,d>=6?(o-a*60)*i:0,d>=7?(r-o*1e3)*i:0)}function Us(n,{relativeTo:t=Date.now()}={}){if(t=new Date(t),n.blank)return n;const e=n.sign;let s=Math.abs(n.years),i=Math.abs(n.months),r=Math.abs(n.weeks),o=Math.abs(n.days),a=Math.abs(n.hours),c=Math.abs(n.minutes),l=Math.abs(n.seconds),u=Math.abs(n.milliseconds);u>=900&&(l+=Math.round(u/1e3)),(l||c||a||o||r||i||s)&&(u=0),l>=55&&(c+=Math.round(l/60)),(c||a||o||r||i||s)&&(l=0),c>=55&&(a+=Math.round(c/60)),(a||o||r||i||s)&&(c=0),o&&a>=12&&(o+=Math.round(a/24)),!o&&a>=21&&(o+=Math.round(a/24)),(o||r||i||s)&&(a=0);const h=t.getFullYear();let d=t.getMonth();const p=t.getDate();if(o>=27||s+i+o){const f=new Date(t);f.setFullYear(h+s*e),f.setMonth(d+i*e),f.setDate(p+o*e);const g=f.getFullYear()-t.getFullYear(),v=f.getMonth()-t.getMonth(),m=Math.abs(Math.round((Number(f)-Number(t))/864e5)),y=Math.abs(g*12+v);m<27?(o>=6?(r+=Math.round(o/7),o=0):o=m,i=s=0):y<11?(i=y,s=0):(i=0,s=g*e),(i||s)&&(o=0),d=t.getMonth()}return s&&(i=0),r>=4&&(i+=Math.round(r/4)),(i||s)&&(r=0),o&&r&&!i&&!s&&(r+=Math.round(o/7),o=0),new _(s*e,i*e,r*e,o*e,a*e,c*e,l*e,u*e)}function _r(n,t){const e=Us(n,t);if(e.blank)return[0,"second"];for(const s of re){if(s==="millisecond")continue;const i=e[`${s}s`];if(i)return[i,s]}return[0,"second"]}var O=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},Jt=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},$,Dt,Bt,Mt,nt,qe,Ks,qs,zs,Ys,ft;const Dr=globalThis.HTMLElement||null,Le=new _,is=new _(0,0,0,0,0,1);class Br extends Event{constructor(t,e,s,i){super("relative-time-updated",{bubbles:!0,composed:!0}),this.oldText=t,this.newText=e,this.oldTitle=s,this.newTitle=i}}function rs(n){if(!n.date)return 1/0;if(n.format==="duration"||n.format==="elapsed"){const e=n.precision;if(e==="second")return 1e3;if(e==="minute")return 60*1e3}const t=Math.abs(Date.now()-n.date.getTime());return t<60*1e3?1e3:t<60*60*1e3?60*1e3:60*60*1e3}const Fe=new class{constructor(){this.elements=new Set,this.time=1/0,this.timer=-1}observe(n){if(this.elements.has(n))return;this.elements.add(n);const t=n.date;if(t&&t.getTime()){const e=rs(n),s=Date.now()+e;s<this.time&&(clearTimeout(this.timer),this.timer=setTimeout(()=>this.update(),e),this.time=s)}}unobserve(n){this.elements.has(n)&&this.elements.delete(n)}update(){if(clearTimeout(this.timer),!this.elements.size)return;let n=1/0;for(const t of this.elements)n=Math.min(n,rs(t)),t.update();this.time=Math.min(60*60*1e3,n),this.timer=setTimeout(()=>this.update(),this.time),this.time+=Date.now()}};class Pr extends Dr{constructor(){super(...arguments),$.add(this),Dt.set(this,!1),Bt.set(this,!1),nt.set(this,this.shadowRoot?this.shadowRoot:this.attachShadow?this.attachShadow({mode:"open"}):this),ft.set(this,null)}static define(t="relative-time",e=customElements){return e.define(t,this),this}static get observedAttributes(){return["second","minute","hour","weekday","day","month","year","time-zone-name","prefix","threshold","tense","precision","format","format-style","datetime","lang","title"]}get onRelativeTimeUpdated(){return O(this,ft,"f")}set onRelativeTimeUpdated(t){O(this,ft,"f")&&this.removeEventListener("relative-time-updated",O(this,ft,"f")),Jt(this,ft,typeof t=="object"||typeof t=="function"?t:null,"f"),typeof t=="function"&&this.addEventListener("relative-time-updated",t)}get second(){const t=this.getAttribute("second");if(t==="numeric"||t==="2-digit")return t}set second(t){this.setAttribute("second",t||"")}get minute(){const t=this.getAttribute("minute");if(t==="numeric"||t==="2-digit")return t}set minute(t){this.setAttribute("minute",t||"")}get hour(){const t=this.getAttribute("hour");if(t==="numeric"||t==="2-digit")return t}set hour(t){this.setAttribute("hour",t||"")}get weekday(){const t=this.getAttribute("weekday");if(t==="long"||t==="short"||t==="narrow")return t;if(this.format==="datetime"&&t!=="")return this.formatStyle}set weekday(t){this.setAttribute("weekday",t||"")}get day(){var t;const e=(t=this.getAttribute("day"))!==null&&t!==void 0?t:"numeric";if(e==="numeric"||e==="2-digit")return e}set day(t){this.setAttribute("day",t||"")}get month(){const t=this.format;let e=this.getAttribute("month");if(e!==""&&(e??(e=t==="datetime"?this.formatStyle:"short"),e==="numeric"||e==="2-digit"||e==="short"||e==="long"||e==="narrow"))return e}set month(t){this.setAttribute("month",t||"")}get year(){var t;const e=this.getAttribute("year");if(e==="numeric"||e==="2-digit")return e;if(!this.hasAttribute("year")&&new Date().getUTCFullYear()!==((t=this.date)===null||t===void 0?void 0:t.getUTCFullYear()))return"numeric"}set year(t){this.setAttribute("year",t||"")}get timeZoneName(){const t=this.getAttribute("time-zone-name");if(t==="long"||t==="short"||t==="shortOffset"||t==="longOffset"||t==="shortGeneric"||t==="longGeneric")return t}set timeZoneName(t){this.setAttribute("time-zone-name",t||"")}get prefix(){var t;return(t=this.getAttribute("prefix"))!==null&&t!==void 0?t:this.format==="datetime"?"":"on"}set prefix(t){this.setAttribute("prefix",t)}get threshold(){const t=this.getAttribute("threshold");return t&&Lr(t)?t:"P30D"}set threshold(t){this.setAttribute("threshold",t)}get tense(){const t=this.getAttribute("tense");return t==="past"?"past":t==="future"?"future":"auto"}set tense(t){this.setAttribute("tense",t)}get precision(){const t=this.getAttribute("precision");return re.includes(t)?t:this.format==="micro"?"minute":"second"}set precision(t){this.setAttribute("precision",t)}get format(){const t=this.getAttribute("format");return t==="datetime"?"datetime":t==="relative"?"relative":t==="duration"?"duration":t==="micro"?"micro":t==="elapsed"?"elapsed":"auto"}set format(t){this.setAttribute("format",t)}get formatStyle(){const t=this.getAttribute("format-style");if(t==="long")return"long";if(t==="short")return"short";if(t==="narrow")return"narrow";const e=this.format;return e==="elapsed"||e==="micro"?"narrow":e==="datetime"?"short":"long"}set formatStyle(t){this.setAttribute("format-style",t)}get datetime(){return this.getAttribute("datetime")||""}set datetime(t){this.setAttribute("datetime",t)}get date(){const t=Date.parse(this.datetime);return Number.isNaN(t)?null:new Date(t)}set date(t){this.datetime=(t==null?void 0:t.toISOString())||""}connectedCallback(){this.update()}disconnectedCallback(){Fe.unobserve(this)}attributeChangedCallback(t,e,s){e!==s&&(t==="title"&&Jt(this,Dt,s!==null&&(this.date&&O(this,$,"m",qe).call(this,this.date))!==s,"f"),!O(this,Bt,"f")&&!(t==="title"&&O(this,Dt,"f"))&&Jt(this,Bt,(async()=>{await Promise.resolve(),this.update()})(),"f"))}update(){const t=O(this,nt,"f").textContent||this.textContent||"",e=this.getAttribute("title")||"";let s=e;const i=this.date;if(typeof Intl>"u"||!Intl.DateTimeFormat||!i){O(this,nt,"f").textContent=t;return}const r=Date.now();O(this,Dt,"f")||(s=O(this,$,"m",qe).call(this,i)||"",s&&this.setAttribute("title",s));const o=Fr(i,this.precision,r),a=O(this,$,"m",Ks).call(this,o);let c=t;a==="duration"?c=O(this,$,"m",qs).call(this,o):a==="relative"?c=O(this,$,"m",zs).call(this,o):c=O(this,$,"m",Ys).call(this,i),c?O(this,nt,"f").textContent=c:this.shadowRoot===O(this,nt,"f")&&this.textContent&&(O(this,nt,"f").textContent=this.textContent),(c!==t||s!==e)&&this.dispatchEvent(new Br(t,c,e,s)),a==="relative"||a==="duration"?Fe.observe(this):Fe.unobserve(this),Jt(this,Bt,!1,"f")}}Dt=new WeakMap,Bt=new WeakMap,nt=new WeakMap,ft=new WeakMap,$=new WeakSet,Mt=function(){var t;return((t=this.closest("[lang]"))===null||t===void 0?void 0:t.getAttribute("lang"))||this.ownerDocument.documentElement.getAttribute("lang")||"default"},qe=function(t){return new Intl.DateTimeFormat(O(this,$,"a",Mt),{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)},Ks=function(t){const e=this.format;if(e==="datetime")return"datetime";if(e==="duration"||e==="elapsed"||e==="micro")return"duration";if((e==="auto"||e==="relative")&&typeof Intl<"u"&&Intl.RelativeTimeFormat){const s=this.tense;if(s==="past"||s==="future"||_.compare(t,this.threshold)===1)return"relative"}return"datetime"},qs=function(t){const e=O(this,$,"a",Mt),s=this.format,i=this.formatStyle,r=this.tense;let o=Le;s==="micro"?(t=Us(t),o=is,(this.tense==="past"&&t.sign!==-1||this.tense==="future"&&t.sign!==1)&&(t=is)):(r==="past"&&t.sign!==-1||r==="future"&&t.sign!==1)&&(t=o);const a=`${this.precision}sDisplay`;return t.blank?o.toLocaleString(e,{style:i,[a]:"always"}):t.abs().toLocaleString(e,{style:i})},zs=function(t){const e=new Intl.RelativeTimeFormat(O(this,$,"a",Mt),{numeric:"auto",style:this.formatStyle}),s=this.tense;s==="future"&&t.sign!==1&&(t=Le),s==="past"&&t.sign!==-1&&(t=Le);const[i,r]=_r(t);return r==="second"&&i<10?e.format(0,this.precision==="millisecond"?"second":this.precision):e.format(i,r)},Ys=function(t){const e=new Intl.DateTimeFormat(O(this,$,"a",Mt),{second:this.second,minute:this.minute,hour:this.hour,weekday:this.weekday,day:this.day,month:this.month,year:this.year,timeZoneName:this.timeZoneName});return`${this.prefix} ${e.format(t)}`.trim()};const os=typeof globalThis<"u"?globalThis:window;try{os.RelativeTimeElement=Pr.define()}catch(n){if(!(os.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}localStorage.getItem("theme");window.matchMedia("(prefers-color-scheme: dark)").matches;class $r{constructor(t,e,s){this.eventTarget=t,this.eventName=e,this.eventOptions=s,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(t){this.unorderedBindings.add(t)}bindingDisconnected(t){this.unorderedBindings.delete(t)}handleEvent(t){const e=Rr(t);for(const s of this.bindings){if(e.immediatePropagationStopped)break;s.handleEvent(e)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((t,e)=>{const s=t.index,i=e.index;return s<i?-1:s>i?1:0})}}function Rr(n){if("immediatePropagationStopped"in n)return n;{const{stopImmediatePropagation:t}=n;return Object.assign(n,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}class Ir{constructor(t){this.application=t,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(t=>t.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(t=>t.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((t,e)=>t.concat(Array.from(e.values())),[])}bindingConnected(t){this.fetchEventListenerForBinding(t).bindingConnected(t)}bindingDisconnected(t,e=!1){this.fetchEventListenerForBinding(t).bindingDisconnected(t),e&&this.clearEventListenersForBinding(t)}handleError(t,e,s={}){this.application.handleError(t,`Error ${e}`,s)}clearEventListenersForBinding(t){const e=this.fetchEventListenerForBinding(t);e.hasBindings()||(e.disconnect(),this.removeMappedEventListenerFor(t))}removeMappedEventListenerFor(t){const{eventTarget:e,eventName:s,eventOptions:i}=t,r=this.fetchEventListenerMapForEventTarget(e),o=this.cacheKey(s,i);r.delete(o),r.size==0&&this.eventListenerMaps.delete(e)}fetchEventListenerForBinding(t){const{eventTarget:e,eventName:s,eventOptions:i}=t;return this.fetchEventListener(e,s,i)}fetchEventListener(t,e,s){const i=this.fetchEventListenerMapForEventTarget(t),r=this.cacheKey(e,s);let o=i.get(r);return o||(o=this.createEventListener(t,e,s),i.set(r,o)),o}createEventListener(t,e,s){const i=new $r(t,e,s);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(t){let e=this.eventListenerMaps.get(t);return e||(e=new Map,this.eventListenerMaps.set(t,e)),e}cacheKey(t,e){const s=[t];return Object.keys(e).sort().forEach(i=>{s.push(`${e[i]?"":"!"}${i}`)}),s.join(":")}}const Nr={stop({event:n,value:t}){return t&&n.stopPropagation(),!0},prevent({event:n,value:t}){return t&&n.preventDefault(),!0},self({event:n,value:t,element:e}){return t?e===n.target:!0}},Vr=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function jr(n){const e=n.trim().match(Vr)||[];let s=e[2],i=e[3];return i&&!["keydown","keyup","keypress"].includes(s)&&(s+=`.${i}`,i=""),{eventTarget:Hr(e[4]),eventName:s,eventOptions:e[7]?Wr(e[7]):{},identifier:e[5],methodName:e[6],keyFilter:e[1]||i}}function Hr(n){if(n=="window")return window;if(n=="document")return document}function Wr(n){return n.split(":").reduce((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)}),{})}function Ur(n){if(n==window)return"window";if(n==document)return"document"}function cn(n){return n.replace(/(?:[_-])([a-z0-9])/g,(t,e)=>e.toUpperCase())}function ze(n){return cn(n.replace(/--/g,"-").replace(/__/g,"_"))}function Kt(n){return n.charAt(0).toUpperCase()+n.slice(1)}function Xs(n){return n.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)}function Kr(n){return n.match(/[^\s]+/g)||[]}function as(n){return n!=null}function Ye(n,t){return Object.prototype.hasOwnProperty.call(n,t)}const cs=["meta","ctrl","alt","shift"];class qr{constructor(t,e,s,i){this.element=t,this.index=e,this.eventTarget=s.eventTarget||t,this.eventName=s.eventName||zr(t)||Qt("missing event name"),this.eventOptions=s.eventOptions||{},this.identifier=s.identifier||Qt("missing identifier"),this.methodName=s.methodName||Qt("missing method name"),this.keyFilter=s.keyFilter||"",this.schema=i}static forToken(t,e){return new this(t.element,t.index,jr(t.content),e)}toString(){const t=this.keyFilter?`.${this.keyFilter}`:"",e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${t}${e}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(t){if(!this.keyFilter)return!1;const e=this.keyFilter.split("+");if(this.keyFilterDissatisfied(t,e))return!0;const s=e.filter(i=>!cs.includes(i))[0];return s?(Ye(this.keyMappings,s)||Qt(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[s].toLowerCase()!==t.key.toLowerCase()):!1}shouldIgnoreMouseEvent(t){if(!this.keyFilter)return!1;const e=[this.keyFilter];return!!this.keyFilterDissatisfied(t,e)}get params(){const t={},e=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:s,value:i}of Array.from(this.element.attributes)){const r=s.match(e),o=r&&r[1];o&&(t[cn(o)]=Yr(i))}return t}get eventTargetName(){return Ur(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(t,e){const[s,i,r,o]=cs.map(a=>e.includes(a));return t.metaKey!==s||t.ctrlKey!==i||t.altKey!==r||t.shiftKey!==o}}const ls={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:n=>n.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function zr(n){const t=n.tagName.toLowerCase();if(t in ls)return ls[t](n)}function Qt(n){throw new Error(n)}function Yr(n){try{return JSON.parse(n)}catch{return n}}class Xr{constructor(t,e){this.context=t,this.action=e}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(t){const e=this.prepareActionEvent(t);this.willBeInvokedByEvent(t)&&this.applyEventModifiers(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){const t=this.controller[this.methodName];if(typeof t=="function")return t;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(t){const{element:e}=this.action,{actionDescriptorFilters:s}=this.context.application,{controller:i}=this.context;let r=!0;for(const[o,a]of Object.entries(this.eventOptions))if(o in s){const c=s[o];r=r&&c({name:o,value:a,event:t,element:e,controller:i})}else continue;return r}prepareActionEvent(t){return Object.assign(t,{params:this.action.params})}invokeWithEvent(t){const{target:e,currentTarget:s}=t;try{this.method.call(this.controller,t),this.context.logDebugActivity(this.methodName,{event:t,target:e,currentTarget:s,action:this.methodName})}catch(i){const{identifier:r,controller:o,element:a,index:c}=this,l={identifier:r,controller:o,element:a,index:c,event:t};this.context.handleError(i,`invoking action "${this.action}"`,l)}}willBeInvokedByEvent(t){const e=t.target;return t instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(t)||t instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(t)?!1:this.element===e?!0:e instanceof Element&&this.element.contains(e)?this.scope.containsElement(e):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class Gs{constructor(t,e){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(t){this.started&&(this.mutationObserver.disconnect(),this.started=!1),t(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const t=new Set(this.matchElementsInTree());for(const e of Array.from(this.elements))t.has(e)||this.removeElement(e);for(const e of Array.from(t))this.addElement(e)}}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){t.type=="attributes"?this.processAttributeChange(t.target,t.attributeName):t.type=="childList"&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))}processAttributeChange(t,e){this.elements.has(t)?this.delegate.elementAttributeChanged&&this.matchElement(t)?this.delegate.elementAttributeChanged(t,e):this.removeElement(t):this.matchElement(t)&&this.addElement(t)}processRemovedNodes(t){for(const e of Array.from(t)){const s=this.elementFromNode(e);s&&this.processTree(s,this.removeElement)}}processAddedNodes(t){for(const e of Array.from(t)){const s=this.elementFromNode(e);s&&this.elementIsActive(s)&&this.processTree(s,this.addElement)}}matchElement(t){return this.delegate.matchElement(t)}matchElementsInTree(t=this.element){return this.delegate.matchElementsInTree(t)}processTree(t,e){for(const s of this.matchElementsInTree(t))e.call(this,s)}elementFromNode(t){if(t.nodeType==Node.ELEMENT_NODE)return t}elementIsActive(t){return t.isConnected!=this.element.isConnected?!1:this.element.contains(t)}addElement(t){this.elements.has(t)||this.elementIsActive(t)&&(this.elements.add(t),this.delegate.elementMatched&&this.delegate.elementMatched(t))}removeElement(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(t))}}class Zs{constructor(t,e,s){this.attributeName=e,this.delegate=s,this.elementObserver=new Gs(t,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(t){return t.hasAttribute(this.attributeName)}matchElementsInTree(t){const e=this.matchElement(t)?[t]:[],s=Array.from(t.querySelectorAll(this.selector));return e.concat(s)}elementMatched(t){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(t,this.attributeName)}elementUnmatched(t){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(t,this.attributeName)}elementAttributeChanged(t,e){this.delegate.elementAttributeValueChanged&&this.attributeName==e&&this.delegate.elementAttributeValueChanged(t,e)}}function Gr(n,t,e){Js(n,t).add(e)}function Zr(n,t,e){Js(n,t).delete(e),Jr(n,t)}function Js(n,t){let e=n.get(t);return e||(e=new Set,n.set(t,e)),e}function Jr(n,t){const e=n.get(t);e!=null&&e.size==0&&n.delete(t)}class it{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((e,s)=>e.concat(Array.from(s)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((e,s)=>e+s.size,0)}add(t,e){Gr(this.valuesByKey,t,e)}delete(t,e){Zr(this.valuesByKey,t,e)}has(t,e){const s=this.valuesByKey.get(t);return s!=null&&s.has(e)}hasKey(t){return this.valuesByKey.has(t)}hasValue(t){return Array.from(this.valuesByKey.values()).some(s=>s.has(t))}getValuesForKey(t){const e=this.valuesByKey.get(t);return e?Array.from(e):[]}getKeysForValue(t){return Array.from(this.valuesByKey).filter(([e,s])=>s.has(t)).map(([e,s])=>e)}}class Qr{constructor(t,e,s,i){this._selector=e,this.details=i,this.elementObserver=new Gs(t,this),this.delegate=s,this.matchesByElement=new it}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(t){this._selector=t,this.refresh()}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(t){const{selector:e}=this;if(e){const s=t.matches(e);return this.delegate.selectorMatchElement?s&&this.delegate.selectorMatchElement(t,this.details):s}else return!1}matchElementsInTree(t){const{selector:e}=this;if(e){const s=this.matchElement(t)?[t]:[],i=Array.from(t.querySelectorAll(e)).filter(r=>this.matchElement(r));return s.concat(i)}else return[]}elementMatched(t){const{selector:e}=this;e&&this.selectorMatched(t,e)}elementUnmatched(t){const e=this.matchesByElement.getKeysForValue(t);for(const s of e)this.selectorUnmatched(t,s)}elementAttributeChanged(t,e){const{selector:s}=this;if(s){const i=this.matchElement(t),r=this.matchesByElement.has(s,t);i&&!r?this.selectorMatched(t,s):!i&&r&&this.selectorUnmatched(t,s)}}selectorMatched(t,e){this.delegate.selectorMatched(t,e,this.details),this.matchesByElement.add(e,t)}selectorUnmatched(t,e){this.delegate.selectorUnmatched(t,e,this.details),this.matchesByElement.delete(e,t)}}class to{constructor(t,e){this.element=t,this.delegate=e,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const t of this.knownAttributeNames)this.refreshAttribute(t,null)}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){const e=t.attributeName;e&&this.refreshAttribute(e,t.oldValue)}refreshAttribute(t,e){const s=this.delegate.getStringMapKeyForAttribute(t);if(s!=null){this.stringMap.has(t)||this.stringMapKeyAdded(s,t);const i=this.element.getAttribute(t);if(this.stringMap.get(t)!=i&&this.stringMapValueChanged(i,s,e),i==null){const r=this.stringMap.get(t);this.stringMap.delete(t),r&&this.stringMapKeyRemoved(s,t,r)}else this.stringMap.set(t,i)}}stringMapKeyAdded(t,e){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(t,e)}stringMapValueChanged(t,e,s){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(t,e,s)}stringMapKeyRemoved(t,e,s){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(t,e,s)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(t=>t.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class Qs{constructor(t,e,s){this.attributeObserver=new Zs(t,e,this),this.delegate=s,this.tokensByElement=new it}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(t){this.attributeObserver.pause(t)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(t){this.tokensMatched(this.readTokensForElement(t))}elementAttributeValueChanged(t){const[e,s]=this.refreshTokensForElement(t);this.tokensUnmatched(e),this.tokensMatched(s)}elementUnmatchedAttribute(t){this.tokensUnmatched(this.tokensByElement.getValuesForKey(t))}tokensMatched(t){t.forEach(e=>this.tokenMatched(e))}tokensUnmatched(t){t.forEach(e=>this.tokenUnmatched(e))}tokenMatched(t){this.delegate.tokenMatched(t),this.tokensByElement.add(t.element,t)}tokenUnmatched(t){this.delegate.tokenUnmatched(t),this.tokensByElement.delete(t.element,t)}refreshTokensForElement(t){const e=this.tokensByElement.getValuesForKey(t),s=this.readTokensForElement(t),i=no(e,s).findIndex(([r,o])=>!so(r,o));return i==-1?[[],[]]:[e.slice(i),s.slice(i)]}readTokensForElement(t){const e=this.attributeName,s=t.getAttribute(e)||"";return eo(s,t,e)}}function eo(n,t,e){return n.trim().split(/\s+/).filter(s=>s.length).map((s,i)=>({element:t,attributeName:e,content:s,index:i}))}function no(n,t){const e=Math.max(n.length,t.length);return Array.from({length:e},(s,i)=>[n[i],t[i]])}function so(n,t){return n&&t&&n.index==t.index&&n.content==t.content}class ti{constructor(t,e,s){this.tokenListObserver=new Qs(t,e,this),this.delegate=s,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(t){const{element:e}=t,{value:s}=this.fetchParseResultForToken(t);s&&(this.fetchValuesByTokenForElement(e).set(t,s),this.delegate.elementMatchedValue(e,s))}tokenUnmatched(t){const{element:e}=t,{value:s}=this.fetchParseResultForToken(t);s&&(this.fetchValuesByTokenForElement(e).delete(t),this.delegate.elementUnmatchedValue(e,s))}fetchParseResultForToken(t){let e=this.parseResultsByToken.get(t);return e||(e=this.parseToken(t),this.parseResultsByToken.set(t,e)),e}fetchValuesByTokenForElement(t){let e=this.valuesByTokenByElement.get(t);return e||(e=new Map,this.valuesByTokenByElement.set(t,e)),e}parseToken(t){try{return{value:this.delegate.parseValueForToken(t)}}catch(e){return{error:e}}}}class io{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new ti(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(t){const e=new Xr(this.context,t);this.bindingsByAction.set(t,e),this.delegate.bindingConnected(e)}disconnectAction(t){const e=this.bindingsByAction.get(t);e&&(this.bindingsByAction.delete(t),this.delegate.bindingDisconnected(e))}disconnectAllActions(){this.bindings.forEach(t=>this.delegate.bindingDisconnected(t,!0)),this.bindingsByAction.clear()}parseValueForToken(t){const e=qr.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}}class ro{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new to(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(t){if(t in this.valueDescriptorMap)return this.valueDescriptorMap[t].name}stringMapKeyAdded(t,e){const s=this.valueDescriptorMap[e];this.hasValue(t)||this.invokeChangedCallback(t,s.writer(this.receiver[t]),s.writer(s.defaultValue))}stringMapValueChanged(t,e,s){const i=this.valueDescriptorNameMap[e];t!==null&&(s===null&&(s=i.writer(i.defaultValue)),this.invokeChangedCallback(e,t,s))}stringMapKeyRemoved(t,e,s){const i=this.valueDescriptorNameMap[t];this.hasValue(t)?this.invokeChangedCallback(t,i.writer(this.receiver[t]),s):this.invokeChangedCallback(t,i.writer(i.defaultValue),s)}invokeChangedCallbacksForDefaultValues(){for(const{key:t,name:e,defaultValue:s,writer:i}of this.valueDescriptors)s!=null&&!this.controller.data.has(t)&&this.invokeChangedCallback(e,i(s),void 0)}invokeChangedCallback(t,e,s){const i=`${t}Changed`,r=this.receiver[i];if(typeof r=="function"){const o=this.valueDescriptorNameMap[t];try{const a=o.reader(e);let c=s;s&&(c=o.reader(s)),r.call(this.receiver,a,c)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){const{valueDescriptorMap:t}=this;return Object.keys(t).map(e=>t[e])}get valueDescriptorNameMap(){const t={};return Object.keys(this.valueDescriptorMap).forEach(e=>{const s=this.valueDescriptorMap[e];t[s.name]=s}),t}hasValue(t){const e=this.valueDescriptorNameMap[t],s=`has${Kt(e.name)}`;return this.receiver[s]}}class oo{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new it}start(){this.tokenListObserver||(this.tokenListObserver=new Qs(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:t,content:e}){this.scope.containsElement(t)&&this.connectTarget(t,e)}tokenUnmatched({element:t,content:e}){this.disconnectTarget(t,e)}connectTarget(t,e){var s;this.targetsByName.has(e,t)||(this.targetsByName.add(e,t),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetConnected(t,e)))}disconnectTarget(t,e){var s;this.targetsByName.has(e,t)&&(this.targetsByName.delete(e,t),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetDisconnected(t,e)))}disconnectAllTargets(){for(const t of this.targetsByName.keys)for(const e of this.targetsByName.getValuesForKey(t))this.disconnectTarget(e,t)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function qt(n,t){const e=ei(n);return Array.from(e.reduce((s,i)=>(co(i,t).forEach(r=>s.add(r)),s),new Set))}function ao(n,t){return ei(n).reduce((s,i)=>(s.push(...lo(i,t)),s),[])}function ei(n){const t=[];for(;n;)t.push(n),n=Object.getPrototypeOf(n);return t.reverse()}function co(n,t){const e=n[t];return Array.isArray(e)?e:[]}function lo(n,t){const e=n[t];return e?Object.keys(e).map(s=>[s,e[s]]):[]}class uo{constructor(t,e){this.started=!1,this.context=t,this.delegate=e,this.outletsByName=new it,this.outletElementsByName=new it,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(t=>{this.setupSelectorObserverForOutlet(t),this.setupAttributeObserverForOutlet(t)}),this.started=!0,this.dependentContexts.forEach(t=>t.refresh()))}refresh(){this.selectorObserverMap.forEach(t=>t.refresh()),this.attributeObserverMap.forEach(t=>t.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(t=>t.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(t=>t.stop()),this.attributeObserverMap.clear())}selectorMatched(t,e,{outletName:s}){const i=this.getOutlet(t,s);i&&this.connectOutlet(i,t,s)}selectorUnmatched(t,e,{outletName:s}){const i=this.getOutletFromMap(t,s);i&&this.disconnectOutlet(i,t,s)}selectorMatchElement(t,{outletName:e}){const s=this.selector(e),i=this.hasOutlet(t,e),r=t.matches(`[${this.schema.controllerAttribute}~=${e}]`);return s?i&&r&&t.matches(s):!1}elementMatchedAttribute(t,e){const s=this.getOutletNameFromOutletAttributeName(e);s&&this.updateSelectorObserverForOutlet(s)}elementAttributeValueChanged(t,e){const s=this.getOutletNameFromOutletAttributeName(e);s&&this.updateSelectorObserverForOutlet(s)}elementUnmatchedAttribute(t,e){const s=this.getOutletNameFromOutletAttributeName(e);s&&this.updateSelectorObserverForOutlet(s)}connectOutlet(t,e,s){var i;this.outletElementsByName.has(s,e)||(this.outletsByName.add(s,t),this.outletElementsByName.add(s,e),(i=this.selectorObserverMap.get(s))===null||i===void 0||i.pause(()=>this.delegate.outletConnected(t,e,s)))}disconnectOutlet(t,e,s){var i;this.outletElementsByName.has(s,e)&&(this.outletsByName.delete(s,t),this.outletElementsByName.delete(s,e),(i=this.selectorObserverMap.get(s))===null||i===void 0||i.pause(()=>this.delegate.outletDisconnected(t,e,s)))}disconnectAllOutlets(){for(const t of this.outletElementsByName.keys)for(const e of this.outletElementsByName.getValuesForKey(t))for(const s of this.outletsByName.getValuesForKey(t))this.disconnectOutlet(s,e,t)}updateSelectorObserverForOutlet(t){const e=this.selectorObserverMap.get(t);e&&(e.selector=this.selector(t))}setupSelectorObserverForOutlet(t){const e=this.selector(t),s=new Qr(document.body,e,this,{outletName:t});this.selectorObserverMap.set(t,s),s.start()}setupAttributeObserverForOutlet(t){const e=this.attributeNameForOutletName(t),s=new Zs(this.scope.element,e,this);this.attributeObserverMap.set(t,s),s.start()}selector(t){return this.scope.outlets.getSelectorForOutletName(t)}attributeNameForOutletName(t){return this.scope.schema.outletAttributeForScope(this.identifier,t)}getOutletNameFromOutletAttributeName(t){return this.outletDefinitions.find(e=>this.attributeNameForOutletName(e)===t)}get outletDependencies(){const t=new it;return this.router.modules.forEach(e=>{const s=e.definition.controllerConstructor;qt(s,"outlets").forEach(r=>t.add(r,e.identifier))}),t}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const t=this.dependentControllerIdentifiers;return this.router.contexts.filter(e=>t.includes(e.identifier))}hasOutlet(t,e){return!!this.getOutlet(t,e)||!!this.getOutletFromMap(t,e)}getOutlet(t,e){return this.application.getControllerForElementAndIdentifier(t,e)}getOutletFromMap(t,e){return this.outletsByName.getValuesForKey(e).find(s=>s.element===t)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class ho{constructor(t,e){this.logDebugActivity=(s,i={})=>{const{identifier:r,controller:o,element:a}=this;i=Object.assign({identifier:r,controller:o,element:a},i),this.application.logDebugActivity(this.identifier,s,i)},this.module=t,this.scope=e,this.controller=new t.controllerConstructor(this),this.bindingObserver=new io(this,this.dispatcher),this.valueObserver=new ro(this,this.controller),this.targetObserver=new oo(this,this),this.outletObserver=new uo(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(s){this.handleError(s,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(t){this.handleError(t,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(t){this.handleError(t,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(t,e,s={}){const{identifier:i,controller:r,element:o}=this;s=Object.assign({identifier:i,controller:r,element:o},s),this.application.handleError(t,`Error ${e}`,s)}targetConnected(t,e){this.invokeControllerMethod(`${e}TargetConnected`,t)}targetDisconnected(t,e){this.invokeControllerMethod(`${e}TargetDisconnected`,t)}outletConnected(t,e,s){this.invokeControllerMethod(`${ze(s)}OutletConnected`,t,e)}outletDisconnected(t,e,s){this.invokeControllerMethod(`${ze(s)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){const s=this.controller;typeof s[t]=="function"&&s[t](...e)}}function fo(n){return mo(n,po(n))}function mo(n,t){const e=yo(n),s=go(n.prototype,t);return Object.defineProperties(e.prototype,s),e}function po(n){return qt(n,"blessings").reduce((e,s)=>{const i=s(n);for(const r in i){const o=e[r]||{};e[r]=Object.assign(o,i[r])}return e},{})}function go(n,t){return vo(t).reduce((e,s)=>{const i=bo(n,t,s);return i&&Object.assign(e,{[s]:i}),e},{})}function bo(n,t,e){const s=Object.getOwnPropertyDescriptor(n,e);if(!(s&&"value"in s)){const r=Object.getOwnPropertyDescriptor(t,e).value;return s&&(r.get=s.get||r.get,r.set=s.set||r.set),r}}const vo=typeof Object.getOwnPropertySymbols=="function"?n=>[...Object.getOwnPropertyNames(n),...Object.getOwnPropertySymbols(n)]:Object.getOwnPropertyNames,yo=(()=>{function n(e){function s(){return Reflect.construct(e,arguments,new.target)}return s.prototype=Object.create(e.prototype,{constructor:{value:s}}),Reflect.setPrototypeOf(s,e),s}function t(){const s=n(function(){this.a.call(this)});return s.prototype.a=function(){},new s}try{return t(),n}catch{return s=>class extends s{}}})();function wo(n){return{identifier:n.identifier,controllerConstructor:fo(n.controllerConstructor)}}class Eo{constructor(t,e){this.application=t,this.definition=wo(e),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(t){const e=this.fetchContextForScope(t);this.connectedContexts.add(e),e.connect()}disconnectContextForScope(t){const e=this.contextsByScope.get(t);e&&(this.connectedContexts.delete(e),e.disconnect())}fetchContextForScope(t){let e=this.contextsByScope.get(t);return e||(e=new ho(this,t),this.contextsByScope.set(t,e)),e}}class Ao{constructor(t){this.scope=t}has(t){return this.data.has(this.getDataKey(t))}get(t){return this.getAll(t)[0]}getAll(t){const e=this.data.get(this.getDataKey(t))||"";return Kr(e)}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}}class To{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(t){const e=this.getAttributeNameForKey(t);return this.element.getAttribute(e)}set(t,e){const s=this.getAttributeNameForKey(t);return this.element.setAttribute(s,e),this.get(t)}has(t){const e=this.getAttributeNameForKey(t);return this.element.hasAttribute(e)}delete(t){if(this.has(t)){const e=this.getAttributeNameForKey(t);return this.element.removeAttribute(e),!0}else return!1}getAttributeNameForKey(t){return`data-${this.identifier}-${Xs(t)}`}}class xo{constructor(t){this.warnedKeysByObject=new WeakMap,this.logger=t}warn(t,e,s){let i=this.warnedKeysByObject.get(t);i||(i=new Set,this.warnedKeysByObject.set(t,i)),i.has(e)||(i.add(e),this.logger.warn(s,t))}}function Xe(n,t){return`[${n}~="${t}"]`}class Oo{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return this.find(t)!=null}find(...t){return t.reduce((e,s)=>e||this.findTarget(s)||this.findLegacyTarget(s),void 0)}findAll(...t){return t.reduce((e,s)=>[...e,...this.findAllTargets(s),...this.findAllLegacyTargets(s)],[])}findTarget(t){const e=this.getSelectorForTargetName(t);return this.scope.findElement(e)}findAllTargets(t){const e=this.getSelectorForTargetName(t);return this.scope.findAllElements(e)}getSelectorForTargetName(t){const e=this.schema.targetAttributeForScope(this.identifier);return Xe(e,t)}findLegacyTarget(t){const e=this.getLegacySelectorForTargetName(t);return this.deprecate(this.scope.findElement(e),t)}findAllLegacyTargets(t){const e=this.getLegacySelectorForTargetName(t);return this.scope.findAllElements(e).map(s=>this.deprecate(s,t))}getLegacySelectorForTargetName(t){const e=`${this.identifier}.${t}`;return Xe(this.schema.targetAttribute,e)}deprecate(t,e){if(t){const{identifier:s}=this,i=this.schema.targetAttribute,r=this.schema.targetAttributeForScope(s);this.guide.warn(t,`target:${e}`,`Please replace ${i}="${s}.${e}" with ${r}="${e}". The ${i} attribute is deprecated and will be removed in a future version of Stimulus.`)}return t}get guide(){return this.scope.guide}}class So{constructor(t,e){this.scope=t,this.controllerElement=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return this.find(t)!=null}find(...t){return t.reduce((e,s)=>e||this.findOutlet(s),void 0)}findAll(...t){return t.reduce((e,s)=>[...e,...this.findAllOutlets(s)],[])}getSelectorForOutletName(t){const e=this.schema.outletAttributeForScope(this.identifier,t);return this.controllerElement.getAttribute(e)}findOutlet(t){const e=this.getSelectorForOutletName(t);if(e)return this.findElement(e,t)}findAllOutlets(t){const e=this.getSelectorForOutletName(t);return e?this.findAllElements(e,t):[]}findElement(t,e){return this.scope.queryElements(t).filter(i=>this.matchesElement(i,t,e))[0]}findAllElements(t,e){return this.scope.queryElements(t).filter(i=>this.matchesElement(i,t,e))}matchesElement(t,e,s){const i=t.getAttribute(this.scope.schema.controllerAttribute)||"";return t.matches(e)&&i.split(" ").includes(s)}}class ln{constructor(t,e,s,i){this.targets=new Oo(this),this.classes=new Ao(this),this.data=new To(this),this.containsElement=r=>r.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=s,this.guide=new xo(i),this.outlets=new So(this.documentScope,e)}findElement(t){return this.element.matches(t)?this.element:this.queryElements(t).find(this.containsElement)}findAllElements(t){return[...this.element.matches(t)?[this.element]:[],...this.queryElements(t).filter(this.containsElement)]}queryElements(t){return Array.from(this.element.querySelectorAll(t))}get controllerSelector(){return Xe(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new ln(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class Mo{constructor(t,e,s){this.element=t,this.schema=e,this.delegate=s,this.valueListObserver=new ti(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(t){const{element:e,content:s}=t;return this.parseValueForElementAndIdentifier(e,s)}parseValueForElementAndIdentifier(t,e){const s=this.fetchScopesByIdentifierForElement(t);let i=s.get(e);return i||(i=this.delegate.createScopeForElementAndIdentifier(t,e),s.set(e,i)),i}elementMatchedValue(t,e){const s=(this.scopeReferenceCounts.get(e)||0)+1;this.scopeReferenceCounts.set(e,s),s==1&&this.delegate.scopeConnected(e)}elementUnmatchedValue(t,e){const s=this.scopeReferenceCounts.get(e);s&&(this.scopeReferenceCounts.set(e,s-1),s==1&&this.delegate.scopeDisconnected(e))}fetchScopesByIdentifierForElement(t){let e=this.scopesByIdentifierByElement.get(t);return e||(e=new Map,this.scopesByIdentifierByElement.set(t,e)),e}}class ko{constructor(t){this.application=t,this.scopeObserver=new Mo(this.element,this.schema,this),this.scopesByIdentifier=new it,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((t,e)=>t.concat(e.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(t){this.unloadIdentifier(t.identifier);const e=new Eo(this.application,t);this.connectModule(e);const s=t.controllerConstructor.afterLoad;s&&s.call(t.controllerConstructor,t.identifier,this.application)}unloadIdentifier(t){const e=this.modulesByIdentifier.get(t);e&&this.disconnectModule(e)}getContextForElementAndIdentifier(t,e){const s=this.modulesByIdentifier.get(e);if(s)return s.contexts.find(i=>i.element==t)}proposeToConnectScopeForElementAndIdentifier(t,e){const s=this.scopeObserver.parseValueForElementAndIdentifier(t,e);s?this.scopeObserver.elementMatchedValue(s.element,s):console.error(`Couldn't find or create scope for identifier: "${e}" and element:`,t)}handleError(t,e,s){this.application.handleError(t,e,s)}createScopeForElementAndIdentifier(t,e){return new ln(this.schema,t,e,this.logger)}scopeConnected(t){this.scopesByIdentifier.add(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.connectContextForScope(t)}scopeDisconnected(t){this.scopesByIdentifier.delete(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.disconnectContextForScope(t)}connectModule(t){this.modulesByIdentifier.set(t.identifier,t),this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(s=>t.connectContextForScope(s))}disconnectModule(t){this.modulesByIdentifier.delete(t.identifier),this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(s=>t.disconnectContextForScope(s))}}const Co={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:n=>`data-${n}-target`,outletAttributeForScope:(n,t)=>`data-${n}-${t}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},us("abcdefghijklmnopqrstuvwxyz".split("").map(n=>[n,n]))),us("0123456789".split("").map(n=>[n,n])))};function us(n){return n.reduce((t,[e,s])=>Object.assign(Object.assign({},t),{[e]:s}),{})}class Lo{constructor(t=document.documentElement,e=Co){this.logger=console,this.debug=!1,this.logDebugActivity=(s,i,r={})=>{this.debug&&this.logFormattedMessage(s,i,r)},this.element=t,this.schema=e,this.dispatcher=new Ir(this),this.router=new ko(this),this.actionDescriptorFilters=Object.assign({},Nr)}static start(t,e){const s=new this(t,e);return s.start(),s}async start(){await Fo(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(t,e){this.load({identifier:t,controllerConstructor:e})}registerActionOption(t,e){this.actionDescriptorFilters[t]=e}load(t,...e){(Array.isArray(t)?t:[t,...e]).forEach(i=>{i.controllerConstructor.shouldLoad&&this.router.loadDefinition(i)})}unload(t,...e){(Array.isArray(t)?t:[t,...e]).forEach(i=>this.router.unloadIdentifier(i))}get controllers(){return this.router.contexts.map(t=>t.controller)}getControllerForElementAndIdentifier(t,e){const s=this.router.getContextForElementAndIdentifier(t,e);return s?s.controller:null}handleError(t,e,s){var i;this.logger.error(`%s
|
92
|
+
`),processed:s}}function xt(n,t){return t?"- ":`${n+1}. `}function Ki(n,t){let e,s,i;return n.orderedList?(s=Nn(t),e=In(s.text),i=e.text):(s=In(t),e=Nn(s.text),i=e.text),[s,e,i]}function zi(n,t){const e=n.selectionStart===n.selectionEnd;let s=n.selectionStart,i=n.selectionEnd;Vi(n);const r=n.value.slice(n.selectionStart,n.selectionEnd),[o,a,c]=Ki(t,r),l=c.split(`
|
93
|
+
`).map((g,b)=>`${xt(b,t.unorderedList)}${g}`),u=l.reduce((g,b,p)=>g+xt(p,t.unorderedList).length,0),d=l.reduce((g,b,p)=>g+xt(p,!t.unorderedList).length,0);if(o.processed)return e?(s=Math.max(s-xt(0,t.unorderedList).length,0),i=s):(s=n.selectionStart,i=n.selectionEnd-u),{text:c,selectionStart:s,selectionEnd:i};const{newlinesToAppend:h,newlinesToPrepend:m}=Ye(n),f=h+l.join(`
|
94
|
+
`)+m;return e?(s=Math.max(s+xt(0,t.unorderedList).length+h.length,0),i=s):a.processed?(s=Math.max(n.selectionStart+h.length,0),i=n.selectionEnd+h.length+u-d):(s=Math.max(n.selectionStart+h.length,0),i=n.selectionEnd+h.length+u),{text:f,selectionStart:s,selectionEnd:i}}function _e(n,t){const e=n.closest("markdown-toolbar");if(!(e instanceof Jt))return;const i=Object.assign(Object.assign({},{prefix:"",suffix:"",blockPrefix:"",blockSuffix:"",multiline:!1,replaceNext:"",prefixSpace:!1,scanFor:"",surroundWithNewlines:!1,orderedList:!1,unorderedList:!1,trimFirst:!1}),t),r=e.field;r&&(r.focus(),ji(r,i))}localStorage.getItem("theme");window.matchMedia("(prefers-color-scheme: dark)").matches;class qi{constructor(t,e,s){this.eventTarget=t,this.eventName=e,this.eventOptions=s,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(t){this.unorderedBindings.add(t)}bindingDisconnected(t){this.unorderedBindings.delete(t)}handleEvent(t){const e=Yi(t);for(const s of this.bindings){if(e.immediatePropagationStopped)break;s.handleEvent(e)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((t,e)=>{const s=t.index,i=e.index;return s<i?-1:s>i?1:0})}}function Yi(n){if("immediatePropagationStopped"in n)return n;{const{stopImmediatePropagation:t}=n;return Object.assign(n,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}class Xi{constructor(t){this.application=t,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(t=>t.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(t=>t.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((t,e)=>t.concat(Array.from(e.values())),[])}bindingConnected(t){this.fetchEventListenerForBinding(t).bindingConnected(t)}bindingDisconnected(t,e=!1){this.fetchEventListenerForBinding(t).bindingDisconnected(t),e&&this.clearEventListenersForBinding(t)}handleError(t,e,s={}){this.application.handleError(t,`Error ${e}`,s)}clearEventListenersForBinding(t){const e=this.fetchEventListenerForBinding(t);e.hasBindings()||(e.disconnect(),this.removeMappedEventListenerFor(t))}removeMappedEventListenerFor(t){const{eventTarget:e,eventName:s,eventOptions:i}=t,r=this.fetchEventListenerMapForEventTarget(e),o=this.cacheKey(s,i);r.delete(o),r.size==0&&this.eventListenerMaps.delete(e)}fetchEventListenerForBinding(t){const{eventTarget:e,eventName:s,eventOptions:i}=t;return this.fetchEventListener(e,s,i)}fetchEventListener(t,e,s){const i=this.fetchEventListenerMapForEventTarget(t),r=this.cacheKey(e,s);let o=i.get(r);return o||(o=this.createEventListener(t,e,s),i.set(r,o)),o}createEventListener(t,e,s){const i=new qi(t,e,s);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(t){let e=this.eventListenerMaps.get(t);return e||(e=new Map,this.eventListenerMaps.set(t,e)),e}cacheKey(t,e){const s=[t];return Object.keys(e).sort().forEach(i=>{s.push(`${e[i]?"":"!"}${i}`)}),s.join(":")}}const Gi={stop({event:n,value:t}){return t&&n.stopPropagation(),!0},prevent({event:n,value:t}){return t&&n.preventDefault(),!0},self({event:n,value:t,element:e}){return t?e===n.target:!0}},Zi=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Ji(n){const e=n.trim().match(Zi)||[];let s=e[2],i=e[3];return i&&!["keydown","keyup","keypress"].includes(s)&&(s+=`.${i}`,i=""),{eventTarget:Qi(e[4]),eventName:s,eventOptions:e[7]?tr(e[7]):{},identifier:e[5],methodName:e[6],keyFilter:e[1]||i}}function Qi(n){if(n=="window")return window;if(n=="document")return document}function tr(n){return n.split(":").reduce((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)}),{})}function er(n){if(n==window)return"window";if(n==document)return"document"}function Xe(n){return n.replace(/(?:[_-])([a-z0-9])/g,(t,e)=>e.toUpperCase())}function Be(n){return Xe(n.replace(/--/g,"-").replace(/__/g,"_"))}function Vt(n){return n.charAt(0).toUpperCase()+n.slice(1)}function Os(n){return n.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)}function nr(n){return n.match(/[^\s]+/g)||[]}function jn(n){return n!=null}function Re(n,t){return Object.prototype.hasOwnProperty.call(n,t)}const Vn=["meta","ctrl","alt","shift"];class sr{constructor(t,e,s,i){this.element=t,this.index=e,this.eventTarget=s.eventTarget||t,this.eventName=s.eventName||ir(t)||zt("missing event name"),this.eventOptions=s.eventOptions||{},this.identifier=s.identifier||zt("missing identifier"),this.methodName=s.methodName||zt("missing method name"),this.keyFilter=s.keyFilter||"",this.schema=i}static forToken(t,e){return new this(t.element,t.index,Ji(t.content),e)}toString(){const t=this.keyFilter?`.${this.keyFilter}`:"",e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${t}${e}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(t){if(!this.keyFilter)return!1;const e=this.keyFilter.split("+");if(this.keyFilterDissatisfied(t,e))return!0;const s=e.filter(i=>!Vn.includes(i))[0];return s?(Re(this.keyMappings,s)||zt(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[s].toLowerCase()!==t.key.toLowerCase()):!1}shouldIgnoreMouseEvent(t){if(!this.keyFilter)return!1;const e=[this.keyFilter];return!!this.keyFilterDissatisfied(t,e)}get params(){const t={},e=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:s,value:i}of Array.from(this.element.attributes)){const r=s.match(e),o=r&&r[1];o&&(t[Xe(o)]=rr(i))}return t}get eventTargetName(){return er(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(t,e){const[s,i,r,o]=Vn.map(a=>e.includes(a));return t.metaKey!==s||t.ctrlKey!==i||t.altKey!==r||t.shiftKey!==o}}const Hn={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:n=>n.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function ir(n){const t=n.tagName.toLowerCase();if(t in Hn)return Hn[t](n)}function zt(n){throw new Error(n)}function rr(n){try{return JSON.parse(n)}catch{return n}}class or{constructor(t,e){this.context=t,this.action=e}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(t){const e=this.prepareActionEvent(t);this.willBeInvokedByEvent(t)&&this.applyEventModifiers(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){const t=this.controller[this.methodName];if(typeof t=="function")return t;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(t){const{element:e}=this.action,{actionDescriptorFilters:s}=this.context.application,{controller:i}=this.context;let r=!0;for(const[o,a]of Object.entries(this.eventOptions))if(o in s){const c=s[o];r=r&&c({name:o,value:a,event:t,element:e,controller:i})}else continue;return r}prepareActionEvent(t){return Object.assign(t,{params:this.action.params})}invokeWithEvent(t){const{target:e,currentTarget:s}=t;try{this.method.call(this.controller,t),this.context.logDebugActivity(this.methodName,{event:t,target:e,currentTarget:s,action:this.methodName})}catch(i){const{identifier:r,controller:o,element:a,index:c}=this,l={identifier:r,controller:o,element:a,index:c,event:t};this.context.handleError(i,`invoking action "${this.action}"`,l)}}willBeInvokedByEvent(t){const e=t.target;return t instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(t)||t instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(t)?!1:this.element===e?!0:e instanceof Element&&this.element.contains(e)?this.scope.containsElement(e):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class Ss{constructor(t,e){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(t){this.started&&(this.mutationObserver.disconnect(),this.started=!1),t(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const t=new Set(this.matchElementsInTree());for(const e of Array.from(this.elements))t.has(e)||this.removeElement(e);for(const e of Array.from(t))this.addElement(e)}}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){t.type=="attributes"?this.processAttributeChange(t.target,t.attributeName):t.type=="childList"&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))}processAttributeChange(t,e){this.elements.has(t)?this.delegate.elementAttributeChanged&&this.matchElement(t)?this.delegate.elementAttributeChanged(t,e):this.removeElement(t):this.matchElement(t)&&this.addElement(t)}processRemovedNodes(t){for(const e of Array.from(t)){const s=this.elementFromNode(e);s&&this.processTree(s,this.removeElement)}}processAddedNodes(t){for(const e of Array.from(t)){const s=this.elementFromNode(e);s&&this.elementIsActive(s)&&this.processTree(s,this.addElement)}}matchElement(t){return this.delegate.matchElement(t)}matchElementsInTree(t=this.element){return this.delegate.matchElementsInTree(t)}processTree(t,e){for(const s of this.matchElementsInTree(t))e.call(this,s)}elementFromNode(t){if(t.nodeType==Node.ELEMENT_NODE)return t}elementIsActive(t){return t.isConnected!=this.element.isConnected?!1:this.element.contains(t)}addElement(t){this.elements.has(t)||this.elementIsActive(t)&&(this.elements.add(t),this.delegate.elementMatched&&this.delegate.elementMatched(t))}removeElement(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(t))}}class Ms{constructor(t,e,s){this.attributeName=e,this.delegate=s,this.elementObserver=new Ss(t,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(t){return t.hasAttribute(this.attributeName)}matchElementsInTree(t){const e=this.matchElement(t)?[t]:[],s=Array.from(t.querySelectorAll(this.selector));return e.concat(s)}elementMatched(t){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(t,this.attributeName)}elementUnmatched(t){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(t,this.attributeName)}elementAttributeChanged(t,e){this.delegate.elementAttributeValueChanged&&this.attributeName==e&&this.delegate.elementAttributeValueChanged(t,e)}}function ar(n,t,e){ks(n,t).add(e)}function cr(n,t,e){ks(n,t).delete(e),lr(n,t)}function ks(n,t){let e=n.get(t);return e||(e=new Set,n.set(t,e)),e}function lr(n,t){const e=n.get(t);e!=null&&e.size==0&&n.delete(t)}class ot{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((e,s)=>e.concat(Array.from(s)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((e,s)=>e+s.size,0)}add(t,e){ar(this.valuesByKey,t,e)}delete(t,e){cr(this.valuesByKey,t,e)}has(t,e){const s=this.valuesByKey.get(t);return s!=null&&s.has(e)}hasKey(t){return this.valuesByKey.has(t)}hasValue(t){return Array.from(this.valuesByKey.values()).some(s=>s.has(t))}getValuesForKey(t){const e=this.valuesByKey.get(t);return e?Array.from(e):[]}getKeysForValue(t){return Array.from(this.valuesByKey).filter(([e,s])=>s.has(t)).map(([e,s])=>e)}}class ur{constructor(t,e,s,i){this._selector=e,this.details=i,this.elementObserver=new Ss(t,this),this.delegate=s,this.matchesByElement=new ot}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(t){this._selector=t,this.refresh()}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(t){const{selector:e}=this;if(e){const s=t.matches(e);return this.delegate.selectorMatchElement?s&&this.delegate.selectorMatchElement(t,this.details):s}else return!1}matchElementsInTree(t){const{selector:e}=this;if(e){const s=this.matchElement(t)?[t]:[],i=Array.from(t.querySelectorAll(e)).filter(r=>this.matchElement(r));return s.concat(i)}else return[]}elementMatched(t){const{selector:e}=this;e&&this.selectorMatched(t,e)}elementUnmatched(t){const e=this.matchesByElement.getKeysForValue(t);for(const s of e)this.selectorUnmatched(t,s)}elementAttributeChanged(t,e){const{selector:s}=this;if(s){const i=this.matchElement(t),r=this.matchesByElement.has(s,t);i&&!r?this.selectorMatched(t,s):!i&&r&&this.selectorUnmatched(t,s)}}selectorMatched(t,e){this.delegate.selectorMatched(t,e,this.details),this.matchesByElement.add(e,t)}selectorUnmatched(t,e){this.delegate.selectorUnmatched(t,e,this.details),this.matchesByElement.delete(e,t)}}class hr{constructor(t,e){this.element=t,this.delegate=e,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const t of this.knownAttributeNames)this.refreshAttribute(t,null)}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){const e=t.attributeName;e&&this.refreshAttribute(e,t.oldValue)}refreshAttribute(t,e){const s=this.delegate.getStringMapKeyForAttribute(t);if(s!=null){this.stringMap.has(t)||this.stringMapKeyAdded(s,t);const i=this.element.getAttribute(t);if(this.stringMap.get(t)!=i&&this.stringMapValueChanged(i,s,e),i==null){const r=this.stringMap.get(t);this.stringMap.delete(t),r&&this.stringMapKeyRemoved(s,t,r)}else this.stringMap.set(t,i)}}stringMapKeyAdded(t,e){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(t,e)}stringMapValueChanged(t,e,s){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(t,e,s)}stringMapKeyRemoved(t,e,s){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(t,e,s)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(t=>t.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class Cs{constructor(t,e,s){this.attributeObserver=new Ms(t,e,this),this.delegate=s,this.tokensByElement=new ot}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(t){this.attributeObserver.pause(t)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(t){this.tokensMatched(this.readTokensForElement(t))}elementAttributeValueChanged(t){const[e,s]=this.refreshTokensForElement(t);this.tokensUnmatched(e),this.tokensMatched(s)}elementUnmatchedAttribute(t){this.tokensUnmatched(this.tokensByElement.getValuesForKey(t))}tokensMatched(t){t.forEach(e=>this.tokenMatched(e))}tokensUnmatched(t){t.forEach(e=>this.tokenUnmatched(e))}tokenMatched(t){this.delegate.tokenMatched(t),this.tokensByElement.add(t.element,t)}tokenUnmatched(t){this.delegate.tokenUnmatched(t),this.tokensByElement.delete(t.element,t)}refreshTokensForElement(t){const e=this.tokensByElement.getValuesForKey(t),s=this.readTokensForElement(t),i=fr(e,s).findIndex(([r,o])=>!mr(r,o));return i==-1?[[],[]]:[e.slice(i),s.slice(i)]}readTokensForElement(t){const e=this.attributeName,s=t.getAttribute(e)||"";return dr(s,t,e)}}function dr(n,t,e){return n.trim().split(/\s+/).filter(s=>s.length).map((s,i)=>({element:t,attributeName:e,content:s,index:i}))}function fr(n,t){const e=Math.max(n.length,t.length);return Array.from({length:e},(s,i)=>[n[i],t[i]])}function mr(n,t){return n&&t&&n.index==t.index&&n.content==t.content}class Ls{constructor(t,e,s){this.tokenListObserver=new Cs(t,e,this),this.delegate=s,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(t){const{element:e}=t,{value:s}=this.fetchParseResultForToken(t);s&&(this.fetchValuesByTokenForElement(e).set(t,s),this.delegate.elementMatchedValue(e,s))}tokenUnmatched(t){const{element:e}=t,{value:s}=this.fetchParseResultForToken(t);s&&(this.fetchValuesByTokenForElement(e).delete(t),this.delegate.elementUnmatchedValue(e,s))}fetchParseResultForToken(t){let e=this.parseResultsByToken.get(t);return e||(e=this.parseToken(t),this.parseResultsByToken.set(t,e)),e}fetchValuesByTokenForElement(t){let e=this.valuesByTokenByElement.get(t);return e||(e=new Map,this.valuesByTokenByElement.set(t,e)),e}parseToken(t){try{return{value:this.delegate.parseValueForToken(t)}}catch(e){return{error:e}}}}class pr{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new Ls(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(t){const e=new or(this.context,t);this.bindingsByAction.set(t,e),this.delegate.bindingConnected(e)}disconnectAction(t){const e=this.bindingsByAction.get(t);e&&(this.bindingsByAction.delete(t),this.delegate.bindingDisconnected(e))}disconnectAllActions(){this.bindings.forEach(t=>this.delegate.bindingDisconnected(t,!0)),this.bindingsByAction.clear()}parseValueForToken(t){const e=sr.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}}class gr{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new hr(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(t){if(t in this.valueDescriptorMap)return this.valueDescriptorMap[t].name}stringMapKeyAdded(t,e){const s=this.valueDescriptorMap[e];this.hasValue(t)||this.invokeChangedCallback(t,s.writer(this.receiver[t]),s.writer(s.defaultValue))}stringMapValueChanged(t,e,s){const i=this.valueDescriptorNameMap[e];t!==null&&(s===null&&(s=i.writer(i.defaultValue)),this.invokeChangedCallback(e,t,s))}stringMapKeyRemoved(t,e,s){const i=this.valueDescriptorNameMap[t];this.hasValue(t)?this.invokeChangedCallback(t,i.writer(this.receiver[t]),s):this.invokeChangedCallback(t,i.writer(i.defaultValue),s)}invokeChangedCallbacksForDefaultValues(){for(const{key:t,name:e,defaultValue:s,writer:i}of this.valueDescriptors)s!=null&&!this.controller.data.has(t)&&this.invokeChangedCallback(e,i(s),void 0)}invokeChangedCallback(t,e,s){const i=`${t}Changed`,r=this.receiver[i];if(typeof r=="function"){const o=this.valueDescriptorNameMap[t];try{const a=o.reader(e);let c=s;s&&(c=o.reader(s)),r.call(this.receiver,a,c)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){const{valueDescriptorMap:t}=this;return Object.keys(t).map(e=>t[e])}get valueDescriptorNameMap(){const t={};return Object.keys(this.valueDescriptorMap).forEach(e=>{const s=this.valueDescriptorMap[e];t[s.name]=s}),t}hasValue(t){const e=this.valueDescriptorNameMap[t],s=`has${Vt(e.name)}`;return this.receiver[s]}}class br{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new ot}start(){this.tokenListObserver||(this.tokenListObserver=new Cs(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:t,content:e}){this.scope.containsElement(t)&&this.connectTarget(t,e)}tokenUnmatched({element:t,content:e}){this.disconnectTarget(t,e)}connectTarget(t,e){var s;this.targetsByName.has(e,t)||(this.targetsByName.add(e,t),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetConnected(t,e)))}disconnectTarget(t,e){var s;this.targetsByName.has(e,t)&&(this.targetsByName.delete(e,t),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetDisconnected(t,e)))}disconnectAllTargets(){for(const t of this.targetsByName.keys)for(const e of this.targetsByName.getValuesForKey(t))this.disconnectTarget(e,t)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function Ht(n,t){const e=Fs(n);return Array.from(e.reduce((s,i)=>(yr(i,t).forEach(r=>s.add(r)),s),new Set))}function vr(n,t){return Fs(n).reduce((s,i)=>(s.push(...wr(i,t)),s),[])}function Fs(n){const t=[];for(;n;)t.push(n),n=Object.getPrototypeOf(n);return t.reverse()}function yr(n,t){const e=n[t];return Array.isArray(e)?e:[]}function wr(n,t){const e=n[t];return e?Object.keys(e).map(s=>[s,e[s]]):[]}class Er{constructor(t,e){this.started=!1,this.context=t,this.delegate=e,this.outletsByName=new ot,this.outletElementsByName=new ot,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(t=>{this.setupSelectorObserverForOutlet(t),this.setupAttributeObserverForOutlet(t)}),this.started=!0,this.dependentContexts.forEach(t=>t.refresh()))}refresh(){this.selectorObserverMap.forEach(t=>t.refresh()),this.attributeObserverMap.forEach(t=>t.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(t=>t.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(t=>t.stop()),this.attributeObserverMap.clear())}selectorMatched(t,e,{outletName:s}){const i=this.getOutlet(t,s);i&&this.connectOutlet(i,t,s)}selectorUnmatched(t,e,{outletName:s}){const i=this.getOutletFromMap(t,s);i&&this.disconnectOutlet(i,t,s)}selectorMatchElement(t,{outletName:e}){const s=this.selector(e),i=this.hasOutlet(t,e),r=t.matches(`[${this.schema.controllerAttribute}~=${e}]`);return s?i&&r&&t.matches(s):!1}elementMatchedAttribute(t,e){const s=this.getOutletNameFromOutletAttributeName(e);s&&this.updateSelectorObserverForOutlet(s)}elementAttributeValueChanged(t,e){const s=this.getOutletNameFromOutletAttributeName(e);s&&this.updateSelectorObserverForOutlet(s)}elementUnmatchedAttribute(t,e){const s=this.getOutletNameFromOutletAttributeName(e);s&&this.updateSelectorObserverForOutlet(s)}connectOutlet(t,e,s){var i;this.outletElementsByName.has(s,e)||(this.outletsByName.add(s,t),this.outletElementsByName.add(s,e),(i=this.selectorObserverMap.get(s))===null||i===void 0||i.pause(()=>this.delegate.outletConnected(t,e,s)))}disconnectOutlet(t,e,s){var i;this.outletElementsByName.has(s,e)&&(this.outletsByName.delete(s,t),this.outletElementsByName.delete(s,e),(i=this.selectorObserverMap.get(s))===null||i===void 0||i.pause(()=>this.delegate.outletDisconnected(t,e,s)))}disconnectAllOutlets(){for(const t of this.outletElementsByName.keys)for(const e of this.outletElementsByName.getValuesForKey(t))for(const s of this.outletsByName.getValuesForKey(t))this.disconnectOutlet(s,e,t)}updateSelectorObserverForOutlet(t){const e=this.selectorObserverMap.get(t);e&&(e.selector=this.selector(t))}setupSelectorObserverForOutlet(t){const e=this.selector(t),s=new ur(document.body,e,this,{outletName:t});this.selectorObserverMap.set(t,s),s.start()}setupAttributeObserverForOutlet(t){const e=this.attributeNameForOutletName(t),s=new Ms(this.scope.element,e,this);this.attributeObserverMap.set(t,s),s.start()}selector(t){return this.scope.outlets.getSelectorForOutletName(t)}attributeNameForOutletName(t){return this.scope.schema.outletAttributeForScope(this.identifier,t)}getOutletNameFromOutletAttributeName(t){return this.outletDefinitions.find(e=>this.attributeNameForOutletName(e)===t)}get outletDependencies(){const t=new ot;return this.router.modules.forEach(e=>{const s=e.definition.controllerConstructor;Ht(s,"outlets").forEach(r=>t.add(r,e.identifier))}),t}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const t=this.dependentControllerIdentifiers;return this.router.contexts.filter(e=>t.includes(e.identifier))}hasOutlet(t,e){return!!this.getOutlet(t,e)||!!this.getOutletFromMap(t,e)}getOutlet(t,e){return this.application.getControllerForElementAndIdentifier(t,e)}getOutletFromMap(t,e){return this.outletsByName.getValuesForKey(e).find(s=>s.element===t)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class Ar{constructor(t,e){this.logDebugActivity=(s,i={})=>{const{identifier:r,controller:o,element:a}=this;i=Object.assign({identifier:r,controller:o,element:a},i),this.application.logDebugActivity(this.identifier,s,i)},this.module=t,this.scope=e,this.controller=new t.controllerConstructor(this),this.bindingObserver=new pr(this,this.dispatcher),this.valueObserver=new gr(this,this.controller),this.targetObserver=new br(this,this),this.outletObserver=new Er(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(s){this.handleError(s,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(t){this.handleError(t,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(t){this.handleError(t,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(t,e,s={}){const{identifier:i,controller:r,element:o}=this;s=Object.assign({identifier:i,controller:r,element:o},s),this.application.handleError(t,`Error ${e}`,s)}targetConnected(t,e){this.invokeControllerMethod(`${e}TargetConnected`,t)}targetDisconnected(t,e){this.invokeControllerMethod(`${e}TargetDisconnected`,t)}outletConnected(t,e,s){this.invokeControllerMethod(`${Be(s)}OutletConnected`,t,e)}outletDisconnected(t,e,s){this.invokeControllerMethod(`${Be(s)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){const s=this.controller;typeof s[t]=="function"&&s[t](...e)}}function Tr(n){return xr(n,Or(n))}function xr(n,t){const e=Cr(n),s=Sr(n.prototype,t);return Object.defineProperties(e.prototype,s),e}function Or(n){return Ht(n,"blessings").reduce((e,s)=>{const i=s(n);for(const r in i){const o=e[r]||{};e[r]=Object.assign(o,i[r])}return e},{})}function Sr(n,t){return kr(t).reduce((e,s)=>{const i=Mr(n,t,s);return i&&Object.assign(e,{[s]:i}),e},{})}function Mr(n,t,e){const s=Object.getOwnPropertyDescriptor(n,e);if(!(s&&"value"in s)){const r=Object.getOwnPropertyDescriptor(t,e).value;return s&&(r.get=s.get||r.get,r.set=s.set||r.set),r}}const kr=typeof Object.getOwnPropertySymbols=="function"?n=>[...Object.getOwnPropertyNames(n),...Object.getOwnPropertySymbols(n)]:Object.getOwnPropertyNames,Cr=(()=>{function n(e){function s(){return Reflect.construct(e,arguments,new.target)}return s.prototype=Object.create(e.prototype,{constructor:{value:s}}),Reflect.setPrototypeOf(s,e),s}function t(){const s=n(function(){this.a.call(this)});return s.prototype.a=function(){},new s}try{return t(),n}catch{return s=>class extends s{}}})();function Lr(n){return{identifier:n.identifier,controllerConstructor:Tr(n.controllerConstructor)}}class Fr{constructor(t,e){this.application=t,this.definition=Lr(e),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(t){const e=this.fetchContextForScope(t);this.connectedContexts.add(e),e.connect()}disconnectContextForScope(t){const e=this.contextsByScope.get(t);e&&(this.connectedContexts.delete(e),e.disconnect())}fetchContextForScope(t){let e=this.contextsByScope.get(t);return e||(e=new Ar(this,t),this.contextsByScope.set(t,e)),e}}class Dr{constructor(t){this.scope=t}has(t){return this.data.has(this.getDataKey(t))}get(t){return this.getAll(t)[0]}getAll(t){const e=this.data.get(this.getDataKey(t))||"";return nr(e)}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}}class _r{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(t){const e=this.getAttributeNameForKey(t);return this.element.getAttribute(e)}set(t,e){const s=this.getAttributeNameForKey(t);return this.element.setAttribute(s,e),this.get(t)}has(t){const e=this.getAttributeNameForKey(t);return this.element.hasAttribute(e)}delete(t){if(this.has(t)){const e=this.getAttributeNameForKey(t);return this.element.removeAttribute(e),!0}else return!1}getAttributeNameForKey(t){return`data-${this.identifier}-${Os(t)}`}}class Br{constructor(t){this.warnedKeysByObject=new WeakMap,this.logger=t}warn(t,e,s){let i=this.warnedKeysByObject.get(t);i||(i=new Set,this.warnedKeysByObject.set(t,i)),i.has(e)||(i.add(e),this.logger.warn(s,t))}}function $e(n,t){return`[${n}~="${t}"]`}class Rr{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return this.find(t)!=null}find(...t){return t.reduce((e,s)=>e||this.findTarget(s)||this.findLegacyTarget(s),void 0)}findAll(...t){return t.reduce((e,s)=>[...e,...this.findAllTargets(s),...this.findAllLegacyTargets(s)],[])}findTarget(t){const e=this.getSelectorForTargetName(t);return this.scope.findElement(e)}findAllTargets(t){const e=this.getSelectorForTargetName(t);return this.scope.findAllElements(e)}getSelectorForTargetName(t){const e=this.schema.targetAttributeForScope(this.identifier);return $e(e,t)}findLegacyTarget(t){const e=this.getLegacySelectorForTargetName(t);return this.deprecate(this.scope.findElement(e),t)}findAllLegacyTargets(t){const e=this.getLegacySelectorForTargetName(t);return this.scope.findAllElements(e).map(s=>this.deprecate(s,t))}getLegacySelectorForTargetName(t){const e=`${this.identifier}.${t}`;return $e(this.schema.targetAttribute,e)}deprecate(t,e){if(t){const{identifier:s}=this,i=this.schema.targetAttribute,r=this.schema.targetAttributeForScope(s);this.guide.warn(t,`target:${e}`,`Please replace ${i}="${s}.${e}" with ${r}="${e}". The ${i} attribute is deprecated and will be removed in a future version of Stimulus.`)}return t}get guide(){return this.scope.guide}}class $r{constructor(t,e){this.scope=t,this.controllerElement=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return this.find(t)!=null}find(...t){return t.reduce((e,s)=>e||this.findOutlet(s),void 0)}findAll(...t){return t.reduce((e,s)=>[...e,...this.findAllOutlets(s)],[])}getSelectorForOutletName(t){const e=this.schema.outletAttributeForScope(this.identifier,t);return this.controllerElement.getAttribute(e)}findOutlet(t){const e=this.getSelectorForOutletName(t);if(e)return this.findElement(e,t)}findAllOutlets(t){const e=this.getSelectorForOutletName(t);return e?this.findAllElements(e,t):[]}findElement(t,e){return this.scope.queryElements(t).filter(i=>this.matchesElement(i,t,e))[0]}findAllElements(t,e){return this.scope.queryElements(t).filter(i=>this.matchesElement(i,t,e))}matchesElement(t,e,s){const i=t.getAttribute(this.scope.schema.controllerAttribute)||"";return t.matches(e)&&i.split(" ").includes(s)}}class Ge{constructor(t,e,s,i){this.targets=new Rr(this),this.classes=new Dr(this),this.data=new _r(this),this.containsElement=r=>r.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=s,this.guide=new Br(i),this.outlets=new $r(this.documentScope,e)}findElement(t){return this.element.matches(t)?this.element:this.queryElements(t).find(this.containsElement)}findAllElements(t){return[...this.element.matches(t)?[this.element]:[],...this.queryElements(t).filter(this.containsElement)]}queryElements(t){return Array.from(this.element.querySelectorAll(t))}get controllerSelector(){return $e(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new Ge(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class Pr{constructor(t,e,s){this.element=t,this.schema=e,this.delegate=s,this.valueListObserver=new Ls(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(t){const{element:e,content:s}=t;return this.parseValueForElementAndIdentifier(e,s)}parseValueForElementAndIdentifier(t,e){const s=this.fetchScopesByIdentifierForElement(t);let i=s.get(e);return i||(i=this.delegate.createScopeForElementAndIdentifier(t,e),s.set(e,i)),i}elementMatchedValue(t,e){const s=(this.scopeReferenceCounts.get(e)||0)+1;this.scopeReferenceCounts.set(e,s),s==1&&this.delegate.scopeConnected(e)}elementUnmatchedValue(t,e){const s=this.scopeReferenceCounts.get(e);s&&(this.scopeReferenceCounts.set(e,s-1),s==1&&this.delegate.scopeDisconnected(e))}fetchScopesByIdentifierForElement(t){let e=this.scopesByIdentifierByElement.get(t);return e||(e=new Map,this.scopesByIdentifierByElement.set(t,e)),e}}class Nr{constructor(t){this.application=t,this.scopeObserver=new Pr(this.element,this.schema,this),this.scopesByIdentifier=new ot,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((t,e)=>t.concat(e.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(t){this.unloadIdentifier(t.identifier);const e=new Fr(this.application,t);this.connectModule(e);const s=t.controllerConstructor.afterLoad;s&&s.call(t.controllerConstructor,t.identifier,this.application)}unloadIdentifier(t){const e=this.modulesByIdentifier.get(t);e&&this.disconnectModule(e)}getContextForElementAndIdentifier(t,e){const s=this.modulesByIdentifier.get(e);if(s)return s.contexts.find(i=>i.element==t)}proposeToConnectScopeForElementAndIdentifier(t,e){const s=this.scopeObserver.parseValueForElementAndIdentifier(t,e);s?this.scopeObserver.elementMatchedValue(s.element,s):console.error(`Couldn't find or create scope for identifier: "${e}" and element:`,t)}handleError(t,e,s){this.application.handleError(t,e,s)}createScopeForElementAndIdentifier(t,e){return new Ge(this.schema,t,e,this.logger)}scopeConnected(t){this.scopesByIdentifier.add(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.connectContextForScope(t)}scopeDisconnected(t){this.scopesByIdentifier.delete(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.disconnectContextForScope(t)}connectModule(t){this.modulesByIdentifier.set(t.identifier,t),this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(s=>t.connectContextForScope(s))}disconnectModule(t){this.modulesByIdentifier.delete(t.identifier),this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(s=>t.disconnectContextForScope(s))}}const Ir={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:n=>`data-${n}-target`,outletAttributeForScope:(n,t)=>`data-${n}-${t}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},Wn("abcdefghijklmnopqrstuvwxyz".split("").map(n=>[n,n]))),Wn("0123456789".split("").map(n=>[n,n])))};function Wn(n){return n.reduce((t,[e,s])=>Object.assign(Object.assign({},t),{[e]:s}),{})}class jr{constructor(t=document.documentElement,e=Ir){this.logger=console,this.debug=!1,this.logDebugActivity=(s,i,r={})=>{this.debug&&this.logFormattedMessage(s,i,r)},this.element=t,this.schema=e,this.dispatcher=new Xi(this),this.router=new Nr(this),this.actionDescriptorFilters=Object.assign({},Gi)}static start(t,e){const s=new this(t,e);return s.start(),s}async start(){await Vr(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(t,e){this.load({identifier:t,controllerConstructor:e})}registerActionOption(t,e){this.actionDescriptorFilters[t]=e}load(t,...e){(Array.isArray(t)?t:[t,...e]).forEach(i=>{i.controllerConstructor.shouldLoad&&this.router.loadDefinition(i)})}unload(t,...e){(Array.isArray(t)?t:[t,...e]).forEach(i=>this.router.unloadIdentifier(i))}get controllers(){return this.router.contexts.map(t=>t.controller)}getControllerForElementAndIdentifier(t,e){const s=this.router.getContextForElementAndIdentifier(t,e);return s?s.controller:null}handleError(t,e,s){var i;this.logger.error(`%s
|
95
95
|
|
96
96
|
%o
|
97
97
|
|
98
|
-
%o`,e,t,s),(i=window.onerror)===null||i===void 0||i.call(window,e,"",0,0,t)}logFormattedMessage(t,e,s={}){s=Object.assign({application:this},s),this.logger.groupCollapsed(`${t} #${e}`),this.logger.log("details:",Object.assign({},s)),this.logger.groupEnd()}}function Fo(){return new Promise(n=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>n()):n()})}function _o(n){return qt(n,"classes").reduce((e,s)=>Object.assign(e,Do(s)),{})}function Do(n){return{[`${n}Class`]:{get(){const{classes:t}=this;if(t.has(n))return t.get(n);{const e=t.getAttributeName(n);throw new Error(`Missing attribute "${e}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${Kt(n)}Class`]:{get(){return this.classes.has(n)}}}}function Bo(n){return qt(n,"outlets").reduce((e,s)=>Object.assign(e,Po(s)),{})}function ds(n,t,e){return n.application.getControllerForElementAndIdentifier(t,e)}function hs(n,t,e){let s=ds(n,t,e);if(s||(n.application.router.proposeToConnectScopeForElementAndIdentifier(t,e),s=ds(n,t,e),s))return s}function Po(n){const t=ze(n);return{[`${t}Outlet`]:{get(){const e=this.outlets.find(n),s=this.outlets.getSelectorForOutletName(n);if(e){const i=hs(this,e,n);if(i)return i;throw new Error(`The provided outlet element is missing an outlet controller "${n}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${n}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${s}".`)}},[`${t}Outlets`]:{get(){const e=this.outlets.findAll(n);return e.length>0?e.map(s=>{const i=hs(this,s,n);if(i)return i;console.warn(`The provided outlet element is missing an outlet controller "${n}" instance for host controller "${this.identifier}"`,s)}).filter(s=>s):[]}},[`${t}OutletElement`]:{get(){const e=this.outlets.find(n),s=this.outlets.getSelectorForOutletName(n);if(e)return e;throw new Error(`Missing outlet element "${n}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${s}".`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(n)}},[`has${Kt(t)}Outlet`]:{get(){return this.outlets.has(n)}}}}function $o(n){return qt(n,"targets").reduce((e,s)=>Object.assign(e,Ro(s)),{})}function Ro(n){return{[`${n}Target`]:{get(){const t=this.targets.find(n);if(t)return t;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${Kt(n)}Target`]:{get(){return this.targets.has(n)}}}}function Io(n){const t=ao(n,"values"),e={valueDescriptorMap:{get(){return t.reduce((s,i)=>{const r=ni(i,this.identifier),o=this.data.getAttributeNameForKey(r.key);return Object.assign(s,{[o]:r})},{})}}};return t.reduce((s,i)=>Object.assign(s,No(i)),e)}function No(n,t){const e=ni(n,t),{key:s,name:i,reader:r,writer:o}=e;return{[i]:{get(){const a=this.data.get(s);return a!==null?r(a):e.defaultValue},set(a){a===void 0?this.data.delete(s):this.data.set(s,o(a))}},[`has${Kt(i)}`]:{get(){return this.data.has(s)||e.hasCustomDefaultValue}}}}function ni([n,t],e){return Wo({controller:e,token:n,typeDefinition:t})}function oe(n){switch(n){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Ht(n){switch(typeof n){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(n))return"array";if(Object.prototype.toString.call(n)==="[object Object]")return"object"}function Vo(n){const{controller:t,token:e,typeObject:s}=n,i=as(s.type),r=as(s.default),o=i&&r,a=i&&!r,c=!i&&r,l=oe(s.type),u=Ht(n.typeObject.default);if(a)return l;if(c)return u;if(l!==u){const h=t?`${t}.${e}`:e;throw new Error(`The specified default value for the Stimulus Value "${h}" must match the defined type "${l}". The provided default value of "${s.default}" is of type "${u}".`)}if(o)return l}function jo(n){const{controller:t,token:e,typeDefinition:s}=n,r=Vo({controller:t,token:e,typeObject:s}),o=Ht(s),a=oe(s),c=r||o||a;if(c)return c;const l=t?`${t}.${s}`:e;throw new Error(`Unknown value type "${l}" for "${e}" value`)}function Ho(n){const t=oe(n);if(t)return fs[t];const e=Ye(n,"default"),s=Ye(n,"type"),i=n;if(e)return i.default;if(s){const{type:r}=i,o=oe(r);if(o)return fs[o]}return n}function Wo(n){const{token:t,typeDefinition:e}=n,s=`${Xs(t)}-value`,i=jo(n);return{type:i,key:s,name:cn(s),get defaultValue(){return Ho(e)},get hasCustomDefaultValue(){return Ht(e)!==void 0},reader:Uo[i],writer:ms[i]||ms.default}}const fs={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Uo={array(n){const t=JSON.parse(n);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${n}" of type "${Ht(t)}"`);return t},boolean(n){return!(n=="0"||String(n).toLowerCase()=="false")},number(n){return Number(n.replace(/_/g,""))},object(n){const t=JSON.parse(n);if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${n}" of type "${Ht(t)}"`);return t},string(n){return n}},ms={default:Ko,array:ps,object:ps};function ps(n){return JSON.stringify(n)}function Ko(n){return`${n}`}let K=class{constructor(t){this.context=t}static get shouldLoad(){return!0}static afterLoad(t,e){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:s={},prefix:i=this.identifier,bubbles:r=!0,cancelable:o=!0}={}){const a=i?`${i}:${t}`:t,c=new CustomEvent(a,{detail:s,bubbles:r,cancelable:o});return e.dispatchEvent(c),c}};K.blessings=[_o,$o,Io,Bo];K.targets=[];K.outlets=[];K.values={};function q(){return function({targets:t,values:e}={}){const i=class i extends K{};i.targets=Object.keys(t??{}),i.values=e??{};let s=i;return s}}function qo(n,t){n.indexOf(t)===-1&&n.push(t)}const si=(n,t,e)=>Math.min(Math.max(e,n),t),R={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},ae=n=>typeof n=="number",vt=n=>Array.isArray(n)&&!ae(n[0]),zo=(n,t,e)=>{const s=t-n;return((e-n)%s+s)%s+n};function Yo(n,t){return vt(n)?n[zo(0,n.length,t)]:n}const ii=(n,t,e)=>-e*n+e*t+n,ri=()=>{},X=n=>n,un=(n,t,e)=>t-n===0?1:(e-n)/(t-n);function oi(n,t){const e=n[n.length-1];for(let s=1;s<=t;s++){const i=un(0,t,s);n.push(ii(e,1,i))}}function Xo(n){const t=[0];return oi(t,n-1),t}function Go(n,t=Xo(n.length),e=X){const s=n.length,i=s-t.length;return i>0&&oi(t,i),r=>{let o=0;for(;o<s-2&&!(r<t[o+1]);o++);let a=si(0,1,un(t[o],t[o+1],r));return a=Yo(e,o)(a),ii(n[o],n[o+1],a)}}const ai=n=>Array.isArray(n)&&ae(n[0]),Ge=n=>typeof n=="object"&&!!n.createAnimation,Et=n=>typeof n=="function",Zo=n=>typeof n=="string",It={ms:n=>n*1e3,s:n=>n/1e3},ci=(n,t,e)=>(((1-3*e+3*t)*n+(3*e-6*t))*n+3*t)*n,Jo=1e-7,Qo=12;function ta(n,t,e,s,i){let r,o,a=0;do o=t+(e-t)/2,r=ci(o,s,i)-n,r>0?e=o:t=o;while(Math.abs(r)>Jo&&++a<Qo);return o}function Pt(n,t,e,s){if(n===t&&e===s)return X;const i=r=>ta(r,0,1,n,e);return r=>r===0||r===1?r:ci(i(r),t,s)}const ea=(n,t="end")=>e=>{e=t==="end"?Math.min(e,.999):Math.max(e,.001);const s=e*n,i=t==="end"?Math.floor(s):Math.ceil(s);return si(0,1,i/n)},na={ease:Pt(.25,.1,.25,1),"ease-in":Pt(.42,0,1,1),"ease-in-out":Pt(.42,0,.58,1),"ease-out":Pt(0,0,.58,1)},sa=/\((.*?)\)/;function gs(n){if(Et(n))return n;if(ai(n))return Pt(...n);const t=na[n];if(t)return t;if(n.startsWith("steps")){const e=sa.exec(n);if(e){const s=e[1].split(",");return ea(parseFloat(s[0]),s[1].trim())}}return X}class li{constructor(t,e=[0,1],{easing:s,duration:i=R.duration,delay:r=R.delay,endDelay:o=R.endDelay,repeat:a=R.repeat,offset:c,direction:l="normal",autoplay:u=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=X,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((d,p)=>{this.resolve=d,this.reject=p}),s=s||R.easing,Ge(s)){const d=s.createAnimation(e);s=d.easing,e=d.keyframes||e,i=d.duration||i}this.repeat=a,this.easing=vt(s)?X:gs(s),this.updateDuration(i);const h=Go(e,c,vt(s)?s.map(gs):X);this.tick=d=>{var p;r=r;let f=0;this.pauseTime!==void 0?f=this.pauseTime:f=(d-this.startTime)*this.rate,this.t=f,f/=1e3,f=Math.max(f-r,0),this.playState==="finished"&&this.pauseTime===void 0&&(f=this.totalDuration);const g=f/this.duration;let v=Math.floor(g),m=g%1;!m&&g>=1&&(m=1),m===1&&v--;const y=v%2;(l==="reverse"||l==="alternate"&&y||l==="alternate-reverse"&&!y)&&(m=1-m);const E=f>=this.totalDuration?1:Math.min(m,1),b=h(this.easing(E));t(b),this.pauseTime===void 0&&(this.playState==="finished"||f>=this.totalDuration+o)?(this.playState="finished",(p=this.resolve)===null||p===void 0||p.call(this,b)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},u&&this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}class ia{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const _e=new WeakMap;function ui(n){return _e.has(n)||_e.set(n,{transforms:[],values:new Map}),_e.get(n)}function ra(n,t){return n.has(t)||n.set(t,new ia),n.get(t)}const oa=["","X","Y","Z"],aa=["translate","scale","rotate","skew"],ce={x:"translateX",y:"translateY",z:"translateZ"},bs={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:n=>n+"deg"},ca={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:n=>n+"px"},rotate:bs,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:X},skew:bs},Wt=new Map,dn=n=>`--motion-${n}`,le=["x","y","z"];aa.forEach(n=>{oa.forEach(t=>{le.push(n+t),Wt.set(dn(n+t),ca[n])})});const la=(n,t)=>le.indexOf(n)-le.indexOf(t),ua=new Set(le),di=n=>ua.has(n),da=(n,t)=>{ce[t]&&(t=ce[t]);const{transforms:e}=ui(n);qo(e,t),n.style.transform=ha(e)},ha=n=>n.sort(la).reduce(fa,"").trim(),fa=(n,t)=>`${n} ${t}(var(${dn(t)}))`,Ze=n=>n.startsWith("--"),vs=new Set;function ma(n){if(!vs.has(n)){vs.add(n);try{const{syntax:t,initialValue:e}=Wt.has(n)?Wt.get(n):{};CSS.registerProperty({name:n,inherits:!1,syntax:t,initialValue:e})}catch{}}}const De=(n,t)=>document.createElement("div").animate(n,t),ys={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{De({opacity:[1]})}catch{return!1}return!0},finished:()=>!!De({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{De({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},Be={},mt={};for(const n in ys)mt[n]=()=>(Be[n]===void 0&&(Be[n]=ys[n]()),Be[n]);const pa=.015,ga=(n,t)=>{let e="";const s=Math.round(t/pa);for(let i=0;i<s;i++)e+=n(un(0,s-1,i))+", ";return e.substring(0,e.length-2)},ws=(n,t)=>Et(n)?mt.linearEasing()?`linear(${ga(n,t)})`:R.easing:ai(n)?ba(n):n,ba=([n,t,e,s])=>`cubic-bezier(${n}, ${t}, ${e}, ${s})`;function va(n,t){for(let e=0;e<n.length;e++)n[e]===null&&(n[e]=e?n[e-1]:t());return n}const ya=n=>Array.isArray(n)?n:[n];function Je(n){return ce[n]&&(n=ce[n]),di(n)?dn(n):n}const te={get:(n,t)=>{t=Je(t);let e=Ze(t)?n.style.getPropertyValue(t):getComputedStyle(n)[t];if(!e&&e!==0){const s=Wt.get(t);s&&(e=s.initialValue)}return e},set:(n,t,e)=>{t=Je(t),Ze(t)?n.style.setProperty(t,e):n.style[t]=e}};function hi(n,t=!0){if(!(!n||n.playState==="finished"))try{n.stop?n.stop():(t&&n.commitStyles(),n.cancel())}catch{}}function wa(n,t){var e;let s=(t==null?void 0:t.toDefaultUnit)||X;const i=n[n.length-1];if(Zo(i)){const r=((e=i.match(/(-?[\d.]+)([a-z%]*)/))===null||e===void 0?void 0:e[2])||"";r&&(s=o=>o+r)}return s}function Ea(){return window.__MOTION_DEV_TOOLS_RECORD}function Aa(n,t,e,s={},i){const r=Ea(),o=s.record!==!1&&r;let a,{duration:c=R.duration,delay:l=R.delay,endDelay:u=R.endDelay,repeat:h=R.repeat,easing:d=R.easing,persist:p=!1,direction:f,offset:g,allowWebkitAcceleration:v=!1,autoplay:m=!0}=s;const y=ui(n),E=di(t);let b=mt.waapi();E&&da(n,t);const w=Je(t),A=ra(y.values,w),S=Wt.get(w);return hi(A.animation,!(Ge(d)&&A.generator)&&s.record!==!1),()=>{const L=()=>{var x,F;return(F=(x=te.get(n,w))!==null&&x!==void 0?x:S==null?void 0:S.initialValue)!==null&&F!==void 0?F:0};let T=va(ya(e),L);const xt=wa(T,S);if(Ge(d)){const x=d.createAnimation(T,t!=="opacity",L,w,A);d=x.easing,T=x.keyframes||T,c=x.duration||c}if(Ze(w)&&(mt.cssRegisterProperty()?ma(w):b=!1),E&&!mt.linearEasing()&&(Et(d)||vt(d)&&d.some(Et))&&(b=!1),b){S&&(T=T.map(V=>ae(V)?S.toDefaultUnit(V):V)),T.length===1&&(!mt.partialKeyframes()||o)&&T.unshift(L());const x={delay:It.ms(l),duration:It.ms(c),endDelay:It.ms(u),easing:vt(d)?void 0:ws(d,c),direction:f,iterations:h+1,fill:"both"};a=n.animate({[w]:T,offset:g,easing:vt(d)?d.map(V=>ws(V,c)):void 0},x),a.finished||(a.finished=new Promise((V,Q)=>{a.onfinish=V,a.oncancel=Q}));const F=T[T.length-1];a.finished.then(()=>{p||(te.set(n,w,F),a.cancel())}).catch(ri),v||(a.playbackRate=1.000001)}else if(i&&E)T=T.map(x=>typeof x=="string"?parseFloat(x):x),T.length===1&&T.unshift(parseFloat(L())),a=new i(x=>{te.set(n,w,xt?xt(x):x)},T,Object.assign(Object.assign({},s),{duration:c,easing:d}));else{const x=T[T.length-1];te.set(n,w,S&&ae(x)?S.toDefaultUnit(x):x)}return o&&r(n,t,T,{duration:c,delay:l,easing:d,repeat:h,offset:g},"motion-one"),A.setAnimation(a),a&&!m&&a.pause(),a}}const Ta=(n,t)=>n[t]?Object.assign(Object.assign({},n),n[t]):Object.assign({},n);function xa(n,t){var e;return typeof n=="string"?t?((e=t[n])!==null&&e!==void 0||(t[n]=document.querySelectorAll(n)),n=t[n]):n=document.querySelectorAll(n):n instanceof Element&&(n=[n]),Array.from(n||[])}const Oa=n=>n(),fi=(n,t,e=R.duration)=>new Proxy({animations:n.map(Oa).filter(Boolean),duration:e,options:t},Ma),Sa=n=>n.animations[0],Ma={get:(n,t)=>{const e=Sa(n);switch(t){case"duration":return n.duration;case"currentTime":return It.s((e==null?void 0:e[t])||0);case"playbackRate":case"playState":return e==null?void 0:e[t];case"finished":return n.finished||(n.finished=Promise.all(n.animations.map(ka)).catch(ri)),n.finished;case"stop":return()=>{n.animations.forEach(s=>hi(s))};case"forEachNative":return s=>{n.animations.forEach(i=>s(i,n))};default:return typeof(e==null?void 0:e[t])>"u"?void 0:()=>n.animations.forEach(s=>s[t]())}},set:(n,t,e)=>{switch(t){case"currentTime":e=It.ms(e);case"playbackRate":for(let s=0;s<n.animations.length;s++)n.animations[s][t]=e;return!0}return!1}},ka=n=>n.finished;function Ca(n,t,e){return Et(n)?n(t,e):n}function La(n){return function(e,s,i={}){e=xa(e);const r=e.length,o=[];for(let a=0;a<r;a++){const c=e[a];for(const l in s){const u=Ta(i,l);u.delay=Ca(u.delay,a,r);const h=Aa(c,l,s[l],u,n);o.push(h)}}return fi(o,i,i.duration)}}const Fa=La(li);function _a(n,t={}){return fi([()=>{const e=new li(n,[0,1],t);return e.finished.catch(()=>{}),e}],t,t.duration)}function Pe(n,t,e){return(Et(n)?_a:Fa)(n,t,e)}class Da extends q()({targets:{icon:HTMLElement,content:HTMLElement},values:{open:Boolean}}){connect(){this.animationDurationValue=.15,this.openValue?this.open():this.close()}toggle(){this.openValue=!this.openValue}openValueChanged(t,e){t?this.open():this.close()}open(){this.hasContentTarget&&(this.revealContent(),this.hasIconTarget&&this.rotateIcon(),this.openValue=!0)}close(){this.hasContentTarget&&(this.hideContent(),this.hasIconTarget&&this.rotateIcon(),this.openValue=!1)}revealContent(){const t=this.contentTarget.scrollHeight;Pe(this.contentTarget,{height:`${t}px`},{duration:this.animationDurationValue,easing:"ease-in-out"})}hideContent(){Pe(this.contentTarget,{height:0},{duration:this.animationDurationValue,easing:"ease-in-out"})}rotateIcon(){Pe(this.iconTarget,{rotate:`${this.openValue?180:0}deg`})}}const Ba=Object.freeze(Object.defineProperty({__proto__:null,default:Da},Symbol.toStringTag,{value:"Module"}));function Pa(n){const t=document.createElement("pre");return t.style.width="1px",t.style.height="1px",t.style.position="fixed",t.style.top="5px",t.textContent=n,t}function mi(n){if("clipboard"in navigator)return navigator.clipboard.writeText(n.textContent||"");const t=getSelection();if(t==null)return Promise.reject(new Error);t.removeAllRanges();const e=document.createRange();return e.selectNodeContents(n),t.addRange(e),document.execCommand("copy"),t.removeAllRanges(),Promise.resolve()}function Qe(n){if("clipboard"in navigator)return navigator.clipboard.writeText(n);const t=document.body;if(!t)return Promise.reject(new Error);const e=Pa(n);return t.appendChild(e),mi(e),t.removeChild(e),Promise.resolve()}async function pi(n){const t=n.getAttribute("for"),e=n.getAttribute("value");function s(){n.dispatchEvent(new CustomEvent("clipboard-copy",{bubbles:!0}))}if(n.getAttribute("aria-disabled")!=="true"){if(e)await Qe(e),s();else if(t){const i="getRootNode"in Element.prototype?n.getRootNode():n.ownerDocument;if(!(i instanceof Document||"ShadowRoot"in window&&i instanceof ShadowRoot))return;const r=i.getElementById(t);r&&(await $a(r),s())}}}function $a(n){return n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?Qe(n.value):n instanceof HTMLAnchorElement&&n.hasAttribute("href")?Qe(n.href):mi(n)}function Ra(n){const t=n.currentTarget;t instanceof HTMLElement&&pi(t)}function gi(n){if(n.key===" "||n.key==="Enter"){const t=n.currentTarget;t instanceof HTMLElement&&(n.preventDefault(),pi(t))}}function Ia(n){n.currentTarget.addEventListener("keydown",gi)}function Na(n){n.currentTarget.removeEventListener("keydown",gi)}class Va extends HTMLElement{static define(t="clipboard-copy",e=customElements){return e.define(t,this),this}constructor(){super(),this.addEventListener("click",Ra),this.addEventListener("focus",Ia),this.addEventListener("blur",Na)}connectedCallback(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button")}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}}const Es=typeof globalThis<"u"?globalThis:window;try{Es.ClipboardCopyElement=Va.define()}catch(n){if(!(Es.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}const ja=2e3;class Ha extends q()({targets:{initial:HTMLElement,confirmed:null}}){connect(){this.clipboardCopyElementTimers=new WeakMap}copy(t){const e=t.target,s=this.clipboardCopyElementTimers.get(e);s?(clearTimeout(s),this.clipboardCopyElementTimers.delete(e)):this.showConfirm(),this.clipboardCopyElementTimers.set(e,window.setTimeout(()=>{this.showInitial(),this.clipboardCopyElementTimers.delete(e)},ja))}showConfirm(){this.hasConfirmedTarget&&(this.confirmedTarget.classList.remove("hidden"),this.confirmedTarget.classList.add("inline-block"),this.initialTarget.classList.add("hidden"))}showInitial(){this.initialTarget.classList.remove("hidden"),this.initialTarget.classList.add("inline-block"),this.hasConfirmedTarget&&this.confirmedTarget.classList.add("hidden")}}const Wa=Object.freeze(Object.defineProperty({__proto__:null,default:Ha},Symbol.toStringTag,{value:"Module"})),At=Math.min,D=Math.max,ue=Math.round,ee=Math.floor,G=n=>({x:n,y:n}),Ua={left:"right",right:"left",bottom:"top",top:"bottom"},Ka={start:"end",end:"start"};function As(n,t,e){return D(n,At(t,e))}function zt(n,t){return typeof n=="function"?n(t):n}function Z(n){return n.split("-")[0]}function Yt(n){return n.split("-")[1]}function bi(n){return n==="x"?"y":"x"}function vi(n){return n==="y"?"height":"width"}function Xt(n){return["top","bottom"].includes(Z(n))?"y":"x"}function yi(n){return bi(Xt(n))}function qa(n,t,e){e===void 0&&(e=!1);const s=Yt(n),i=yi(n),r=vi(i);let o=i==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(o=de(o)),[o,de(o)]}function za(n){const t=de(n);return[tn(n),t,tn(t)]}function tn(n){return n.replace(/start|end/g,t=>Ka[t])}function Ya(n,t,e){const s=["left","right"],i=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return e?t?i:s:t?s:i;case"left":case"right":return t?r:o;default:return[]}}function Xa(n,t,e,s){const i=Yt(n);let r=Ya(Z(n),e==="start",s);return i&&(r=r.map(o=>o+"-"+i),t&&(r=r.concat(r.map(tn)))),r}function de(n){return n.replace(/left|right|bottom|top/g,t=>Ua[t])}function Ga(n){return{top:0,right:0,bottom:0,left:0,...n}}function Za(n){return typeof n!="number"?Ga(n):{top:n,right:n,bottom:n,left:n}}function he(n){return{...n,top:n.y,left:n.x,right:n.x+n.width,bottom:n.y+n.height}}function Ts(n,t,e){let{reference:s,floating:i}=n;const r=Xt(t),o=yi(t),a=vi(o),c=Z(t),l=r==="y",u=s.x+s.width/2-i.width/2,h=s.y+s.height/2-i.height/2,d=s[a]/2-i[a]/2;let p;switch(c){case"top":p={x:u,y:s.y-i.height};break;case"bottom":p={x:u,y:s.y+s.height};break;case"right":p={x:s.x+s.width,y:h};break;case"left":p={x:s.x-i.width,y:h};break;default:p={x:s.x,y:s.y}}switch(Yt(t)){case"start":p[o]-=d*(e&&l?-1:1);break;case"end":p[o]+=d*(e&&l?-1:1);break}return p}const Ja=async(n,t,e)=>{const{placement:s="bottom",strategy:i="absolute",middleware:r=[],platform:o}=e,a=r.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let l=await o.getElementRects({reference:n,floating:t,strategy:i}),{x:u,y:h}=Ts(l,s,c),d=s,p={},f=0;for(let g=0;g<a.length;g++){const{name:v,fn:m}=a[g],{x:y,y:E,data:b,reset:w}=await m({x:u,y:h,initialPlacement:s,placement:d,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:n,floating:t}});u=y??u,h=E??h,p={...p,[v]:{...p[v],...b}},w&&f<=50&&(f++,typeof w=="object"&&(w.placement&&(d=w.placement),w.rects&&(l=w.rects===!0?await o.getElementRects({reference:n,floating:t,strategy:i}):w.rects),{x:u,y:h}=Ts(l,d,c)),g=-1)}return{x:u,y:h,placement:d,strategy:i,middlewareData:p}};async function hn(n,t){var e;t===void 0&&(t={});const{x:s,y:i,platform:r,rects:o,elements:a,strategy:c}=n,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=!1,padding:p=0}=zt(t,n),f=Za(p),v=a[d?h==="floating"?"reference":"floating":h],m=he(await r.getClippingRect({element:(e=await(r.isElement==null?void 0:r.isElement(v)))==null||e?v:v.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),y=h==="floating"?{...o.floating,x:s,y:i}:o.reference,E=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),b=await(r.isElement==null?void 0:r.isElement(E))?await(r.getScale==null?void 0:r.getScale(E))||{x:1,y:1}:{x:1,y:1},w=he(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:E,strategy:c}):y);return{top:(m.top-w.top+f.top)/b.y,bottom:(w.bottom-m.bottom+f.bottom)/b.y,left:(m.left-w.left+f.left)/b.x,right:(w.right-m.right+f.right)/b.x}}const Qa=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var e,s;const{placement:i,middlewareData:r,rects:o,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:g=!0,...v}=zt(n,t);if((e=r.arrow)!=null&&e.alignmentOffset)return{};const m=Z(i),y=Z(a)===a,E=await(c.isRTL==null?void 0:c.isRTL(l.floating)),b=d||(y||!g?[de(a)]:za(a));!d&&f!=="none"&&b.push(...Xa(a,g,f,E));const w=[a,...b],A=await hn(t,v),S=[];let L=((s=r.flip)==null?void 0:s.overflows)||[];if(u&&S.push(A[m]),h){const F=qa(i,o,E);S.push(A[F[0]],A[F[1]])}if(L=[...L,{placement:i,overflows:S}],!S.every(F=>F<=0)){var T,xt;const F=(((T=r.flip)==null?void 0:T.index)||0)+1,V=w[F];if(V)return{data:{index:F,overflows:L},reset:{placement:V}};let Q=(xt=L.filter(at=>at.overflows[0]<=0).sort((at,ct)=>at.overflows[1]-ct.overflows[1])[0])==null?void 0:xt.placement;if(!Q)switch(p){case"bestFit":{var x;const at=(x=L.map(ct=>[ct.placement,ct.overflows.filter(Ot=>Ot>0).reduce((Ot,_i)=>Ot+_i,0)]).sort((ct,Ot)=>ct[1]-Ot[1])[0])==null?void 0:x[0];at&&(Q=at);break}case"initialPlacement":Q=a;break}if(i!==Q)return{reset:{placement:Q}}}return{}}}};async function tc(n,t){const{placement:e,platform:s,elements:i}=n,r=await(s.isRTL==null?void 0:s.isRTL(i.floating)),o=Z(e),a=Yt(e),c=Xt(e)==="y",l=["left","top"].includes(o)?-1:1,u=r&&c?-1:1,h=zt(t,n);let{mainAxis:d,crossAxis:p,alignmentAxis:f}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&typeof f=="number"&&(p=a==="end"?f*-1:f),c?{x:p*u,y:d*l}:{x:d*l,y:p*u}}const fn=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var e,s;const{x:i,y:r,placement:o,middlewareData:a}=t,c=await tc(t,n);return o===((e=a.offset)==null?void 0:e.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+c.x,y:r+c.y,data:{...c,placement:o}}}}},ec=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){const{x:e,y:s,placement:i}=t,{mainAxis:r=!0,crossAxis:o=!1,limiter:a={fn:v=>{let{x:m,y}=v;return{x:m,y}}},...c}=zt(n,t),l={x:e,y:s},u=await hn(t,c),h=Xt(Z(i)),d=bi(h);let p=l[d],f=l[h];if(r){const v=d==="y"?"top":"left",m=d==="y"?"bottom":"right",y=p+u[v],E=p-u[m];p=As(y,p,E)}if(o){const v=h==="y"?"top":"left",m=h==="y"?"bottom":"right",y=f+u[v],E=f-u[m];f=As(y,f,E)}const g=a.fn({...t,[d]:p,[h]:f});return{...g,data:{x:g.x-e,y:g.y-s}}}}},nc=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(t){const{placement:e,rects:s,platform:i,elements:r}=t,{apply:o=()=>{},...a}=zt(n,t),c=await hn(t,a),l=Z(e),u=Yt(e),h=Xt(e)==="y",{width:d,height:p}=s.floating;let f,g;l==="top"||l==="bottom"?(f=l,g=u===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(g=l,f=u==="end"?"top":"bottom");const v=p-c[f],m=d-c[g],y=!t.middlewareData.shift;let E=v,b=m;if(h){const A=d-c.left-c.right;b=u||y?At(m,A):A}else{const A=p-c.top-c.bottom;E=u||y?At(v,A):A}if(y&&!u){const A=D(c.left,0),S=D(c.right,0),L=D(c.top,0),T=D(c.bottom,0);h?b=d-2*(A!==0||S!==0?A+S:D(c.left,c.right)):E=p-2*(L!==0||T!==0?L+T:D(c.top,c.bottom))}await o({...t,availableWidth:b,availableHeight:E});const w=await i.getDimensions(r.floating);return d!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function J(n){return wi(n)?(n.nodeName||"").toLowerCase():"#document"}function B(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function z(n){var t;return(t=(wi(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function wi(n){return n instanceof Node||n instanceof B(n).Node}function U(n){return n instanceof Element||n instanceof B(n).Element}function j(n){return n instanceof HTMLElement||n instanceof B(n).HTMLElement}function xs(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof B(n).ShadowRoot}function Gt(n){const{overflow:t,overflowX:e,overflowY:s,display:i}=I(n);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(i)}function sc(n){return["table","td","th"].includes(J(n))}function mn(n){const t=pn(),e=I(n);return e.transform!=="none"||e.perspective!=="none"||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(e.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(e.contain||"").includes(s))}function ic(n){let t=Tt(n);for(;j(t)&&!ye(t);){if(mn(t))return t;t=Tt(t)}return null}function pn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ye(n){return["html","body","#document"].includes(J(n))}function I(n){return B(n).getComputedStyle(n)}function we(n){return U(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function Tt(n){if(J(n)==="html")return n;const t=n.assignedSlot||n.parentNode||xs(n)&&n.host||z(n);return xs(t)?t.host:t}function Ei(n){const t=Tt(n);return ye(t)?n.ownerDocument?n.ownerDocument.body:n.body:j(t)&&Gt(t)?t:Ei(t)}function Ut(n,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=Ei(n),r=i===((s=n.ownerDocument)==null?void 0:s.body),o=B(i);return r?t.concat(o,o.visualViewport||[],Gt(i)?i:[],o.frameElement&&e?Ut(o.frameElement):[]):t.concat(i,Ut(i,[],e))}function Ai(n){const t=I(n);let e=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=j(n),r=i?n.offsetWidth:e,o=i?n.offsetHeight:s,a=ue(e)!==r||ue(s)!==o;return a&&(e=r,s=o),{width:e,height:s,$:a}}function gn(n){return U(n)?n:n.contextElement}function yt(n){const t=gn(n);if(!j(t))return G(1);const e=t.getBoundingClientRect(),{width:s,height:i,$:r}=Ai(t);let o=(r?ue(e.width):e.width)/s,a=(r?ue(e.height):e.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const rc=G(0);function Ti(n){const t=B(n);return!pn()||!t.visualViewport?rc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oc(n,t,e){return t===void 0&&(t=!1),!e||t&&e!==B(n)?!1:t}function ot(n,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),r=gn(n);let o=G(1);t&&(s?U(s)&&(o=yt(s)):o=yt(n));const a=oc(r,e,s)?Ti(r):G(0);let c=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,u=i.width/o.x,h=i.height/o.y;if(r){const d=B(r),p=s&&U(s)?B(s):s;let f=d,g=f.frameElement;for(;g&&s&&p!==f;){const v=yt(g),m=g.getBoundingClientRect(),y=I(g),E=m.left+(g.clientLeft+parseFloat(y.paddingLeft))*v.x,b=m.top+(g.clientTop+parseFloat(y.paddingTop))*v.y;c*=v.x,l*=v.y,u*=v.x,h*=v.y,c+=E,l+=b,f=B(g),g=f.frameElement}}return he({width:u,height:h,x:c,y:l})}const ac=[":popover-open",":modal"];function xi(n){return ac.some(t=>{try{return n.matches(t)}catch{return!1}})}function cc(n){let{elements:t,rect:e,offsetParent:s,strategy:i}=n;const r=i==="fixed",o=z(s),a=t?xi(t.floating):!1;if(s===o||a&&r)return e;let c={scrollLeft:0,scrollTop:0},l=G(1);const u=G(0),h=j(s);if((h||!h&&!r)&&((J(s)!=="body"||Gt(o))&&(c=we(s)),j(s))){const d=ot(s);l=yt(s),u.x=d.x+s.clientLeft,u.y=d.y+s.clientTop}return{width:e.width*l.x,height:e.height*l.y,x:e.x*l.x-c.scrollLeft*l.x+u.x,y:e.y*l.y-c.scrollTop*l.y+u.y}}function lc(n){return Array.from(n.getClientRects())}function Oi(n){return ot(z(n)).left+we(n).scrollLeft}function uc(n){const t=z(n),e=we(n),s=n.ownerDocument.body,i=D(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),r=D(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-e.scrollLeft+Oi(n);const a=-e.scrollTop;return I(s).direction==="rtl"&&(o+=D(t.clientWidth,s.clientWidth)-i),{width:i,height:r,x:o,y:a}}function dc(n,t){const e=B(n),s=z(n),i=e.visualViewport;let r=s.clientWidth,o=s.clientHeight,a=0,c=0;if(i){r=i.width,o=i.height;const l=pn();(!l||l&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:r,height:o,x:a,y:c}}function hc(n,t){const e=ot(n,!0,t==="fixed"),s=e.top+n.clientTop,i=e.left+n.clientLeft,r=j(n)?yt(n):G(1),o=n.clientWidth*r.x,a=n.clientHeight*r.y,c=i*r.x,l=s*r.y;return{width:o,height:a,x:c,y:l}}function Os(n,t,e){let s;if(t==="viewport")s=dc(n,e);else if(t==="document")s=uc(z(n));else if(U(t))s=hc(t,e);else{const i=Ti(n);s={...t,x:t.x-i.x,y:t.y-i.y}}return he(s)}function Si(n,t){const e=Tt(n);return e===t||!U(e)||ye(e)?!1:I(e).position==="fixed"||Si(e,t)}function fc(n,t){const e=t.get(n);if(e)return e;let s=Ut(n,[],!1).filter(a=>U(a)&&J(a)!=="body"),i=null;const r=I(n).position==="fixed";let o=r?Tt(n):n;for(;U(o)&&!ye(o);){const a=I(o),c=mn(o);!c&&a.position==="fixed"&&(i=null),(r?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Gt(o)&&!c&&Si(n,o))?s=s.filter(u=>u!==o):i=a,o=Tt(o)}return t.set(n,s),s}function mc(n){let{element:t,boundary:e,rootBoundary:s,strategy:i}=n;const o=[...e==="clippingAncestors"?fc(t,this._c):[].concat(e),s],a=o[0],c=o.reduce((l,u)=>{const h=Os(t,u,i);return l.top=D(h.top,l.top),l.right=At(h.right,l.right),l.bottom=At(h.bottom,l.bottom),l.left=D(h.left,l.left),l},Os(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function pc(n){const{width:t,height:e}=Ai(n);return{width:t,height:e}}function gc(n,t,e){const s=j(t),i=z(t),r=e==="fixed",o=ot(n,!0,r,t);let a={scrollLeft:0,scrollTop:0};const c=G(0);if(s||!s&&!r)if((J(t)!=="body"||Gt(i))&&(a=we(t)),s){const h=ot(t,!0,r,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=Oi(i));const l=o.left+a.scrollLeft-c.x,u=o.top+a.scrollTop-c.y;return{x:l,y:u,width:o.width,height:o.height}}function Ss(n,t){return!j(n)||I(n).position==="fixed"?null:t?t(n):n.offsetParent}function Mi(n,t){const e=B(n);if(!j(n)||xi(n))return e;let s=Ss(n,t);for(;s&&sc(s)&&I(s).position==="static";)s=Ss(s,t);return s&&(J(s)==="html"||J(s)==="body"&&I(s).position==="static"&&!mn(s))?e:s||ic(n)||e}const bc=async function(n){const t=this.getOffsetParent||Mi,e=this.getDimensions;return{reference:gc(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,...await e(n.floating)}}};function vc(n){return I(n).direction==="rtl"}const yc={convertOffsetParentRelativeRectToViewportRelativeRect:cc,getDocumentElement:z,getClippingRect:mc,getOffsetParent:Mi,getElementRects:bc,getClientRects:lc,getDimensions:pc,getScale:yt,isElement:U,isRTL:vc};function wc(n,t){let e=null,s;const i=z(n);function r(){var a;clearTimeout(s),(a=e)==null||a.disconnect(),e=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),r();const{left:l,top:u,width:h,height:d}=n.getBoundingClientRect();if(a||t(),!h||!d)return;const p=ee(u),f=ee(i.clientWidth-(l+h)),g=ee(i.clientHeight-(u+d)),v=ee(l),y={rootMargin:-p+"px "+-f+"px "+-g+"px "+-v+"px",threshold:D(0,At(1,c))||1};let E=!0;function b(w){const A=w[0].intersectionRatio;if(A!==c){if(!E)return o();A?o(!1,A):s=setTimeout(()=>{o(!1,1e-7)},100)}E=!1}try{e=new IntersectionObserver(b,{...y,root:i.ownerDocument})}catch{e=new IntersectionObserver(b,y)}e.observe(n)}return o(!0),r}function bn(n,t,e,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,l=gn(n),u=i||r?[...l?Ut(l):[],...Ut(t)]:[];u.forEach(m=>{i&&m.addEventListener("scroll",e,{passive:!0}),r&&m.addEventListener("resize",e)});const h=l&&a?wc(l,e):null;let d=-1,p=null;o&&(p=new ResizeObserver(m=>{let[y]=m;y&&y.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var E;(E=p)==null||E.observe(t)})),e()}),l&&!c&&p.observe(l),p.observe(t));let f,g=c?ot(n):null;c&&v();function v(){const m=ot(n);g&&(m.x!==g.x||m.y!==g.y||m.width!==g.width||m.height!==g.height)&&e(),g=m,f=requestAnimationFrame(v)}return e(),()=>{var m;u.forEach(y=>{i&&y.removeEventListener("scroll",e),r&&y.removeEventListener("resize",e)}),h==null||h(),(m=p)==null||m.disconnect(),p=null,c&&cancelAnimationFrame(f)}}const vn=ec,yn=Qa,Ec=nc,wn=(n,t,e)=>{const s=new Map,i={platform:yc,...e},r={...i.platform,_c:s};return Ja(n,t,{...i,platform:r})},Ms=(n,t)=>{const e=n[t];return typeof e=="function"?e:(...s)=>{}},en=(n,t,e)=>{let s=n;return e===!0?s=`${t.identifier}:${n}`:typeof e=="string"&&(s=`${e}:${n}`),s},nn=(n,t,e)=>{const{bubbles:s,cancelable:i,composed:r}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(e,{originalEvent:t}),new CustomEvent(n,{bubbles:s,cancelable:i,composed:r,detail:e})};function Ac(n){const t=n.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,i=t.top<=e&&t.top+t.height>0,r=t.left<=s&&t.left+t.width>0;return i&&r}function Tc(n,t){var e={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&t.indexOf(s)<0&&(e[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(n);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(n,s[i])&&(e[s[i]]=n[s[i]]);return e}const $e={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class xc{constructor(t,e={}){var s,i,r;this.log=(c,l)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${c}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},l)),this.logger.groupEnd())},this.warn=c=>{this.logger.warn(`%c${this.controller.identifier} %c${c}`,"color: #3B82F6; font-weight: bold","color: unset")},this.dispatch=(c,l={})=>{if(this.dispatchEvent){const{event:u}=l,h=Tc(l,["event"]),d=this.extendedEvent(c,u||null,h);this.targetElement.dispatchEvent(d),this.log("dispatchEvent",Object.assign({eventName:d.type},h))}},this.call=(c,l={})=>{const u=this.controller[c];if(typeof u=="function")return u.call(this.controller,l)},this.extendedEvent=(c,l,u)=>{const{bubbles:h,cancelable:d,composed:p}=l||{bubbles:!0,cancelable:!0,composed:!0};return l&&Object.assign(u,{originalEvent:l}),new CustomEvent(this.composeEventName(c),{bubbles:h,cancelable:d,composed:p,detail:u})},this.composeEventName=c=>{let l=c;return this.eventPrefix===!0?l=`${this.controller.identifier}:${c}`:typeof this.eventPrefix=="string"&&(l=`${this.eventPrefix}:${c}`),l},this.debug=(i=(s=e==null?void 0:e.debug)!==null&&s!==void 0?s:t.application.stimulusUseDebug)!==null&&i!==void 0?i:$e.debug,this.logger=(r=e==null?void 0:e.logger)!==null&&r!==void 0?r:$e.logger,this.controller=t,this.controllerId=t.element.id||t.element.dataset.id,this.targetElement=(e==null?void 0:e.element)||t.element;const{dispatchEvent:o,eventPrefix:a}=Object.assign({},$e,e);Object.assign(this,{dispatchEvent:o,eventPrefix:a}),this.controllerInitialize=t.initialize.bind(t),this.controllerConnect=t.connect.bind(t),this.controllerDisconnect=t.disconnect.bind(t)}}const Oc={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},ki=(n,t={})=>{const e=n,{onlyVisible:s,dispatchEvent:i,events:r,eventPrefix:o}=Object.assign({},Oc,t),a=h=>{const d=(t==null?void 0:t.element)||e.element;if(!(d.contains(h.target)||!Ac(d)&&s)&&(e.clickOutside&&e.clickOutside(h),i)){const p=en("click:outside",e,o),f=nn(p,h,{controller:e});d.dispatchEvent(f)}},c=()=>{r==null||r.forEach(h=>{window.addEventListener(h,a,!0)})},l=()=>{r==null||r.forEach(h=>{window.removeEventListener(h,a,!0)})},u=e.disconnect.bind(e);return Object.assign(e,{disconnect(){l(),u()}}),c(),[c,l]};class Sc extends K{}Sc.debounces=[];const Mc=200,ks=(n,t=Mc)=>{let e=null;return function(){const s=Array.from(arguments),i=this,r=s.map(a=>a.params),o=()=>(s.forEach((a,c)=>a.params=r[c]),n.apply(i,s));e&&clearTimeout(e),e=setTimeout(o,t)}},kc=(n,t)=>{const e=n;e.constructor.debounces.forEach(i=>{if(typeof i=="string"&&(e[i]=ks(e[i],t==null?void 0:t.wait)),typeof i=="object"){const{name:r,wait:o}=i;if(!r)return;e[r]=ks(e[r],o||(t==null?void 0:t.wait))}})},Cc={dispatchEvent:!0,eventPrefix:!0,visibleAttribute:"isVisible"},Lc=(n,t={})=>{const e=n,{dispatchEvent:s,eventPrefix:i,visibleAttribute:r}=Object.assign({},Cc,t),o=(t==null?void 0:t.element)||e.element;e.intersectionElements||(e.intersectionElements=[]),e.intersectionElements.push(o);const a=b=>{const[w]=b;w.isIntersecting?l(w):o.hasAttribute(r)&&u(w)},c=new IntersectionObserver(a,t),l=b=>{if(o.setAttribute(r,"true"),Ms(e,"appear").call(e,b,c),s){const w=en("appear",e,i),A=nn(w,null,{controller:e,entry:b,observer:c});o.dispatchEvent(A)}},u=b=>{if(o.removeAttribute(r),Ms(e,"disappear").call(e,b,c),s){const w=en("disappear",e,i),A=nn(w,null,{controller:e,entry:b,observer:c});o.dispatchEvent(A)}},h=e.disconnect.bind(e),d=()=>{f(),h()},p=()=>{c.observe(o)},f=()=>{c.unobserve(o)},g=()=>e.intersectionElements.filter(b=>b.hasAttribute(r)).length===0,v=()=>e.intersectionElements.filter(b=>b.hasAttribute(r)).length===1,m=()=>e.intersectionElements.some(b=>b.hasAttribute(r)),y=()=>e.intersectionElements.every(b=>b.hasAttribute(r));return Object.assign(e,{isVisible:y,noneVisible:g,oneVisible:v,atLeastOneVisible:m,allVisible:y,disconnect:d}),p(),[p,f]};class Fc extends xc{constructor(t,e={}){super(t,e),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(s){this.controller.application.handleError(s,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=s=>{this.call("mutate",s),this.log("mutate",{entries:s}),this.dispatch("mutate",{entries:s})},this.targetElement=(e==null?void 0:e.element)||t.element,this.controller=t,this.options=e,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const t=this.controller.disconnect.bind(this.controller),e=()=>{this.unobserve(),t()};Object.assign(this.controller,{disconnect:e})}}const En=(n,t={})=>{const e=new Fc(n,t);return[e.observe,e.unobserve]};class _c extends K{}_c.throttles=[];class Dc extends q()({targets:{wrapper:HTMLDetailsElement,button:HTMLElement,popover:Ne,options:HTMLDivElement},values:{clamped:Boolean,placement:String,dynamicLabelPrefix:String}}){constructor(){super(...arguments),this.changedIds=new Set}clickOutside(){this.element.open=!1,this.setupAutoUpdate(),this.close()}close(){this.changedIds.size>0&&(this.dispatch("changed"),this.changedIds.clear())}connect(){ki(this),En(this,{childList:!0,subtree:!0}),this.setupAutoUpdate(),this.setupForm()}disconnect(){var t;(t=this.unsubAutoUpdate)==null||t.call(this)}setupForm(){for(const t of["checkbox","radio"])for(const e of this.popoverTarget.querySelectorAll(`input[type="${t}"]`))e.addEventListener("change",s=>{const i=s.target;this.changedIds.has(i)?this.changedIds.delete(i):this.changedIds.add(i),this.dispatch("clicked",{detail:i})})}setupAutoUpdate(){var e;if(!this.element.open){(e=this.unsubAutoUpdate)==null||e.call(this);return}const t=()=>{const s=this.optionsTarget,i=this.clampedValue;wn(this.buttonTarget,this.popoverTarget,{middleware:[fn(6),yn(),vn({padding:6}),Ec({apply({availableHeight:r}){let o=r-6;i&&o>400&&(o=400),Object.assign(s.style,{maxHeight:`${o}px`})}})],placement:this.placementValue,strategy:"fixed"}).then(({x:r,y:o})=>{Object.assign(this.popoverTarget.style,{left:`${r}px`,top:`${o}px`})})};t(),this.unsubAutoUpdate=bn(this.buttonTarget,this.popoverTarget,t)}updateButtonLabel(t){var r;const s=t.target.querySelector("input[type=radio]:checked");if(!s)return;const i=((r=s.labels)==null?void 0:r.item(0)).textContent;this.buttonTarget.querySelector('[data-ariadne-ui-button-target="content"]').textContent=`${this.dynamicLabelPrefixValue}${i}`}toggle(){this.element.open=!this.element.open,this.setupAutoUpdate()}}const Bc=Object.freeze(Object.defineProperty({__proto__:null,default:Dc},Symbol.toStringTag,{value:"Module"}));function Pc(n){if(Array.isArray(n)){for(var t=0,e=Array(n.length);t<n.length;t++)e[t]=n[t];return e}else return Array.from(n)}var An=!1;if(typeof window<"u"){var Cs={get passive(){An=!0}};window.addEventListener("testPassive",null,Cs),window.removeEventListener("testPassive",null,Cs)}var fe=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),rt=[],me=!1,Ci=-1,Nt=void 0,st=void 0,Vt=void 0,Li=function(t){return rt.some(function(e){return!!(e.options.allowTouchMove&&e.options.allowTouchMove(t))})},pe=function(t){var e=t||window.event;return Li(e.target)||e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)},$c=function(t){if(Vt===void 0){var e=!!t&&t.reserveScrollBarGap===!0,s=window.innerWidth-document.documentElement.clientWidth;if(e&&s>0){var i=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);Vt=document.body.style.paddingRight,document.body.style.paddingRight=i+s+"px"}}Nt===void 0&&(Nt=document.body.style.overflow,document.body.style.overflow="hidden")},Rc=function(){Vt!==void 0&&(document.body.style.paddingRight=Vt,Vt=void 0),Nt!==void 0&&(document.body.style.overflow=Nt,Nt=void 0)},Ic=function(){return window.requestAnimationFrame(function(){if(st===void 0){st={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var t=window,e=t.scrollY,s=t.scrollX,i=t.innerHeight;document.body.style.position="fixed",document.body.style.top=-e,document.body.style.left=-s,setTimeout(function(){return window.requestAnimationFrame(function(){var r=i-window.innerHeight;r&&e>=i&&(document.body.style.top=-(e+r))})},300)}})},Nc=function(){if(st!==void 0){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=st.position,document.body.style.top=st.top,document.body.style.left=st.left,window.scrollTo(e,t),st=void 0}},Vc=function(t){return t?t.scrollHeight-t.scrollTop<=t.clientHeight:!1},jc=function(t,e){var s=t.targetTouches[0].clientY-Ci;return Li(t.target)?!1:e&&e.scrollTop===0&&s>0||Vc(e)&&s<0?pe(t):(t.stopPropagation(),!0)},Hc=function(t,e){if(!t){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!rt.some(function(i){return i.targetElement===t})){var s={targetElement:t,options:e||{}};rt=[].concat(Pc(rt),[s]),fe?Ic():$c(e),fe&&(t.ontouchstart=function(i){i.targetTouches.length===1&&(Ci=i.targetTouches[0].clientY)},t.ontouchmove=function(i){i.targetTouches.length===1&&jc(i,t)},me||(document.addEventListener("touchmove",pe,An?{passive:!1}:void 0),me=!0))}},Wc=function(t){if(!t){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}rt=rt.filter(function(e){return e.targetElement!==t}),fe&&(t.ontouchstart=null,t.ontouchmove=null,me&&rt.length===0&&(document.removeEventListener("touchmove",pe,An?{passive:!1}:void 0),me=!1)),fe?Nc():Rc()};class Uc extends q()({targets:{dialog:HTMLDialogElement}}){close(){this.dialogTarget.open&&(this.dialogTarget.close(),Wc(this.dialogTarget))}disconnect(){this.close()}open(){this.dialogTarget.showModal(),Hc(this.dialogTarget,{reserveScrollBarGap:!0})}triggerClick(){this.dialogTarget.open?this.close():this.open()}windowClick(t){t.target===this.dialogTarget&&this.close()}}const Kc=Object.freeze(Object.defineProperty({__proto__:null,default:Uc},Symbol.toStringTag,{value:"Module"}));async function qc(n,t=null){n.classList.remove("hidden"),await Fi("enter",n,t)}async function zc(n,t=null){await Fi("leave",n,t),n.classList.add("hidden")}async function Fi(n,t,e){const s=t.dataset,i=e?`${e}-${n}`:n;let r=`transition${n.charAt(0).toUpperCase()+n.slice(1)}`;const o=s[r]?s[r].split(" "):[i],a=s[`${r}Start`]?s[`${r}Start`].split(" "):[`${i}-start`],c=s[`${r}End`]?s[`${r}End`].split(" "):[`${i}-end`];Re(t,o),Re(t,a),await Yc(),Ie(t,a),Re(t,c),await Xc(t),Ie(t,c),Ie(t,o)}function Re(n,t){n.classList.add(...t)}function Ie(n,t){n.classList.remove(...t)}function Yc(){return new Promise(n=>{requestAnimationFrame(()=>{requestAnimationFrame(n)})})}function Xc(n){return new Promise(t=>{const e=getComputedStyle(n).transitionDuration.split(",")[0],s=Number(e.replace("s",""))*1e3;setTimeout(()=>{t()},s)})}const ge=class ge extends K{async connect(){await this.show();const t=()=>{};setTimeout(()=>{this.hide().then(t).catch(t)},this.timerValue)}async disconnect(){await this.hide()}async hide(){await zc(this.element),this.hasHiddenClass?this.element.classList.add(this.hiddenClass):this.element.classList.add("hidden"),this.element.remove()}async show(){this.hasHiddenClass?this.element.classList.remove(this.hiddenClass):this.element.classList.remove("hidden"),await qc(this.element)}};ge.classes=["ariadne-hidden"],ge.values={timer:{default:4e3,type:Number}};let sn=ge;const Gc=Object.freeze(Object.defineProperty({__proto__:null,default:sn},Symbol.toStringTag,{value:"Module"}));class Zc extends q()({targets:{emptyRoot:null,input:HTMLInputElement,searchString:null}}){handleNewQuery(t){let e=!1;for(const{el:s,searchString:i}of this.items){const r=i.includes(t.trim().toLowerCase());!e&&r&&(e=!0),r?s.classList.remove("ariadne-hidden"):s.classList.add("ariadne-hidden")}e?this.emptyRootTarget.classList.add("ariadne-hidden"):this.emptyRootTarget.classList.remove("ariadne-hidden")}connect(){this.items=this.searchStringTargets.map(t=>({el:t,searchString:(t.textContent??"").trim().toLowerCase()})),Lc(this)}appear(t,e){this.reset()}handleInput(){this.hasSearchStringTarget&&this.handleNewQuery(this.inputTarget.value)}reset(){this.handleNewQuery(""),this.hasInputTarget&&(this.inputTarget.value="")}}const Jc=Object.freeze(Object.defineProperty({__proto__:null,default:Zc},Symbol.toStringTag,{value:"Module"}));class Qc extends q()({targets:{anchor:null,popover:null},values:{clamped:Boolean,placement:String}}){constructor(){super(...arguments),this.changedIds=new Set,this.clickHandlers=[]}setupClickHandlers(){const t=()=>this.toggle();for(const e of this.clickHandlers)e();this.clickHandlers=[];for(const e of this.anchorTarget.querySelectorAll('button, [tabindex]:not([tabindex="-1"])'))e.addEventListener("click",t),this.clickHandlers.push(()=>e.removeEventListener("click",t))}checkboxClicked(t){const s=t.target.value;this.changedIds.has(s)?this.changedIds.delete(s):this.changedIds.add(s),this.dispatch("clicked",{detail:s})}clickOutside(){this.setupAutoUpdate(),this.close()}close(){this.element.open=!1}connect(){ki(this),En(this,{childList:!0,subtree:!0}),this.setupAutoUpdate(),this.setupClickHandlers()}disconnect(){var t;(t=this.unsubAutoUpdate)==null||t.call(this)}setupAutoUpdate(){var e;if(!this.element.open){(e=this.unsubAutoUpdate)==null||e.call(this);return}const t=()=>{wn(this.anchorTarget,this.popoverTarget,{middleware:[fn(6),yn(),vn({padding:6})],placement:this.placementValue,strategy:"fixed"}).then(({x:s,y:i})=>{Object.assign(this.popoverTarget.style,{left:`${s}px`,top:`${i}px`})})};t(),this.unsubAutoUpdate=bn(this.anchorTarget,this.popoverTarget,t)}toggle(){this.element.open=!this.element.open,this.setupAutoUpdate()}}const tl=Object.freeze(Object.defineProperty({__proto__:null,default:Qc},Symbol.toStringTag,{value:"Module"}));class el extends q()({targets:{button:HTMLButtonElement,popover:HTMLElement},values:{placement:String}}){connect(){this.popoverTarget.addEventListener("toggle",t=>{t.newState==="open"&&this.updatePosition()})}updatePosition(){bn(this.buttonTarget,this.popoverTarget,()=>{wn(this.buttonTarget,this.popoverTarget,{placement:this.placementValue,middleware:[fn(5),yn(),vn({padding:5})]}).then(({x:t,y:e})=>{Object.assign(this.buttonTarget.style,{left:`${t}px`,top:`${e}px`})})})}}const nl=Object.freeze(Object.defineProperty({__proto__:null,default:el},Symbol.toStringTag,{value:"Module"}));class sl extends q()({targets:{toggle:HTMLInputElement},values:{formMethod:String,formUrl:String,csrfToken:String}}){connect(){this.toggling=!1}requiresFormSubmit(){return this.formUrlValue!=null}async toggle(){if(!this.toggling&&(this.toggling=!0,!this.isDisabled())){if(!this.requiresFormSubmit()){this.performToggle(),this.toggling=!1;return}this.performToggle();try{await this.submitForm()}catch(t){t instanceof Error&&this.performToggle();return}finally{this.toggling=!1}}}performToggle(){this.isOn()?this.turnOff():this.turnOn()}turnOn(){this.isDisabled()||this.toggleTarget.setAttribute("aria-pressed","true")}turnOff(){this.isDisabled()||this.toggleTarget.setAttribute("aria-pressed","false")}isOn(){return this.toggleTarget.getAttribute("aria-pressed")==="true"}isOff(){return!this.isOn()}isDisabled(){return this.toggleTarget.getAttribute("disabled")!=null}async submitForm(){const t=new FormData,e=this.documentCsrfToken()||this.csrfTokenValue;if(e&&t.append(this.csrfField(),e),t.append(this.toggleTarget.name,this.isOn()?"true":"false"),!this.formUrlValue)throw new Error("invalid src");let s;try{s=await fetch(this.formUrlValue,{credentials:"same-origin",method:this.formMethodValue,headers:{"Requested-With":"XMLHttpRequest"},body:t})}catch{throw new Error("A network error occurred, please try again.")}if(!s.ok)throw new Error(await s.text())}csrfField(){return this.toggleTarget.getAttribute("csrf-field")||"authenticity_token"}documentCsrfToken(){const t=document.querySelector("meta[name=csrf-token]");return t&&t.getAttribute("content")}}const il=Object.freeze(Object.defineProperty({__proto__:null,default:sl},Symbol.toStringTag,{value:"Module"})),be=class be extends K{connect(){kc(this)}save(){this.hasFormTarget?this.formTarget.requestSubmit():this.element.requestSubmit()}};be.debounces=["save"],be.targets=["form"];let rn=be;const rl=Object.freeze(Object.defineProperty({__proto__:null,default:rn},Symbol.toStringTag,{value:"Module"}));class ol extends q()({targets:{button:HTMLButtonElement,form:HTMLFormElement}}){get form(){return this.hasFormTarget?this.formTarget:this.element}runCheck(){this.buttonTarget.disabled=!this.form.checkValidity()}connect(){this.form.addEventListener("input",()=>this.runCheck()),this.runCheck(),En(this,{childList:!0,subtree:!0})}mutate(){this.runCheck()}}const al=Object.freeze(Object.defineProperty({__proto__:null,default:ol},Symbol.toStringTag,{value:"Module"})),Ee=Lo.start();Ee.debug=!1;window.Stimulus=Ee;const cl=Object.assign({"../../components/ariadne/ui/accordion/component.ts":Ba,"../../components/ariadne/ui/clipboard_copy/component.ts":Wa,"../../components/ariadne/ui/combobox/component.ts":Bc,"../../components/ariadne/ui/dialog/component.ts":Kc,"../../components/ariadne/ui/flash/component.ts":Gc,"../../components/ariadne/ui/list/component.ts":Jc,"../../components/ariadne/ui/overlay/component.ts":tl,"../../components/ariadne/ui/popover/component.ts":nl,"../../components/ariadne/ui/toggle/component.ts":il});for(const[n,t]of Object.entries(cl)){const e=n.split("/"),s=e.slice(3,e.length-1).join("-").replaceAll("_","-").toLocaleLowerCase();Ee.register(s,t.default)}const ll=Object.assign({"/controllers/form_autosubmit_controller.ts":rl,"/controllers/form_validity_controller.ts":al});for(const[n,t]of Object.entries(ll)){const e=n.split("/"),s=e[e.length-1].replace("_controller.ts","").replaceAll("_","-").toLocaleLowerCase();Ee.register(`ariadne-${s}`,t.default)}
|
98
|
+
%o`,e,t,s),(i=window.onerror)===null||i===void 0||i.call(window,e,"",0,0,t)}logFormattedMessage(t,e,s={}){s=Object.assign({application:this},s),this.logger.groupCollapsed(`${t} #${e}`),this.logger.log("details:",Object.assign({},s)),this.logger.groupEnd()}}function Vr(){return new Promise(n=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>n()):n()})}function Hr(n){return Ht(n,"classes").reduce((e,s)=>Object.assign(e,Wr(s)),{})}function Wr(n){return{[`${n}Class`]:{get(){const{classes:t}=this;if(t.has(n))return t.get(n);{const e=t.getAttributeName(n);throw new Error(`Missing attribute "${e}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${Vt(n)}Class`]:{get(){return this.classes.has(n)}}}}function Ur(n){return Ht(n,"outlets").reduce((e,s)=>Object.assign(e,Kr(s)),{})}function Un(n,t,e){return n.application.getControllerForElementAndIdentifier(t,e)}function Kn(n,t,e){let s=Un(n,t,e);if(s||(n.application.router.proposeToConnectScopeForElementAndIdentifier(t,e),s=Un(n,t,e),s))return s}function Kr(n){const t=Be(n);return{[`${t}Outlet`]:{get(){const e=this.outlets.find(n),s=this.outlets.getSelectorForOutletName(n);if(e){const i=Kn(this,e,n);if(i)return i;throw new Error(`The provided outlet element is missing an outlet controller "${n}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${n}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${s}".`)}},[`${t}Outlets`]:{get(){const e=this.outlets.findAll(n);return e.length>0?e.map(s=>{const i=Kn(this,s,n);if(i)return i;console.warn(`The provided outlet element is missing an outlet controller "${n}" instance for host controller "${this.identifier}"`,s)}).filter(s=>s):[]}},[`${t}OutletElement`]:{get(){const e=this.outlets.find(n),s=this.outlets.getSelectorForOutletName(n);if(e)return e;throw new Error(`Missing outlet element "${n}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${s}".`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(n)}},[`has${Vt(t)}Outlet`]:{get(){return this.outlets.has(n)}}}}function zr(n){return Ht(n,"targets").reduce((e,s)=>Object.assign(e,qr(s)),{})}function qr(n){return{[`${n}Target`]:{get(){const t=this.targets.find(n);if(t)return t;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${Vt(n)}Target`]:{get(){return this.targets.has(n)}}}}function Yr(n){const t=vr(n,"values"),e={valueDescriptorMap:{get(){return t.reduce((s,i)=>{const r=Ds(i,this.identifier),o=this.data.getAttributeNameForKey(r.key);return Object.assign(s,{[o]:r})},{})}}};return t.reduce((s,i)=>Object.assign(s,Xr(i)),e)}function Xr(n,t){const e=Ds(n,t),{key:s,name:i,reader:r,writer:o}=e;return{[i]:{get(){const a=this.data.get(s);return a!==null?r(a):e.defaultValue},set(a){a===void 0?this.data.delete(s):this.data.set(s,o(a))}},[`has${Vt(i)}`]:{get(){return this.data.has(s)||e.hasCustomDefaultValue}}}}function Ds([n,t],e){return Qr({controller:e,token:n,typeDefinition:t})}function Qt(n){switch(n){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Nt(n){switch(typeof n){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(n))return"array";if(Object.prototype.toString.call(n)==="[object Object]")return"object"}function Gr(n){const{controller:t,token:e,typeObject:s}=n,i=jn(s.type),r=jn(s.default),o=i&&r,a=i&&!r,c=!i&&r,l=Qt(s.type),u=Nt(n.typeObject.default);if(a)return l;if(c)return u;if(l!==u){const d=t?`${t}.${e}`:e;throw new Error(`The specified default value for the Stimulus Value "${d}" must match the defined type "${l}". The provided default value of "${s.default}" is of type "${u}".`)}if(o)return l}function Zr(n){const{controller:t,token:e,typeDefinition:s}=n,r=Gr({controller:t,token:e,typeObject:s}),o=Nt(s),a=Qt(s),c=r||o||a;if(c)return c;const l=t?`${t}.${s}`:e;throw new Error(`Unknown value type "${l}" for "${e}" value`)}function Jr(n){const t=Qt(n);if(t)return zn[t];const e=Re(n,"default"),s=Re(n,"type"),i=n;if(e)return i.default;if(s){const{type:r}=i,o=Qt(r);if(o)return zn[o]}return n}function Qr(n){const{token:t,typeDefinition:e}=n,s=`${Os(t)}-value`,i=Zr(n);return{type:i,key:s,name:Xe(s),get defaultValue(){return Jr(e)},get hasCustomDefaultValue(){return Nt(e)!==void 0},reader:to[i],writer:qn[i]||qn.default}}const zn={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},to={array(n){const t=JSON.parse(n);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${n}" of type "${Nt(t)}"`);return t},boolean(n){return!(n=="0"||String(n).toLowerCase()=="false")},number(n){return Number(n.replace(/_/g,""))},object(n){const t=JSON.parse(n);if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${n}" of type "${Nt(t)}"`);return t},string(n){return n}},qn={default:eo,array:Yn,object:Yn};function Yn(n){return JSON.stringify(n)}function eo(n){return`${n}`}let K=class{constructor(t){this.context=t}static get shouldLoad(){return!0}static afterLoad(t,e){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:s={},prefix:i=this.identifier,bubbles:r=!0,cancelable:o=!0}={}){const a=i?`${i}:${t}`:t,c=new CustomEvent(a,{detail:s,bubbles:r,cancelable:o});return e.dispatchEvent(c),c}};K.blessings=[Hr,zr,Yr,Ur];K.targets=[];K.outlets=[];K.values={};function V(){return function({targets:t,values:e}={}){const i=class i extends K{};i.targets=Object.keys(t??{}),i.values=e??{};let s=i;return s}}function no(n,t){n.indexOf(t)===-1&&n.push(t)}const _s=(n,t,e)=>Math.min(Math.max(e,n),t),_={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},te=n=>typeof n=="number",bt=n=>Array.isArray(n)&&!te(n[0]),so=(n,t,e)=>{const s=t-n;return((e-n)%s+s)%s+n};function io(n,t){return bt(n)?n[so(0,n.length,t)]:n}const Bs=(n,t,e)=>-e*n+e*t+n,Rs=()=>{},J=n=>n,Ze=(n,t,e)=>t-n===0?1:(e-n)/(t-n);function $s(n,t){const e=n[n.length-1];for(let s=1;s<=t;s++){const i=Ze(0,t,s);n.push(Bs(e,1,i))}}function ro(n){const t=[0];return $s(t,n-1),t}function oo(n,t=ro(n.length),e=J){const s=n.length,i=s-t.length;return i>0&&$s(t,i),r=>{let o=0;for(;o<s-2&&!(r<t[o+1]);o++);let a=_s(0,1,Ze(t[o],t[o+1],r));return a=io(e,o)(a),Bs(n[o],n[o+1],a)}}const Ps=n=>Array.isArray(n)&&te(n[0]),Pe=n=>typeof n=="object"&&!!n.createAnimation,wt=n=>typeof n=="function",ao=n=>typeof n=="string",Bt={ms:n=>n*1e3,s:n=>n/1e3},Ns=(n,t,e)=>(((1-3*e+3*t)*n+(3*e-6*t))*n+3*t)*n,co=1e-7,lo=12;function uo(n,t,e,s,i){let r,o,a=0;do o=t+(e-t)/2,r=Ns(o,s,i)-n,r>0?e=o:t=o;while(Math.abs(r)>co&&++a<lo);return o}function Lt(n,t,e,s){if(n===t&&e===s)return J;const i=r=>uo(r,0,1,n,e);return r=>r===0||r===1?r:Ns(i(r),t,s)}const ho=(n,t="end")=>e=>{e=t==="end"?Math.min(e,.999):Math.max(e,.001);const s=e*n,i=t==="end"?Math.floor(s):Math.ceil(s);return _s(0,1,i/n)},fo={ease:Lt(.25,.1,.25,1),"ease-in":Lt(.42,0,1,1),"ease-in-out":Lt(.42,0,.58,1),"ease-out":Lt(0,0,.58,1)},mo=/\((.*?)\)/;function Xn(n){if(wt(n))return n;if(Ps(n))return Lt(...n);const t=fo[n];if(t)return t;if(n.startsWith("steps")){const e=mo.exec(n);if(e){const s=e[1].split(",");return ho(parseFloat(s[0]),s[1].trim())}}return J}class Is{constructor(t,e=[0,1],{easing:s,duration:i=_.duration,delay:r=_.delay,endDelay:o=_.endDelay,repeat:a=_.repeat,offset:c,direction:l="normal",autoplay:u=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=J,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((h,m)=>{this.resolve=h,this.reject=m}),s=s||_.easing,Pe(s)){const h=s.createAnimation(e);s=h.easing,e=h.keyframes||e,i=h.duration||i}this.repeat=a,this.easing=bt(s)?J:Xn(s),this.updateDuration(i);const d=oo(e,c,bt(s)?s.map(Xn):J);this.tick=h=>{var m;r=r;let f=0;this.pauseTime!==void 0?f=this.pauseTime:f=(h-this.startTime)*this.rate,this.t=f,f/=1e3,f=Math.max(f-r,0),this.playState==="finished"&&this.pauseTime===void 0&&(f=this.totalDuration);const g=f/this.duration;let b=Math.floor(g),p=g%1;!p&&g>=1&&(p=1),p===1&&b--;const w=b%2;(l==="reverse"||l==="alternate"&&w||l==="alternate-reverse"&&!w)&&(p=1-p);const E=f>=this.totalDuration?1:Math.min(p,1),v=d(this.easing(E));t(v),this.pauseTime===void 0&&(this.playState==="finished"||f>=this.totalDuration+o)?(this.playState="finished",(m=this.resolve)===null||m===void 0||m.call(this,v)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},u&&this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}class po{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const we=new WeakMap;function js(n){return we.has(n)||we.set(n,{transforms:[],values:new Map}),we.get(n)}function go(n,t){return n.has(t)||n.set(t,new po),n.get(t)}const bo=["","X","Y","Z"],vo=["translate","scale","rotate","skew"],ee={x:"translateX",y:"translateY",z:"translateZ"},Gn={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:n=>n+"deg"},yo={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:n=>n+"px"},rotate:Gn,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:J},skew:Gn},It=new Map,Je=n=>`--motion-${n}`,ne=["x","y","z"];vo.forEach(n=>{bo.forEach(t=>{ne.push(n+t),It.set(Je(n+t),yo[n])})});const wo=(n,t)=>ne.indexOf(n)-ne.indexOf(t),Eo=new Set(ne),Vs=n=>Eo.has(n),Ao=(n,t)=>{ee[t]&&(t=ee[t]);const{transforms:e}=js(n);no(e,t),n.style.transform=To(e)},To=n=>n.sort(wo).reduce(xo,"").trim(),xo=(n,t)=>`${n} ${t}(var(${Je(t)}))`,Ne=n=>n.startsWith("--"),Zn=new Set;function Oo(n){if(!Zn.has(n)){Zn.add(n);try{const{syntax:t,initialValue:e}=It.has(n)?It.get(n):{};CSS.registerProperty({name:n,inherits:!1,syntax:t,initialValue:e})}catch{}}}const Ee=(n,t)=>document.createElement("div").animate(n,t),Jn={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{Ee({opacity:[1]})}catch{return!1}return!0},finished:()=>!!Ee({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{Ee({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},Ae={},ft={};for(const n in Jn)ft[n]=()=>(Ae[n]===void 0&&(Ae[n]=Jn[n]()),Ae[n]);const So=.015,Mo=(n,t)=>{let e="";const s=Math.round(t/So);for(let i=0;i<s;i++)e+=n(Ze(0,s-1,i))+", ";return e.substring(0,e.length-2)},Qn=(n,t)=>wt(n)?ft.linearEasing()?`linear(${Mo(n,t)})`:_.easing:Ps(n)?ko(n):n,ko=([n,t,e,s])=>`cubic-bezier(${n}, ${t}, ${e}, ${s})`;function Co(n,t){for(let e=0;e<n.length;e++)n[e]===null&&(n[e]=e?n[e-1]:t());return n}const Lo=n=>Array.isArray(n)?n:[n];function Ie(n){return ee[n]&&(n=ee[n]),Vs(n)?Je(n):n}const qt={get:(n,t)=>{t=Ie(t);let e=Ne(t)?n.style.getPropertyValue(t):getComputedStyle(n)[t];if(!e&&e!==0){const s=It.get(t);s&&(e=s.initialValue)}return e},set:(n,t,e)=>{t=Ie(t),Ne(t)?n.style.setProperty(t,e):n.style[t]=e}};function Hs(n,t=!0){if(!(!n||n.playState==="finished"))try{n.stop?n.stop():(t&&n.commitStyles(),n.cancel())}catch{}}function Fo(n,t){var e;let s=(t==null?void 0:t.toDefaultUnit)||J;const i=n[n.length-1];if(ao(i)){const r=((e=i.match(/(-?[\d.]+)([a-z%]*)/))===null||e===void 0?void 0:e[2])||"";r&&(s=o=>o+r)}return s}function Do(){return window.__MOTION_DEV_TOOLS_RECORD}function _o(n,t,e,s={},i){const r=Do(),o=s.record!==!1&&r;let a,{duration:c=_.duration,delay:l=_.delay,endDelay:u=_.endDelay,repeat:d=_.repeat,easing:h=_.easing,persist:m=!1,direction:f,offset:g,allowWebkitAcceleration:b=!1,autoplay:p=!0}=s;const w=js(n),E=Vs(t);let v=ft.waapi();E&&Ao(n,t);const y=Ie(t),x=go(w.values,y),S=It.get(y);return Hs(x.animation,!(Pe(h)&&x.generator)&&s.record!==!1),()=>{const B=()=>{var T,q;return(q=(T=qt.get(n,y))!==null&&T!==void 0?T:S==null?void 0:S.initialValue)!==null&&q!==void 0?q:0};let A=Co(Lo(e),B);const R=Fo(A,S);if(Pe(h)){const T=h.createAnimation(A,t!=="opacity",B,y,x);h=T.easing,A=T.keyframes||A,c=T.duration||c}if(Ne(y)&&(ft.cssRegisterProperty()?Oo(y):v=!1),E&&!ft.linearEasing()&&(wt(h)||bt(h)&&h.some(wt))&&(v=!1),v){S&&(A=A.map(I=>te(I)?S.toDefaultUnit(I):I)),A.length===1&&(!ft.partialKeyframes()||o)&&A.unshift(B());const T={delay:Bt.ms(l),duration:Bt.ms(c),endDelay:Bt.ms(u),easing:bt(h)?void 0:Qn(h,c),direction:f,iterations:d+1,fill:"both"};a=n.animate({[y]:A,offset:g,easing:bt(h)?h.map(I=>Qn(I,c)):void 0},T),a.finished||(a.finished=new Promise((I,H)=>{a.onfinish=I,a.oncancel=H}));const q=A[A.length-1];a.finished.then(()=>{m||(qt.set(n,y,q),a.cancel())}).catch(Rs),b||(a.playbackRate=1.000001)}else if(i&&E)A=A.map(T=>typeof T=="string"?parseFloat(T):T),A.length===1&&A.unshift(parseFloat(B())),a=new i(T=>{qt.set(n,y,R?R(T):T)},A,Object.assign(Object.assign({},s),{duration:c,easing:h}));else{const T=A[A.length-1];qt.set(n,y,S&&te(T)?S.toDefaultUnit(T):T)}return o&&r(n,t,A,{duration:c,delay:l,easing:h,repeat:d,offset:g},"motion-one"),x.setAnimation(a),a&&!p&&a.pause(),a}}const Bo=(n,t)=>n[t]?Object.assign(Object.assign({},n),n[t]):Object.assign({},n);function Ro(n,t){return typeof n=="string"?n=document.querySelectorAll(n):n instanceof Element&&(n=[n]),Array.from(n||[])}const $o=n=>n(),Ws=(n,t,e=_.duration)=>new Proxy({animations:n.map($o).filter(Boolean),duration:e,options:t},No),Po=n=>n.animations[0],No={get:(n,t)=>{const e=Po(n);switch(t){case"duration":return n.duration;case"currentTime":return Bt.s((e==null?void 0:e[t])||0);case"playbackRate":case"playState":return e==null?void 0:e[t];case"finished":return n.finished||(n.finished=Promise.all(n.animations.map(Io)).catch(Rs)),n.finished;case"stop":return()=>{n.animations.forEach(s=>Hs(s))};case"forEachNative":return s=>{n.animations.forEach(i=>s(i,n))};default:return typeof(e==null?void 0:e[t])>"u"?void 0:()=>n.animations.forEach(s=>s[t]())}},set:(n,t,e)=>{switch(t){case"currentTime":e=Bt.ms(e);case"playbackRate":for(let s=0;s<n.animations.length;s++)n.animations[s][t]=e;return!0}return!1}},Io=n=>n.finished;function jo(n,t,e){return wt(n)?n(t,e):n}function Vo(n){return function(e,s,i={}){e=Ro(e);const r=e.length,o=[];for(let a=0;a<r;a++){const c=e[a];for(const l in s){const u=Bo(i,l);u.delay=jo(u.delay,a,r);const d=_o(c,l,s[l],u,n);o.push(d)}}return Ws(o,i,i.duration)}}const Ho=Vo(Is);function Wo(n,t={}){return Ws([()=>{const e=new Is(n,[0,1],t);return e.finished.catch(()=>{}),e}],t,t.duration)}function Te(n,t,e){return(wt(n)?Wo:Ho)(n,t,e)}class Uo extends V()({targets:{icon:HTMLElement,content:HTMLElement},values:{open:Boolean}}){connect(){this.animationDurationValue=.15,this.openValue?this.open():this.close()}toggle(){this.openValue=!this.openValue}openValueChanged(t,e){t?this.open():this.close()}open(){this.hasContentTarget&&(this.revealContent(),this.hasIconTarget&&this.rotateIcon(),this.openValue=!0)}close(){this.hasContentTarget&&(this.hideContent(),this.hasIconTarget&&this.rotateIcon(),this.openValue=!1)}revealContent(){const t=this.contentTarget.scrollHeight;Te(this.contentTarget,{height:`${t}px`},{duration:this.animationDurationValue,easing:"ease-in-out"})}hideContent(){Te(this.contentTarget,{height:0},{duration:this.animationDurationValue,easing:"ease-in-out"})}rotateIcon(){Te(this.iconTarget,{rotate:`${this.openValue?180:0}deg`})}}const Ko=Object.freeze(Object.defineProperty({__proto__:null,default:Uo},Symbol.toStringTag,{value:"Module"}));function zo(n){const t=document.createElement("pre");return t.style.width="1px",t.style.height="1px",t.style.position="fixed",t.style.top="5px",t.textContent=n,t}function Us(n){if("clipboard"in navigator)return navigator.clipboard.writeText(n.textContent||"");const t=getSelection();if(t==null)return Promise.reject(new Error);t.removeAllRanges();const e=document.createRange();return e.selectNodeContents(n),t.addRange(e),document.execCommand("copy"),t.removeAllRanges(),Promise.resolve()}function je(n){if("clipboard"in navigator)return navigator.clipboard.writeText(n);const t=document.body;if(!t)return Promise.reject(new Error);const e=zo(n);return t.appendChild(e),Us(e),t.removeChild(e),Promise.resolve()}async function Ks(n){const t=n.getAttribute("for"),e=n.getAttribute("value");function s(){n.dispatchEvent(new CustomEvent("clipboard-copy",{bubbles:!0}))}if(n.getAttribute("aria-disabled")!=="true"){if(e)await je(e),s();else if(t){const i="getRootNode"in Element.prototype?n.getRootNode():n.ownerDocument;if(!(i instanceof Document||"ShadowRoot"in window&&i instanceof ShadowRoot))return;const r=i.getElementById(t);r&&(await qo(r),s())}}}function qo(n){return n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?je(n.value):n instanceof HTMLAnchorElement&&n.hasAttribute("href")?je(n.href):Us(n)}function Yo(n){const t=n.currentTarget;t instanceof HTMLElement&&Ks(t)}function zs(n){if(n.key===" "||n.key==="Enter"){const t=n.currentTarget;t instanceof HTMLElement&&(n.preventDefault(),Ks(t))}}function Xo(n){n.currentTarget.addEventListener("keydown",zs)}function Go(n){n.currentTarget.removeEventListener("keydown",zs)}class Zo extends HTMLElement{static define(t="clipboard-copy",e=customElements){return e.define(t,this),this}constructor(){super(),this.addEventListener("click",Yo),this.addEventListener("focus",Xo),this.addEventListener("blur",Go)}connectedCallback(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button")}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}}const ts=typeof globalThis<"u"?globalThis:window;try{ts.ClipboardCopyElement=Zo.define()}catch(n){if(!(ts.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}const Jo=2e3;class Qo extends V()({targets:{initial:HTMLElement,confirmed:null}}){connect(){this.clipboardCopyElementTimers=new WeakMap}copy(t){const e=t.target,s=this.clipboardCopyElementTimers.get(e);s?(clearTimeout(s),this.clipboardCopyElementTimers.delete(e)):this.showConfirm(),this.clipboardCopyElementTimers.set(e,window.setTimeout(()=>{this.showInitial(),this.clipboardCopyElementTimers.delete(e)},Jo))}showConfirm(){this.hasConfirmedTarget&&(this.confirmedTarget.classList.remove("hidden"),this.confirmedTarget.classList.add("inline-block"),this.initialTarget.classList.add("hidden"))}showInitial(){this.initialTarget.classList.remove("hidden"),this.initialTarget.classList.add("inline-block"),this.hasConfirmedTarget&&this.confirmedTarget.classList.add("hidden")}}const ta=Object.freeze(Object.defineProperty({__proto__:null,default:Qo},Symbol.toStringTag,{value:"Module"})),Z=Math.min,k=Math.max,se=Math.round,Yt=Math.floor,Q=n=>({x:n,y:n}),ea={left:"right",right:"left",bottom:"top",top:"bottom"},na={start:"end",end:"start"};function es(n,t,e){return k(n,Z(t,e))}function Wt(n,t){return typeof n=="function"?n(t):n}function tt(n){return n.split("-")[0]}function Ut(n){return n.split("-")[1]}function qs(n){return n==="x"?"y":"x"}function Ys(n){return n==="y"?"height":"width"}function ct(n){return["top","bottom"].includes(tt(n))?"y":"x"}function Xs(n){return qs(ct(n))}function sa(n,t,e){e===void 0&&(e=!1);const s=Ut(n),i=Xs(n),r=Ys(i);let o=i==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(o=ie(o)),[o,ie(o)]}function ia(n){const t=ie(n);return[Ve(n),t,Ve(t)]}function Ve(n){return n.replace(/start|end/g,t=>na[t])}function ra(n,t,e){const s=["left","right"],i=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return e?t?i:s:t?s:i;case"left":case"right":return t?r:o;default:return[]}}function oa(n,t,e,s){const i=Ut(n);let r=ra(tt(n),e==="start",s);return i&&(r=r.map(o=>o+"-"+i),t&&(r=r.concat(r.map(Ve)))),r}function ie(n){return n.replace(/left|right|bottom|top/g,t=>ea[t])}function aa(n){return{top:0,right:0,bottom:0,left:0,...n}}function ca(n){return typeof n!="number"?aa(n):{top:n,right:n,bottom:n,left:n}}function re(n){const{x:t,y:e,width:s,height:i}=n;return{width:s,height:i,top:e,left:t,right:t+s,bottom:e+i,x:t,y:e}}function ns(n,t,e){let{reference:s,floating:i}=n;const r=ct(t),o=Xs(t),a=Ys(o),c=tt(t),l=r==="y",u=s.x+s.width/2-i.width/2,d=s.y+s.height/2-i.height/2,h=s[a]/2-i[a]/2;let m;switch(c){case"top":m={x:u,y:s.y-i.height};break;case"bottom":m={x:u,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:d};break;case"left":m={x:s.x-i.width,y:d};break;default:m={x:s.x,y:s.y}}switch(Ut(t)){case"start":m[o]-=h*(e&&l?-1:1);break;case"end":m[o]+=h*(e&&l?-1:1);break}return m}const la=async(n,t,e)=>{const{placement:s="bottom",strategy:i="absolute",middleware:r=[],platform:o}=e,a=r.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let l=await o.getElementRects({reference:n,floating:t,strategy:i}),{x:u,y:d}=ns(l,s,c),h=s,m={},f=0;for(let g=0;g<a.length;g++){const{name:b,fn:p}=a[g],{x:w,y:E,data:v,reset:y}=await p({x:u,y:d,initialPlacement:s,placement:h,strategy:i,middlewareData:m,rects:l,platform:o,elements:{reference:n,floating:t}});u=w??u,d=E??d,m={...m,[b]:{...m[b],...v}},y&&f<=50&&(f++,typeof y=="object"&&(y.placement&&(h=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:n,floating:t,strategy:i}):y.rects),{x:u,y:d}=ns(l,h,c)),g=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:m}};async function Qe(n,t){var e;t===void 0&&(t={});const{x:s,y:i,platform:r,rects:o,elements:a,strategy:c}=n,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=Wt(t,n),f=ca(m),b=a[h?d==="floating"?"reference":"floating":d],p=re(await r.getClippingRect({element:(e=await(r.isElement==null?void 0:r.isElement(b)))==null||e?b:b.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),w=d==="floating"?{x:s,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),v=await(r.isElement==null?void 0:r.isElement(E))?await(r.getScale==null?void 0:r.getScale(E))||{x:1,y:1}:{x:1,y:1},y=re(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:E,strategy:c}):w);return{top:(p.top-y.top+f.top)/v.y,bottom:(y.bottom-p.bottom+f.bottom)/v.y,left:(p.left-y.left+f.left)/v.x,right:(y.right-p.right+f.right)/v.x}}const ua=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var e,s;const{placement:i,middlewareData:r,rects:o,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:g=!0,...b}=Wt(n,t);if((e=r.arrow)!=null&&e.alignmentOffset)return{};const p=tt(i),w=ct(a),E=tt(a)===a,v=await(c.isRTL==null?void 0:c.isRTL(l.floating)),y=h||(E||!g?[ie(a)]:ia(a)),x=f!=="none";!h&&x&&y.push(...oa(a,g,f,v));const S=[a,...y],B=await Qe(t,b),A=[];let R=((s=r.flip)==null?void 0:s.overflows)||[];if(u&&A.push(B[p]),d){const H=sa(i,o,v);A.push(B[H[0]],B[H[1]])}if(R=[...R,{placement:i,overflows:A}],!A.every(H=>H<=0)){var T,q;const H=(((T=r.flip)==null?void 0:T.index)||0)+1,hn=S[H];if(hn)return{data:{index:H,overflows:R},reset:{placement:hn}};let Tt=(q=R.filter(ut=>ut.overflows[0]<=0).sort((ut,Y)=>ut.overflows[1]-Y.overflows[1])[0])==null?void 0:q.placement;if(!Tt)switch(m){case"bestFit":{var I;const ut=(I=R.filter(Y=>{if(x){const X=ct(Y.placement);return X===w||X==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(X=>X>0).reduce((X,fi)=>X+fi,0)]).sort((Y,X)=>Y[1]-X[1])[0])==null?void 0:I[0];ut&&(Tt=ut);break}case"initialPlacement":Tt=a;break}if(i!==Tt)return{reset:{placement:Tt}}}return{}}}};async function ha(n,t){const{placement:e,platform:s,elements:i}=n,r=await(s.isRTL==null?void 0:s.isRTL(i.floating)),o=tt(e),a=Ut(e),c=ct(e)==="y",l=["left","top"].includes(o)?-1:1,u=r&&c?-1:1,d=Wt(t,n);let{mainAxis:h,crossAxis:m,alignmentAxis:f}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&typeof f=="number"&&(m=a==="end"?f*-1:f),c?{x:m*u,y:h*l}:{x:h*l,y:m*u}}const da=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var e,s;const{x:i,y:r,placement:o,middlewareData:a}=t,c=await ha(t,n);return o===((e=a.offset)==null?void 0:e.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+c.x,y:r+c.y,data:{...c,placement:o}}}}},fa=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){const{x:e,y:s,placement:i}=t,{mainAxis:r=!0,crossAxis:o=!1,limiter:a={fn:b=>{let{x:p,y:w}=b;return{x:p,y:w}}},...c}=Wt(n,t),l={x:e,y:s},u=await Qe(t,c),d=ct(tt(i)),h=qs(d);let m=l[h],f=l[d];if(r){const b=h==="y"?"top":"left",p=h==="y"?"bottom":"right",w=m+u[b],E=m-u[p];m=es(w,m,E)}if(o){const b=d==="y"?"top":"left",p=d==="y"?"bottom":"right",w=f+u[b],E=f-u[p];f=es(w,f,E)}const g=a.fn({...t,[h]:m,[d]:f});return{...g,data:{x:g.x-e,y:g.y-s}}}}},ma=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(t){const{placement:e,rects:s,platform:i,elements:r}=t,{apply:o=()=>{},...a}=Wt(n,t),c=await Qe(t,a),l=tt(e),u=Ut(e),d=ct(e)==="y",{width:h,height:m}=s.floating;let f,g;l==="top"||l==="bottom"?(f=l,g=u===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(g=l,f=u==="end"?"top":"bottom");const b=m-c.top-c.bottom,p=h-c.left-c.right,w=Z(m-c[f],b),E=Z(h-c[g],p),v=!t.middlewareData.shift;let y=w,x=E;if(d?x=u||v?Z(E,p):p:y=u||v?Z(w,b):b,v&&!u){const B=k(c.left,0),A=k(c.right,0),R=k(c.top,0),T=k(c.bottom,0);d?x=h-2*(B!==0||A!==0?B+A:k(c.left,c.right)):y=m-2*(R!==0||T!==0?R+T:k(c.top,c.bottom))}await o({...t,availableWidth:x,availableHeight:y});const S=await i.getDimensions(r.floating);return h!==S.width||m!==S.height?{reset:{rects:!0}}:{}}}};function At(n){return Gs(n)?(n.nodeName||"").toLowerCase():"#document"}function L(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function z(n){var t;return(t=(Gs(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function Gs(n){return n instanceof Node||n instanceof L(n).Node}function P(n){return n instanceof Element||n instanceof L(n).Element}function j(n){return n instanceof HTMLElement||n instanceof L(n).HTMLElement}function ss(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof L(n).ShadowRoot}function Kt(n){const{overflow:t,overflowX:e,overflowY:s,display:i}=N(n);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(i)}function pa(n){return["table","td","th"].includes(At(n))}function de(n){return[":popover-open",":modal"].some(t=>{try{return n.matches(t)}catch{return!1}})}function tn(n){const t=en(),e=P(n)?N(n):n;return e.transform!=="none"||e.perspective!=="none"||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(e.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(e.contain||"").includes(s))}function ga(n){let t=et(n);for(;j(t)&&!Et(t);){if(tn(t))return t;if(de(t))return null;t=et(t)}return null}function en(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Et(n){return["html","body","#document"].includes(At(n))}function N(n){return L(n).getComputedStyle(n)}function fe(n){return P(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function et(n){if(At(n)==="html")return n;const t=n.assignedSlot||n.parentNode||ss(n)&&n.host||z(n);return ss(t)?t.host:t}function Zs(n){const t=et(n);return Et(t)?n.ownerDocument?n.ownerDocument.body:n.body:j(t)&&Kt(t)?t:Zs(t)}function jt(n,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=Zs(n),r=i===((s=n.ownerDocument)==null?void 0:s.body),o=L(i);if(r){const a=He(o);return t.concat(o,o.visualViewport||[],Kt(i)?i:[],a&&e?jt(a):[])}return t.concat(i,jt(i,[],e))}function He(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Js(n){const t=N(n);let e=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=j(n),r=i?n.offsetWidth:e,o=i?n.offsetHeight:s,a=se(e)!==r||se(s)!==o;return a&&(e=r,s=o),{width:e,height:s,$:a}}function nn(n){return P(n)?n:n.contextElement}function vt(n){const t=nn(n);if(!j(t))return Q(1);const e=t.getBoundingClientRect(),{width:s,height:i,$:r}=Js(t);let o=(r?se(e.width):e.width)/s,a=(r?se(e.height):e.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const ba=Q(0);function Qs(n){const t=L(n);return!en()||!t.visualViewport?ba:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function va(n,t,e){return t===void 0&&(t=!1),!e||t&&e!==L(n)?!1:t}function lt(n,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),r=nn(n);let o=Q(1);t&&(s?P(s)&&(o=vt(s)):o=vt(n));const a=va(r,e,s)?Qs(r):Q(0);let c=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(r){const h=L(r),m=s&&P(s)?L(s):s;let f=h,g=He(f);for(;g&&s&&m!==f;){const b=vt(g),p=g.getBoundingClientRect(),w=N(g),E=p.left+(g.clientLeft+parseFloat(w.paddingLeft))*b.x,v=p.top+(g.clientTop+parseFloat(w.paddingTop))*b.y;c*=b.x,l*=b.y,u*=b.x,d*=b.y,c+=E,l+=v,f=L(g),g=He(f)}}return re({width:u,height:d,x:c,y:l})}function ya(n){let{elements:t,rect:e,offsetParent:s,strategy:i}=n;const r=i==="fixed",o=z(s),a=t?de(t.floating):!1;if(s===o||a&&r)return e;let c={scrollLeft:0,scrollTop:0},l=Q(1);const u=Q(0),d=j(s);if((d||!d&&!r)&&((At(s)!=="body"||Kt(o))&&(c=fe(s)),j(s))){const h=lt(s);l=vt(s),u.x=h.x+s.clientLeft,u.y=h.y+s.clientTop}return{width:e.width*l.x,height:e.height*l.y,x:e.x*l.x-c.scrollLeft*l.x+u.x,y:e.y*l.y-c.scrollTop*l.y+u.y}}function wa(n){return Array.from(n.getClientRects())}function ti(n){return lt(z(n)).left+fe(n).scrollLeft}function Ea(n){const t=z(n),e=fe(n),s=n.ownerDocument.body,i=k(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),r=k(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-e.scrollLeft+ti(n);const a=-e.scrollTop;return N(s).direction==="rtl"&&(o+=k(t.clientWidth,s.clientWidth)-i),{width:i,height:r,x:o,y:a}}function Aa(n,t){const e=L(n),s=z(n),i=e.visualViewport;let r=s.clientWidth,o=s.clientHeight,a=0,c=0;if(i){r=i.width,o=i.height;const l=en();(!l||l&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:r,height:o,x:a,y:c}}function Ta(n,t){const e=lt(n,!0,t==="fixed"),s=e.top+n.clientTop,i=e.left+n.clientLeft,r=j(n)?vt(n):Q(1),o=n.clientWidth*r.x,a=n.clientHeight*r.y,c=i*r.x,l=s*r.y;return{width:o,height:a,x:c,y:l}}function is(n,t,e){let s;if(t==="viewport")s=Aa(n,e);else if(t==="document")s=Ea(z(n));else if(P(t))s=Ta(t,e);else{const i=Qs(n);s={...t,x:t.x-i.x,y:t.y-i.y}}return re(s)}function ei(n,t){const e=et(n);return e===t||!P(e)||Et(e)?!1:N(e).position==="fixed"||ei(e,t)}function xa(n,t){const e=t.get(n);if(e)return e;let s=jt(n,[],!1).filter(a=>P(a)&&At(a)!=="body"),i=null;const r=N(n).position==="fixed";let o=r?et(n):n;for(;P(o)&&!Et(o);){const a=N(o),c=tn(o);!c&&a.position==="fixed"&&(i=null),(r?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Kt(o)&&!c&&ei(n,o))?s=s.filter(u=>u!==o):i=a,o=et(o)}return t.set(n,s),s}function Oa(n){let{element:t,boundary:e,rootBoundary:s,strategy:i}=n;const o=[...e==="clippingAncestors"?de(t)?[]:xa(t,this._c):[].concat(e),s],a=o[0],c=o.reduce((l,u)=>{const d=is(t,u,i);return l.top=k(d.top,l.top),l.right=Z(d.right,l.right),l.bottom=Z(d.bottom,l.bottom),l.left=k(d.left,l.left),l},is(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Sa(n){const{width:t,height:e}=Js(n);return{width:t,height:e}}function Ma(n,t,e){const s=j(t),i=z(t),r=e==="fixed",o=lt(n,!0,r,t);let a={scrollLeft:0,scrollTop:0};const c=Q(0);if(s||!s&&!r)if((At(t)!=="body"||Kt(i))&&(a=fe(t)),s){const d=lt(t,!0,r,t);c.x=d.x+t.clientLeft,c.y=d.y+t.clientTop}else i&&(c.x=ti(i));const l=o.left+a.scrollLeft-c.x,u=o.top+a.scrollTop-c.y;return{x:l,y:u,width:o.width,height:o.height}}function xe(n){return N(n).position==="static"}function rs(n,t){return!j(n)||N(n).position==="fixed"?null:t?t(n):n.offsetParent}function ni(n,t){const e=L(n);if(de(n))return e;if(!j(n)){let i=et(n);for(;i&&!Et(i);){if(P(i)&&!xe(i))return i;i=et(i)}return e}let s=rs(n,t);for(;s&&pa(s)&&xe(s);)s=rs(s,t);return s&&Et(s)&&xe(s)&&!tn(s)?e:s||ga(n)||e}const ka=async function(n){const t=this.getOffsetParent||ni,e=this.getDimensions,s=await e(n.floating);return{reference:Ma(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Ca(n){return N(n).direction==="rtl"}const La={convertOffsetParentRelativeRectToViewportRelativeRect:ya,getDocumentElement:z,getClippingRect:Oa,getOffsetParent:ni,getElementRects:ka,getClientRects:wa,getDimensions:Sa,getScale:vt,isElement:P,isRTL:Ca};function Fa(n,t){let e=null,s;const i=z(n);function r(){var a;clearTimeout(s),(a=e)==null||a.disconnect(),e=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),r();const{left:l,top:u,width:d,height:h}=n.getBoundingClientRect();if(a||t(),!d||!h)return;const m=Yt(u),f=Yt(i.clientWidth-(l+d)),g=Yt(i.clientHeight-(u+h)),b=Yt(l),w={rootMargin:-m+"px "+-f+"px "+-g+"px "+-b+"px",threshold:k(0,Z(1,c))||1};let E=!0;function v(y){const x=y[0].intersectionRatio;if(x!==c){if(!E)return o();x?o(!1,x):s=setTimeout(()=>{o(!1,1e-7)},1e3)}E=!1}try{e=new IntersectionObserver(v,{...w,root:i.ownerDocument})}catch{e=new IntersectionObserver(v,w)}e.observe(n)}return o(!0),r}function sn(n,t,e,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,l=nn(n),u=i||r?[...l?jt(l):[],...jt(t)]:[];u.forEach(p=>{i&&p.addEventListener("scroll",e,{passive:!0}),r&&p.addEventListener("resize",e)});const d=l&&a?Fa(l,e):null;let h=-1,m=null;o&&(m=new ResizeObserver(p=>{let[w]=p;w&&w.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var E;(E=m)==null||E.observe(t)})),e()}),l&&!c&&m.observe(l),m.observe(t));let f,g=c?lt(n):null;c&&b();function b(){const p=lt(n);g&&(p.x!==g.x||p.y!==g.y||p.width!==g.width||p.height!==g.height)&&e(),g=p,f=requestAnimationFrame(b)}return e(),()=>{var p;u.forEach(w=>{i&&w.removeEventListener("scroll",e),r&&w.removeEventListener("resize",e)}),d==null||d(),(p=m)==null||p.disconnect(),m=null,c&&cancelAnimationFrame(f)}}const rn=da,on=fa,an=ua,Da=ma,cn=(n,t,e)=>{const s=new Map,i={platform:La,...e},r={...i.platform,_c:s};return la(n,t,{...i,platform:r})},os=(n,t)=>{const e=n[t];return typeof e=="function"?e:(...s)=>{}},We=(n,t,e)=>{let s=n;return e===!0?s=`${t.identifier}:${n}`:typeof e=="string"&&(s=`${e}:${n}`),s},Ue=(n,t,e)=>{const{bubbles:s,cancelable:i,composed:r}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(e,{originalEvent:t}),new CustomEvent(n,{bubbles:s,cancelable:i,composed:r,detail:e})};function _a(n){const t=n.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,i=t.top<=e&&t.top+t.height>0,r=t.left<=s&&t.left+t.width>0;return i&&r}function Ba(n,t){var e={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&t.indexOf(s)<0&&(e[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(n);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(n,s[i])&&(e[s[i]]=n[s[i]]);return e}const Oe={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class Ra{constructor(t,e={}){var s,i,r;this.log=(c,l)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${c}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},l)),this.logger.groupEnd())},this.warn=c=>{this.logger.warn(`%c${this.controller.identifier} %c${c}`,"color: #3B82F6; font-weight: bold","color: unset")},this.dispatch=(c,l={})=>{if(this.dispatchEvent){const{event:u}=l,d=Ba(l,["event"]),h=this.extendedEvent(c,u||null,d);this.targetElement.dispatchEvent(h),this.log("dispatchEvent",Object.assign({eventName:h.type},d))}},this.call=(c,l={})=>{const u=this.controller[c];if(typeof u=="function")return u.call(this.controller,l)},this.extendedEvent=(c,l,u)=>{const{bubbles:d,cancelable:h,composed:m}=l||{bubbles:!0,cancelable:!0,composed:!0};return l&&Object.assign(u,{originalEvent:l}),new CustomEvent(this.composeEventName(c),{bubbles:d,cancelable:h,composed:m,detail:u})},this.composeEventName=c=>{let l=c;return this.eventPrefix===!0?l=`${this.controller.identifier}:${c}`:typeof this.eventPrefix=="string"&&(l=`${this.eventPrefix}:${c}`),l},this.debug=(i=(s=e==null?void 0:e.debug)!==null&&s!==void 0?s:t.application.stimulusUseDebug)!==null&&i!==void 0?i:Oe.debug,this.logger=(r=e==null?void 0:e.logger)!==null&&r!==void 0?r:Oe.logger,this.controller=t,this.controllerId=t.element.id||t.element.dataset.id,this.targetElement=(e==null?void 0:e.element)||t.element;const{dispatchEvent:o,eventPrefix:a}=Object.assign({},Oe,e);Object.assign(this,{dispatchEvent:o,eventPrefix:a}),this.controllerInitialize=t.initialize.bind(t),this.controllerConnect=t.connect.bind(t),this.controllerDisconnect=t.disconnect.bind(t)}}const $a={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},si=(n,t={})=>{const e=n,{onlyVisible:s,dispatchEvent:i,events:r,eventPrefix:o}=Object.assign({},$a,t),a=d=>{const h=(t==null?void 0:t.element)||e.element;if(!(h.contains(d.target)||!_a(h)&&s)&&(e.clickOutside&&e.clickOutside(d),i)){const m=We("click:outside",e,o),f=Ue(m,d,{controller:e});h.dispatchEvent(f)}},c=()=>{r==null||r.forEach(d=>{window.addEventListener(d,a,!0)})},l=()=>{r==null||r.forEach(d=>{window.removeEventListener(d,a,!0)})},u=e.disconnect.bind(e);return Object.assign(e,{disconnect(){l(),u()}}),c(),[c,l]};class Pa extends K{}Pa.debounces=[];const Na=200,as=(n,t=Na)=>{let e=null;return function(){const s=Array.from(arguments),i=this,r=s.map(a=>a.params),o=()=>(s.forEach((a,c)=>a.params=r[c]),n.apply(i,s));e&&clearTimeout(e),e=setTimeout(o,t)}},Ia=(n,t)=>{const e=n;e.constructor.debounces.forEach(i=>{if(typeof i=="string"&&(e[i]=as(e[i],void 0)),typeof i=="object"){const{name:r,wait:o}=i;if(!r)return;e[r]=as(e[r],o||void 0)}})},ja={dispatchEvent:!0,eventPrefix:!0,visibleAttribute:"isVisible"},Va=(n,t={})=>{const e=n,{dispatchEvent:s,eventPrefix:i,visibleAttribute:r}=Object.assign({},ja,t),o=(t==null?void 0:t.element)||e.element;e.intersectionElements||(e.intersectionElements=[]),e.intersectionElements.push(o);const a=v=>{const[y]=v;y.isIntersecting?l(y):o.hasAttribute(r)&&u(y)},c=new IntersectionObserver(a,t),l=v=>{if(o.setAttribute(r,"true"),os(e,"appear").call(e,v,c),s){const y=We("appear",e,i),x=Ue(y,null,{controller:e,entry:v,observer:c});o.dispatchEvent(x)}},u=v=>{if(o.removeAttribute(r),os(e,"disappear").call(e,v,c),s){const y=We("disappear",e,i),x=Ue(y,null,{controller:e,entry:v,observer:c});o.dispatchEvent(x)}},d=e.disconnect.bind(e),h=()=>{f(),d()},m=()=>{c.observe(o)},f=()=>{c.unobserve(o)},g=()=>e.intersectionElements.filter(v=>v.hasAttribute(r)).length===0,b=()=>e.intersectionElements.filter(v=>v.hasAttribute(r)).length===1,p=()=>e.intersectionElements.some(v=>v.hasAttribute(r)),w=()=>e.intersectionElements.every(v=>v.hasAttribute(r));return Object.assign(e,{isVisible:w,noneVisible:g,oneVisible:b,atLeastOneVisible:p,allVisible:w,disconnect:h}),m(),[m,f]};class Ha extends Ra{constructor(t,e={}){super(t,e),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(s){this.controller.application.handleError(s,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=s=>{this.call("mutate",s),this.log("mutate",{entries:s}),this.dispatch("mutate",{entries:s})},this.targetElement=(e==null?void 0:e.element)||t.element,this.controller=t,this.options=e,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const t=this.controller.disconnect.bind(this.controller),e=()=>{this.unobserve(),t()};Object.assign(this.controller,{disconnect:e})}}const ln=(n,t={})=>{const e=new Ha(n,t);return[e.observe,e.unobserve]};class Wa extends K{}Wa.throttles=[];class Ua extends V()({targets:{wrapper:HTMLDetailsElement,button:HTMLElement,popover:Le,options:HTMLDivElement},values:{clamped:Boolean,placement:String,dynamicLabelPrefix:String}}){constructor(){super(...arguments),this.changedIds=new Set}clickOutside(){this.element.open=!1,this.setupAutoUpdate(),this.close()}close(){this.changedIds.size>0&&(this.dispatch("changed"),this.changedIds.clear())}connect(){si(this),ln(this,{childList:!0,subtree:!0}),this.setupAutoUpdate(),this.setupForm()}disconnect(){var t;(t=this.unsubAutoUpdate)==null||t.call(this)}setupForm(){for(const t of["checkbox","radio"])for(const e of this.popoverTarget.querySelectorAll(`input[type="${t}"]`))e.addEventListener("change",s=>{const i=s.target;this.changedIds.has(i)?this.changedIds.delete(i):this.changedIds.add(i),this.dispatch("clicked",{detail:i})})}setupAutoUpdate(){var e;if(!this.element.open){(e=this.unsubAutoUpdate)==null||e.call(this);return}const t=()=>{const s=this.optionsTarget,i=this.clampedValue;cn(this.buttonTarget,this.popoverTarget,{middleware:[rn(6),an(),on({padding:6}),Da({apply({availableHeight:r}){let o=r-6;i&&o>400&&(o=400),Object.assign(s.style,{maxHeight:`${o}px`})}})],placement:this.placementValue,strategy:"fixed"}).then(({x:r,y:o})=>{Object.assign(this.popoverTarget.style,{left:`${r}px`,top:`${o}px`})})};t(),this.unsubAutoUpdate=sn(this.buttonTarget,this.popoverTarget,t)}updateButtonLabel(t){var r;const s=t.target.querySelector("input[type=radio]:checked");if(!s)return;const i=((r=s.labels)==null?void 0:r.item(0)).textContent;this.buttonTarget.querySelector('[data-ariadne-ui-button-target="content"]').textContent=`${this.dynamicLabelPrefixValue}${i}`}toggle(){this.element.open=!this.element.open,this.setupAutoUpdate()}}const Ka=Object.freeze(Object.defineProperty({__proto__:null,default:Ua},Symbol.toStringTag,{value:"Module"}));function za(n){if(Array.isArray(n)){for(var t=0,e=Array(n.length);t<n.length;t++)e[t]=n[t];return e}else return Array.from(n)}var un=!1;if(typeof window<"u"){var cs={get passive(){un=!0}};window.addEventListener("testPassive",null,cs),window.removeEventListener("testPassive",null,cs)}var oe=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),at=[],ae=!1,ii=-1,Rt=void 0,rt=void 0,$t=void 0,ri=function(t){return at.some(function(e){return!!(e.options.allowTouchMove&&e.options.allowTouchMove(t))})},ce=function(t){var e=t||window.event;return ri(e.target)||e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)},qa=function(t){if($t===void 0){var e=!!t&&t.reserveScrollBarGap===!0,s=window.innerWidth-document.documentElement.clientWidth;if(e&&s>0){var i=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);$t=document.body.style.paddingRight,document.body.style.paddingRight=i+s+"px"}}Rt===void 0&&(Rt=document.body.style.overflow,document.body.style.overflow="hidden")},Ya=function(){$t!==void 0&&(document.body.style.paddingRight=$t,$t=void 0),Rt!==void 0&&(document.body.style.overflow=Rt,Rt=void 0)},Xa=function(){return window.requestAnimationFrame(function(){if(rt===void 0){rt={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var t=window,e=t.scrollY,s=t.scrollX,i=t.innerHeight;document.body.style.position="fixed",document.body.style.top=-e,document.body.style.left=-s,setTimeout(function(){return window.requestAnimationFrame(function(){var r=i-window.innerHeight;r&&e>=i&&(document.body.style.top=-(e+r))})},300)}})},Ga=function(){if(rt!==void 0){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=rt.position,document.body.style.top=rt.top,document.body.style.left=rt.left,window.scrollTo(e,t),rt=void 0}},Za=function(t){return t?t.scrollHeight-t.scrollTop<=t.clientHeight:!1},Ja=function(t,e){var s=t.targetTouches[0].clientY-ii;return ri(t.target)?!1:e&&e.scrollTop===0&&s>0||Za(e)&&s<0?ce(t):(t.stopPropagation(),!0)},Qa=function(t,e){if(!t){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!at.some(function(i){return i.targetElement===t})){var s={targetElement:t,options:e||{}};at=[].concat(za(at),[s]),oe?Xa():qa(e),oe&&(t.ontouchstart=function(i){i.targetTouches.length===1&&(ii=i.targetTouches[0].clientY)},t.ontouchmove=function(i){i.targetTouches.length===1&&Ja(i,t)},ae||(document.addEventListener("touchmove",ce,un?{passive:!1}:void 0),ae=!0))}},tc=function(t){if(!t){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}at=at.filter(function(e){return e.targetElement!==t}),oe&&(t.ontouchstart=null,t.ontouchmove=null,ae&&at.length===0&&(document.removeEventListener("touchmove",ce,un?{passive:!1}:void 0),ae=!1)),oe?Ga():Ya()};class ec extends V()({targets:{dialog:HTMLDialogElement}}){close(){this.dialogTarget.open&&(this.dialogTarget.close(),tc(this.dialogTarget))}disconnect(){this.close()}open(){this.dialogTarget.showModal(),Qa(this.dialogTarget,{reserveScrollBarGap:!0})}triggerClick(){this.dialogTarget.open?this.close():this.open()}windowClick(t){t.target===this.dialogTarget&&this.close()}}const nc=Object.freeze(Object.defineProperty({__proto__:null,default:ec},Symbol.toStringTag,{value:"Module"}));async function sc(n,t=null){n.classList.remove("hidden"),await oi("enter",n,t)}async function ic(n,t=null){await oi("leave",n,t),n.classList.add("hidden")}async function oi(n,t,e){const s=t.dataset,i=e?`${e}-${n}`:n;let r=`transition${n.charAt(0).toUpperCase()+n.slice(1)}`;const o=s[r]?s[r].split(" "):[i],a=s[`${r}Start`]?s[`${r}Start`].split(" "):[`${i}-start`],c=s[`${r}End`]?s[`${r}End`].split(" "):[`${i}-end`];Se(t,o),Se(t,a),await rc(),Me(t,a),Se(t,c),await oc(t),Me(t,c),Me(t,o)}function Se(n,t){n.classList.add(...t)}function Me(n,t){n.classList.remove(...t)}function rc(){return new Promise(n=>{requestAnimationFrame(()=>{requestAnimationFrame(n)})})}function oc(n){return new Promise(t=>{const e=getComputedStyle(n).transitionDuration.split(",")[0],s=Number(e.replace("s",""))*1e3;setTimeout(()=>{t()},s)})}const ue=class ue extends K{async connect(){await this.show();const t=()=>{};setTimeout(()=>{this.hide().then(t).catch(t)},this.timerValue)}async disconnect(){await this.hide()}async hide(){await ic(this.element),this.hasHiddenClass?this.element.classList.add(this.hiddenClass):this.element.classList.add("hidden"),this.element.remove()}async show(){this.hasHiddenClass?this.element.classList.remove(this.hiddenClass):this.element.classList.remove("hidden"),await sc(this.element)}};ue.classes=["ariadne-hidden"],ue.values={timer:{default:4e3,type:Number}};let Ke=ue;const ac=Object.freeze(Object.defineProperty({__proto__:null,default:Ke},Symbol.toStringTag,{value:"Module"}));class cc extends V()({targets:{emptyRoot:null,input:HTMLInputElement,searchString:null}}){handleNewQuery(t){let e=!1;for(const{el:s,searchString:i}of this.items){const r=i.includes(t.trim().toLowerCase());!e&&r&&(e=!0),r?s.classList.remove("ariadne-hidden"):s.classList.add("ariadne-hidden")}e?this.emptyRootTarget.classList.add("ariadne-hidden"):this.emptyRootTarget.classList.remove("ariadne-hidden")}connect(){this.items=this.searchStringTargets.map(t=>({el:t,searchString:(t.textContent??"").trim().toLowerCase()})),Va(this)}appear(t,e){this.reset()}handleInput(){this.hasSearchStringTarget&&this.handleNewQuery(this.inputTarget.value)}reset(){this.handleNewQuery(""),this.hasInputTarget&&(this.inputTarget.value="")}}const lc=Object.freeze(Object.defineProperty({__proto__:null,default:cc},Symbol.toStringTag,{value:"Module"}));class uc extends V()({targets:{anchor:null,popover:null},values:{clamped:Boolean,placement:String}}){constructor(){super(...arguments),this.changedIds=new Set,this.clickHandlers=[]}setupClickHandlers(){const t=()=>this.toggle();for(const e of this.clickHandlers)e();this.clickHandlers=[];for(const e of this.anchorTarget.querySelectorAll('button, [tabindex]:not([tabindex="-1"])'))e.addEventListener("click",t),this.clickHandlers.push(()=>e.removeEventListener("click",t))}checkboxClicked(t){const s=t.target.value;this.changedIds.has(s)?this.changedIds.delete(s):this.changedIds.add(s),this.dispatch("clicked",{detail:s})}clickOutside(){this.setupAutoUpdate(),this.close()}close(){this.element.open=!1}connect(){si(this),ln(this,{childList:!0,subtree:!0}),this.setupAutoUpdate(),this.setupClickHandlers()}disconnect(){var t;(t=this.unsubAutoUpdate)==null||t.call(this)}setupAutoUpdate(){var e;if(!this.element.open){(e=this.unsubAutoUpdate)==null||e.call(this);return}const t=()=>{cn(this.anchorTarget,this.popoverTarget,{middleware:[rn(6),an(),on({padding:6})],placement:this.placementValue,strategy:"fixed"}).then(({x:s,y:i})=>{Object.assign(this.popoverTarget.style,{left:`${s}px`,top:`${i}px`})})};t(),this.unsubAutoUpdate=sn(this.anchorTarget,this.popoverTarget,t)}toggle(){this.element.open=!this.element.open,this.setupAutoUpdate()}}const hc=Object.freeze(Object.defineProperty({__proto__:null,default:uc},Symbol.toStringTag,{value:"Module"}));class dc extends V()({targets:{button:HTMLButtonElement,popover:HTMLElement},values:{placement:String}}){connect(){this.popoverTarget.addEventListener("toggle",t=>{t.newState==="open"&&this.updatePosition()})}updatePosition(){sn(this.buttonTarget,this.popoverTarget,()=>{cn(this.buttonTarget,this.popoverTarget,{placement:this.placementValue,middleware:[rn(5),an(),on({padding:5})]}).then(({x:t,y:e})=>{Object.assign(this.buttonTarget.style,{left:`${t}px`,top:`${e}px`})})})}}const fc=Object.freeze(Object.defineProperty({__proto__:null,default:dc},Symbol.toStringTag,{value:"Module"}));var mc=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},ls=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},Ft;class pc{formatToParts(t){const e=[];for(const s of t)e.push({type:"element",value:s}),e.push({type:"literal",value:", "});return e.slice(0,-1)}}const gc=typeof Intl<"u"&&Intl.ListFormat||pc,bc=[["years","year"],["months","month"],["weeks","week"],["days","day"],["hours","hour"],["minutes","minute"],["seconds","second"],["milliseconds","millisecond"]],vc={minimumIntegerDigits:2};class yc{constructor(t,e={}){Ft.set(this,void 0);let s=String(e.style||"short");s!=="long"&&s!=="short"&&s!=="narrow"&&s!=="digital"&&(s="short");let i=s==="digital"?"numeric":s;const r=e.hours||i;i=r==="2-digit"?"numeric":r;const o=e.minutes||i;i=o==="2-digit"?"numeric":o;const a=e.seconds||i;i=a==="2-digit"?"numeric":a;const c=e.milliseconds||i;mc(this,Ft,{locale:t,style:s,years:e.years||s==="digital"?"short":s,yearsDisplay:e.yearsDisplay==="always"?"always":"auto",months:e.months||s==="digital"?"short":s,monthsDisplay:e.monthsDisplay==="always"?"always":"auto",weeks:e.weeks||s==="digital"?"short":s,weeksDisplay:e.weeksDisplay==="always"?"always":"auto",days:e.days||s==="digital"?"short":s,daysDisplay:e.daysDisplay==="always"?"always":"auto",hours:r,hoursDisplay:e.hoursDisplay==="always"||s==="digital"?"always":"auto",minutes:o,minutesDisplay:e.minutesDisplay==="always"||s==="digital"?"always":"auto",seconds:a,secondsDisplay:e.secondsDisplay==="always"||s==="digital"?"always":"auto",milliseconds:c,millisecondsDisplay:e.millisecondsDisplay==="always"?"always":"auto"},"f")}resolvedOptions(){return ls(this,Ft,"f")}formatToParts(t){const e=[],s=ls(this,Ft,"f"),i=s.style,r=s.locale;for(const[o,a]of bc){const c=t[o];if(s[`${o}Display`]==="auto"&&!c)continue;const l=s[o],u=l==="2-digit"?vc:l==="numeric"?{}:{style:"unit",unit:a,unitDisplay:l};e.push(new Intl.NumberFormat(r,u).format(c))}return new gc(r,{type:"unit",style:i==="digital"?"short":i}).formatToParts(e)}format(t){return this.formatToParts(t).map(e=>e.value).join("")}}Ft=new WeakMap;const ai=/^[-+]?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,le=["year","month","week","day","hour","minute","second","millisecond"],wc=n=>ai.test(n);class C{constructor(t=0,e=0,s=0,i=0,r=0,o=0,a=0,c=0){this.years=t,this.months=e,this.weeks=s,this.days=i,this.hours=r,this.minutes=o,this.seconds=a,this.milliseconds=c,this.years||(this.years=0),this.sign||(this.sign=Math.sign(this.years)),this.months||(this.months=0),this.sign||(this.sign=Math.sign(this.months)),this.weeks||(this.weeks=0),this.sign||(this.sign=Math.sign(this.weeks)),this.days||(this.days=0),this.sign||(this.sign=Math.sign(this.days)),this.hours||(this.hours=0),this.sign||(this.sign=Math.sign(this.hours)),this.minutes||(this.minutes=0),this.sign||(this.sign=Math.sign(this.minutes)),this.seconds||(this.seconds=0),this.sign||(this.sign=Math.sign(this.seconds)),this.milliseconds||(this.milliseconds=0),this.sign||(this.sign=Math.sign(this.milliseconds)),this.blank=this.sign===0}abs(){return new C(Math.abs(this.years),Math.abs(this.months),Math.abs(this.weeks),Math.abs(this.days),Math.abs(this.hours),Math.abs(this.minutes),Math.abs(this.seconds),Math.abs(this.milliseconds))}static from(t){var e;if(typeof t=="string"){const s=String(t).trim(),i=s.startsWith("-")?-1:1,r=(e=s.match(ai))===null||e===void 0?void 0:e.slice(1).map(o=>(Number(o)||0)*i);return r?new C(...r):new C}else if(typeof t=="object"){const{years:s,months:i,weeks:r,days:o,hours:a,minutes:c,seconds:l,milliseconds:u}=t;return new C(s,i,r,o,a,c,l,u)}throw new RangeError("invalid duration")}static compare(t,e){const s=Date.now(),i=Math.abs(us(s,C.from(t)).getTime()-s),r=Math.abs(us(s,C.from(e)).getTime()-s);return i>r?-1:i<r?1:0}toLocaleString(t,e){return new yc(t,e).format(this)}}function us(n,t){const e=new Date(n);return e.setFullYear(e.getFullYear()+t.years),e.setMonth(e.getMonth()+t.months),e.setDate(e.getDate()+t.weeks*7+t.days),e.setHours(e.getHours()+t.hours),e.setMinutes(e.getMinutes()+t.minutes),e.setSeconds(e.getSeconds()+t.seconds),e}function Ec(n,t="second",e=Date.now()){const s=n.getTime()-e;if(s===0)return new C;const i=Math.sign(s),r=Math.abs(s),o=Math.floor(r/1e3),a=Math.floor(o/60),c=Math.floor(a/60),l=Math.floor(c/24),u=Math.floor(l/30),d=Math.floor(u/12),h=le.indexOf(t)||le.length;return new C(h>=0?d*i:0,h>=1?(u-d*12)*i:0,0,h>=3?(l-u*30)*i:0,h>=4?(c-l*24)*i:0,h>=5?(a-c*60)*i:0,h>=6?(o-a*60)*i:0,h>=7?(r-o*1e3)*i:0)}function ci(n,{relativeTo:t=Date.now()}={}){if(t=new Date(t),n.blank)return n;const e=n.sign;let s=Math.abs(n.years),i=Math.abs(n.months),r=Math.abs(n.weeks),o=Math.abs(n.days),a=Math.abs(n.hours),c=Math.abs(n.minutes),l=Math.abs(n.seconds),u=Math.abs(n.milliseconds);u>=900&&(l+=Math.round(u/1e3)),(l||c||a||o||r||i||s)&&(u=0),l>=55&&(c+=Math.round(l/60)),(c||a||o||r||i||s)&&(l=0),c>=55&&(a+=Math.round(c/60)),(a||o||r||i||s)&&(c=0),o&&a>=12&&(o+=Math.round(a/24)),!o&&a>=21&&(o+=Math.round(a/24)),(o||r||i||s)&&(a=0);const d=t.getFullYear(),h=t.getMonth(),m=t.getDate();if(o>=27||s+i+o){const f=new Date(t);f.setDate(1),f.setMonth(h+i*e+1),f.setDate(0);const g=Math.max(0,m-f.getDate()),b=new Date(t);b.setFullYear(d+s*e),b.setDate(m-g),b.setMonth(h+i*e),b.setDate(m-g+o*e);const p=b.getFullYear()-t.getFullYear(),w=b.getMonth()-t.getMonth(),E=Math.abs(Math.round((Number(b)-Number(t))/864e5))+g,v=Math.abs(p*12+w);E<27?(o>=6?(r+=Math.round(o/7),o=0):o=E,i=s=0):v<11?(i=v,s=0):(i=0,s=p*e),(i||s)&&(o=0)}return s&&(i=0),r>=4&&(i+=Math.round(r/4)),(i||s)&&(r=0),o&&r&&!i&&!s&&(r+=Math.round(o/7),o=0),new C(s*e,i*e,r*e,o*e,a*e,c*e,l*e,u*e)}function Ac(n,t){const e=ci(n,t);if(e.blank)return[0,"second"];for(const s of le){if(s==="millisecond")continue;const i=e[`${s}s`];if(i)return[i,s]}return[0,"second"]}var O=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},Xt=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},D,Dt,_t,Ot,it,ze,li,ui,hi,di,dt;const Tc=globalThis.HTMLElement||null,ke=new C,hs=new C(0,0,0,0,0,1);class xc extends Event{constructor(t,e,s,i){super("relative-time-updated",{bubbles:!0,composed:!0}),this.oldText=t,this.newText=e,this.oldTitle=s,this.newTitle=i}}function ds(n){if(!n.date)return 1/0;if(n.format==="duration"||n.format==="elapsed"){const e=n.precision;if(e==="second")return 1e3;if(e==="minute")return 60*1e3}const t=Math.abs(Date.now()-n.date.getTime());return t<60*1e3?1e3:t<60*60*1e3?60*1e3:60*60*1e3}const Ce=new class{constructor(){this.elements=new Set,this.time=1/0,this.timer=-1}observe(n){if(this.elements.has(n))return;this.elements.add(n);const t=n.date;if(t&&t.getTime()){const e=ds(n),s=Date.now()+e;s<this.time&&(clearTimeout(this.timer),this.timer=setTimeout(()=>this.update(),e),this.time=s)}}unobserve(n){this.elements.has(n)&&this.elements.delete(n)}update(){if(clearTimeout(this.timer),!this.elements.size)return;let n=1/0;for(const t of this.elements)n=Math.min(n,ds(t)),t.update();this.time=Math.min(60*60*1e3,n),this.timer=setTimeout(()=>this.update(),this.time),this.time+=Date.now()}};class Oc extends Tc{constructor(){super(...arguments),D.add(this),Dt.set(this,!1),_t.set(this,!1),it.set(this,this.shadowRoot?this.shadowRoot:this.attachShadow?this.attachShadow({mode:"open"}):this),dt.set(this,null)}static define(t="relative-time",e=customElements){return e.define(t,this),this}static get observedAttributes(){return["second","minute","hour","weekday","day","month","year","time-zone-name","prefix","threshold","tense","precision","format","format-style","no-title","datetime","lang","title"]}get onRelativeTimeUpdated(){return O(this,dt,"f")}set onRelativeTimeUpdated(t){O(this,dt,"f")&&this.removeEventListener("relative-time-updated",O(this,dt,"f")),Xt(this,dt,typeof t=="object"||typeof t=="function"?t:null,"f"),typeof t=="function"&&this.addEventListener("relative-time-updated",t)}get second(){const t=this.getAttribute("second");if(t==="numeric"||t==="2-digit")return t}set second(t){this.setAttribute("second",t||"")}get minute(){const t=this.getAttribute("minute");if(t==="numeric"||t==="2-digit")return t}set minute(t){this.setAttribute("minute",t||"")}get hour(){const t=this.getAttribute("hour");if(t==="numeric"||t==="2-digit")return t}set hour(t){this.setAttribute("hour",t||"")}get weekday(){const t=this.getAttribute("weekday");if(t==="long"||t==="short"||t==="narrow")return t;if(this.format==="datetime"&&t!=="")return this.formatStyle}set weekday(t){this.setAttribute("weekday",t||"")}get day(){var t;const e=(t=this.getAttribute("day"))!==null&&t!==void 0?t:"numeric";if(e==="numeric"||e==="2-digit")return e}set day(t){this.setAttribute("day",t||"")}get month(){const t=this.format;let e=this.getAttribute("month");if(e!==""&&(e??(e=t==="datetime"?this.formatStyle:"short"),e==="numeric"||e==="2-digit"||e==="short"||e==="long"||e==="narrow"))return e}set month(t){this.setAttribute("month",t||"")}get year(){var t;const e=this.getAttribute("year");if(e==="numeric"||e==="2-digit")return e;if(!this.hasAttribute("year")&&new Date().getUTCFullYear()!==((t=this.date)===null||t===void 0?void 0:t.getUTCFullYear()))return"numeric"}set year(t){this.setAttribute("year",t||"")}get timeZoneName(){const t=this.getAttribute("time-zone-name");if(t==="long"||t==="short"||t==="shortOffset"||t==="longOffset"||t==="shortGeneric"||t==="longGeneric")return t}set timeZoneName(t){this.setAttribute("time-zone-name",t||"")}get prefix(){var t;return(t=this.getAttribute("prefix"))!==null&&t!==void 0?t:this.format==="datetime"?"":"on"}set prefix(t){this.setAttribute("prefix",t)}get threshold(){const t=this.getAttribute("threshold");return t&&wc(t)?t:"P30D"}set threshold(t){this.setAttribute("threshold",t)}get tense(){const t=this.getAttribute("tense");return t==="past"?"past":t==="future"?"future":"auto"}set tense(t){this.setAttribute("tense",t)}get precision(){const t=this.getAttribute("precision");return le.includes(t)?t:this.format==="micro"?"minute":"second"}set precision(t){this.setAttribute("precision",t)}get format(){const t=this.getAttribute("format");return t==="datetime"?"datetime":t==="relative"?"relative":t==="duration"?"duration":t==="micro"?"micro":t==="elapsed"?"elapsed":"auto"}set format(t){this.setAttribute("format",t)}get formatStyle(){const t=this.getAttribute("format-style");if(t==="long")return"long";if(t==="short")return"short";if(t==="narrow")return"narrow";const e=this.format;return e==="elapsed"||e==="micro"?"narrow":e==="datetime"?"short":"long"}set formatStyle(t){this.setAttribute("format-style",t)}get noTitle(){return this.hasAttribute("no-title")}set noTitle(t){this.toggleAttribute("no-title",t)}get datetime(){return this.getAttribute("datetime")||""}set datetime(t){this.setAttribute("datetime",t)}get date(){const t=Date.parse(this.datetime);return Number.isNaN(t)?null:new Date(t)}set date(t){this.datetime=(t==null?void 0:t.toISOString())||""}connectedCallback(){this.update()}disconnectedCallback(){Ce.unobserve(this)}attributeChangedCallback(t,e,s){e!==s&&(t==="title"&&Xt(this,Dt,s!==null&&(this.date&&O(this,D,"m",ze).call(this,this.date))!==s,"f"),!O(this,_t,"f")&&!(t==="title"&&O(this,Dt,"f"))&&Xt(this,_t,(async()=>{await Promise.resolve(),this.update()})(),"f"))}update(){const t=O(this,it,"f").textContent||this.textContent||"",e=this.getAttribute("title")||"";let s=e;const i=this.date;if(typeof Intl>"u"||!Intl.DateTimeFormat||!i){O(this,it,"f").textContent=t;return}const r=Date.now();O(this,Dt,"f")||(s=O(this,D,"m",ze).call(this,i)||"",s&&!this.noTitle&&this.setAttribute("title",s));const o=Ec(i,this.precision,r),a=O(this,D,"m",li).call(this,o);let c=t;a==="duration"?c=O(this,D,"m",ui).call(this,o):a==="relative"?c=O(this,D,"m",hi).call(this,o):c=O(this,D,"m",di).call(this,i),c?O(this,it,"f").textContent=c:this.shadowRoot===O(this,it,"f")&&this.textContent&&(O(this,it,"f").textContent=this.textContent),(c!==t||s!==e)&&this.dispatchEvent(new xc(t,c,e,s)),a==="relative"||a==="duration"?Ce.observe(this):Ce.unobserve(this),Xt(this,_t,!1,"f")}}Dt=new WeakMap,_t=new WeakMap,it=new WeakMap,dt=new WeakMap,D=new WeakSet,Ot=function(){var t;return((t=this.closest("[lang]"))===null||t===void 0?void 0:t.getAttribute("lang"))||this.ownerDocument.documentElement.getAttribute("lang")||"default"},ze=function(t){return new Intl.DateTimeFormat(O(this,D,"a",Ot),{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)},li=function(t){const e=this.format;if(e==="datetime")return"datetime";if(e==="duration"||e==="elapsed"||e==="micro")return"duration";if((e==="auto"||e==="relative")&&typeof Intl<"u"&&Intl.RelativeTimeFormat){const s=this.tense;if(s==="past"||s==="future"||C.compare(t,this.threshold)===1)return"relative"}return"datetime"},ui=function(t){const e=O(this,D,"a",Ot),s=this.format,i=this.formatStyle,r=this.tense;let o=ke;s==="micro"?(t=ci(t),o=hs,(this.tense==="past"&&t.sign!==-1||this.tense==="future"&&t.sign!==1)&&(t=hs)):(r==="past"&&t.sign!==-1||r==="future"&&t.sign!==1)&&(t=o);const a=`${this.precision}sDisplay`;return t.blank?o.toLocaleString(e,{style:i,[a]:"always"}):t.abs().toLocaleString(e,{style:i})},hi=function(t){const e=new Intl.RelativeTimeFormat(O(this,D,"a",Ot),{numeric:"auto",style:this.formatStyle}),s=this.tense;s==="future"&&t.sign!==1&&(t=ke),s==="past"&&t.sign!==-1&&(t=ke);const[i,r]=Ac(t);return r==="second"&&i<10?e.format(0,this.precision==="millisecond"?"second":this.precision):e.format(i,r)},di=function(t){const e=new Intl.DateTimeFormat(O(this,D,"a",Ot),{second:this.second,minute:this.minute,hour:this.hour,weekday:this.weekday,day:this.day,month:this.month,year:this.year,timeZoneName:this.timeZoneName});return`${this.prefix} ${e.format(t)}`.trim()};const fs=typeof globalThis<"u"?globalThis:window;try{fs.RelativeTimeElement=Oc.define()}catch(n){if(!(fs.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class Sc extends V()({targets:{}}){}const Mc=Object.freeze(Object.defineProperty({__proto__:null,default:Sc},Symbol.toStringTag,{value:"Module"}));class kc extends V()({targets:{toggle:HTMLInputElement},values:{formMethod:String,formUrl:String,csrfToken:String}}){connect(){this.toggling=!1}requiresFormSubmit(){return this.formUrlValue!=null}async toggle(){if(!this.toggling&&(this.toggling=!0,!this.isDisabled())){if(!this.requiresFormSubmit()){this.performToggle(),this.toggling=!1;return}this.performToggle();try{await this.submitForm()}catch(t){t instanceof Error&&this.performToggle();return}finally{this.toggling=!1}}}performToggle(){this.isOn()?this.turnOff():this.turnOn()}turnOn(){this.isDisabled()||this.toggleTarget.setAttribute("aria-pressed","true")}turnOff(){this.isDisabled()||this.toggleTarget.setAttribute("aria-pressed","false")}isOn(){return this.toggleTarget.getAttribute("aria-pressed")==="true"}isOff(){return!this.isOn()}isDisabled(){return this.toggleTarget.getAttribute("disabled")!=null}async submitForm(){const t=new FormData,e=this.documentCsrfToken()||this.csrfTokenValue;if(e&&t.append(this.csrfField(),e),t.append(this.toggleTarget.name,this.isOn()?"true":"false"),!this.formUrlValue)throw new Error("invalid src");let s;try{s=await fetch(this.formUrlValue,{credentials:"same-origin",method:this.formMethodValue,headers:{"Requested-With":"XMLHttpRequest"},body:t})}catch{throw new Error("A network error occurred, please try again.")}if(!s.ok)throw new Error(await s.text())}csrfField(){return this.toggleTarget.getAttribute("csrf-field")||"authenticity_token"}documentCsrfToken(){const t=document.querySelector("meta[name=csrf-token]");return t&&t.getAttribute("content")}}const Cc=Object.freeze(Object.defineProperty({__proto__:null,default:kc},Symbol.toStringTag,{value:"Module"})),he=class he extends K{connect(){Ia(this)}save(){this.hasFormTarget?this.formTarget.requestSubmit():this.element.requestSubmit()}};he.debounces=["save"],he.targets=["form"];let qe=he;const Lc=Object.freeze(Object.defineProperty({__proto__:null,default:qe},Symbol.toStringTag,{value:"Module"}));class Fc extends V()({targets:{button:HTMLButtonElement,form:HTMLFormElement}}){get form(){return this.hasFormTarget?this.formTarget:this.element}runCheck(){this.buttonTarget.disabled=!this.form.checkValidity()}connect(){this.form.addEventListener("input",()=>this.runCheck()),this.runCheck(),ln(this,{childList:!0,subtree:!0})}mutate(){this.runCheck()}}const Dc=Object.freeze(Object.defineProperty({__proto__:null,default:Fc},Symbol.toStringTag,{value:"Module"})),me=jr.start();me.debug=!1;window.Stimulus=me;const _c=Object.assign({"../../components/ariadne/ui/accordion/component.ts":Ko,"../../components/ariadne/ui/clipboard_copy/component.ts":ta,"../../components/ariadne/ui/combobox/component.ts":Ka,"../../components/ariadne/ui/dialog/component.ts":nc,"../../components/ariadne/ui/flash/component.ts":ac,"../../components/ariadne/ui/list/component.ts":lc,"../../components/ariadne/ui/overlay/component.ts":hc,"../../components/ariadne/ui/popover/component.ts":fc,"../../components/ariadne/ui/time_ago/component.ts":Mc,"../../components/ariadne/ui/toggle/component.ts":Cc});for(const[n,t]of Object.entries(_c)){const e=n.split("/"),s=e.slice(3,e.length-1).join("-").replaceAll("_","-").toLocaleLowerCase();me.register(s,t.default)}const Bc=Object.assign({"/controllers/form_autosubmit_controller.ts":Lc,"/controllers/form_validity_controller.ts":Dc});for(const[n,t]of Object.entries(Bc)){const e=n.split("/"),s=e[e.length-1].replace("_controller.ts","").replaceAll("_","-").toLocaleLowerCase();me.register(`ariadne-${s}`,t.default)}
|
99
99
|
//# sourceMappingURL=ariadne_view_components.js.map
|