ariadne_view_components 0.0.91 → 0.0.93

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- class gi{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=>bi(o,this),this.compositionEventHandler=o=>wi(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",bn),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",bn)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(Ee)[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(Ee)[0],s=Array.from(this.list.querySelectorAll('[role="option"]')).filter(Ee),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"),yi(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 bi(n,t){if(!(n.shiftKey||n.metaKey||n.altKey)&&!(!t.ctrlBindings&&n.ctrlKey)&&!t.isComposing)switch(n.key){case"Enter":vn(t.input,t.list)&&n.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&vn(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 bn(n){if(!(n.target instanceof Element))return;const t=n.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&vi(t,{event:n})}function vn(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 vi(n,t){n.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0,detail:t}))}function yi(n){n.dispatchEvent(new Event("combobox-select",{bubbles:!0}))}function Ee(n){return!n.hidden&&!(n instanceof HTMLInputElement&&n.type==="hidden")&&(n.offsetWidth>0||n.offsetHeight>0)}function wi(n,t){t.isComposing=n.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function Ei(n,t=0){let e;return function(...s){clearTimeout(e),e=window.setTimeout(()=>{clearTimeout(e),n(...s)},t)}}const Ai=window.testScreenReaderDelay||100;class Ti{constructor(t,e,s,i=!1){var r;if(this.container=t,this.input=e,this.results=s,this.combobox=new gi(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=Ei(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)},Ai)}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,l=o.length,[c]=o,u=c==null?void 0:c.textContent;this.autoselectEnabled&&u?this.updateFeedbackForScreenReaders(`${l} results. ${u} is the top result: Press Enter to activate.`):this.updateFeedbackForScreenReaders(`${l||"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 Y=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)},Ae=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},xi=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},ft,Ct,Lt,Dt,Zt;const Oi=globalThis.HTMLElement||null;class Si extends Event{constructor(t,e){var{relatedTarget:s}=e,i=xi(e,["relatedTarget"]);super(t,i),this.relatedTarget=s}}const Q=new WeakMap;let Te=null;class Mi extends Oi{constructor(){super(...arguments),ft.add(this),Ct.set(this,null),Lt.set(this,null),Zt.set(this,void 0)}static define(t="auto-complete",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){Te=t===null?t:Promise.resolve(t)}get forElement(){var t;if(!((t=Y(this,Ct,"f"))===null||t===void 0)&&t.isConnected)return Y(this,Ct,"f");const e=this.getAttribute("for"),s=this.getRootNode();return e&&(s instanceof Document||s instanceof ShadowRoot)?s.getElementById(e):null}set forElement(t){Ae(this,Ct,t,"f"),this.setAttribute("for","")}get inputElement(){var t;return!((t=Y(this,Lt,"f"))===null||t===void 0)&&t.isConnected?Y(this,Lt,"f"):this.querySelector("input")}set inputElement(t){Ae(this,Lt,t,"f"),Y(this,ft,"m",Dt).call(this)}connectedCallback(){this.isConnected&&(Y(this,ft,"m",Dt).call(this),new MutationObserver(()=>{Q.get(this)||Y(this,ft,"m",Dt).call(this)}).observe(this,{subtree:!0,childList:!0}))}disconnectedCallback(){const t=Q.get(this);t&&(t.destroy(),Q.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=Y(this,Zt,"f"))===null||e===void 0||e.abort();const{signal:s}=Ae(this,Zt,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 Te?(await Te).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=Q.get(this);if(o)switch((this.forElement!==((i=Q.get(this))===null||i===void 0?void 0:i.results)||this.inputElement!==((r=Q.get(this))===null||r===void 0?void 0:r.input))&&Y(this,ft,"m",Dt).call(this),t){case"open":s===null?o.close():o.open();break;case"value":s!==null&&(o.input.value=s),this.dispatchEvent(new Si("auto-complete-change",{bubbles:!0,relatedTarget:o.input}));break}}}Ct=new WeakMap,Lt=new WeakMap,Zt=new WeakMap,ft=new WeakSet,Dt=function(){var t;(t=Q.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";Q.set(this,new Ti(this,s,e,i)),e.setAttribute("role","listbox")};const xe=typeof globalThis<"u"?globalThis:window;try{xe.AutocompleteElement=xe.AutoCompleteElement=Mi.define()}catch(n){if(!(xe.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class $e 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=[j(t,"compositionstart",i=>Tn(this,i)),j(t,"compositionend",i=>Tn(this,i)),j(t,"click",i=>En(t,i)),j(t,"change",i=>En(t,i)),j(t,"keydown",i=>Fi(t,this,i)),j(t,"toggle",()=>yn(t,this),{once:!0}),j(t,"toggle",()=>Li(t)),this.preload?j(t,"mouseover",()=>yn(t,this),{once:!0}):ki,...Ci(t)];gt.set(this,{subscriptions:s,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=gt.get(this);if(t){gt.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const gt=new WeakMap,ki={unsubscribe(){}};function j(n,t,e,s=!1){return n.addEventListener(t,e,s),{unsubscribe:()=>{n.removeEventListener(t,e,s)}}}function yn(n,t){const e=t.getAttribute("src");if(!e)return;const s=gt.get(t);if(!s||s.loaded)return;s.loaded=!0;const i=t.querySelector("include-fragment");i&&!i.hasAttribute("src")&&(i.addEventListener("loadend",()=>vs(n)),i.setAttribute("src",e))}function Ci(n){let t=!1;const e=()=>t=!0,s=()=>t=!1,i=()=>{n.hasAttribute("open")&&(vs(n)||t||Di(n))};return[j(n,"mousedown",e),j(n,"keydown",s),j(n,"toggle",i)]}function Li(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 vs(n){if(!n.hasAttribute("open"))return!1;const t=n.querySelector("details-menu [autofocus]");return t?(t.focus(),!0):!1}function Di(n){const t=document.activeElement;if(t&&ys(t)&&n.contains(t))return;const e=_t(n,!0);e&&e.focus()}function _t(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 wn=navigator.userAgent.match(/Macintosh/);function En(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||An(s,n)}else if(t.type==="change"){const s=e.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');s&&An(s,n)}}}function _i(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 An(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}}))||(Bi(n,t),_i(n,t),n.getAttribute("role")!=="menuitemcheckbox"&&ws(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=gt.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")&&(ws(n),e.preventDefault(),e.stopPropagation());break;case"ArrowDown":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=_t(n,!0);r&&r.focus(),e.preventDefault()}break;case"ArrowUp":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=_t(n,!1);r&&r.focus(),e.preventDefault()}break;case"n":if(wn&&e.ctrlKey){const r=_t(n,!0);r&&r.focus(),e.preventDefault()}break;case"p":if(wn&&e.ctrlKey){const r=_t(n,!1);r&&r.focus(),e.preventDefault()}break;case" ":case"Enter":{const r=document.activeElement;r instanceof HTMLElement&&ys(r)&&r.closest("details")===n&&(e.preventDefault(),e.stopPropagation(),r.click())}break}}function ys(n){const t=n.getAttribute("role");return t==="menuitem"||t==="menuitemcheckbox"||t==="menuitemradio"}function ws(n){if(!n.hasAttribute("open"))return;n.removeAttribute("open");const e=n.querySelector("summary");e&&e.focus()}function Bi(n,t){const e=t.querySelector("[data-menu-button]");if(!e)return;const s=Pi(n);if(s)e.textContent=s;else{const i=$i(n);i&&(e.innerHTML=i)}}function Pi(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 $i(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 Tn(n,t){const e=gt.get(n);e&&(e.isComposing=t.type==="compositionstart")}window.customElements.get("details-menu")||(window.DetailsMenuElement=$e,window.customElements.define("details-menu",$e));const bt=new WeakMap,rt=new WeakMap,X=new WeakMap;function jt(n){const t=n.currentTarget;if(!(t instanceof Et))return;const{box:e,image:s}=X.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(rt.has(t)&&n instanceof MouseEvent){const o=rt.get(t);i=n.pageX-o.dragStartX,r=n.pageY-o.dragStartY}else if(rt.has(t)&&n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0],{dragStartX:l,dragStartY:c}=rt.get(t);i=o-l,r=a-c}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`,xs(t,{x:o,y:a,width:e.offsetWidth,height:e.offsetHeight})}if(n instanceof MouseEvent)rt.set(t,{dragStartX:n.pageX,dragStartY:n.pageY});else if(n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0];rt.set(t,{dragStartX:o,dragStartY:a})}}function vt(n){const t=n.target;if(!(t instanceof HTMLElement))return;const e=Es(t);if(!(e instanceof Et))return;const{box:s}=X.get(e)||{};if(!s)return;const i=e.getBoundingClientRect();let r,o,a;if(n instanceof KeyboardEvent){if(n.key==="Escape")return Ts(e);if(n.key==="-"&&(a=-10),n.key==="="&&(a=10),!a)return;r=s.offsetWidth+a,o=s.offsetHeight+a,bt.set(e,{startX:s.offsetLeft,startY:s.offsetTop})}else if(n instanceof MouseEvent){const l=bt.get(e);if(!l)return;r=n.pageX-l.startX-i.left-window.pageXOffset,o=n.pageY-l.startY-i.top-window.pageYOffset}else if(n instanceof TouchEvent){const l=bt.get(e);if(!l)return;r=n.changedTouches[0].pageX-l.startX-i.left-window.pageXOffset,o=n.changedTouches[0].pageY-l.startY-i.top-window.pageYOffset}r&&o&&As(e,r,o,!(n instanceof KeyboardEvent))}function Es(n){const t=n.getRootNode();return t instanceof ShadowRoot?t.host:n}function xn(n){const t=n.currentTarget;if(!(t instanceof HTMLElement))return;const e=Es(t);if(!(e instanceof Et))return;const{box:s}=X.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",vt),e.addEventListener("touchmove",vt,{passive:!0}),["nw","se"].indexOf(r)>=0&&e.classList.add("nwse"),["ne","sw"].indexOf(r)>=0&&e.classList.add("nesw"),bt.set(e,{startX:s.offsetLeft+(["se","ne"].indexOf(r)>=0?0:s.offsetWidth),startY:s.offsetTop+(["se","sw"].indexOf(r)>=0?0:s.offsetHeight)}),vt(n)}else e.addEventListener("mousemove",jt),e.addEventListener("touchmove",jt,{passive:!0})}function As(n,t,e,s=!0){let i=Math.max(Math.abs(t),Math.abs(e),10);const r=bt.get(n);if(!r)return;const{box:o,image:a}=X.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 l=s?Math.round(Math.max(0,t>0?r.startX:r.startX-i)):o.offsetLeft,c=s?Math.round(Math.max(0,e>0?r.startY:r.startY-i)):o.offsetTop;o.style.left=`${l}px`,o.style.top=`${c}px`,o.style.width=`${i}px`,o.style.height=`${i}px`,xs(n,{x:l,y:c,width:i,height:i})}function Ts(n){const{image:t}=X.get(n)||{};if(!t)return;const e=Math.round(t.clientWidth>t.clientHeight?t.clientHeight:t.clientWidth);bt.set(n,{startX:(t.clientWidth-e)/2,startY:(t.clientHeight-e)/2}),As(n,e,e)}function Oe(n){const t=n.currentTarget;t instanceof Et&&(rt.delete(t),t.classList.remove("nwse","nesw"),t.removeEventListener("mousemove",vt),t.removeEventListener("mousemove",jt),t.removeEventListener("touchmove",vt),t.removeEventListener("touchmove",jt))}function xs(n,t){const{image:e}=X.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 Et extends HTMLElement{connectedCallback(){if(X.has(this))return;const t=this.attachShadow({mode:"open"});t.innerHTML=`
1
+ class bi{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=>vi(o,this),this.compositionEventHandler=o=>Ei(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",bn),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",bn)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(Ee)[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(Ee)[0],s=Array.from(this.list.querySelectorAll('[role="option"]')).filter(Ee),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"),wi(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 vi(n,t){if(!(n.shiftKey||n.metaKey||n.altKey)&&!(!t.ctrlBindings&&n.ctrlKey)&&!t.isComposing)switch(n.key){case"Enter":vn(t.input,t.list)&&n.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&vn(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 bn(n){if(!(n.target instanceof Element))return;const t=n.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&yi(t,{event:n})}function vn(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 yi(n,t){n.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0,detail:t}))}function wi(n){n.dispatchEvent(new Event("combobox-select",{bubbles:!0}))}function Ee(n){return!n.hidden&&!(n instanceof HTMLInputElement&&n.type==="hidden")&&(n.offsetWidth>0||n.offsetHeight>0)}function Ei(n,t){t.isComposing=n.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function Ai(n,t=0){let e;return function(...s){clearTimeout(e),e=window.setTimeout(()=>{clearTimeout(e),n(...s)},t)}}const Ti=window.testScreenReaderDelay||100;class xi{constructor(t,e,s,i=!1){var r;if(this.container=t,this.input=e,this.results=s,this.combobox=new bi(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=Ai(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)},Ti)}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,l=o.length,[c]=o,u=c==null?void 0:c.textContent;this.autoselectEnabled&&u?this.updateFeedbackForScreenReaders(`${l} results. ${u} is the top result: Press Enter to activate.`):this.updateFeedbackForScreenReaders(`${l||"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 X=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)},Ae=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},Oi=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},ft,Ct,Lt,Dt,Zt;const Si=globalThis.HTMLElement||null;class Mi extends Event{constructor(t,e){var{relatedTarget:s}=e,i=Oi(e,["relatedTarget"]);super(t,i),this.relatedTarget=s}}const tt=new WeakMap;let Te=null;class ki extends Si{constructor(){super(...arguments),ft.add(this),Ct.set(this,null),Lt.set(this,null),Zt.set(this,void 0)}static define(t="auto-complete",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){Te=t===null?t:Promise.resolve(t)}get forElement(){var t;if(!((t=X(this,Ct,"f"))===null||t===void 0)&&t.isConnected)return X(this,Ct,"f");const e=this.getAttribute("for"),s=this.getRootNode();return e&&(s instanceof Document||s instanceof ShadowRoot)?s.getElementById(e):null}set forElement(t){Ae(this,Ct,t,"f"),this.setAttribute("for","")}get inputElement(){var t;return!((t=X(this,Lt,"f"))===null||t===void 0)&&t.isConnected?X(this,Lt,"f"):this.querySelector("input")}set inputElement(t){Ae(this,Lt,t,"f"),X(this,ft,"m",Dt).call(this)}connectedCallback(){this.isConnected&&(X(this,ft,"m",Dt).call(this),new MutationObserver(()=>{tt.get(this)||X(this,ft,"m",Dt).call(this)}).observe(this,{subtree:!0,childList:!0}))}disconnectedCallback(){const t=tt.get(this);t&&(t.destroy(),tt.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=X(this,Zt,"f"))===null||e===void 0||e.abort();const{signal:s}=Ae(this,Zt,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 Te?(await Te).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=tt.get(this);if(o)switch((this.forElement!==((i=tt.get(this))===null||i===void 0?void 0:i.results)||this.inputElement!==((r=tt.get(this))===null||r===void 0?void 0:r.input))&&X(this,ft,"m",Dt).call(this),t){case"open":s===null?o.close():o.open();break;case"value":s!==null&&(o.input.value=s),this.dispatchEvent(new Mi("auto-complete-change",{bubbles:!0,relatedTarget:o.input}));break}}}Ct=new WeakMap,Lt=new WeakMap,Zt=new WeakMap,ft=new WeakSet,Dt=function(){var t;(t=tt.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";tt.set(this,new xi(this,s,e,i)),e.setAttribute("role","listbox")};const xe=typeof globalThis<"u"?globalThis:window;try{xe.AutocompleteElement=xe.AutoCompleteElement=ki.define()}catch(n){if(!(xe.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class $e 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=[j(t,"compositionstart",i=>Tn(this,i)),j(t,"compositionend",i=>Tn(this,i)),j(t,"click",i=>En(t,i)),j(t,"change",i=>En(t,i)),j(t,"keydown",i=>Bi(t,this,i)),j(t,"toggle",()=>yn(t,this),{once:!0}),j(t,"toggle",()=>Di(t)),this.preload?j(t,"mouseover",()=>yn(t,this),{once:!0}):Ci,...Li(t)];gt.set(this,{subscriptions:s,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=gt.get(this);if(t){gt.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const gt=new WeakMap,Ci={unsubscribe(){}};function j(n,t,e,s=!1){return n.addEventListener(t,e,s),{unsubscribe:()=>{n.removeEventListener(t,e,s)}}}function yn(n,t){const e=t.getAttribute("src");if(!e)return;const s=gt.get(t);if(!s||s.loaded)return;s.loaded=!0;const i=t.querySelector("include-fragment");i&&!i.hasAttribute("src")&&(i.addEventListener("loadend",()=>vs(n)),i.setAttribute("src",e))}function Li(n){let t=!1;const e=()=>t=!0,s=()=>t=!1,i=()=>{n.hasAttribute("open")&&(vs(n)||t||_i(n))};return[j(n,"mousedown",e),j(n,"keydown",s),j(n,"toggle",i)]}function Di(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 vs(n){if(!n.hasAttribute("open"))return!1;const t=n.querySelector("details-menu [autofocus]");return t?(t.focus(),!0):!1}function _i(n){const t=document.activeElement;if(t&&ys(t)&&n.contains(t))return;const e=_t(n,!0);e&&e.focus()}function _t(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 wn=navigator.userAgent.match(/Macintosh/);function En(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||An(s,n)}else if(t.type==="change"){const s=e.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');s&&An(s,n)}}}function Fi(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 An(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}}))||(Pi(n,t),Fi(n,t),n.getAttribute("role")!=="menuitemcheckbox"&&ws(t),e.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:n}})))}function Bi(n,t,e){if(!(e instanceof KeyboardEvent)||n.querySelector("details[open]"))return;const s=gt.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")&&(ws(n),e.preventDefault(),e.stopPropagation());break;case"ArrowDown":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=_t(n,!0);r&&r.focus(),e.preventDefault()}break;case"ArrowUp":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=_t(n,!1);r&&r.focus(),e.preventDefault()}break;case"n":if(wn&&e.ctrlKey){const r=_t(n,!0);r&&r.focus(),e.preventDefault()}break;case"p":if(wn&&e.ctrlKey){const r=_t(n,!1);r&&r.focus(),e.preventDefault()}break;case" ":case"Enter":{const r=document.activeElement;r instanceof HTMLElement&&ys(r)&&r.closest("details")===n&&(e.preventDefault(),e.stopPropagation(),r.click())}break}}function ys(n){const t=n.getAttribute("role");return t==="menuitem"||t==="menuitemcheckbox"||t==="menuitemradio"}function ws(n){if(!n.hasAttribute("open"))return;n.removeAttribute("open");const e=n.querySelector("summary");e&&e.focus()}function Pi(n,t){const e=t.querySelector("[data-menu-button]");if(!e)return;const s=$i(n);if(s)e.textContent=s;else{const i=Ri(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 Ri(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 Tn(n,t){const e=gt.get(n);e&&(e.isComposing=t.type==="compositionstart")}window.customElements.get("details-menu")||(window.DetailsMenuElement=$e,window.customElements.define("details-menu",$e));const bt=new WeakMap,rt=new WeakMap,G=new WeakMap;function jt(n){const t=n.currentTarget;if(!(t instanceof Et))return;const{box:e,image:s}=G.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(rt.has(t)&&n instanceof MouseEvent){const o=rt.get(t);i=n.pageX-o.dragStartX,r=n.pageY-o.dragStartY}else if(rt.has(t)&&n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0],{dragStartX:l,dragStartY:c}=rt.get(t);i=o-l,r=a-c}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`,xs(t,{x:o,y:a,width:e.offsetWidth,height:e.offsetHeight})}if(n instanceof MouseEvent)rt.set(t,{dragStartX:n.pageX,dragStartY:n.pageY});else if(n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0];rt.set(t,{dragStartX:o,dragStartY:a})}}function vt(n){const t=n.target;if(!(t instanceof HTMLElement))return;const e=Es(t);if(!(e instanceof Et))return;const{box:s}=G.get(e)||{};if(!s)return;const i=e.getBoundingClientRect();let r,o,a;if(n instanceof KeyboardEvent){if(n.key==="Escape")return Ts(e);if(n.key==="-"&&(a=-10),n.key==="="&&(a=10),!a)return;r=s.offsetWidth+a,o=s.offsetHeight+a,bt.set(e,{startX:s.offsetLeft,startY:s.offsetTop})}else if(n instanceof MouseEvent){const l=bt.get(e);if(!l)return;r=n.pageX-l.startX-i.left-window.pageXOffset,o=n.pageY-l.startY-i.top-window.pageYOffset}else if(n instanceof TouchEvent){const l=bt.get(e);if(!l)return;r=n.changedTouches[0].pageX-l.startX-i.left-window.pageXOffset,o=n.changedTouches[0].pageY-l.startY-i.top-window.pageYOffset}r&&o&&As(e,r,o,!(n instanceof KeyboardEvent))}function Es(n){const t=n.getRootNode();return t instanceof ShadowRoot?t.host:n}function xn(n){const t=n.currentTarget;if(!(t instanceof HTMLElement))return;const e=Es(t);if(!(e instanceof Et))return;const{box:s}=G.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",vt),e.addEventListener("touchmove",vt,{passive:!0}),["nw","se"].indexOf(r)>=0&&e.classList.add("nwse"),["ne","sw"].indexOf(r)>=0&&e.classList.add("nesw"),bt.set(e,{startX:s.offsetLeft+(["se","ne"].indexOf(r)>=0?0:s.offsetWidth),startY:s.offsetTop+(["se","sw"].indexOf(r)>=0?0:s.offsetHeight)}),vt(n)}else e.addEventListener("mousemove",jt),e.addEventListener("touchmove",jt,{passive:!0})}function As(n,t,e,s=!0){let i=Math.max(Math.abs(t),Math.abs(e),10);const r=bt.get(n);if(!r)return;const{box:o,image:a}=G.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 l=s?Math.round(Math.max(0,t>0?r.startX:r.startX-i)):o.offsetLeft,c=s?Math.round(Math.max(0,e>0?r.startY:r.startY-i)):o.offsetTop;o.style.left=`${l}px`,o.style.top=`${c}px`,o.style.width=`${i}px`,o.style.height=`${i}px`,xs(n,{x:l,y:c,width:i,height:i})}function Ts(n){const{image:t}=G.get(n)||{};if(!t)return;const e=Math.round(t.clientWidth>t.clientHeight?t.clientHeight:t.clientWidth);bt.set(n,{startX:(t.clientWidth-e)/2,startY:(t.clientHeight-e)/2}),As(n,e,e)}function Oe(n){const t=n.currentTarget;t instanceof Et&&(rt.delete(t),t.classList.remove("nwse","nesw"),t.removeEventListener("mousemove",vt),t.removeEventListener("mousemove",jt),t.removeEventListener("touchmove",vt),t.removeEventListener("touchmove",jt))}function xs(n,t){const{image:e}=G.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 Et extends HTMLElement{connectedCallback(){if(G.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 @@ class gi{constructor(t,e,{tabInsertsSuggestions:s,defaultFirstOption:i,scrollInt
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&&(X.set(this,{box:e,image:s}),s.addEventListener("load",()=>{this.loaded=!0,Ts(this)}),this.addEventListener("mouseleave",Oe),this.addEventListener("touchend",Oe),this.addEventListener("mouseup",Oe),e.addEventListener("mousedown",xn),e.addEventListener("touchstart",xn,{passive:!0}),this.addEventListener("keydown",jt),this.addEventListener("keydown",vt),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}=X.get(this)||{};t==="src"&&(this.loaded=!1,i&&(i.src=s))}}window.customElements.get("image-crop")||(window.ImageCropElement=Et,window.customElements.define("image-crop",Et));var On=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,Re;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 Os(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 Ss(n){return function(t){(t.key===" "||t.key==="Enter")&&n(t)}}const k=new WeakMap,Ni={"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:"![",suffix:"](url)",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 $ extends HTMLElement{constructor(){super();const t=e=>{const s=k.get(this);s&&(e.preventDefault(),Ie(this,s))};this.addEventListener("keydown",Ss(t)),this.addEventListener("click",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","button")}click(){const t=k.get(this);t&&Ie(this,t)}}class Sn extends ${constructor(){super(...arguments),Jt.add(this)}connectedCallback(){const t=parseInt(this.getAttribute("level")||"3",10);On(this,Jt,"m",Re).call(this,t)}static get observedAttributes(){return["level"]}attributeChangedCallback(t,e,s){if(t!=="level")return;const i=parseInt(s||"3",10);On(this,Jt,"m",Re).call(this,i)}}Jt=new WeakSet,Re=function(t){if(t<1||t>6)return;const e=`${"#".repeat(t)} `;k.set(this,{prefix:e})};window.customElements.get("md-header")||(window.MarkdownHeaderButtonElement=Sn,window.customElements.define("md-header",Sn));class Mn extends ${connectedCallback(){k.set(this,{prefix:"**",suffix:"**",trimFirst:!0})}}window.customElements.get("md-bold")||(window.MarkdownBoldButtonElement=Mn,window.customElements.define("md-bold",Mn));class kn extends ${connectedCallback(){k.set(this,{prefix:"_",suffix:"_",trimFirst:!0})}}window.customElements.get("md-italic")||(window.MarkdownItalicButtonElement=kn,window.customElements.define("md-italic",kn));class Cn extends ${connectedCallback(){k.set(this,{prefix:"> ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-quote")||(window.MarkdownQuoteButtonElement=Cn,window.customElements.define("md-quote",Cn));class Ln extends ${connectedCallback(){k.set(this,{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"})}}window.customElements.get("md-code")||(window.MarkdownCodeButtonElement=Ln,window.customElements.define("md-code",Ln));class Dn extends ${connectedCallback(){k.set(this,{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-link")||(window.MarkdownLinkButtonElement=Dn,window.customElements.define("md-link",Dn));class _n extends ${connectedCallback(){k.set(this,{prefix:"![",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-image")||(window.MarkdownImageButtonElement=_n,window.customElements.define("md-image",_n));class Fn extends ${connectedCallback(){k.set(this,{prefix:"- ",multiline:!0,unorderedList:!0})}}window.customElements.get("md-unordered-list")||(window.MarkdownUnorderedListButtonElement=Fn,window.customElements.define("md-unordered-list",Fn));class Bn extends ${connectedCallback(){k.set(this,{prefix:"1. ",multiline:!0,orderedList:!0})}}window.customElements.get("md-ordered-list")||(window.MarkdownOrderedListButtonElement=Bn,window.customElements.define("md-ordered-list",Bn));class Pn extends ${connectedCallback(){k.set(this,{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-task-list")||(window.MarkdownTaskListButtonElement=Pn,window.customElements.define("md-task-list",Pn));class $n extends ${connectedCallback(){k.set(this,{prefix:"@",prefixSpace:!0})}}window.customElements.get("md-mention")||(window.MarkdownMentionButtonElement=$n,window.customElements.define("md-mention",$n));class Rn extends ${connectedCallback(){k.set(this,{prefix:"#",prefixSpace:!0})}}window.customElements.get("md-ref")||(window.MarkdownRefButtonElement=Rn,window.customElements.define("md-ref",Rn));class Nn extends ${connectedCallback(){k.set(this,{prefix:"~~",suffix:"~~",trimFirst:!0})}}window.customElements.get("md-strikethrough")||(window.MarkdownStrikethroughButtonElement=Nn,window.customElements.define("md-strikethrough",Nn));function In(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=Ni[i];r&&(n.preventDefault(),Ie(t,r))}function jn(n){n.addEventListener("keydown",ks),n.setAttribute("tabindex","0"),n.addEventListener("focus",Ms,{once:!0})}function Vn(n){n.removeEventListener("keydown",ks),n.removeAttribute("tabindex"),n.removeEventListener("focus",Ms)}class Qt extends HTMLElement{connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","toolbar"),this.hasAttribute("data-no-focus")||jn(this),this.addEventListener("keydown",Ss(In)),this.addEventListener("click",In)}attributeChangedCallback(t,e,s){t==="data-no-focus"&&(s===null?jn(this):Vn(this))}disconnectedCallback(){Vn(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}}Qt.observedAttributes=["data-no-focus"];function Ms({target:n}){if(!(n instanceof Element))return;n.removeAttribute("tabindex");let t="0";for(const e of Os(n))e.setAttribute("tabindex",t),t==="0"&&(e.focus(),t="-1")}function ks(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=Os(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=Qt,window.customElements.define("markdown-toolbar",Qt));function Ne(n){return n.trim().split(`
80
- `).length>1}function Hn(n,t){return Array(t+1).join(n)}function Ii(n,t){let e=t;for(;n[e]&&n[e-1]!=null&&!n[e-1].match(/\s/);)e--;return e}function ji(n,t,e){let s=t;const i=e?/\n/:/\s/;for(;n[s]&&!n[s].match(i);)s++;return s}let it=null;function Vi(n,{text:t,selectionStart:e,selectionEnd:s}){const i=n.selectionStart,r=n.value.slice(0,i),o=n.value.slice(n.selectionEnd);if(it===null||it===!0){n.contentEditable="true";try{it=document.execCommand("insertText",!1,t)}catch{it=!1}n.contentEditable="false"}if(it&&!n.value.slice(0,n.selectionStart).endsWith(t)&&(it=!1),!it){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 Hi(n,t){const e=n.value.slice(n.selectionStart,n.selectionEnd);let s;t.orderedList||t.unorderedList?s=Yi(n,t):t.multiline&&Ne(e)?s=zi(n,t):s=Ki(n,t),Vi(n,s)}function Wi(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 Ui(n,t,e,s=!1){if(n.selectionStart===n.selectionEnd)n.selectionStart=Ii(n.value,n.selectionStart),n.selectionEnd=ji(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 nn(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,l;return t.match(/\S/)&&r<2&&(a=Hn(`
79
+ `;const e=t.querySelector("[data-crop-box]");if(!(e instanceof HTMLElement))return;const s=t.querySelector("img");s instanceof HTMLImageElement&&(G.set(this,{box:e,image:s}),s.addEventListener("load",()=>{this.loaded=!0,Ts(this)}),this.addEventListener("mouseleave",Oe),this.addEventListener("touchend",Oe),this.addEventListener("mouseup",Oe),e.addEventListener("mousedown",xn),e.addEventListener("touchstart",xn,{passive:!0}),this.addEventListener("keydown",jt),this.addEventListener("keydown",vt),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}=G.get(this)||{};t==="src"&&(this.loaded=!1,i&&(i.src=s))}}window.customElements.get("image-crop")||(window.ImageCropElement=Et,window.customElements.define("image-crop",Et));var On=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,Re;const Ni=["[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 Os(n){const t=[];for(const e of n.querySelectorAll(Ni.join(", ")))e.hidden||e.offsetWidth<=0&&e.offsetHeight<=0||e.closest("markdown-toolbar")===n&&t.push(e);return t}function Ss(n){return function(t){(t.key===" "||t.key==="Enter")&&n(t)}}const k=new WeakMap,Ii={"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:"![",suffix:"](url)",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 $ extends HTMLElement{constructor(){super();const t=e=>{const s=k.get(this);s&&(e.preventDefault(),Ie(this,s))};this.addEventListener("keydown",Ss(t)),this.addEventListener("click",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","button")}click(){const t=k.get(this);t&&Ie(this,t)}}class Sn extends ${constructor(){super(...arguments),Jt.add(this)}connectedCallback(){const t=parseInt(this.getAttribute("level")||"3",10);On(this,Jt,"m",Re).call(this,t)}static get observedAttributes(){return["level"]}attributeChangedCallback(t,e,s){if(t!=="level")return;const i=parseInt(s||"3",10);On(this,Jt,"m",Re).call(this,i)}}Jt=new WeakSet,Re=function(t){if(t<1||t>6)return;const e=`${"#".repeat(t)} `;k.set(this,{prefix:e})};window.customElements.get("md-header")||(window.MarkdownHeaderButtonElement=Sn,window.customElements.define("md-header",Sn));class Mn extends ${connectedCallback(){k.set(this,{prefix:"**",suffix:"**",trimFirst:!0})}}window.customElements.get("md-bold")||(window.MarkdownBoldButtonElement=Mn,window.customElements.define("md-bold",Mn));class kn extends ${connectedCallback(){k.set(this,{prefix:"_",suffix:"_",trimFirst:!0})}}window.customElements.get("md-italic")||(window.MarkdownItalicButtonElement=kn,window.customElements.define("md-italic",kn));class Cn extends ${connectedCallback(){k.set(this,{prefix:"> ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-quote")||(window.MarkdownQuoteButtonElement=Cn,window.customElements.define("md-quote",Cn));class Ln extends ${connectedCallback(){k.set(this,{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"})}}window.customElements.get("md-code")||(window.MarkdownCodeButtonElement=Ln,window.customElements.define("md-code",Ln));class Dn extends ${connectedCallback(){k.set(this,{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-link")||(window.MarkdownLinkButtonElement=Dn,window.customElements.define("md-link",Dn));class _n extends ${connectedCallback(){k.set(this,{prefix:"![",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-image")||(window.MarkdownImageButtonElement=_n,window.customElements.define("md-image",_n));class Fn extends ${connectedCallback(){k.set(this,{prefix:"- ",multiline:!0,unorderedList:!0})}}window.customElements.get("md-unordered-list")||(window.MarkdownUnorderedListButtonElement=Fn,window.customElements.define("md-unordered-list",Fn));class Bn extends ${connectedCallback(){k.set(this,{prefix:"1. ",multiline:!0,orderedList:!0})}}window.customElements.get("md-ordered-list")||(window.MarkdownOrderedListButtonElement=Bn,window.customElements.define("md-ordered-list",Bn));class Pn extends ${connectedCallback(){k.set(this,{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-task-list")||(window.MarkdownTaskListButtonElement=Pn,window.customElements.define("md-task-list",Pn));class $n extends ${connectedCallback(){k.set(this,{prefix:"@",prefixSpace:!0})}}window.customElements.get("md-mention")||(window.MarkdownMentionButtonElement=$n,window.customElements.define("md-mention",$n));class Rn extends ${connectedCallback(){k.set(this,{prefix:"#",prefixSpace:!0})}}window.customElements.get("md-ref")||(window.MarkdownRefButtonElement=Rn,window.customElements.define("md-ref",Rn));class Nn extends ${connectedCallback(){k.set(this,{prefix:"~~",suffix:"~~",trimFirst:!0})}}window.customElements.get("md-strikethrough")||(window.MarkdownStrikethroughButtonElement=Nn,window.customElements.define("md-strikethrough",Nn));function In(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=Ii[i];r&&(n.preventDefault(),Ie(t,r))}function jn(n){n.addEventListener("keydown",ks),n.setAttribute("tabindex","0"),n.addEventListener("focus",Ms,{once:!0})}function Vn(n){n.removeEventListener("keydown",ks),n.removeAttribute("tabindex"),n.removeEventListener("focus",Ms)}class Qt extends HTMLElement{connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","toolbar"),this.hasAttribute("data-no-focus")||jn(this),this.addEventListener("keydown",Ss(In)),this.addEventListener("click",In)}attributeChangedCallback(t,e,s){t==="data-no-focus"&&(s===null?jn(this):Vn(this))}disconnectedCallback(){Vn(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}}Qt.observedAttributes=["data-no-focus"];function Ms({target:n}){if(!(n instanceof Element))return;n.removeAttribute("tabindex");let t="0";for(const e of Os(n))e.setAttribute("tabindex",t),t==="0"&&(e.focus(),t="-1")}function ks(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=Os(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=Qt,window.customElements.define("markdown-toolbar",Qt));function Ne(n){return n.trim().split(`
80
+ `).length>1}function Hn(n,t){return Array(t+1).join(n)}function ji(n,t){let e=t;for(;n[e]&&n[e-1]!=null&&!n[e-1].match(/\s/);)e--;return e}function Vi(n,t,e){let s=t;const i=e?/\n/:/\s/;for(;n[s]&&!n[s].match(i);)s++;return s}let it=null;function Hi(n,{text:t,selectionStart:e,selectionEnd:s}){const i=n.selectionStart,r=n.value.slice(0,i),o=n.value.slice(n.selectionEnd);if(it===null||it===!0){n.contentEditable="true";try{it=document.execCommand("insertText",!1,t)}catch{it=!1}n.contentEditable="false"}if(it&&!n.value.slice(0,n.selectionStart).endsWith(t)&&(it=!1),!it){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 Wi(n,t){const e=n.value.slice(n.selectionStart,n.selectionEnd);let s;t.orderedList||t.unorderedList?s=Xi(n,t):t.multiline&&Ne(e)?s=qi(n,t):s=zi(n,t),Hi(n,s)}function Ui(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 Ki(n,t,e,s=!1){if(n.selectionStart===n.selectionEnd)n.selectionStart=ji(n.value,n.selectionStart),n.selectionEnd=Vi(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 en(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,l;return t.match(/\S/)&&r<2&&(a=Hn(`
82
82
  `,2-r)),e.match(/\S/)&&o<2&&(l=Hn(`
83
- `,2-o)),a==null&&(a=""),l==null&&(l=""),{newlinesToAppend:a,newlinesToPrepend:l}}function Ki(n,t){let e,s;const{prefix:i,suffix:r,blockPrefix:o,blockSuffix:a,replaceNext:l,prefixSpace:c,scanFor:u,surroundWithNewlines:m}=t,h=n.selectionStart,d=n.selectionEnd;let f=n.value.slice(n.selectionStart,n.selectionEnd),p=Ne(f)&&o.length>0?`${o}
83
+ `,2-o)),a==null&&(a=""),l==null&&(l=""),{newlinesToAppend:a,newlinesToPrepend:l}}function zi(n,t){let e,s;const{prefix:i,suffix:r,blockPrefix:o,blockSuffix:a,replaceNext:l,prefixSpace:c,scanFor:u,surroundWithNewlines:d}=t,h=n.selectionStart,m=n.selectionEnd;let f=n.value.slice(n.selectionStart,n.selectionEnd),p=Ne(f)&&o.length>0?`${o}
84
84
  `:i,b=Ne(f)&&a.length>0?`
85
- ${a}`:r;if(c){const v=n.value[n.selectionStart-1];n.selectionStart!==0&&v!=null&&!v.match(/\s/)&&(p=` ${p}`)}f=Ui(n,p,b,t.multiline);let g=n.selectionStart,w=n.selectionEnd;const E=l.length>0&&b.indexOf(l)>-1&&f.length>0;if(m){const v=nn(n);e=v.newlinesToAppend,s=v.newlinesToPrepend,p=e+i,b+=s}if(f.startsWith(p)&&f.endsWith(b)){const v=f.slice(p.length,f.length-b.length);if(h===d){let y=h-p.length;y=Math.max(y,g),y=Math.min(y,g+v.length),g=w=y}else w=g+v.length;return{text:v,selectionStart:g,selectionEnd:w}}else if(E)if(u.length>0&&f.match(u)){b=b.replace(l,f);const v=p+b;return g=w=g+p.length,{text:v,selectionStart:g,selectionEnd:w}}else{const v=p+f+b;return g=g+p.length+f.length+b.indexOf(l),w=g+l.length,{text:v,selectionStart:g,selectionEnd:w}}else{let v=p+f+b;g=h+p.length,w=d+p.length;const y=f.match(/^\s*|\s*$/g);if(t.trimFirst&&y){const x=y[0]||"",O=y[1]||"";v=x+p+f.trim()+b+O,g+=x.length,w-=O.length}return{text:v,selectionStart:g,selectionEnd:w}}}function zi(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 l=r.split(`
85
+ ${a}`:r;if(c){const v=n.value[n.selectionStart-1];n.selectionStart!==0&&v!=null&&!v.match(/\s/)&&(p=` ${p}`)}f=Ki(n,p,b,t.multiline);let g=n.selectionStart,w=n.selectionEnd;const E=l.length>0&&b.indexOf(l)>-1&&f.length>0;if(d){const v=en(n);e=v.newlinesToAppend,s=v.newlinesToPrepend,p=e+i,b+=s}if(f.startsWith(p)&&f.endsWith(b)){const v=f.slice(p.length,f.length-b.length);if(h===m){let y=h-p.length;y=Math.max(y,g),y=Math.min(y,g+v.length),g=w=y}else w=g+v.length;return{text:v,selectionStart:g,selectionEnd:w}}else if(E)if(u.length>0&&f.match(u)){b=b.replace(l,f);const v=p+b;return g=w=g+p.length,{text:v,selectionStart:g,selectionEnd:w}}else{const v=p+f+b;return g=g+p.length+f.length+b.indexOf(l),w=g+l.length,{text:v,selectionStart:g,selectionEnd:w}}else{let v=p+f+b;g=h+p.length,w=m+p.length;const y=f.match(/^\s*|\s*$/g);if(t.trimFirst&&y){const x=y[0]||"",O=y[1]||"";v=x+p+f.trim()+b+O,g+=x.length,w-=O.length}return{text:v,selectionStart:g,selectionEnd:w}}}function qi(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 l=r.split(`
86
86
  `);if(l.every(u=>u.startsWith(e)&&u.endsWith(s)))r=l.map(u=>u.slice(e.length,u.length-s.length)).join(`
87
87
  `),a=o+r.length;else if(r=l.map(u=>e+u+s).join(`
88
- `),i){const{newlinesToAppend:u,newlinesToPrepend:m}=nn(n);o+=u.length,a=o+r.length,r=u+r+m}return{text:r,selectionStart:o,selectionEnd:a}}function Wn(n){const t=n.split(`
88
+ `),i){const{newlinesToAppend:u,newlinesToPrepend:d}=en(n);o+=u.length,a=o+r.length,r=u+r+d}return{text:r,selectionStart:o,selectionEnd:a}}function Wn(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
90
  `),processed:s}}function Un(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 Mt(n,t){return t?"- ":`${n+1}. `}function qi(n,t){let e,s,i;return n.orderedList?(s=Wn(t),e=Un(s.text),i=e.text):(s=Un(t),e=Wn(s.text),i=e.text),[s,e,i]}function Yi(n,t){const e=n.selectionStart===n.selectionEnd;let s=n.selectionStart,i=n.selectionEnd;Wi(n);const r=n.value.slice(n.selectionStart,n.selectionEnd),[o,a,l]=qi(t,r),c=l.split(`
93
- `).map((p,b)=>`${Mt(b,t.unorderedList)}${p}`),u=c.reduce((p,b,g)=>p+Mt(g,t.unorderedList).length,0),m=c.reduce((p,b,g)=>p+Mt(g,!t.unorderedList).length,0);if(o.processed)return e?(s=Math.max(s-Mt(0,t.unorderedList).length,0),i=s):(s=n.selectionStart,i=n.selectionEnd-u),{text:l,selectionStart:s,selectionEnd:i};const{newlinesToAppend:h,newlinesToPrepend:d}=nn(n),f=h+c.join(`
94
- `)+d;return e?(s=Math.max(s+Mt(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-m):(s=Math.max(n.selectionStart+h.length,0),i=n.selectionEnd+h.length+u),{text:f,selectionStart:s,selectionEnd:i}}function Ie(n,t){const e=n.closest("markdown-toolbar");if(!(e instanceof Qt))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(),Hi(r,i))}localStorage.getItem("theme");window.matchMedia("(prefers-color-scheme: dark)").matches;class Xi{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=Gi(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 Gi(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 Zi{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 Xi(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 Ji={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}},Qi=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function tr(n){const e=n.trim().match(Qi)||[];let s=e[2],i=e[3];return i&&!["keydown","keyup","keypress"].includes(s)&&(s+=`.${i}`,i=""),{eventTarget:er(e[4]),eventName:s,eventOptions:e[7]?nr(e[7]):{},identifier:e[5],methodName:e[6],keyFilter:e[1]||i}}function er(n){if(n=="window")return window;if(n=="document")return document}function nr(n){return n.split(":").reduce((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)}),{})}function sr(n){if(n==window)return"window";if(n==document)return"document"}function sn(n){return n.replace(/(?:[_-])([a-z0-9])/g,(t,e)=>e.toUpperCase())}function je(n){return sn(n.replace(/--/g,"-").replace(/__/g,"_"))}function Ut(n){return n.charAt(0).toUpperCase()+n.slice(1)}function Cs(n){return n.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)}function ir(n){return n.match(/[^\s]+/g)||[]}function Kn(n){return n!=null}function Ve(n,t){return Object.prototype.hasOwnProperty.call(n,t)}const zn=["meta","ctrl","alt","shift"];class rr{constructor(t,e,s,i){this.element=t,this.index=e,this.eventTarget=s.eventTarget||t,this.eventName=s.eventName||or(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,tr(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=>!zn.includes(i))[0];return s?(Ve(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[sn(o)]=ar(i))}return t}get eventTargetName(){return sr(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(t,e){const[s,i,r,o]=zn.map(a=>e.includes(a));return t.metaKey!==s||t.ctrlKey!==i||t.altKey!==r||t.shiftKey!==o}}const qn={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:n=>n.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function or(n){const t=n.tagName.toLowerCase();if(t in qn)return qn[t](n)}function qt(n){throw new Error(n)}function ar(n){try{return JSON.parse(n)}catch{return n}}class lr{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 l=s[o];r=r&&l({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:l}=this,c={identifier:r,controller:o,element:a,index:l,event:t};this.context.handleError(i,`invoking action "${this.action}"`,c)}}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 Ls{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 Ds{constructor(t,e,s){this.attributeName=e,this.delegate=s,this.elementObserver=new Ls(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 cr(n,t,e){_s(n,t).add(e)}function ur(n,t,e){_s(n,t).delete(e),hr(n,t)}function _s(n,t){let e=n.get(t);return e||(e=new Set,n.set(t,e)),e}function hr(n,t){const e=n.get(t);e!=null&&e.size==0&&n.delete(t)}class lt{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){cr(this.valuesByKey,t,e)}delete(t,e){ur(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 dr{constructor(t,e,s,i){this._selector=e,this.details=i,this.elementObserver=new Ls(t,this),this.delegate=s,this.matchesByElement=new lt}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 fr{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 Fs{constructor(t,e,s){this.attributeObserver=new Ds(t,e,this),this.delegate=s,this.tokensByElement=new lt}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=pr(e,s).findIndex(([r,o])=>!gr(r,o));return i==-1?[[],[]]:[e.slice(i),s.slice(i)]}readTokensForElement(t){const e=this.attributeName,s=t.getAttribute(e)||"";return mr(s,t,e)}}function mr(n,t,e){return n.trim().split(/\s+/).filter(s=>s.length).map((s,i)=>({element:t,attributeName:e,content:s,index:i}))}function pr(n,t){const e=Math.max(n.length,t.length);return Array.from({length:e},(s,i)=>[n[i],t[i]])}function gr(n,t){return n&&t&&n.index==t.index&&n.content==t.content}class Bs{constructor(t,e,s){this.tokenListObserver=new Fs(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 br{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new Bs(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 lr(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=rr.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}}class vr{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new fr(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 l=s;s&&(l=o.reader(s)),r.call(this.receiver,a,l)}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${Ut(e.name)}`;return this.receiver[s]}}class yr{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new lt}start(){this.tokenListObserver||(this.tokenListObserver=new Fs(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 Kt(n,t){const e=Ps(n);return Array.from(e.reduce((s,i)=>(Er(i,t).forEach(r=>s.add(r)),s),new Set))}function wr(n,t){return Ps(n).reduce((s,i)=>(s.push(...Ar(i,t)),s),[])}function Ps(n){const t=[];for(;n;)t.push(n),n=Object.getPrototypeOf(n);return t.reverse()}function Er(n,t){const e=n[t];return Array.isArray(e)?e:[]}function Ar(n,t){const e=n[t];return e?Object.keys(e).map(s=>[s,e[s]]):[]}class Tr{constructor(t,e){this.started=!1,this.context=t,this.delegate=e,this.outletsByName=new lt,this.outletElementsByName=new lt,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 dr(document.body,e,this,{outletName:t});this.selectorObserverMap.set(t,s),s.start()}setupAttributeObserverForOutlet(t){const e=this.attributeNameForOutletName(t),s=new Ds(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 lt;return this.router.modules.forEach(e=>{const s=e.definition.controllerConstructor;Kt(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 xr{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 br(this,this.dispatcher),this.valueObserver=new vr(this,this.controller),this.targetObserver=new yr(this,this),this.outletObserver=new Tr(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(`${je(s)}OutletConnected`,t,e)}outletDisconnected(t,e,s){this.invokeControllerMethod(`${je(s)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){const s=this.controller;typeof s[t]=="function"&&s[t](...e)}}function Or(n){return Sr(n,Mr(n))}function Sr(n,t){const e=Dr(n),s=kr(n.prototype,t);return Object.defineProperties(e.prototype,s),e}function Mr(n){return Kt(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 kr(n,t){return Lr(t).reduce((e,s)=>{const i=Cr(n,t,s);return i&&Object.assign(e,{[s]:i}),e},{})}function Cr(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 Lr=typeof Object.getOwnPropertySymbols=="function"?n=>[...Object.getOwnPropertyNames(n),...Object.getOwnPropertySymbols(n)]:Object.getOwnPropertyNames,Dr=(()=>{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 _r(n){return{identifier:n.identifier,controllerConstructor:Or(n.controllerConstructor)}}class Fr{constructor(t,e){this.application=t,this.definition=_r(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 xr(this,t),this.contextsByScope.set(t,e)),e}}class Br{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 ir(e)}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}}class Pr{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}-${Cs(t)}`}}class $r{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 He(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 He(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 He(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 Nr{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 rn{constructor(t,e,s,i){this.targets=new Rr(this),this.classes=new Br(this),this.data=new Pr(this),this.containsElement=r=>r.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=s,this.guide=new $r(i),this.outlets=new Nr(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 He(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new rn(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class Ir{constructor(t,e,s){this.element=t,this.schema=e,this.delegate=s,this.valueListObserver=new Bs(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 jr{constructor(t){this.application=t,this.scopeObserver=new Ir(this.element,this.schema,this),this.scopesByIdentifier=new lt,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 rn(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 Vr={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"},Yn("abcdefghijklmnopqrstuvwxyz".split("").map(n=>[n,n]))),Yn("0123456789".split("").map(n=>[n,n])))};function Yn(n){return n.reduce((t,[e,s])=>Object.assign(Object.assign({},t),{[e]:s}),{})}class Hr{constructor(t=document.documentElement,e=Vr){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 Zi(this),this.router=new jr(this),this.actionDescriptorFilters=Object.assign({},Ji)}static start(t,e){const s=new this(t,e);return s.start(),s}async start(){await Wr(),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 Mt(n,t){return t?"- ":`${n+1}. `}function Yi(n,t){let e,s,i;return n.orderedList?(s=Wn(t),e=Un(s.text),i=e.text):(s=Un(t),e=Wn(s.text),i=e.text),[s,e,i]}function Xi(n,t){const e=n.selectionStart===n.selectionEnd;let s=n.selectionStart,i=n.selectionEnd;Ui(n);const r=n.value.slice(n.selectionStart,n.selectionEnd),[o,a,l]=Yi(t,r),c=l.split(`
93
+ `).map((p,b)=>`${Mt(b,t.unorderedList)}${p}`),u=c.reduce((p,b,g)=>p+Mt(g,t.unorderedList).length,0),d=c.reduce((p,b,g)=>p+Mt(g,!t.unorderedList).length,0);if(o.processed)return e?(s=Math.max(s-Mt(0,t.unorderedList).length,0),i=s):(s=n.selectionStart,i=n.selectionEnd-u),{text:l,selectionStart:s,selectionEnd:i};const{newlinesToAppend:h,newlinesToPrepend:m}=en(n),f=h+c.join(`
94
+ `)+m;return e?(s=Math.max(s+Mt(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 Ie(n,t){const e=n.closest("markdown-toolbar");if(!(e instanceof Qt))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(),Wi(r,i))}localStorage.getItem("theme");window.matchMedia("(prefers-color-scheme: dark)").matches;class Gi{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=Zi(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 Zi(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 Ji{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 Gi(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 Qi={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}},tr=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function er(n){const e=n.trim().match(tr)||[];let s=e[2],i=e[3];return i&&!["keydown","keyup","keypress"].includes(s)&&(s+=`.${i}`,i=""),{eventTarget:nr(e[4]),eventName:s,eventOptions:e[7]?sr(e[7]):{},identifier:e[5],methodName:e[6],keyFilter:e[1]||i}}function nr(n){if(n=="window")return window;if(n=="document")return document}function sr(n){return n.split(":").reduce((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)}),{})}function ir(n){if(n==window)return"window";if(n==document)return"document"}function nn(n){return n.replace(/(?:[_-])([a-z0-9])/g,(t,e)=>e.toUpperCase())}function je(n){return nn(n.replace(/--/g,"-").replace(/__/g,"_"))}function Ut(n){return n.charAt(0).toUpperCase()+n.slice(1)}function Cs(n){return n.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)}function rr(n){return n.match(/[^\s]+/g)||[]}function Kn(n){return n!=null}function Ve(n,t){return Object.prototype.hasOwnProperty.call(n,t)}const zn=["meta","ctrl","alt","shift"];class or{constructor(t,e,s,i){this.element=t,this.index=e,this.eventTarget=s.eventTarget||t,this.eventName=s.eventName||ar(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,er(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=>!zn.includes(i))[0];return s?(Ve(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[nn(o)]=lr(i))}return t}get eventTargetName(){return ir(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(t,e){const[s,i,r,o]=zn.map(a=>e.includes(a));return t.metaKey!==s||t.ctrlKey!==i||t.altKey!==r||t.shiftKey!==o}}const qn={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:n=>n.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function ar(n){const t=n.tagName.toLowerCase();if(t in qn)return qn[t](n)}function qt(n){throw new Error(n)}function lr(n){try{return JSON.parse(n)}catch{return n}}class cr{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 l=s[o];r=r&&l({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:l}=this,c={identifier:r,controller:o,element:a,index:l,event:t};this.context.handleError(i,`invoking action "${this.action}"`,c)}}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 Ls{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 Ds{constructor(t,e,s){this.attributeName=e,this.delegate=s,this.elementObserver=new Ls(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 ur(n,t,e){_s(n,t).add(e)}function hr(n,t,e){_s(n,t).delete(e),dr(n,t)}function _s(n,t){let e=n.get(t);return e||(e=new Set,n.set(t,e)),e}function dr(n,t){const e=n.get(t);e!=null&&e.size==0&&n.delete(t)}class lt{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){ur(this.valuesByKey,t,e)}delete(t,e){hr(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 fr{constructor(t,e,s,i){this._selector=e,this.details=i,this.elementObserver=new Ls(t,this),this.delegate=s,this.matchesByElement=new lt}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 mr{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 Fs{constructor(t,e,s){this.attributeObserver=new Ds(t,e,this),this.delegate=s,this.tokensByElement=new lt}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=gr(e,s).findIndex(([r,o])=>!br(r,o));return i==-1?[[],[]]:[e.slice(i),s.slice(i)]}readTokensForElement(t){const e=this.attributeName,s=t.getAttribute(e)||"";return pr(s,t,e)}}function pr(n,t,e){return n.trim().split(/\s+/).filter(s=>s.length).map((s,i)=>({element:t,attributeName:e,content:s,index:i}))}function gr(n,t){const e=Math.max(n.length,t.length);return Array.from({length:e},(s,i)=>[n[i],t[i]])}function br(n,t){return n&&t&&n.index==t.index&&n.content==t.content}class Bs{constructor(t,e,s){this.tokenListObserver=new Fs(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 vr{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new Bs(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 cr(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=or.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}}class yr{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new mr(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 l=s;s&&(l=o.reader(s)),r.call(this.receiver,a,l)}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${Ut(e.name)}`;return this.receiver[s]}}class wr{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new lt}start(){this.tokenListObserver||(this.tokenListObserver=new Fs(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 Kt(n,t){const e=Ps(n);return Array.from(e.reduce((s,i)=>(Ar(i,t).forEach(r=>s.add(r)),s),new Set))}function Er(n,t){return Ps(n).reduce((s,i)=>(s.push(...Tr(i,t)),s),[])}function Ps(n){const t=[];for(;n;)t.push(n),n=Object.getPrototypeOf(n);return t.reverse()}function Ar(n,t){const e=n[t];return Array.isArray(e)?e:[]}function Tr(n,t){const e=n[t];return e?Object.keys(e).map(s=>[s,e[s]]):[]}class xr{constructor(t,e){this.started=!1,this.context=t,this.delegate=e,this.outletsByName=new lt,this.outletElementsByName=new lt,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 fr(document.body,e,this,{outletName:t});this.selectorObserverMap.set(t,s),s.start()}setupAttributeObserverForOutlet(t){const e=this.attributeNameForOutletName(t),s=new Ds(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 lt;return this.router.modules.forEach(e=>{const s=e.definition.controllerConstructor;Kt(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 Or{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 vr(this,this.dispatcher),this.valueObserver=new yr(this,this.controller),this.targetObserver=new wr(this,this),this.outletObserver=new xr(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(`${je(s)}OutletConnected`,t,e)}outletDisconnected(t,e,s){this.invokeControllerMethod(`${je(s)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){const s=this.controller;typeof s[t]=="function"&&s[t](...e)}}function Sr(n){return Mr(n,kr(n))}function Mr(n,t){const e=_r(n),s=Cr(n.prototype,t);return Object.defineProperties(e.prototype,s),e}function kr(n){return Kt(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 Cr(n,t){return Dr(t).reduce((e,s)=>{const i=Lr(n,t,s);return i&&Object.assign(e,{[s]:i}),e},{})}function Lr(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 Dr=typeof Object.getOwnPropertySymbols=="function"?n=>[...Object.getOwnPropertyNames(n),...Object.getOwnPropertySymbols(n)]:Object.getOwnPropertyNames,_r=(()=>{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 Fr(n){return{identifier:n.identifier,controllerConstructor:Sr(n.controllerConstructor)}}class Br{constructor(t,e){this.application=t,this.definition=Fr(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 Or(this,t),this.contextsByScope.set(t,e)),e}}class Pr{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 rr(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}-${Cs(t)}`}}class Rr{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 He(n,t){return`[${n}~="${t}"]`}class Nr{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 He(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 He(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 Ir{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 sn{constructor(t,e,s,i){this.targets=new Nr(this),this.classes=new Pr(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 Rr(i),this.outlets=new Ir(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 He(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new sn(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class jr{constructor(t,e,s){this.element=t,this.schema=e,this.delegate=s,this.valueListObserver=new Bs(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 Vr{constructor(t){this.application=t,this.scopeObserver=new jr(this.element,this.schema,this),this.scopesByIdentifier=new lt,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 Br(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 sn(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 Hr={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"},Yn("abcdefghijklmnopqrstuvwxyz".split("").map(n=>[n,n]))),Yn("0123456789".split("").map(n=>[n,n])))};function Yn(n){return n.reduce((t,[e,s])=>Object.assign(Object.assign({},t),{[e]:s}),{})}class Wr{constructor(t=document.documentElement,e=Hr){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 Ji(this),this.router=new Vr(this),this.actionDescriptorFilters=Object.assign({},Qi)}static start(t,e){const s=new this(t,e);return s.start(),s}async start(){await Ur(),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 Wr(){return new Promise(n=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>n()):n()})}function Ur(n){return Kt(n,"classes").reduce((e,s)=>Object.assign(e,Kr(s)),{})}function Kr(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${Ut(n)}Class`]:{get(){return this.classes.has(n)}}}}function zr(n){return Kt(n,"outlets").reduce((e,s)=>Object.assign(e,qr(s)),{})}function Xn(n,t,e){return n.application.getControllerForElementAndIdentifier(t,e)}function Gn(n,t,e){let s=Xn(n,t,e);if(s||(n.application.router.proposeToConnectScopeForElementAndIdentifier(t,e),s=Xn(n,t,e),s))return s}function qr(n){const t=je(n);return{[`${t}Outlet`]:{get(){const e=this.outlets.find(n),s=this.outlets.getSelectorForOutletName(n);if(e){const i=Gn(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=Gn(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${Ut(t)}Outlet`]:{get(){return this.outlets.has(n)}}}}function Yr(n){return Kt(n,"targets").reduce((e,s)=>Object.assign(e,Xr(s)),{})}function Xr(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${Ut(n)}Target`]:{get(){return this.targets.has(n)}}}}function Gr(n){const t=wr(n,"values"),e={valueDescriptorMap:{get(){return t.reduce((s,i)=>{const r=$s(i,this.identifier),o=this.data.getAttributeNameForKey(r.key);return Object.assign(s,{[o]:r})},{})}}};return t.reduce((s,i)=>Object.assign(s,Zr(i)),e)}function Zr(n,t){const e=$s(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${Ut(i)}`]:{get(){return this.data.has(s)||e.hasCustomDefaultValue}}}}function $s([n,t],e){return eo({controller:e,token:n,typeDefinition:t})}function te(n){switch(n){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Vt(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 Jr(n){const{controller:t,token:e,typeObject:s}=n,i=Kn(s.type),r=Kn(s.default),o=i&&r,a=i&&!r,l=!i&&r,c=te(s.type),u=Vt(n.typeObject.default);if(a)return c;if(l)return u;if(c!==u){const m=t?`${t}.${e}`:e;throw new Error(`The specified default value for the Stimulus Value "${m}" must match the defined type "${c}". The provided default value of "${s.default}" is of type "${u}".`)}if(o)return c}function Qr(n){const{controller:t,token:e,typeDefinition:s}=n,r=Jr({controller:t,token:e,typeObject:s}),o=Vt(s),a=te(s),l=r||o||a;if(l)return l;const c=t?`${t}.${s}`:e;throw new Error(`Unknown value type "${c}" for "${e}" value`)}function to(n){const t=te(n);if(t)return Zn[t];const e=Ve(n,"default"),s=Ve(n,"type"),i=n;if(e)return i.default;if(s){const{type:r}=i,o=te(r);if(o)return Zn[o]}return n}function eo(n){const{token:t,typeDefinition:e}=n,s=`${Cs(t)}-value`,i=Qr(n);return{type:i,key:s,name:sn(s),get defaultValue(){return to(e)},get hasCustomDefaultValue(){return Vt(e)!==void 0},reader:no[i],writer:Jn[i]||Jn.default}}const Zn={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},no={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 "${Vt(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 "${Vt(t)}"`);return t},string(n){return n}},Jn={default:so,array:Qn,object:Qn};function Qn(n){return JSON.stringify(n)}function so(n){return`${n}`}let G=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,l=new CustomEvent(a,{detail:s,bubbles:r,cancelable:o});return e.dispatchEvent(l),l}};G.blessings=[Ur,Yr,Gr,zr];G.targets=[];G.outlets=[];G.values={};function I(){return function({targets:t,values:e}={}){const i=class i extends G{};i.targets=Object.keys(t??{}),i.values=e??{};let s=i;return s}}class io extends I()({targets:{toggle:HTMLInputElement},values:{formMethod:String,formUrl:String,csrfToken:String,turbo:Boolean}}){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;const i={"Requested-With":"XMLHttpRequest"};this.turboValue&&(i.Accept="text/vnd.turbo-stream.html");try{s=await fetch(this.formUrlValue,{credentials:"same-origin",method:this.formMethodValue,headers:i,body:t})}catch(o){throw new Error(`A network error occurred, please try again: ${o.message}`)}if(!s.ok)throw new Error(await s.text());const r=s.headers.get("Content-Type");window.Turbo&&this.turbo&&(r!=null&&r.startsWith("text/vnd.turbo-stream.html"))&&window.Turbo.renderStreamMessage(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 ro=Object.freeze(Object.defineProperty({__proto__:null,default:io},Symbol.toStringTag,{value:"Module"}));function oo(n,t){n.indexOf(t)===-1&&n.push(t)}const Rs=(n,t,e)=>Math.min(Math.max(e,n),t),N={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},ee=n=>typeof n=="number",yt=n=>Array.isArray(n)&&!ee(n[0]),ao=(n,t,e)=>{const s=t-n;return((e-n)%s+s)%s+n};function lo(n,t){return yt(n)?n[ao(0,n.length,t)]:n}const Ns=(n,t,e)=>-e*n+e*t+n,Is=()=>{},tt=n=>n,on=(n,t,e)=>t-n===0?1:(e-n)/(t-n);function js(n,t){const e=n[n.length-1];for(let s=1;s<=t;s++){const i=on(0,t,s);n.push(Ns(e,1,i))}}function co(n){const t=[0];return js(t,n-1),t}function uo(n,t=co(n.length),e=tt){const s=n.length,i=s-t.length;return i>0&&js(t,i),r=>{let o=0;for(;o<s-2&&!(r<t[o+1]);o++);let a=Rs(0,1,on(t[o],t[o+1],r));return a=lo(e,o)(a),Ns(n[o],n[o+1],a)}}const Vs=n=>Array.isArray(n)&&ee(n[0]),We=n=>typeof n=="object"&&!!n.createAnimation,At=n=>typeof n=="function",ho=n=>typeof n=="string",Rt={ms:n=>n*1e3,s:n=>n/1e3},Hs=(n,t,e)=>(((1-3*e+3*t)*n+(3*e-6*t))*n+3*t)*n,fo=1e-7,mo=12;function po(n,t,e,s,i){let r,o,a=0;do o=t+(e-t)/2,r=Hs(o,s,i)-n,r>0?e=o:t=o;while(Math.abs(r)>fo&&++a<mo);return o}function Ft(n,t,e,s){if(n===t&&e===s)return tt;const i=r=>po(r,0,1,n,e);return r=>r===0||r===1?r:Hs(i(r),t,s)}const go=(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 Rs(0,1,i/n)},bo={ease:Ft(.25,.1,.25,1),"ease-in":Ft(.42,0,1,1),"ease-in-out":Ft(.42,0,.58,1),"ease-out":Ft(0,0,.58,1)},vo=/\((.*?)\)/;function ts(n){if(At(n))return n;if(Vs(n))return Ft(...n);const t=bo[n];if(t)return t;if(n.startsWith("steps")){const e=vo.exec(n);if(e){const s=e[1].split(",");return go(parseFloat(s[0]),s[1].trim())}}return tt}class Ws{constructor(t,e=[0,1],{easing:s,duration:i=N.duration,delay:r=N.delay,endDelay:o=N.endDelay,repeat:a=N.repeat,offset:l,direction:c="normal",autoplay:u=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=tt,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((h,d)=>{this.resolve=h,this.reject=d}),s=s||N.easing,We(s)){const h=s.createAnimation(e);s=h.easing,e=h.keyframes||e,i=h.duration||i}this.repeat=a,this.easing=yt(s)?tt:ts(s),this.updateDuration(i);const m=uo(e,l,yt(s)?s.map(ts):tt);this.tick=h=>{var d;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 p=f/this.duration;let b=Math.floor(p),g=p%1;!g&&p>=1&&(g=1),g===1&&b--;const w=b%2;(c==="reverse"||c==="alternate"&&w||c==="alternate-reverse"&&!w)&&(g=1-g);const E=f>=this.totalDuration?1:Math.min(g,1),v=m(this.easing(E));t(v),this.pauseTime===void 0&&(this.playState==="finished"||f>=this.totalDuration+o)?(this.playState="finished",(d=this.resolve)===null||d===void 0||d.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 yo{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const Se=new WeakMap;function Us(n){return Se.has(n)||Se.set(n,{transforms:[],values:new Map}),Se.get(n)}function wo(n,t){return n.has(t)||n.set(t,new yo),n.get(t)}const Eo=["","X","Y","Z"],Ao=["translate","scale","rotate","skew"],ne={x:"translateX",y:"translateY",z:"translateZ"},es={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:n=>n+"deg"},To={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:n=>n+"px"},rotate:es,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:tt},skew:es},Ht=new Map,an=n=>`--motion-${n}`,se=["x","y","z"];Ao.forEach(n=>{Eo.forEach(t=>{se.push(n+t),Ht.set(an(n+t),To[n])})});const xo=(n,t)=>se.indexOf(n)-se.indexOf(t),Oo=new Set(se),Ks=n=>Oo.has(n),So=(n,t)=>{ne[t]&&(t=ne[t]);const{transforms:e}=Us(n);oo(e,t),n.style.transform=Mo(e)},Mo=n=>n.sort(xo).reduce(ko,"").trim(),ko=(n,t)=>`${n} ${t}(var(${an(t)}))`,Ue=n=>n.startsWith("--"),ns=new Set;function Co(n){if(!ns.has(n)){ns.add(n);try{const{syntax:t,initialValue:e}=Ht.has(n)?Ht.get(n):{};CSS.registerProperty({name:n,inherits:!1,syntax:t,initialValue:e})}catch{}}}const Me=(n,t)=>document.createElement("div").animate(n,t),ss={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{Me({opacity:[1]})}catch{return!1}return!0},finished:()=>!!Me({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{Me({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},ke={},pt={};for(const n in ss)pt[n]=()=>(ke[n]===void 0&&(ke[n]=ss[n]()),ke[n]);const Lo=.015,Do=(n,t)=>{let e="";const s=Math.round(t/Lo);for(let i=0;i<s;i++)e+=n(on(0,s-1,i))+", ";return e.substring(0,e.length-2)},is=(n,t)=>At(n)?pt.linearEasing()?`linear(${Do(n,t)})`:N.easing:Vs(n)?_o(n):n,_o=([n,t,e,s])=>`cubic-bezier(${n}, ${t}, ${e}, ${s})`;function Fo(n,t){for(let e=0;e<n.length;e++)n[e]===null&&(n[e]=e?n[e-1]:t());return n}const Bo=n=>Array.isArray(n)?n:[n];function Ke(n){return ne[n]&&(n=ne[n]),Ks(n)?an(n):n}const Yt={get:(n,t)=>{t=Ke(t);let e=Ue(t)?n.style.getPropertyValue(t):getComputedStyle(n)[t];if(!e&&e!==0){const s=Ht.get(t);s&&(e=s.initialValue)}return e},set:(n,t,e)=>{t=Ke(t),Ue(t)?n.style.setProperty(t,e):n.style[t]=e}};function zs(n,t=!0){if(!(!n||n.playState==="finished"))try{n.stop?n.stop():(t&&n.commitStyles(),n.cancel())}catch{}}function Po(n,t){var e;let s=(t==null?void 0:t.toDefaultUnit)||tt;const i=n[n.length-1];if(ho(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 $o(){return window.__MOTION_DEV_TOOLS_RECORD}function Ro(n,t,e,s={},i){const r=$o(),o=s.record!==!1&&r;let a,{duration:l=N.duration,delay:c=N.delay,endDelay:u=N.endDelay,repeat:m=N.repeat,easing:h=N.easing,persist:d=!1,direction:f,offset:p,allowWebkitAcceleration:b=!1,autoplay:g=!0}=s;const w=Us(n),E=Ks(t);let v=pt.waapi();E&&So(n,t);const y=Ke(t),x=wo(w.values,y),O=Ht.get(y);return zs(x.animation,!(We(h)&&x.generator)&&s.record!==!1),()=>{const L=()=>{var T,D;return(D=(T=Yt.get(n,y))!==null&&T!==void 0?T:O==null?void 0:O.initialValue)!==null&&D!==void 0?D:0};let A=Fo(Bo(e),L);const C=Po(A,O);if(We(h)){const T=h.createAnimation(A,t!=="opacity",L,y,x);h=T.easing,A=T.keyframes||A,l=T.duration||l}if(Ue(y)&&(pt.cssRegisterProperty()?Co(y):v=!1),E&&!pt.linearEasing()&&(At(h)||yt(h)&&h.some(At))&&(v=!1),v){O&&(A=A.map(_=>ee(_)?O.toDefaultUnit(_):_)),A.length===1&&(!pt.partialKeyframes()||o)&&A.unshift(L());const T={delay:Rt.ms(c),duration:Rt.ms(l),endDelay:Rt.ms(u),easing:yt(h)?void 0:is(h,l),direction:f,iterations:m+1,fill:"both"};a=n.animate({[y]:A,offset:p,easing:yt(h)?h.map(_=>is(_,l)):void 0},T),a.finished||(a.finished=new Promise((_,M)=>{a.onfinish=_,a.oncancel=M}));const D=A[A.length-1];a.finished.then(()=>{d||(Yt.set(n,y,D),a.cancel())}).catch(Is),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(L())),a=new i(T=>{Yt.set(n,y,C?C(T):T)},A,Object.assign(Object.assign({},s),{duration:l,easing:h}));else{const T=A[A.length-1];Yt.set(n,y,O&&ee(T)?O.toDefaultUnit(T):T)}return o&&r(n,t,A,{duration:l,delay:c,easing:h,repeat:m,offset:p},"motion-one"),x.setAnimation(a),a&&!g&&a.pause(),a}}const No=(n,t)=>n[t]?Object.assign(Object.assign({},n),n[t]):Object.assign({},n);function Io(n,t){return typeof n=="string"?n=document.querySelectorAll(n):n instanceof Element&&(n=[n]),Array.from(n||[])}const jo=n=>n(),qs=(n,t,e=N.duration)=>new Proxy({animations:n.map(jo).filter(Boolean),duration:e,options:t},Ho),Vo=n=>n.animations[0],Ho={get:(n,t)=>{const e=Vo(n);switch(t){case"duration":return n.duration;case"currentTime":return Rt.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(Wo)).catch(Is)),n.finished;case"stop":return()=>{n.animations.forEach(s=>zs(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=Rt.ms(e);case"playbackRate":for(let s=0;s<n.animations.length;s++)n.animations[s][t]=e;return!0}return!1}},Wo=n=>n.finished;function Uo(n,t,e){return At(n)?n(t,e):n}function Ko(n){return function(e,s,i={}){e=Io(e);const r=e.length,o=[];for(let a=0;a<r;a++){const l=e[a];for(const c in s){const u=No(i,c);u.delay=Uo(u.delay,a,r);const m=Ro(l,c,s[c],u,n);o.push(m)}}return qs(o,i,i.duration)}}const zo=Ko(Ws);function qo(n,t={}){return qs([()=>{const e=new Ws(n,[0,1],t);return e.finished.catch(()=>{}),e}],t,t.duration)}function Ce(n,t,e){return(At(n)?qo:zo)(n,t,e)}class Yo extends I()({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){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;Ce(this.contentTarget,{height:`${t}px`},{duration:this.animationDurationValue,easing:"ease-in-out"})}hideContent(){Ce(this.contentTarget,{height:0},{duration:this.animationDurationValue,easing:"ease-in-out"})}rotateIcon(){Ce(this.iconTarget,{rotate:`${this.openValue?180:0}deg`})}}const Xo=Object.freeze(Object.defineProperty({__proto__:null,default:Yo},Symbol.toStringTag,{value:"Module"}));function Go(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 Ys(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 ze(n){if("clipboard"in navigator)return navigator.clipboard.writeText(n);const t=document.body;if(!t)return Promise.reject(new Error);const e=Go(n);return t.appendChild(e),Ys(e),t.removeChild(e),Promise.resolve()}async function Xs(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 ze(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 Zo(r),s())}}}function Zo(n){return n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?ze(n.value):n instanceof HTMLAnchorElement&&n.hasAttribute("href")?ze(n.href):Ys(n)}function Jo(n){const t=n.currentTarget;t instanceof HTMLElement&&Xs(t)}function Gs(n){if(n.key===" "||n.key==="Enter"){const t=n.currentTarget;t instanceof HTMLElement&&(n.preventDefault(),Xs(t))}}function Qo(n){n.currentTarget.addEventListener("keydown",Gs)}function ta(n){n.currentTarget.removeEventListener("keydown",Gs)}class ea extends HTMLElement{static define(t="clipboard-copy",e=customElements){return e.define(t,this),this}constructor(){super(),this.addEventListener("click",Jo),this.addEventListener("focus",Qo),this.addEventListener("blur",ta)}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 rs=typeof globalThis<"u"?globalThis:window;try{rs.ClipboardCopyElement=ea.define()}catch(n){if(!(rs.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}const na=2e3;class sa extends I()({targets:{initial:HTMLElement,confirmed:null},values:{hiddenClass:String,showClass:String}}){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)},na))}showConfirm(){this.hasConfirmedTarget&&(this.confirmedTarget.classList.remove(this.hiddenClassValue),this.confirmedTarget.classList.add(this.showClassValue),this.initialTarget.classList.add(this.hiddenClassValue))}showInitial(){this.initialTarget.classList.remove(this.hiddenClassValue),this.initialTarget.classList.add(this.showClassValue),this.hasConfirmedTarget&&this.confirmedTarget.classList.add(this.hiddenClassValue)}}const ia=Object.freeze(Object.defineProperty({__proto__:null,default:sa},Symbol.toStringTag,{value:"Module"})),U=Math.min,F=Math.max,ie=Math.round,Xt=Math.floor,et=n=>({x:n,y:n}),ra={left:"right",right:"left",bottom:"top",top:"bottom"},oa={start:"end",end:"start"};function qe(n,t,e){return F(n,U(t,e))}function xt(n,t){return typeof n=="function"?n(t):n}function nt(n){return n.split("-")[0]}function Ot(n){return n.split("-")[1]}function Zs(n){return n==="x"?"y":"x"}function ln(n){return n==="y"?"height":"width"}function ut(n){return["top","bottom"].includes(nt(n))?"y":"x"}function cn(n){return Zs(ut(n))}function aa(n,t,e){e===void 0&&(e=!1);const s=Ot(n),i=cn(n),r=ln(i);let o=i==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(o=re(o)),[o,re(o)]}function la(n){const t=re(n);return[Ye(n),t,Ye(t)]}function Ye(n){return n.replace(/start|end/g,t=>oa[t])}function ca(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 ua(n,t,e,s){const i=Ot(n);let r=ca(nt(n),e==="start",s);return i&&(r=r.map(o=>o+"-"+i),t&&(r=r.concat(r.map(Ye)))),r}function re(n){return n.replace(/left|right|bottom|top/g,t=>ra[t])}function ha(n){return{top:0,right:0,bottom:0,left:0,...n}}function Js(n){return typeof n!="number"?ha(n):{top:n,right:n,bottom:n,left:n}}function oe(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 os(n,t,e){let{reference:s,floating:i}=n;const r=ut(t),o=cn(t),a=ln(o),l=nt(t),c=r==="y",u=s.x+s.width/2-i.width/2,m=s.y+s.height/2-i.height/2,h=s[a]/2-i[a]/2;let d;switch(l){case"top":d={x:u,y:s.y-i.height};break;case"bottom":d={x:u,y:s.y+s.height};break;case"right":d={x:s.x+s.width,y:m};break;case"left":d={x:s.x-i.width,y:m};break;default:d={x:s.x,y:s.y}}switch(Ot(t)){case"start":d[o]-=h*(e&&c?-1:1);break;case"end":d[o]+=h*(e&&c?-1:1);break}return d}const da=async(n,t,e)=>{const{placement:s="bottom",strategy:i="absolute",middleware:r=[],platform:o}=e,a=r.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:n,floating:t,strategy:i}),{x:u,y:m}=os(c,s,l),h=s,d={},f=0;for(let p=0;p<a.length;p++){const{name:b,fn:g}=a[p],{x:w,y:E,data:v,reset:y}=await g({x:u,y:m,initialPlacement:s,placement:h,strategy:i,middlewareData:d,rects:c,platform:o,elements:{reference:n,floating:t}});u=w??u,m=E??m,d={...d,[b]:{...d[b],...v}},y&&f<=50&&(f++,typeof y=="object"&&(y.placement&&(h=y.placement),y.rects&&(c=y.rects===!0?await o.getElementRects({reference:n,floating:t,strategy:i}):y.rects),{x:u,y:m}=os(c,h,l)),p=-1)}return{x:u,y:m,placement:h,strategy:i,middlewareData:d}};async function un(n,t){var e;t===void 0&&(t={});const{x:s,y:i,platform:r,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:m="floating",altBoundary:h=!1,padding:d=0}=xt(t,n),f=Js(d),b=a[h?m==="floating"?"reference":"floating":m],g=oe(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:c,rootBoundary:u,strategy:l})),w=m==="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=oe(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:E,strategy:l}):w);return{top:(g.top-y.top+f.top)/v.y,bottom:(y.bottom-g.bottom+f.bottom)/v.y,left:(g.left-y.left+f.left)/v.x,right:(y.right-g.right+f.right)/v.x}}const fa=n=>({name:"arrow",options:n,async fn(t){const{x:e,y:s,placement:i,rects:r,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=xt(n,t)||{};if(c==null)return{};const m=Js(u),h={x:e,y:s},d=cn(i),f=ln(d),p=await o.getDimensions(c),b=d==="y",g=b?"top":"left",w=b?"bottom":"right",E=b?"clientHeight":"clientWidth",v=r.reference[f]+r.reference[d]-h[d]-r.floating[f],y=h[d]-r.reference[d],x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let O=x?x[E]:0;(!O||!await(o.isElement==null?void 0:o.isElement(x)))&&(O=a.floating[E]||r.floating[f]);const L=v/2-y/2,A=O/2-p[f]/2-1,C=U(m[g],A),T=U(m[w],A),D=C,_=O-p[f]-T,M=O/2-p[f]/2+L,dt=qe(D,M,_),q=!l.arrow&&Ot(i)!=null&&M!==dt&&r.reference[f]/2-(M<D?C:T)-p[f]/2<0,W=q?M<D?M-D:M-_:0;return{[d]:h[d]+W,data:{[d]:dt,centerOffset:M-dt-W,...q&&{alignmentOffset:W}},reset:q}}}),ma=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:l,elements:c}=t,{mainAxis:u=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:p=!0,...b}=xt(n,t);if((e=r.arrow)!=null&&e.alignmentOffset)return{};const g=nt(i),w=ut(a),E=nt(a)===a,v=await(l.isRTL==null?void 0:l.isRTL(c.floating)),y=h||(E||!p?[re(a)]:la(a)),x=f!=="none";!h&&x&&y.push(...ua(a,p,f,v));const O=[a,...y],L=await un(t,b),A=[];let C=((s=r.flip)==null?void 0:s.overflows)||[];if(u&&A.push(L[g]),m){const M=aa(i,o,v);A.push(L[M[0]],L[M[1]])}if(C=[...C,{placement:i,overflows:A}],!A.every(M=>M<=0)){var T,D;const M=(((T=r.flip)==null?void 0:T.index)||0)+1,dt=O[M];if(dt)return{data:{index:M,overflows:C},reset:{placement:dt}};let q=(D=C.filter(W=>W.overflows[0]<=0).sort((W,Z)=>W.overflows[1]-Z.overflows[1])[0])==null?void 0:D.placement;if(!q)switch(d){case"bestFit":{var _;const W=(_=C.filter(Z=>{if(x){const J=ut(Z.placement);return J===w||J==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(J=>J>0).reduce((J,pi)=>J+pi,0)]).sort((Z,J)=>Z[1]-J[1])[0])==null?void 0:_[0];W&&(q=W);break}case"initialPlacement":q=a;break}if(i!==q)return{reset:{placement:q}}}return{}}}};async function pa(n,t){const{placement:e,platform:s,elements:i}=n,r=await(s.isRTL==null?void 0:s.isRTL(i.floating)),o=nt(e),a=Ot(e),l=ut(e)==="y",c=["left","top"].includes(o)?-1:1,u=r&&l?-1:1,m=xt(t,n);let{mainAxis:h,crossAxis:d,alignmentAxis:f}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};return a&&typeof f=="number"&&(d=a==="end"?f*-1:f),l?{x:d*u,y:h*c}:{x:h*c,y:d*u}}const ga=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,l=await pa(t,n);return o===((e=a.offset)==null?void 0:e.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:o}}}}},ba=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:g,y:w}=b;return{x:g,y:w}}},...l}=xt(n,t),c={x:e,y:s},u=await un(t,l),m=ut(nt(i)),h=Zs(m);let d=c[h],f=c[m];if(r){const b=h==="y"?"top":"left",g=h==="y"?"bottom":"right",w=d+u[b],E=d-u[g];d=qe(w,d,E)}if(o){const b=m==="y"?"top":"left",g=m==="y"?"bottom":"right",w=f+u[b],E=f-u[g];f=qe(w,f,E)}const p=a.fn({...t,[h]:d,[m]:f});return{...p,data:{x:p.x-e,y:p.y-s}}}}},va=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}=xt(n,t),l=await un(t,a),c=nt(e),u=Ot(e),m=ut(e)==="y",{width:h,height:d}=s.floating;let f,p;c==="top"||c==="bottom"?(f=c,p=u===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(p=c,f=u==="end"?"top":"bottom");const b=d-l.top-l.bottom,g=h-l.left-l.right,w=U(d-l[f],b),E=U(h-l[p],g),v=!t.middlewareData.shift;let y=w,x=E;if(m?x=u||v?U(E,g):g:y=u||v?U(w,b):b,v&&!u){const L=F(l.left,0),A=F(l.right,0),C=F(l.top,0),T=F(l.bottom,0);m?x=h-2*(L!==0||A!==0?L+A:F(l.left,l.right)):y=d-2*(C!==0||T!==0?C+T:F(l.top,l.bottom))}await o({...t,availableWidth:x,availableHeight:y});const O=await i.getDimensions(r.floating);return h!==O.width||d!==O.height?{reset:{rects:!0}}:{}}}};function fe(){return typeof window<"u"}function St(n){return Qs(n)?(n.nodeName||"").toLowerCase():"#document"}function P(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function z(n){var t;return(t=(Qs(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function Qs(n){return fe()?n instanceof Node||n instanceof P(n).Node:!1}function V(n){return fe()?n instanceof Element||n instanceof P(n).Element:!1}function K(n){return fe()?n instanceof HTMLElement||n instanceof P(n).HTMLElement:!1}function as(n){return!fe()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof P(n).ShadowRoot}function zt(n){const{overflow:t,overflowX:e,overflowY:s,display:i}=H(n);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(i)}function ya(n){return["table","td","th"].includes(St(n))}function me(n){return[":popover-open",":modal"].some(t=>{try{return n.matches(t)}catch{return!1}})}function hn(n){const t=dn(),e=V(n)?H(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 wa(n){let t=st(n);for(;K(t)&&!Tt(t);){if(hn(t))return t;if(me(t))return null;t=st(t)}return null}function dn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Tt(n){return["html","body","#document"].includes(St(n))}function H(n){return P(n).getComputedStyle(n)}function pe(n){return V(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function st(n){if(St(n)==="html")return n;const t=n.assignedSlot||n.parentNode||as(n)&&n.host||z(n);return as(t)?t.host:t}function ti(n){const t=st(n);return Tt(t)?n.ownerDocument?n.ownerDocument.body:n.body:K(t)&&zt(t)?t:ti(t)}function Wt(n,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=ti(n),r=i===((s=n.ownerDocument)==null?void 0:s.body),o=P(i);if(r){const a=Xe(o);return t.concat(o,o.visualViewport||[],zt(i)?i:[],a&&e?Wt(a):[])}return t.concat(i,Wt(i,[],e))}function Xe(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function ei(n){const t=H(n);let e=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=K(n),r=i?n.offsetWidth:e,o=i?n.offsetHeight:s,a=ie(e)!==r||ie(s)!==o;return a&&(e=r,s=o),{width:e,height:s,$:a}}function fn(n){return V(n)?n:n.contextElement}function wt(n){const t=fn(n);if(!K(t))return et(1);const e=t.getBoundingClientRect(),{width:s,height:i,$:r}=ei(t);let o=(r?ie(e.width):e.width)/s,a=(r?ie(e.height):e.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Ea=et(0);function ni(n){const t=P(n);return!dn()||!t.visualViewport?Ea:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Aa(n,t,e){return t===void 0&&(t=!1),!e||t&&e!==P(n)?!1:t}function ht(n,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),r=fn(n);let o=et(1);t&&(s?V(s)&&(o=wt(s)):o=wt(n));const a=Aa(r,e,s)?ni(r):et(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,m=i.height/o.y;if(r){const h=P(r),d=s&&V(s)?P(s):s;let f=h,p=Xe(f);for(;p&&s&&d!==f;){const b=wt(p),g=p.getBoundingClientRect(),w=H(p),E=g.left+(p.clientLeft+parseFloat(w.paddingLeft))*b.x,v=g.top+(p.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,m*=b.y,l+=E,c+=v,f=P(p),p=Xe(f)}}return oe({width:u,height:m,x:l,y:c})}function Ta(n){let{elements:t,rect:e,offsetParent:s,strategy:i}=n;const r=i==="fixed",o=z(s),a=t?me(t.floating):!1;if(s===o||a&&r)return e;let l={scrollLeft:0,scrollTop:0},c=et(1);const u=et(0),m=K(s);if((m||!m&&!r)&&((St(s)!=="body"||zt(o))&&(l=pe(s)),K(s))){const h=ht(s);c=wt(s),u.x=h.x+s.clientLeft,u.y=h.y+s.clientTop}return{width:e.width*c.x,height:e.height*c.y,x:e.x*c.x-l.scrollLeft*c.x+u.x,y:e.y*c.y-l.scrollTop*c.y+u.y}}function xa(n){return Array.from(n.getClientRects())}function Ge(n,t){const e=pe(n).scrollLeft;return t?t.left+e:ht(z(n)).left+e}function Oa(n){const t=z(n),e=pe(n),s=n.ownerDocument.body,i=F(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),r=F(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-e.scrollLeft+Ge(n);const a=-e.scrollTop;return H(s).direction==="rtl"&&(o+=F(t.clientWidth,s.clientWidth)-i),{width:i,height:r,x:o,y:a}}function Sa(n,t){const e=P(n),s=z(n),i=e.visualViewport;let r=s.clientWidth,o=s.clientHeight,a=0,l=0;if(i){r=i.width,o=i.height;const c=dn();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:r,height:o,x:a,y:l}}function Ma(n,t){const e=ht(n,!0,t==="fixed"),s=e.top+n.clientTop,i=e.left+n.clientLeft,r=K(n)?wt(n):et(1),o=n.clientWidth*r.x,a=n.clientHeight*r.y,l=i*r.x,c=s*r.y;return{width:o,height:a,x:l,y:c}}function ls(n,t,e){let s;if(t==="viewport")s=Sa(n,e);else if(t==="document")s=Oa(z(n));else if(V(t))s=Ma(t,e);else{const i=ni(n);s={...t,x:t.x-i.x,y:t.y-i.y}}return oe(s)}function si(n,t){const e=st(n);return e===t||!V(e)||Tt(e)?!1:H(e).position==="fixed"||si(e,t)}function ka(n,t){const e=t.get(n);if(e)return e;let s=Wt(n,[],!1).filter(a=>V(a)&&St(a)!=="body"),i=null;const r=H(n).position==="fixed";let o=r?st(n):n;for(;V(o)&&!Tt(o);){const a=H(o),l=hn(o);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||zt(o)&&!l&&si(n,o))?s=s.filter(u=>u!==o):i=a,o=st(o)}return t.set(n,s),s}function Ca(n){let{element:t,boundary:e,rootBoundary:s,strategy:i}=n;const o=[...e==="clippingAncestors"?me(t)?[]:ka(t,this._c):[].concat(e),s],a=o[0],l=o.reduce((c,u)=>{const m=ls(t,u,i);return c.top=F(m.top,c.top),c.right=U(m.right,c.right),c.bottom=U(m.bottom,c.bottom),c.left=F(m.left,c.left),c},ls(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function La(n){const{width:t,height:e}=ei(n);return{width:t,height:e}}function Da(n,t,e){const s=K(t),i=z(t),r=e==="fixed",o=ht(n,!0,r,t);let a={scrollLeft:0,scrollTop:0};const l=et(0);if(s||!s&&!r)if((St(t)!=="body"||zt(i))&&(a=pe(t)),s){const d=ht(t,!0,r,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&(l.x=Ge(i));let c=0,u=0;if(i&&!s&&!r){const d=i.getBoundingClientRect();u=d.top+a.scrollTop,c=d.left+a.scrollLeft-Ge(i,d)}const m=o.left+a.scrollLeft-l.x-c,h=o.top+a.scrollTop-l.y-u;return{x:m,y:h,width:o.width,height:o.height}}function Le(n){return H(n).position==="static"}function cs(n,t){if(!K(n)||H(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return z(n)===e&&(e=e.ownerDocument.body),e}function ii(n,t){const e=P(n);if(me(n))return e;if(!K(n)){let i=st(n);for(;i&&!Tt(i);){if(V(i)&&!Le(i))return i;i=st(i)}return e}let s=cs(n,t);for(;s&&ya(s)&&Le(s);)s=cs(s,t);return s&&Tt(s)&&Le(s)&&!hn(s)?e:s||wa(n)||e}const _a=async function(n){const t=this.getOffsetParent||ii,e=this.getDimensions,s=await e(n.floating);return{reference:Da(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Fa(n){return H(n).direction==="rtl"}const Ba={convertOffsetParentRelativeRectToViewportRelativeRect:Ta,getDocumentElement:z,getClippingRect:Ca,getOffsetParent:ii,getElementRects:_a,getClientRects:xa,getDimensions:La,getScale:wt,isElement:V,isRTL:Fa};function Pa(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,l){a===void 0&&(a=!1),l===void 0&&(l=1),r();const{left:c,top:u,width:m,height:h}=n.getBoundingClientRect();if(a||t(),!m||!h)return;const d=Xt(u),f=Xt(i.clientWidth-(c+m)),p=Xt(i.clientHeight-(u+h)),b=Xt(c),w={rootMargin:-d+"px "+-f+"px "+-p+"px "+-b+"px",threshold:F(0,U(1,l))||1};let E=!0;function v(y){const x=y[0].intersectionRatio;if(x!==l){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 mn(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:l=!1}=s,c=fn(n),u=i||r?[...c?Wt(c):[],...Wt(t)]:[];u.forEach(g=>{i&&g.addEventListener("scroll",e,{passive:!0}),r&&g.addEventListener("resize",e)});const m=c&&a?Pa(c,e):null;let h=-1,d=null;o&&(d=new ResizeObserver(g=>{let[w]=g;w&&w.target===c&&d&&(d.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var E;(E=d)==null||E.observe(t)})),e()}),c&&!l&&d.observe(c),d.observe(t));let f,p=l?ht(n):null;l&&b();function b(){const g=ht(n);p&&(g.x!==p.x||g.y!==p.y||g.width!==p.width||g.height!==p.height)&&e(),p=g,f=requestAnimationFrame(b)}return e(),()=>{var g;u.forEach(w=>{i&&w.removeEventListener("scroll",e),r&&w.removeEventListener("resize",e)}),m==null||m(),(g=d)==null||g.disconnect(),d=null,l&&cancelAnimationFrame(f)}}const ge=ga,be=ba,ve=ma,$a=va,Ra=fa,ye=(n,t,e)=>{const s=new Map,i={platform:Ba,...e},r={...i.platform,_c:s};return da(n,t,{...i,platform:r})},us=(n,t)=>{const e=n[t];return typeof e=="function"?e:(...s)=>{}},Ze=(n,t,e)=>{let s=n;return e===!0?s=`${t.identifier}:${n}`:typeof e=="string"&&(s=`${e}:${n}`),s},Je=(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 Na(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 Ia(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 De={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class ja{constructor(t,e={}){var s,i,r;this.log=(l,c)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${l}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},c)),this.logger.groupEnd())},this.warn=l=>{this.logger.warn(`%c${this.controller.identifier} %c${l}`,"color: #3B82F6; font-weight: bold","color: unset")},this.dispatch=(l,c={})=>{if(this.dispatchEvent){const{event:u}=c,m=Ia(c,["event"]),h=this.extendedEvent(l,u||null,m);this.targetElement.dispatchEvent(h),this.log("dispatchEvent",Object.assign({eventName:h.type},m))}},this.call=(l,c={})=>{const u=this.controller[l];if(typeof u=="function")return u.call(this.controller,c)},this.extendedEvent=(l,c,u)=>{const{bubbles:m,cancelable:h,composed:d}=c||{bubbles:!0,cancelable:!0,composed:!0};return c&&Object.assign(u,{originalEvent:c}),new CustomEvent(this.composeEventName(l),{bubbles:m,cancelable:h,composed:d,detail:u})},this.composeEventName=l=>{let c=l;return this.eventPrefix===!0?c=`${this.controller.identifier}:${l}`:typeof this.eventPrefix=="string"&&(c=`${this.eventPrefix}:${l}`),c},this.debug=(i=(s=e==null?void 0:e.debug)!==null&&s!==void 0?s:t.application.stimulusUseDebug)!==null&&i!==void 0?i:De.debug,this.logger=(r=e==null?void 0:e.logger)!==null&&r!==void 0?r:De.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({},De,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 Va={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},ri=(n,t={})=>{const e=n,{onlyVisible:s,dispatchEvent:i,events:r,eventPrefix:o}=Object.assign({},Va,t),a=m=>{const h=(t==null?void 0:t.element)||e.element;if(!(h.contains(m.target)||!Na(h)&&s)&&(e.clickOutside&&e.clickOutside(m),i)){const d=Ze("click:outside",e,o),f=Je(d,m,{controller:e});h.dispatchEvent(f)}},l=()=>{r==null||r.forEach(m=>{window.addEventListener(m,a,!0)})},c=()=>{r==null||r.forEach(m=>{window.removeEventListener(m,a,!0)})},u=e.disconnect.bind(e);return Object.assign(e,{disconnect(){c(),u()}}),l(),[l,c]};class Ha extends G{}Ha.debounces=[];const Wa=200,hs=(n,t=Wa)=>{let e=null;return function(){const s=Array.from(arguments),i=this,r=s.map(a=>a.params),o=()=>(s.forEach((a,l)=>a.params=r[l]),n.apply(i,s));e&&clearTimeout(e),e=setTimeout(o,t)}},Ua=(n,t)=>{const e=n;e.constructor.debounces.forEach(i=>{if(typeof i=="string"&&(e[i]=hs(e[i],void 0)),typeof i=="object"){const{name:r,wait:o}=i;if(!r)return;e[r]=hs(e[r],o||void 0)}})},Ka={dispatchEvent:!0,eventPrefix:!0,visibleAttribute:"isVisible"},za=(n,t={})=>{const e=n,{dispatchEvent:s,eventPrefix:i,visibleAttribute:r}=Object.assign({},Ka,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?c(y):o.hasAttribute(r)&&u(y)},l=new IntersectionObserver(a,t),c=v=>{if(o.setAttribute(r,"true"),us(e,"appear").call(e,v,l),s){const y=Ze("appear",e,i),x=Je(y,null,{controller:e,entry:v,observer:l});o.dispatchEvent(x)}},u=v=>{if(o.removeAttribute(r),us(e,"disappear").call(e,v,l),s){const y=Ze("disappear",e,i),x=Je(y,null,{controller:e,entry:v,observer:l});o.dispatchEvent(x)}},m=e.disconnect.bind(e),h=()=>{f(),m()},d=()=>{l.observe(o)},f=()=>{l.unobserve(o)},p=()=>e.intersectionElements.filter(v=>v.hasAttribute(r)).length===0,b=()=>e.intersectionElements.filter(v=>v.hasAttribute(r)).length===1,g=()=>e.intersectionElements.some(v=>v.hasAttribute(r)),w=()=>e.intersectionElements.every(v=>v.hasAttribute(r));return Object.assign(e,{isVisible:w,noneVisible:p,oneVisible:b,atLeastOneVisible:g,allVisible:w,disconnect:h}),d(),[d,f]};class qa extends ja{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 pn=(n,t={})=>{const e=new qa(n,t);return[e.observe,e.unobserve]};class Ya extends G{}Ya.throttles=[];class Xa extends I()({targets:{wrapper:HTMLDetailsElement,button:HTMLElement,popover:$e,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(){ri(this),pn(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;ye(this.buttonTarget,this.popoverTarget,{middleware:[ge(6),ve(),be({padding:6}),$a({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=mn(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 Ga=Object.freeze(Object.defineProperty({__proto__:null,default:Xa},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 gn=!1;if(typeof window<"u"){var ds={get passive(){gn=!0}};window.addEventListener("testPassive",null,ds),window.removeEventListener("testPassive",null,ds)}var ae=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),ct=[],le=!1,oi=-1,Nt=void 0,at=void 0,It=void 0,ai=function(t){return ct.some(function(e){return!!(e.options.allowTouchMove&&e.options.allowTouchMove(t))})},ce=function(t){var e=t||window.event;return ai(e.target)||e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)},Ja=function(t){if(It===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);It=document.body.style.paddingRight,document.body.style.paddingRight=i+s+"px"}}Nt===void 0&&(Nt=document.body.style.overflow,document.body.style.overflow="hidden")},Qa=function(){It!==void 0&&(document.body.style.paddingRight=It,It=void 0),Nt!==void 0&&(document.body.style.overflow=Nt,Nt=void 0)},tl=function(){return window.requestAnimationFrame(function(){if(at===void 0){at={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)}})},el=function(){if(at!==void 0){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=at.position,document.body.style.top=at.top,document.body.style.left=at.left,window.scrollTo(e,t),at=void 0}},nl=function(t){return t?t.scrollHeight-t.scrollTop<=t.clientHeight:!1},sl=function(t,e){var s=t.targetTouches[0].clientY-oi;return ai(t.target)?!1:e&&e.scrollTop===0&&s>0||nl(e)&&s<0?ce(t):(t.stopPropagation(),!0)},il=function(t,e){if(!t){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!ct.some(function(i){return i.targetElement===t})){var s={targetElement:t,options:e||{}};ct=[].concat(Za(ct),[s]),ae?tl():Ja(e),ae&&(t.ontouchstart=function(i){i.targetTouches.length===1&&(oi=i.targetTouches[0].clientY)},t.ontouchmove=function(i){i.targetTouches.length===1&&sl(i,t)},le||(document.addEventListener("touchmove",ce,gn?{passive:!1}:void 0),le=!0))}},rl=function(t){if(!t){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}ct=ct.filter(function(e){return e.targetElement!==t}),ae&&(t.ontouchstart=null,t.ontouchmove=null,le&&ct.length===0&&(document.removeEventListener("touchmove",ce,gn?{passive:!1}:void 0),le=!1)),ae?el():Qa()};class ol extends I()({targets:{dialog:HTMLDialogElement}}){close(){this.dialogTarget.open&&(this.dialogTarget.close(),rl(this.dialogTarget))}disconnect(){this.close()}open(){this.dialogTarget.showModal(),il(this.dialogTarget,{reserveScrollBarGap:!0})}triggerClick(){this.dialogTarget.open?this.close():this.open()}windowClick(t){t.target===this.dialogTarget&&this.close()}}const al=Object.freeze(Object.defineProperty({__proto__:null,default:ol},Symbol.toStringTag,{value:"Module"}));async function ll(n,t=null){n.classList.remove("hidden"),await li("enter",n,t)}async function cl(n,t=null){await li("leave",n,t),n.classList.add("hidden")}async function li(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`],l=s[`${r}End`]?s[`${r}End`].split(" "):[`${i}-end`];_e(t,o),_e(t,a),await ul(),Fe(t,a),_e(t,l),await hl(t),Fe(t,l),Fe(t,o)}function _e(n,t){n.classList.add(...t)}function Fe(n,t){n.classList.remove(...t)}function ul(){return new Promise(n=>{requestAnimationFrame(()=>{requestAnimationFrame(n)})})}function hl(n){return new Promise(t=>{const e=getComputedStyle(n).transitionDuration.split(",")[0],s=Number(e.replace("s",""))*1e3;setTimeout(()=>{t()},s)})}const he=class he extends G{async connect(){await this.show();const t=()=>{};setTimeout(()=>{this.hide().then(t).catch(t)},this.timerValue)}async disconnect(){await this.hide()}async hide(){await cl(this.element),this.hasHiddenClass?this.element.classList.add(this.hiddenClass):this.element.classList.add("ariadne-hidden"),this.element.remove()}async show(){this.hasHiddenClass?this.element.classList.remove(this.hiddenClass):this.element.classList.remove("ariadne-hidden"),await ll(this.element)}};he.classes=["ariadne-hidden"],he.values={timer:{default:4e3,type:Number}};let Qe=he;const dl=Object.freeze(Object.defineProperty({__proto__:null,default:Qe},Symbol.toStringTag,{value:"Module"}));class fl extends I()({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()})),za(this)}appear(){this.reset()}handleInput(){this.hasSearchStringTarget&&this.handleNewQuery(this.inputTarget.value)}reset(){this.handleNewQuery(""),this.hasInputTarget&&(this.inputTarget.value="")}}const ml=Object.freeze(Object.defineProperty({__proto__:null,default:fl},Symbol.toStringTag,{value:"Module"}));class pl extends I()({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(){ri(this),pn(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=()=>{ye(this.anchorTarget,this.popoverTarget,{middleware:[ge(6),ve(),be({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=mn(this.anchorTarget,this.popoverTarget,t)}toggle(){this.element.open=!this.element.open,this.setupAutoUpdate()}}const gl=Object.freeze(Object.defineProperty({__proto__:null,default:pl},Symbol.toStringTag,{value:"Module"}));class bl extends I()({targets:{button:HTMLButtonElement,popover:HTMLElement},values:{placement:String}}){connect(){this.popoverTarget.addEventListener("toggle",t=>{t.newState==="open"&&this.updatePosition()})}updatePosition(){mn(this.buttonTarget,this.popoverTarget,()=>{ye(this.buttonTarget,this.popoverTarget,{placement:this.placementValue,middleware:[ge(5),ve(),be({padding:5})]}).then(({x:t,y:e})=>{Object.assign(this.buttonTarget.style,{left:`${t}px`,top:`${e}px`})})})}}const vl=Object.freeze(Object.defineProperty({__proto__:null,default:bl},Symbol.toStringTag,{value:"Module"}));function yl(){return/Mac|iMac|Macintosh|MacIntel/.test(navigator.userAgent)}class wl extends I()({targets:{alt:HTMLSpanElement,ctrl:HTMLSpanElement,shift:HTMLSpanElement}}){replaceSymbol(t,e){for(const s of t)s.innerText=e,s.classList.add("!font-fallback")}connect(){yl()&&(this.replaceSymbol(this.ctrlTargets,"⌘"),this.replaceSymbol(this.altTargets,"⌥"),this.replaceSymbol(this.shiftTargets,"⇧"))}}const El=Object.freeze(Object.defineProperty({__proto__:null,default:wl},Symbol.toStringTag,{value:"Module"}));var Al=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},fs=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)},Bt;class Tl{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 xl=typeof Intl<"u"&&Intl.ListFormat||Tl,Ol=[["years","year"],["months","month"],["weeks","week"],["days","day"],["hours","hour"],["minutes","minute"],["seconds","second"],["milliseconds","millisecond"]],Sl={minimumIntegerDigits:2};class Ml{constructor(t,e={}){Bt.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 l=e.milliseconds||i;Al(this,Bt,{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:l,millisecondsDisplay:e.millisecondsDisplay==="always"?"always":"auto"},"f")}resolvedOptions(){return fs(this,Bt,"f")}formatToParts(t){const e=[],s=fs(this,Bt,"f"),i=s.style,r=s.locale;for(const[o,a]of Ol){const l=t[o];if(s[`${o}Display`]==="auto"&&!l)continue;const c=s[o],u=c==="2-digit"?Sl:c==="numeric"?{}:{style:"unit",unit:a,unitDisplay:c};e.push(new Intl.NumberFormat(r,u).format(l))}return new xl(r,{type:"unit",style:i==="digital"?"short":i}).formatToParts(e)}format(t){return this.formatToParts(t).map(e=>e.value).join("")}}Bt=new WeakMap;const ci=/^[-+]?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,ue=["year","month","week","day","hour","minute","second","millisecond"],kl=n=>ci.test(n);class B{constructor(t=0,e=0,s=0,i=0,r=0,o=0,a=0,l=0){this.years=t,this.months=e,this.weeks=s,this.days=i,this.hours=r,this.minutes=o,this.seconds=a,this.milliseconds=l,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 B(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(ci))===null||e===void 0?void 0:e.slice(1).map(o=>(Number(o)||0)*i);return r?new B(...r):new B}else if(typeof t=="object"){const{years:s,months:i,weeks:r,days:o,hours:a,minutes:l,seconds:c,milliseconds:u}=t;return new B(s,i,r,o,a,l,c,u)}throw new RangeError("invalid duration")}static compare(t,e){const s=Date.now(),i=Math.abs(ms(s,B.from(t)).getTime()-s),r=Math.abs(ms(s,B.from(e)).getTime()-s);return i>r?-1:i<r?1:0}toLocaleString(t,e){return new Ml(t,e).format(this)}}function ms(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 Cl(n,t="second",e=Date.now()){const s=n.getTime()-e;if(s===0)return new B;const i=Math.sign(s),r=Math.abs(s),o=Math.floor(r/1e3),a=Math.floor(o/60),l=Math.floor(a/60),c=Math.floor(l/24),u=Math.floor(c/30),m=Math.floor(u/12),h=ue.indexOf(t)||ue.length;return new B(h>=0?m*i:0,h>=1?(u-m*12)*i:0,0,h>=3?(c-u*30)*i:0,h>=4?(l-c*24)*i:0,h>=5?(a-l*60)*i:0,h>=6?(o-a*60)*i:0,h>=7?(r-o*1e3)*i:0)}function ui(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),l=Math.abs(n.minutes),c=Math.abs(n.seconds),u=Math.abs(n.milliseconds);u>=900&&(c+=Math.round(u/1e3)),(c||l||a||o||r||i||s)&&(u=0),c>=55&&(l+=Math.round(c/60)),(l||a||o||r||i||s)&&(c=0),l>=55&&(a+=Math.round(l/60)),(a||o||r||i||s)&&(l=0),o&&a>=12&&(o+=Math.round(a/24)),!o&&a>=21&&(o+=Math.round(a/24)),(o||r||i||s)&&(a=0);const m=t.getFullYear(),h=t.getMonth(),d=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 p=Math.max(0,d-f.getDate()),b=new Date(t);b.setFullYear(m+s*e),b.setDate(d-p),b.setMonth(h+i*e),b.setDate(d-p+o*e);const g=b.getFullYear()-t.getFullYear(),w=b.getMonth()-t.getMonth(),E=Math.abs(Math.round((Number(b)-Number(t))/864e5))+p,v=Math.abs(g*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=g*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 B(s*e,i*e,r*e,o*e,a*e,l*e,c*e,u*e)}function Ll(n,t){const e=ui(n,t);if(e.blank)return[0,"second"];for(const s of ue){if(s==="millisecond")continue;const i=e[`${s}s`];if(i)return[i,s]}return[0,"second"]}var S=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)},Gt=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},R,Pt,$t,kt,ot,tn,hi,di,fi,mi,mt;const Dl=globalThis.HTMLElement||null,Be=new B,ps=new B(0,0,0,0,0,1);class _l 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 gs(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 Pe=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=gs(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,gs(t)),t.update();this.time=Math.min(60*60*1e3,n),this.timer=setTimeout(()=>this.update(),this.time),this.time+=Date.now()}};class Fl extends Dl{constructor(){super(...arguments),R.add(this),Pt.set(this,!1),$t.set(this,!1),ot.set(this,this.shadowRoot?this.shadowRoot:this.attachShadow?this.attachShadow({mode:"open"}):this),mt.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 S(this,mt,"f")}set onRelativeTimeUpdated(t){S(this,mt,"f")&&this.removeEventListener("relative-time-updated",S(this,mt,"f")),Gt(this,mt,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&&kl(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 ue.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(){Pe.unobserve(this)}attributeChangedCallback(t,e,s){e!==s&&(t==="title"&&Gt(this,Pt,s!==null&&(this.date&&S(this,R,"m",tn).call(this,this.date))!==s,"f"),!S(this,$t,"f")&&!(t==="title"&&S(this,Pt,"f"))&&Gt(this,$t,(async()=>{await Promise.resolve(),this.update(),Gt(this,$t,!1,"f")})(),"f"))}update(){const t=S(this,ot,"f").textContent||this.textContent||"",e=this.getAttribute("title")||"";let s=e;const i=this.date;if(typeof Intl>"u"||!Intl.DateTimeFormat||!i){S(this,ot,"f").textContent=t;return}const r=Date.now();S(this,Pt,"f")||(s=S(this,R,"m",tn).call(this,i)||"",s&&!this.noTitle&&this.setAttribute("title",s));const o=Cl(i,this.precision,r),a=S(this,R,"m",hi).call(this,o);let l=t;a==="duration"?l=S(this,R,"m",di).call(this,o):a==="relative"?l=S(this,R,"m",fi).call(this,o):l=S(this,R,"m",mi).call(this,i),l?S(this,ot,"f").textContent=l:this.shadowRoot===S(this,ot,"f")&&this.textContent&&(S(this,ot,"f").textContent=this.textContent),(l!==t||s!==e)&&this.dispatchEvent(new _l(t,l,e,s)),a==="relative"||a==="duration"?Pe.observe(this):Pe.unobserve(this)}}Pt=new WeakMap,$t=new WeakMap,ot=new WeakMap,mt=new WeakMap,R=new WeakSet,kt=function(){var t;return((t=this.closest("[lang]"))===null||t===void 0?void 0:t.getAttribute("lang"))||this.ownerDocument.documentElement.getAttribute("lang")||"default"},tn=function(t){return new Intl.DateTimeFormat(S(this,R,"a",kt),{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)},hi=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"||B.compare(t,this.threshold)===1)return"relative"}return"datetime"},di=function(t){const e=S(this,R,"a",kt),s=this.format,i=this.formatStyle,r=this.tense;let o=Be;s==="micro"?(t=ui(t),o=ps,(this.tense==="past"&&t.sign!==-1||this.tense==="future"&&t.sign!==1)&&(t=ps)):(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})},fi=function(t){const e=new Intl.RelativeTimeFormat(S(this,R,"a",kt),{numeric:"auto",style:this.formatStyle}),s=this.tense;s==="future"&&t.sign!==1&&(t=Be),s==="past"&&t.sign!==-1&&(t=Be);const[i,r]=Ll(t);return r==="second"&&i<10?e.format(0,this.precision==="millisecond"?"second":this.precision):e.format(i,r)},mi=function(t){const e=new Intl.DateTimeFormat(S(this,R,"a",kt),{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 bs=typeof globalThis<"u"?globalThis:window;try{bs.RelativeTimeElement=Fl.define()}catch(n){if(!(bs.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class Bl extends I()({targets:{}}){}const Pl=Object.freeze(Object.defineProperty({__proto__:null,default:Bl},Symbol.toStringTag,{value:"Module"})),de=class de extends G{connect(){Ua(this)}save(){this.hasFormTarget?this.formTarget.requestSubmit():this.element.requestSubmit()}};de.debounces=["save"],de.targets=["form"];let en=de;const $l=Object.freeze(Object.defineProperty({__proto__:null,default:en},Symbol.toStringTag,{value:"Module"}));class Rl extends I()({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(),pn(this,{childList:!0,subtree:!0})}mutate(){this.runCheck()}}const Nl=Object.freeze(Object.defineProperty({__proto__:null,default:Rl},Symbol.toStringTag,{value:"Module"}));class Il extends I()({targets:{activator:HTMLElement,wrapper:HTMLDivElement,tooltip:HTMLDivElement,arrow:HTMLDivElement}}){async update(){ye(this.activatorTarget,this.tooltipTarget,{placement:"top",middleware:[ge(10),ve(),be({padding:5}),Ra({element:this.arrowTarget})]}).then(({x:t,y:e,placement:s,middlewareData:i})=>{Object.assign(this.tooltipTarget.style,{left:`${t}px`,top:`${e}px`}),Object.assign(this.arrowTarget.style,{left:"",top:"",right:"",bottom:""});const{x:r,y:o}=i.arrow||{};switch(s.split("-")[0]){case"top":Object.assign(this.arrowTarget.style,{left:r?`${r}px`:"",bottom:"-4px"});break;case"bottom":Object.assign(this.arrowTarget.style,{left:r?`${r}px`:"",top:"-4px"});break;case"left":Object.assign(this.arrowTarget.style,{top:o?`${o}px`:"",right:"-4px"});break;case"right":Object.assign(this.arrowTarget.style,{top:o?`${o}px`:"",left:"-4px"});break}})}showTooltip(t){this.wrapperTarget.classList.add("ariadne-block"),this.wrapperTarget.classList.remove("ariadne-hidden"),this.update()}hideTooltip(t){this.wrapperTarget.classList.add("ariadne-hidden"),this.wrapperTarget.classList.remove("ariadne-block")}}const jl=Object.freeze(Object.defineProperty({__proto__:null,default:Il},Symbol.toStringTag,{value:"Module"})),we=Hr.start();we.debug=!1;window.Stimulus=we;const Vl=Object.assign({"../../components/ariadne/form/toggle/component.ts":ro,"../../components/ariadne/ui/accordion/component.ts":Xo,"../../components/ariadne/ui/clipboard_copy/component.ts":ia,"../../components/ariadne/ui/combobox/component.ts":Ga,"../../components/ariadne/ui/dialog/component.ts":al,"../../components/ariadne/ui/flash/component.ts":dl,"../../components/ariadne/ui/list/component.ts":ml,"../../components/ariadne/ui/overlay/component.ts":gl,"../../components/ariadne/ui/popover/component.ts":vl,"../../components/ariadne/ui/shortcut/component.ts":El,"../../components/ariadne/ui/time_ago/component.ts":Pl});for(const[n,t]of Object.entries(Vl)){const e=n.split("/"),s=e.slice(3,e.length-1).join("-").replaceAll("_","-").toLocaleLowerCase();we.register(s,t.default)}const Hl=Object.assign({"/controllers/form_autosubmit_controller.ts":$l,"/controllers/form_validity_controller.ts":Nl,"/controllers/tooltip_controller.ts":jl});for(const[n,t]of Object.entries(Hl)){const e=n.split("/"),s=e[e.length-1].replace("_controller.ts","").replaceAll("_","-").toLocaleLowerCase();we.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 Ur(){return new Promise(n=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>n()):n()})}function Kr(n){return Kt(n,"classes").reduce((e,s)=>Object.assign(e,zr(s)),{})}function zr(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${Ut(n)}Class`]:{get(){return this.classes.has(n)}}}}function qr(n){return Kt(n,"outlets").reduce((e,s)=>Object.assign(e,Yr(s)),{})}function Xn(n,t,e){return n.application.getControllerForElementAndIdentifier(t,e)}function Gn(n,t,e){let s=Xn(n,t,e);if(s||(n.application.router.proposeToConnectScopeForElementAndIdentifier(t,e),s=Xn(n,t,e),s))return s}function Yr(n){const t=je(n);return{[`${t}Outlet`]:{get(){const e=this.outlets.find(n),s=this.outlets.getSelectorForOutletName(n);if(e){const i=Gn(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=Gn(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${Ut(t)}Outlet`]:{get(){return this.outlets.has(n)}}}}function Xr(n){return Kt(n,"targets").reduce((e,s)=>Object.assign(e,Gr(s)),{})}function Gr(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${Ut(n)}Target`]:{get(){return this.targets.has(n)}}}}function Zr(n){const t=Er(n,"values"),e={valueDescriptorMap:{get(){return t.reduce((s,i)=>{const r=$s(i,this.identifier),o=this.data.getAttributeNameForKey(r.key);return Object.assign(s,{[o]:r})},{})}}};return t.reduce((s,i)=>Object.assign(s,Jr(i)),e)}function Jr(n,t){const e=$s(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${Ut(i)}`]:{get(){return this.data.has(s)||e.hasCustomDefaultValue}}}}function $s([n,t],e){return no({controller:e,token:n,typeDefinition:t})}function te(n){switch(n){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Vt(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 Qr(n){const{controller:t,token:e,typeObject:s}=n,i=Kn(s.type),r=Kn(s.default),o=i&&r,a=i&&!r,l=!i&&r,c=te(s.type),u=Vt(n.typeObject.default);if(a)return c;if(l)return u;if(c!==u){const d=t?`${t}.${e}`:e;throw new Error(`The specified default value for the Stimulus Value "${d}" must match the defined type "${c}". The provided default value of "${s.default}" is of type "${u}".`)}if(o)return c}function to(n){const{controller:t,token:e,typeDefinition:s}=n,r=Qr({controller:t,token:e,typeObject:s}),o=Vt(s),a=te(s),l=r||o||a;if(l)return l;const c=t?`${t}.${s}`:e;throw new Error(`Unknown value type "${c}" for "${e}" value`)}function eo(n){const t=te(n);if(t)return Zn[t];const e=Ve(n,"default"),s=Ve(n,"type"),i=n;if(e)return i.default;if(s){const{type:r}=i,o=te(r);if(o)return Zn[o]}return n}function no(n){const{token:t,typeDefinition:e}=n,s=`${Cs(t)}-value`,i=to(n);return{type:i,key:s,name:nn(s),get defaultValue(){return eo(e)},get hasCustomDefaultValue(){return Vt(e)!==void 0},reader:so[i],writer:Jn[i]||Jn.default}}const Zn={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},so={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 "${Vt(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 "${Vt(t)}"`);return t},string(n){return n}},Jn={default:io,array:Qn,object:Qn};function Qn(n){return JSON.stringify(n)}function io(n){return`${n}`}let Z=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,l=new CustomEvent(a,{detail:s,bubbles:r,cancelable:o});return e.dispatchEvent(l),l}};Z.blessings=[Kr,Xr,Zr,qr];Z.targets=[];Z.outlets=[];Z.values={};function I(){return function({targets:t,values:e}={}){const i=class i extends Z{};i.targets=Object.keys(t??{}),i.values=e??{};let s=i;return s}}class ro extends I()({targets:{toggle:HTMLInputElement},values:{formMethod:String,formUrl:String,csrfToken:String,turbo:Boolean}}){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;const i={"Requested-With":"XMLHttpRequest"};this.turboValue&&(i.Accept="text/vnd.turbo-stream.html");try{s=await fetch(this.formUrlValue,{credentials:"same-origin",method:this.formMethodValue,headers:i,body:t})}catch(o){throw new Error(`A network error occurred, please try again: ${o.message}`)}if(!s.ok)throw new Error(await s.text());const r=s.headers.get("Content-Type");window.Turbo&&this.turbo&&(r!=null&&r.startsWith("text/vnd.turbo-stream.html"))&&window.Turbo.renderStreamMessage(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 oo=Object.freeze(Object.defineProperty({__proto__:null,default:ro},Symbol.toStringTag,{value:"Module"}));function ao(n,t){n.indexOf(t)===-1&&n.push(t)}const Rs=(n,t,e)=>Math.min(Math.max(e,n),t),N={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},ee=n=>typeof n=="number",yt=n=>Array.isArray(n)&&!ee(n[0]),lo=(n,t,e)=>{const s=t-n;return((e-n)%s+s)%s+n};function co(n,t){return yt(n)?n[lo(0,n.length,t)]:n}const Ns=(n,t,e)=>-e*n+e*t+n,Is=()=>{},et=n=>n,rn=(n,t,e)=>t-n===0?1:(e-n)/(t-n);function js(n,t){const e=n[n.length-1];for(let s=1;s<=t;s++){const i=rn(0,t,s);n.push(Ns(e,1,i))}}function uo(n){const t=[0];return js(t,n-1),t}function ho(n,t=uo(n.length),e=et){const s=n.length,i=s-t.length;return i>0&&js(t,i),r=>{let o=0;for(;o<s-2&&!(r<t[o+1]);o++);let a=Rs(0,1,rn(t[o],t[o+1],r));return a=co(e,o)(a),Ns(n[o],n[o+1],a)}}const Vs=n=>Array.isArray(n)&&ee(n[0]),We=n=>typeof n=="object"&&!!n.createAnimation,At=n=>typeof n=="function",fo=n=>typeof n=="string",Rt={ms:n=>n*1e3,s:n=>n/1e3},Hs=(n,t,e)=>(((1-3*e+3*t)*n+(3*e-6*t))*n+3*t)*n,mo=1e-7,po=12;function go(n,t,e,s,i){let r,o,a=0;do o=t+(e-t)/2,r=Hs(o,s,i)-n,r>0?e=o:t=o;while(Math.abs(r)>mo&&++a<po);return o}function Ft(n,t,e,s){if(n===t&&e===s)return et;const i=r=>go(r,0,1,n,e);return r=>r===0||r===1?r:Hs(i(r),t,s)}const bo=(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 Rs(0,1,i/n)},vo={ease:Ft(.25,.1,.25,1),"ease-in":Ft(.42,0,1,1),"ease-in-out":Ft(.42,0,.58,1),"ease-out":Ft(0,0,.58,1)},yo=/\((.*?)\)/;function ts(n){if(At(n))return n;if(Vs(n))return Ft(...n);const t=vo[n];if(t)return t;if(n.startsWith("steps")){const e=yo.exec(n);if(e){const s=e[1].split(",");return bo(parseFloat(s[0]),s[1].trim())}}return et}class Ws{constructor(t,e=[0,1],{easing:s,duration:i=N.duration,delay:r=N.delay,endDelay:o=N.endDelay,repeat:a=N.repeat,offset:l,direction:c="normal",autoplay:u=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=et,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||N.easing,We(s)){const h=s.createAnimation(e);s=h.easing,e=h.keyframes||e,i=h.duration||i}this.repeat=a,this.easing=yt(s)?et:ts(s),this.updateDuration(i);const d=ho(e,l,yt(s)?s.map(ts):et);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 p=f/this.duration;let b=Math.floor(p),g=p%1;!g&&p>=1&&(g=1),g===1&&b--;const w=b%2;(c==="reverse"||c==="alternate"&&w||c==="alternate-reverse"&&!w)&&(g=1-g);const E=f>=this.totalDuration?1:Math.min(g,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 wo{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const Se=new WeakMap;function Us(n){return Se.has(n)||Se.set(n,{transforms:[],values:new Map}),Se.get(n)}function Eo(n,t){return n.has(t)||n.set(t,new wo),n.get(t)}const Ao=["","X","Y","Z"],To=["translate","scale","rotate","skew"],ne={x:"translateX",y:"translateY",z:"translateZ"},es={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:n=>n+"deg"},xo={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:n=>n+"px"},rotate:es,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:et},skew:es},Ht=new Map,on=n=>`--motion-${n}`,se=["x","y","z"];To.forEach(n=>{Ao.forEach(t=>{se.push(n+t),Ht.set(on(n+t),xo[n])})});const Oo=(n,t)=>se.indexOf(n)-se.indexOf(t),So=new Set(se),Ks=n=>So.has(n),Mo=(n,t)=>{ne[t]&&(t=ne[t]);const{transforms:e}=Us(n);ao(e,t),n.style.transform=ko(e)},ko=n=>n.sort(Oo).reduce(Co,"").trim(),Co=(n,t)=>`${n} ${t}(var(${on(t)}))`,Ue=n=>n.startsWith("--"),ns=new Set;function Lo(n){if(!ns.has(n)){ns.add(n);try{const{syntax:t,initialValue:e}=Ht.has(n)?Ht.get(n):{};CSS.registerProperty({name:n,inherits:!1,syntax:t,initialValue:e})}catch{}}}const Me=(n,t)=>document.createElement("div").animate(n,t),ss={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{Me({opacity:[1]})}catch{return!1}return!0},finished:()=>!!Me({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{Me({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},ke={},pt={};for(const n in ss)pt[n]=()=>(ke[n]===void 0&&(ke[n]=ss[n]()),ke[n]);const Do=.015,_o=(n,t)=>{let e="";const s=Math.round(t/Do);for(let i=0;i<s;i++)e+=n(rn(0,s-1,i))+", ";return e.substring(0,e.length-2)},is=(n,t)=>At(n)?pt.linearEasing()?`linear(${_o(n,t)})`:N.easing:Vs(n)?Fo(n):n,Fo=([n,t,e,s])=>`cubic-bezier(${n}, ${t}, ${e}, ${s})`;function Bo(n,t){for(let e=0;e<n.length;e++)n[e]===null&&(n[e]=e?n[e-1]:t());return n}const Po=n=>Array.isArray(n)?n:[n];function Ke(n){return ne[n]&&(n=ne[n]),Ks(n)?on(n):n}const Yt={get:(n,t)=>{t=Ke(t);let e=Ue(t)?n.style.getPropertyValue(t):getComputedStyle(n)[t];if(!e&&e!==0){const s=Ht.get(t);s&&(e=s.initialValue)}return e},set:(n,t,e)=>{t=Ke(t),Ue(t)?n.style.setProperty(t,e):n.style[t]=e}};function zs(n,t=!0){if(!(!n||n.playState==="finished"))try{n.stop?n.stop():(t&&n.commitStyles(),n.cancel())}catch{}}function $o(n,t){var e;let s=(t==null?void 0:t.toDefaultUnit)||et;const i=n[n.length-1];if(fo(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 Ro(){return window.__MOTION_DEV_TOOLS_RECORD}function No(n,t,e,s={},i){const r=Ro(),o=s.record!==!1&&r;let a,{duration:l=N.duration,delay:c=N.delay,endDelay:u=N.endDelay,repeat:d=N.repeat,easing:h=N.easing,persist:m=!1,direction:f,offset:p,allowWebkitAcceleration:b=!1,autoplay:g=!0}=s;const w=Us(n),E=Ks(t);let v=pt.waapi();E&&Mo(n,t);const y=Ke(t),x=Eo(w.values,y),O=Ht.get(y);return zs(x.animation,!(We(h)&&x.generator)&&s.record!==!1),()=>{const L=()=>{var T,D;return(D=(T=Yt.get(n,y))!==null&&T!==void 0?T:O==null?void 0:O.initialValue)!==null&&D!==void 0?D:0};let A=Bo(Po(e),L);const C=$o(A,O);if(We(h)){const T=h.createAnimation(A,t!=="opacity",L,y,x);h=T.easing,A=T.keyframes||A,l=T.duration||l}if(Ue(y)&&(pt.cssRegisterProperty()?Lo(y):v=!1),E&&!pt.linearEasing()&&(At(h)||yt(h)&&h.some(At))&&(v=!1),v){O&&(A=A.map(_=>ee(_)?O.toDefaultUnit(_):_)),A.length===1&&(!pt.partialKeyframes()||o)&&A.unshift(L());const T={delay:Rt.ms(c),duration:Rt.ms(l),endDelay:Rt.ms(u),easing:yt(h)?void 0:is(h,l),direction:f,iterations:d+1,fill:"both"};a=n.animate({[y]:A,offset:p,easing:yt(h)?h.map(_=>is(_,l)):void 0},T),a.finished||(a.finished=new Promise((_,M)=>{a.onfinish=_,a.oncancel=M}));const D=A[A.length-1];a.finished.then(()=>{m||(Yt.set(n,y,D),a.cancel())}).catch(Is),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(L())),a=new i(T=>{Yt.set(n,y,C?C(T):T)},A,Object.assign(Object.assign({},s),{duration:l,easing:h}));else{const T=A[A.length-1];Yt.set(n,y,O&&ee(T)?O.toDefaultUnit(T):T)}return o&&r(n,t,A,{duration:l,delay:c,easing:h,repeat:d,offset:p},"motion-one"),x.setAnimation(a),a&&!g&&a.pause(),a}}const Io=(n,t)=>n[t]?Object.assign(Object.assign({},n),n[t]):Object.assign({},n);function jo(n,t){return typeof n=="string"?n=document.querySelectorAll(n):n instanceof Element&&(n=[n]),Array.from(n||[])}const Vo=n=>n(),qs=(n,t,e=N.duration)=>new Proxy({animations:n.map(Vo).filter(Boolean),duration:e,options:t},Wo),Ho=n=>n.animations[0],Wo={get:(n,t)=>{const e=Ho(n);switch(t){case"duration":return n.duration;case"currentTime":return Rt.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(Uo)).catch(Is)),n.finished;case"stop":return()=>{n.animations.forEach(s=>zs(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=Rt.ms(e);case"playbackRate":for(let s=0;s<n.animations.length;s++)n.animations[s][t]=e;return!0}return!1}},Uo=n=>n.finished;function Ko(n,t,e){return At(n)?n(t,e):n}function zo(n){return function(e,s,i={}){e=jo(e);const r=e.length,o=[];for(let a=0;a<r;a++){const l=e[a];for(const c in s){const u=Io(i,c);u.delay=Ko(u.delay,a,r);const d=No(l,c,s[c],u,n);o.push(d)}}return qs(o,i,i.duration)}}const qo=zo(Ws);function Yo(n,t={}){return qs([()=>{const e=new Ws(n,[0,1],t);return e.finished.catch(()=>{}),e}],t,t.duration)}function Ce(n,t,e){return(At(n)?Yo:qo)(n,t,e)}class Xo extends I()({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){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;Ce(this.contentTarget,{height:`${t}px`},{duration:this.animationDurationValue,easing:"ease-in-out"})}hideContent(){Ce(this.contentTarget,{height:0},{duration:this.animationDurationValue,easing:"ease-in-out"})}rotateIcon(){Ce(this.iconTarget,{rotate:`${this.openValue?180:0}deg`})}}const Go=Object.freeze(Object.defineProperty({__proto__:null,default:Xo},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 Ys(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 ze(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),Ys(e),t.removeChild(e),Promise.resolve()}async function Xs(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 ze(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 Jo(r),s())}}}function Jo(n){return n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?ze(n.value):n instanceof HTMLAnchorElement&&n.hasAttribute("href")?ze(n.href):Ys(n)}function Qo(n){const t=n.currentTarget;t instanceof HTMLElement&&Xs(t)}function Gs(n){if(n.key===" "||n.key==="Enter"){const t=n.currentTarget;t instanceof HTMLElement&&(n.preventDefault(),Xs(t))}}function ta(n){n.currentTarget.addEventListener("keydown",Gs)}function ea(n){n.currentTarget.removeEventListener("keydown",Gs)}class na extends HTMLElement{static define(t="clipboard-copy",e=customElements){return e.define(t,this),this}constructor(){super(),this.addEventListener("click",Qo),this.addEventListener("focus",ta),this.addEventListener("blur",ea)}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 rs=typeof globalThis<"u"?globalThis:window;try{rs.ClipboardCopyElement=na.define()}catch(n){if(!(rs.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}const sa=2e3;class ia extends I()({targets:{initial:HTMLElement,confirmed:null},values:{hiddenClass:String,showClass:String}}){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)},sa))}showConfirm(){this.hasConfirmedTarget&&(this.confirmedTarget.classList.remove(this.hiddenClassValue),this.confirmedTarget.classList.add(this.showClassValue),this.initialTarget.classList.add(this.hiddenClassValue))}showInitial(){this.initialTarget.classList.remove(this.hiddenClassValue),this.initialTarget.classList.add(this.showClassValue),this.hasConfirmedTarget&&this.confirmedTarget.classList.add(this.hiddenClassValue)}}const ra=Object.freeze(Object.defineProperty({__proto__:null,default:ia},Symbol.toStringTag,{value:"Module"})),U=Math.min,F=Math.max,ie=Math.round,Xt=Math.floor,K=n=>({x:n,y:n}),oa={left:"right",right:"left",bottom:"top",top:"bottom"},aa={start:"end",end:"start"};function qe(n,t,e){return F(n,U(t,e))}function xt(n,t){return typeof n=="function"?n(t):n}function nt(n){return n.split("-")[0]}function Ot(n){return n.split("-")[1]}function Zs(n){return n==="x"?"y":"x"}function an(n){return n==="y"?"height":"width"}function ut(n){return["top","bottom"].includes(nt(n))?"y":"x"}function ln(n){return Zs(ut(n))}function la(n,t,e){e===void 0&&(e=!1);const s=Ot(n),i=ln(n),r=an(i);let o=i==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(o=re(o)),[o,re(o)]}function ca(n){const t=re(n);return[Ye(n),t,Ye(t)]}function Ye(n){return n.replace(/start|end/g,t=>aa[t])}function ua(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 ha(n,t,e,s){const i=Ot(n);let r=ua(nt(n),e==="start",s);return i&&(r=r.map(o=>o+"-"+i),t&&(r=r.concat(r.map(Ye)))),r}function re(n){return n.replace(/left|right|bottom|top/g,t=>oa[t])}function da(n){return{top:0,right:0,bottom:0,left:0,...n}}function Js(n){return typeof n!="number"?da(n):{top:n,right:n,bottom:n,left:n}}function oe(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 os(n,t,e){let{reference:s,floating:i}=n;const r=ut(t),o=ln(t),a=an(o),l=nt(t),c=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(l){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(Ot(t)){case"start":m[o]-=h*(e&&c?-1:1);break;case"end":m[o]+=h*(e&&c?-1:1);break}return m}const fa=async(n,t,e)=>{const{placement:s="bottom",strategy:i="absolute",middleware:r=[],platform:o}=e,a=r.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:n,floating:t,strategy:i}),{x:u,y:d}=os(c,s,l),h=s,m={},f=0;for(let p=0;p<a.length;p++){const{name:b,fn:g}=a[p],{x:w,y:E,data:v,reset:y}=await g({x:u,y:d,initialPlacement:s,placement:h,strategy:i,middlewareData:m,rects:c,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&&(c=y.rects===!0?await o.getElementRects({reference:n,floating:t,strategy:i}):y.rects),{x:u,y:d}=os(c,h,l)),p=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:m}};async function cn(n,t){var e;t===void 0&&(t={});const{x:s,y:i,platform:r,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=xt(t,n),f=Js(m),b=a[h?d==="floating"?"reference":"floating":d],g=oe(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:c,rootBoundary:u,strategy:l})),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=oe(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:E,strategy:l}):w);return{top:(g.top-y.top+f.top)/v.y,bottom:(y.bottom-g.bottom+f.bottom)/v.y,left:(g.left-y.left+f.left)/v.x,right:(y.right-g.right+f.right)/v.x}}const ma=n=>({name:"arrow",options:n,async fn(t){const{x:e,y:s,placement:i,rects:r,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=xt(n,t)||{};if(c==null)return{};const d=Js(u),h={x:e,y:s},m=ln(i),f=an(m),p=await o.getDimensions(c),b=m==="y",g=b?"top":"left",w=b?"bottom":"right",E=b?"clientHeight":"clientWidth",v=r.reference[f]+r.reference[m]-h[m]-r.floating[f],y=h[m]-r.reference[m],x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let O=x?x[E]:0;(!O||!await(o.isElement==null?void 0:o.isElement(x)))&&(O=a.floating[E]||r.floating[f]);const L=v/2-y/2,A=O/2-p[f]/2-1,C=U(d[g],A),T=U(d[w],A),D=C,_=O-p[f]-T,M=O/2-p[f]/2+L,dt=qe(D,M,_),Y=!l.arrow&&Ot(i)!=null&&M!==dt&&r.reference[f]/2-(M<D?C:T)-p[f]/2<0,W=Y?M<D?M-D:M-_:0;return{[m]:h[m]+W,data:{[m]:dt,centerOffset:M-dt-W,...Y&&{alignmentOffset:W}},reset:Y}}}),pa=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:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:p=!0,...b}=xt(n,t);if((e=r.arrow)!=null&&e.alignmentOffset)return{};const g=nt(i),w=ut(a),E=nt(a)===a,v=await(l.isRTL==null?void 0:l.isRTL(c.floating)),y=h||(E||!p?[re(a)]:ca(a)),x=f!=="none";!h&&x&&y.push(...ha(a,p,f,v));const O=[a,...y],L=await cn(t,b),A=[];let C=((s=r.flip)==null?void 0:s.overflows)||[];if(u&&A.push(L[g]),d){const M=la(i,o,v);A.push(L[M[0]],L[M[1]])}if(C=[...C,{placement:i,overflows:A}],!A.every(M=>M<=0)){var T,D;const M=(((T=r.flip)==null?void 0:T.index)||0)+1,dt=O[M];if(dt)return{data:{index:M,overflows:C},reset:{placement:dt}};let Y=(D=C.filter(W=>W.overflows[0]<=0).sort((W,J)=>W.overflows[1]-J.overflows[1])[0])==null?void 0:D.placement;if(!Y)switch(m){case"bestFit":{var _;const W=(_=C.filter(J=>{if(x){const Q=ut(J.placement);return Q===w||Q==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(Q=>Q>0).reduce((Q,gi)=>Q+gi,0)]).sort((J,Q)=>J[1]-Q[1])[0])==null?void 0:_[0];W&&(Y=W);break}case"initialPlacement":Y=a;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}};async function ga(n,t){const{placement:e,platform:s,elements:i}=n,r=await(s.isRTL==null?void 0:s.isRTL(i.floating)),o=nt(e),a=Ot(e),l=ut(e)==="y",c=["left","top"].includes(o)?-1:1,u=r&&l?-1:1,d=xt(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),l?{x:m*u,y:h*c}:{x:h*c,y:m*u}}const ba=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,l=await ga(t,n);return o===((e=a.offset)==null?void 0:e.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:o}}}}},va=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:g,y:w}=b;return{x:g,y:w}}},...l}=xt(n,t),c={x:e,y:s},u=await cn(t,l),d=ut(nt(i)),h=Zs(d);let m=c[h],f=c[d];if(r){const b=h==="y"?"top":"left",g=h==="y"?"bottom":"right",w=m+u[b],E=m-u[g];m=qe(w,m,E)}if(o){const b=d==="y"?"top":"left",g=d==="y"?"bottom":"right",w=f+u[b],E=f-u[g];f=qe(w,f,E)}const p=a.fn({...t,[h]:m,[d]:f});return{...p,data:{x:p.x-e,y:p.y-s}}}}},ya=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}=xt(n,t),l=await cn(t,a),c=nt(e),u=Ot(e),d=ut(e)==="y",{width:h,height:m}=s.floating;let f,p;c==="top"||c==="bottom"?(f=c,p=u===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(p=c,f=u==="end"?"top":"bottom");const b=m-l.top-l.bottom,g=h-l.left-l.right,w=U(m-l[f],b),E=U(h-l[p],g),v=!t.middlewareData.shift;let y=w,x=E;if(d?x=u||v?U(E,g):g:y=u||v?U(w,b):b,v&&!u){const L=F(l.left,0),A=F(l.right,0),C=F(l.top,0),T=F(l.bottom,0);d?x=h-2*(L!==0||A!==0?L+A:F(l.left,l.right)):y=m-2*(C!==0||T!==0?C+T:F(l.top,l.bottom))}await o({...t,availableWidth:x,availableHeight:y});const O=await i.getDimensions(r.floating);return h!==O.width||m!==O.height?{reset:{rects:!0}}:{}}}};function fe(){return typeof window<"u"}function St(n){return Qs(n)?(n.nodeName||"").toLowerCase():"#document"}function P(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function q(n){var t;return(t=(Qs(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function Qs(n){return fe()?n instanceof Node||n instanceof P(n).Node:!1}function V(n){return fe()?n instanceof Element||n instanceof P(n).Element:!1}function z(n){return fe()?n instanceof HTMLElement||n instanceof P(n).HTMLElement:!1}function as(n){return!fe()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof P(n).ShadowRoot}function zt(n){const{overflow:t,overflowX:e,overflowY:s,display:i}=H(n);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(i)}function wa(n){return["table","td","th"].includes(St(n))}function me(n){return[":popover-open",":modal"].some(t=>{try{return n.matches(t)}catch{return!1}})}function un(n){const t=hn(),e=V(n)?H(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 Ea(n){let t=st(n);for(;z(t)&&!Tt(t);){if(un(t))return t;if(me(t))return null;t=st(t)}return null}function hn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Tt(n){return["html","body","#document"].includes(St(n))}function H(n){return P(n).getComputedStyle(n)}function pe(n){return V(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function st(n){if(St(n)==="html")return n;const t=n.assignedSlot||n.parentNode||as(n)&&n.host||q(n);return as(t)?t.host:t}function ti(n){const t=st(n);return Tt(t)?n.ownerDocument?n.ownerDocument.body:n.body:z(t)&&zt(t)?t:ti(t)}function Wt(n,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=ti(n),r=i===((s=n.ownerDocument)==null?void 0:s.body),o=P(i);if(r){const a=Xe(o);return t.concat(o,o.visualViewport||[],zt(i)?i:[],a&&e?Wt(a):[])}return t.concat(i,Wt(i,[],e))}function Xe(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function ei(n){const t=H(n);let e=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=z(n),r=i?n.offsetWidth:e,o=i?n.offsetHeight:s,a=ie(e)!==r||ie(s)!==o;return a&&(e=r,s=o),{width:e,height:s,$:a}}function dn(n){return V(n)?n:n.contextElement}function wt(n){const t=dn(n);if(!z(t))return K(1);const e=t.getBoundingClientRect(),{width:s,height:i,$:r}=ei(t);let o=(r?ie(e.width):e.width)/s,a=(r?ie(e.height):e.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Aa=K(0);function ni(n){const t=P(n);return!hn()||!t.visualViewport?Aa:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ta(n,t,e){return t===void 0&&(t=!1),!e||t&&e!==P(n)?!1:t}function ht(n,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),r=dn(n);let o=K(1);t&&(s?V(s)&&(o=wt(s)):o=wt(n));const a=Ta(r,e,s)?ni(r):K(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(r){const h=P(r),m=s&&V(s)?P(s):s;let f=h,p=Xe(f);for(;p&&s&&m!==f;){const b=wt(p),g=p.getBoundingClientRect(),w=H(p),E=g.left+(p.clientLeft+parseFloat(w.paddingLeft))*b.x,v=g.top+(p.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,d*=b.y,l+=E,c+=v,f=P(p),p=Xe(f)}}return oe({width:u,height:d,x:l,y:c})}function fn(n,t){const e=pe(n).scrollLeft;return t?t.left+e:ht(q(n)).left+e}function si(n,t,e){e===void 0&&(e=!1);const s=n.getBoundingClientRect(),i=s.left+t.scrollLeft-(e?0:fn(n,s)),r=s.top+t.scrollTop;return{x:i,y:r}}function xa(n){let{elements:t,rect:e,offsetParent:s,strategy:i}=n;const r=i==="fixed",o=q(s),a=t?me(t.floating):!1;if(s===o||a&&r)return e;let l={scrollLeft:0,scrollTop:0},c=K(1);const u=K(0),d=z(s);if((d||!d&&!r)&&((St(s)!=="body"||zt(o))&&(l=pe(s)),z(s))){const m=ht(s);c=wt(s),u.x=m.x+s.clientLeft,u.y=m.y+s.clientTop}const h=o&&!d&&!r?si(o,l,!0):K(0);return{width:e.width*c.x,height:e.height*c.y,x:e.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:e.y*c.y-l.scrollTop*c.y+u.y+h.y}}function Oa(n){return Array.from(n.getClientRects())}function Sa(n){const t=q(n),e=pe(n),s=n.ownerDocument.body,i=F(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),r=F(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-e.scrollLeft+fn(n);const a=-e.scrollTop;return H(s).direction==="rtl"&&(o+=F(t.clientWidth,s.clientWidth)-i),{width:i,height:r,x:o,y:a}}function Ma(n,t){const e=P(n),s=q(n),i=e.visualViewport;let r=s.clientWidth,o=s.clientHeight,a=0,l=0;if(i){r=i.width,o=i.height;const c=hn();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:r,height:o,x:a,y:l}}function ka(n,t){const e=ht(n,!0,t==="fixed"),s=e.top+n.clientTop,i=e.left+n.clientLeft,r=z(n)?wt(n):K(1),o=n.clientWidth*r.x,a=n.clientHeight*r.y,l=i*r.x,c=s*r.y;return{width:o,height:a,x:l,y:c}}function ls(n,t,e){let s;if(t==="viewport")s=Ma(n,e);else if(t==="document")s=Sa(q(n));else if(V(t))s=ka(t,e);else{const i=ni(n);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return oe(s)}function ii(n,t){const e=st(n);return e===t||!V(e)||Tt(e)?!1:H(e).position==="fixed"||ii(e,t)}function Ca(n,t){const e=t.get(n);if(e)return e;let s=Wt(n,[],!1).filter(a=>V(a)&&St(a)!=="body"),i=null;const r=H(n).position==="fixed";let o=r?st(n):n;for(;V(o)&&!Tt(o);){const a=H(o),l=un(o);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||zt(o)&&!l&&ii(n,o))?s=s.filter(u=>u!==o):i=a,o=st(o)}return t.set(n,s),s}function La(n){let{element:t,boundary:e,rootBoundary:s,strategy:i}=n;const o=[...e==="clippingAncestors"?me(t)?[]:Ca(t,this._c):[].concat(e),s],a=o[0],l=o.reduce((c,u)=>{const d=ls(t,u,i);return c.top=F(d.top,c.top),c.right=U(d.right,c.right),c.bottom=U(d.bottom,c.bottom),c.left=F(d.left,c.left),c},ls(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Da(n){const{width:t,height:e}=ei(n);return{width:t,height:e}}function _a(n,t,e){const s=z(t),i=q(t),r=e==="fixed",o=ht(n,!0,r,t);let a={scrollLeft:0,scrollTop:0};const l=K(0);if(s||!s&&!r)if((St(t)!=="body"||zt(i))&&(a=pe(t)),s){const h=ht(t,!0,r,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else i&&(l.x=fn(i));const c=i&&!s&&!r?si(i,a):K(0),u=o.left+a.scrollLeft-l.x-c.x,d=o.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:o.width,height:o.height}}function Le(n){return H(n).position==="static"}function cs(n,t){if(!z(n)||H(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return q(n)===e&&(e=e.ownerDocument.body),e}function ri(n,t){const e=P(n);if(me(n))return e;if(!z(n)){let i=st(n);for(;i&&!Tt(i);){if(V(i)&&!Le(i))return i;i=st(i)}return e}let s=cs(n,t);for(;s&&wa(s)&&Le(s);)s=cs(s,t);return s&&Tt(s)&&Le(s)&&!un(s)?e:s||Ea(n)||e}const Fa=async function(n){const t=this.getOffsetParent||ri,e=this.getDimensions,s=await e(n.floating);return{reference:_a(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Ba(n){return H(n).direction==="rtl"}const Pa={convertOffsetParentRelativeRectToViewportRelativeRect:xa,getDocumentElement:q,getClippingRect:La,getOffsetParent:ri,getElementRects:Fa,getClientRects:Oa,getDimensions:Da,getScale:wt,isElement:V,isRTL:Ba};function $a(n,t){let e=null,s;const i=q(n);function r(){var a;clearTimeout(s),(a=e)==null||a.disconnect(),e=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),r();const{left:c,top:u,width:d,height:h}=n.getBoundingClientRect();if(a||t(),!d||!h)return;const m=Xt(u),f=Xt(i.clientWidth-(c+d)),p=Xt(i.clientHeight-(u+h)),b=Xt(c),w={rootMargin:-m+"px "+-f+"px "+-p+"px "+-b+"px",threshold:F(0,U(1,l))||1};let E=!0;function v(y){const x=y[0].intersectionRatio;if(x!==l){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 mn(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:l=!1}=s,c=dn(n),u=i||r?[...c?Wt(c):[],...Wt(t)]:[];u.forEach(g=>{i&&g.addEventListener("scroll",e,{passive:!0}),r&&g.addEventListener("resize",e)});const d=c&&a?$a(c,e):null;let h=-1,m=null;o&&(m=new ResizeObserver(g=>{let[w]=g;w&&w.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var E;(E=m)==null||E.observe(t)})),e()}),c&&!l&&m.observe(c),m.observe(t));let f,p=l?ht(n):null;l&&b();function b(){const g=ht(n);p&&(g.x!==p.x||g.y!==p.y||g.width!==p.width||g.height!==p.height)&&e(),p=g,f=requestAnimationFrame(b)}return e(),()=>{var g;u.forEach(w=>{i&&w.removeEventListener("scroll",e),r&&w.removeEventListener("resize",e)}),d==null||d(),(g=m)==null||g.disconnect(),m=null,l&&cancelAnimationFrame(f)}}const ge=ba,be=va,ve=pa,Ra=ya,Na=ma,ye=(n,t,e)=>{const s=new Map,i={platform:Pa,...e},r={...i.platform,_c:s};return fa(n,t,{...i,platform:r})},us=(n,t)=>{const e=n[t];return typeof e=="function"?e:(...s)=>{}},Ge=(n,t,e)=>{let s=n;return e===!0?s=`${t.identifier}:${n}`:typeof e=="string"&&(s=`${e}:${n}`),s},Ze=(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 Ia(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 ja(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 De={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class Va{constructor(t,e={}){var s,i,r;this.log=(l,c)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${l}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},c)),this.logger.groupEnd())},this.warn=l=>{this.logger.warn(`%c${this.controller.identifier} %c${l}`,"color: #3B82F6; font-weight: bold","color: unset")},this.dispatch=(l,c={})=>{if(this.dispatchEvent){const{event:u}=c,d=ja(c,["event"]),h=this.extendedEvent(l,u||null,d);this.targetElement.dispatchEvent(h),this.log("dispatchEvent",Object.assign({eventName:h.type},d))}},this.call=(l,c={})=>{const u=this.controller[l];if(typeof u=="function")return u.call(this.controller,c)},this.extendedEvent=(l,c,u)=>{const{bubbles:d,cancelable:h,composed:m}=c||{bubbles:!0,cancelable:!0,composed:!0};return c&&Object.assign(u,{originalEvent:c}),new CustomEvent(this.composeEventName(l),{bubbles:d,cancelable:h,composed:m,detail:u})},this.composeEventName=l=>{let c=l;return this.eventPrefix===!0?c=`${this.controller.identifier}:${l}`:typeof this.eventPrefix=="string"&&(c=`${this.eventPrefix}:${l}`),c},this.debug=(i=(s=e==null?void 0:e.debug)!==null&&s!==void 0?s:t.application.stimulusUseDebug)!==null&&i!==void 0?i:De.debug,this.logger=(r=e==null?void 0:e.logger)!==null&&r!==void 0?r:De.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({},De,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 Ha={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},oi=(n,t={})=>{const e=n,{onlyVisible:s,dispatchEvent:i,events:r,eventPrefix:o}=Object.assign({},Ha,t),a=d=>{const h=(t==null?void 0:t.element)||e.element;if(!(h.contains(d.target)||!Ia(h)&&s)&&(e.clickOutside&&e.clickOutside(d),i)){const m=Ge("click:outside",e,o),f=Ze(m,d,{controller:e});h.dispatchEvent(f)}},l=()=>{r==null||r.forEach(d=>{window.addEventListener(d,a,!0)})},c=()=>{r==null||r.forEach(d=>{window.removeEventListener(d,a,!0)})},u=e.disconnect.bind(e);return Object.assign(e,{disconnect(){c(),u()}}),l(),[l,c]};class Wa extends Z{}Wa.debounces=[];const Ua=200,hs=(n,t=Ua)=>{let e=null;return function(){const s=Array.from(arguments),i=this,r=s.map(a=>a.params),o=()=>(s.forEach((a,l)=>a.params=r[l]),n.apply(i,s));e&&clearTimeout(e),e=setTimeout(o,t)}},Ka=(n,t)=>{const e=n;e.constructor.debounces.forEach(i=>{if(typeof i=="string"&&(e[i]=hs(e[i],void 0)),typeof i=="object"){const{name:r,wait:o}=i;if(!r)return;e[r]=hs(e[r],o||void 0)}})},za={dispatchEvent:!0,eventPrefix:!0,visibleAttribute:"isVisible"},qa=(n,t={})=>{const e=n,{dispatchEvent:s,eventPrefix:i,visibleAttribute:r}=Object.assign({},za,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?c(y):o.hasAttribute(r)&&u(y)},l=new IntersectionObserver(a,t),c=v=>{if(o.setAttribute(r,"true"),us(e,"appear").call(e,v,l),s){const y=Ge("appear",e,i),x=Ze(y,null,{controller:e,entry:v,observer:l});o.dispatchEvent(x)}},u=v=>{if(o.removeAttribute(r),us(e,"disappear").call(e,v,l),s){const y=Ge("disappear",e,i),x=Ze(y,null,{controller:e,entry:v,observer:l});o.dispatchEvent(x)}},d=e.disconnect.bind(e),h=()=>{f(),d()},m=()=>{l.observe(o)},f=()=>{l.unobserve(o)},p=()=>e.intersectionElements.filter(v=>v.hasAttribute(r)).length===0,b=()=>e.intersectionElements.filter(v=>v.hasAttribute(r)).length===1,g=()=>e.intersectionElements.some(v=>v.hasAttribute(r)),w=()=>e.intersectionElements.every(v=>v.hasAttribute(r));return Object.assign(e,{isVisible:w,noneVisible:p,oneVisible:b,atLeastOneVisible:g,allVisible:w,disconnect:h}),m(),[m,f]};class Ya extends Va{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 pn=(n,t={})=>{const e=new Ya(n,t);return[e.observe,e.unobserve]};class Xa extends Z{}Xa.throttles=[];class Ga extends I()({targets:{wrapper:HTMLDetailsElement,button:HTMLElement,popover:$e,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(){oi(this),pn(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;ye(this.buttonTarget,this.popoverTarget,{middleware:[ge(6),ve(),be({padding:6}),Ra({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=mn(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 Za=Object.freeze(Object.defineProperty({__proto__:null,default:Ga},Symbol.toStringTag,{value:"Module"}));function Ja(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 gn=!1;if(typeof window<"u"){var ds={get passive(){gn=!0}};window.addEventListener("testPassive",null,ds),window.removeEventListener("testPassive",null,ds)}var ae=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),ct=[],le=!1,ai=-1,Nt=void 0,at=void 0,It=void 0,li=function(t){return ct.some(function(e){return!!(e.options.allowTouchMove&&e.options.allowTouchMove(t))})},ce=function(t){var e=t||window.event;return li(e.target)||e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)},Qa=function(t){if(It===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);It=document.body.style.paddingRight,document.body.style.paddingRight=i+s+"px"}}Nt===void 0&&(Nt=document.body.style.overflow,document.body.style.overflow="hidden")},tl=function(){It!==void 0&&(document.body.style.paddingRight=It,It=void 0),Nt!==void 0&&(document.body.style.overflow=Nt,Nt=void 0)},el=function(){return window.requestAnimationFrame(function(){if(at===void 0){at={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)}})},nl=function(){if(at!==void 0){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=at.position,document.body.style.top=at.top,document.body.style.left=at.left,window.scrollTo(e,t),at=void 0}},sl=function(t){return t?t.scrollHeight-t.scrollTop<=t.clientHeight:!1},il=function(t,e){var s=t.targetTouches[0].clientY-ai;return li(t.target)?!1:e&&e.scrollTop===0&&s>0||sl(e)&&s<0?ce(t):(t.stopPropagation(),!0)},rl=function(t,e){if(!t){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!ct.some(function(i){return i.targetElement===t})){var s={targetElement:t,options:e||{}};ct=[].concat(Ja(ct),[s]),ae?el():Qa(e),ae&&(t.ontouchstart=function(i){i.targetTouches.length===1&&(ai=i.targetTouches[0].clientY)},t.ontouchmove=function(i){i.targetTouches.length===1&&il(i,t)},le||(document.addEventListener("touchmove",ce,gn?{passive:!1}:void 0),le=!0))}},ol=function(t){if(!t){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}ct=ct.filter(function(e){return e.targetElement!==t}),ae&&(t.ontouchstart=null,t.ontouchmove=null,le&&ct.length===0&&(document.removeEventListener("touchmove",ce,gn?{passive:!1}:void 0),le=!1)),ae?nl():tl()};class al extends I()({targets:{dialog:HTMLDialogElement}}){close(){this.dialogTarget.open&&(this.dialogTarget.close(),ol(this.dialogTarget))}disconnect(){this.close()}open(){this.dialogTarget.showModal(),rl(this.dialogTarget,{reserveScrollBarGap:!0})}triggerClick(){this.dialogTarget.open?this.close():this.open()}windowClick(t){t.target===this.dialogTarget&&this.close()}}const ll=Object.freeze(Object.defineProperty({__proto__:null,default:al},Symbol.toStringTag,{value:"Module"}));async function cl(n,t=null){n.classList.remove("hidden"),await ci("enter",n,t)}async function ul(n,t=null){await ci("leave",n,t),n.classList.add("hidden")}async function ci(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`],l=s[`${r}End`]?s[`${r}End`].split(" "):[`${i}-end`];_e(t,o),_e(t,a),await hl(),Fe(t,a),_e(t,l),await dl(t),Fe(t,l),Fe(t,o)}function _e(n,t){n.classList.add(...t)}function Fe(n,t){n.classList.remove(...t)}function hl(){return new Promise(n=>{requestAnimationFrame(()=>{requestAnimationFrame(n)})})}function dl(n){return new Promise(t=>{const e=getComputedStyle(n).transitionDuration.split(",")[0],s=Number(e.replace("s",""))*1e3;setTimeout(()=>{t()},s)})}const he=class he extends Z{async connect(){await this.show();const t=()=>{};setTimeout(()=>{this.hide().then(t).catch(t)},this.timerValue)}async disconnect(){await this.hide()}async hide(){await ul(this.element),this.hasHiddenClass?this.element.classList.add(this.hiddenClass):this.element.classList.add("ariadne-hidden"),this.element.remove()}async show(){this.hasHiddenClass?this.element.classList.remove(this.hiddenClass):this.element.classList.remove("ariadne-hidden"),await cl(this.element)}};he.classes=["ariadne-hidden"],he.values={timer:{default:4e3,type:Number}};let Je=he;const fl=Object.freeze(Object.defineProperty({__proto__:null,default:Je},Symbol.toStringTag,{value:"Module"}));class ml extends I()({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()})),qa(this)}appear(){this.reset()}handleInput(){this.hasSearchStringTarget&&this.handleNewQuery(this.inputTarget.value)}reset(){this.handleNewQuery(""),this.hasInputTarget&&(this.inputTarget.value="")}}const pl=Object.freeze(Object.defineProperty({__proto__:null,default:ml},Symbol.toStringTag,{value:"Module"}));class gl extends I()({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(){oi(this),pn(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=()=>{ye(this.anchorTarget,this.popoverTarget,{middleware:[ge(6),ve(),be({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=mn(this.anchorTarget,this.popoverTarget,t)}toggle(){this.element.open=!this.element.open,this.setupAutoUpdate()}}const bl=Object.freeze(Object.defineProperty({__proto__:null,default:gl},Symbol.toStringTag,{value:"Module"}));class vl extends I()({targets:{button:HTMLButtonElement,popover:HTMLElement},values:{placement:String}}){connect(){this.popoverTarget.addEventListener("toggle",t=>{t.newState==="open"&&this.updatePosition()})}updatePosition(){mn(this.buttonTarget,this.popoverTarget,()=>{ye(this.buttonTarget,this.popoverTarget,{placement:this.placementValue,middleware:[ge(5),ve(),be({padding:5})]}).then(({x:t,y:e})=>{Object.assign(this.buttonTarget.style,{left:`${t}px`,top:`${e}px`})})})}}const yl=Object.freeze(Object.defineProperty({__proto__:null,default:vl},Symbol.toStringTag,{value:"Module"}));function wl(){return/Mac|iMac|Macintosh|MacIntel/.test(navigator.userAgent)}class El extends I()({targets:{alt:HTMLSpanElement,ctrl:HTMLSpanElement,shift:HTMLSpanElement}}){replaceSymbol(t,e){for(const s of t)s.innerText=e,s.classList.add("!font-fallback")}connect(){wl()&&(this.replaceSymbol(this.ctrlTargets,"⌘"),this.replaceSymbol(this.altTargets,"⌥"),this.replaceSymbol(this.shiftTargets,"⇧"))}}const Al=Object.freeze(Object.defineProperty({__proto__:null,default:El},Symbol.toStringTag,{value:"Module"}));var Tl=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},fs=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)},Bt;class xl{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 Ol=typeof Intl<"u"&&Intl.ListFormat||xl,Sl=[["years","year"],["months","month"],["weeks","week"],["days","day"],["hours","hour"],["minutes","minute"],["seconds","second"],["milliseconds","millisecond"]],Ml={minimumIntegerDigits:2};class kl{constructor(t,e={}){Bt.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 l=e.milliseconds||i;Tl(this,Bt,{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:l,millisecondsDisplay:e.millisecondsDisplay==="always"?"always":"auto"},"f")}resolvedOptions(){return fs(this,Bt,"f")}formatToParts(t){const e=[],s=fs(this,Bt,"f"),i=s.style,r=s.locale;for(const[o,a]of Sl){const l=t[o];if(s[`${o}Display`]==="auto"&&!l)continue;const c=s[o],u=c==="2-digit"?Ml:c==="numeric"?{}:{style:"unit",unit:a,unitDisplay:c};e.push(new Intl.NumberFormat(r,u).format(l))}return new Ol(r,{type:"unit",style:i==="digital"?"short":i}).formatToParts(e)}format(t){return this.formatToParts(t).map(e=>e.value).join("")}}Bt=new WeakMap;const ui=/^[-+]?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,ue=["year","month","week","day","hour","minute","second","millisecond"],Cl=n=>ui.test(n);class B{constructor(t=0,e=0,s=0,i=0,r=0,o=0,a=0,l=0){this.years=t,this.months=e,this.weeks=s,this.days=i,this.hours=r,this.minutes=o,this.seconds=a,this.milliseconds=l,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 B(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(ui))===null||e===void 0?void 0:e.slice(1).map(o=>(Number(o)||0)*i);return r?new B(...r):new B}else if(typeof t=="object"){const{years:s,months:i,weeks:r,days:o,hours:a,minutes:l,seconds:c,milliseconds:u}=t;return new B(s,i,r,o,a,l,c,u)}throw new RangeError("invalid duration")}static compare(t,e){const s=Date.now(),i=Math.abs(ms(s,B.from(t)).getTime()-s),r=Math.abs(ms(s,B.from(e)).getTime()-s);return i>r?-1:i<r?1:0}toLocaleString(t,e){return new kl(t,e).format(this)}}function ms(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 Ll(n,t="second",e=Date.now()){const s=n.getTime()-e;if(s===0)return new B;const i=Math.sign(s),r=Math.abs(s),o=Math.floor(r/1e3),a=Math.floor(o/60),l=Math.floor(a/60),c=Math.floor(l/24),u=Math.floor(c/30),d=Math.floor(u/12),h=ue.indexOf(t)||ue.length;return new B(h>=0?d*i:0,h>=1?(u-d*12)*i:0,0,h>=3?(c-u*30)*i:0,h>=4?(l-c*24)*i:0,h>=5?(a-l*60)*i:0,h>=6?(o-a*60)*i:0,h>=7?(r-o*1e3)*i:0)}function hi(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),l=Math.abs(n.minutes),c=Math.abs(n.seconds),u=Math.abs(n.milliseconds);u>=900&&(c+=Math.round(u/1e3)),(c||l||a||o||r||i||s)&&(u=0),c>=55&&(l+=Math.round(c/60)),(l||a||o||r||i||s)&&(c=0),l>=55&&(a+=Math.round(l/60)),(a||o||r||i||s)&&(l=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 p=Math.max(0,m-f.getDate()),b=new Date(t);b.setFullYear(d+s*e),b.setDate(m-p),b.setMonth(h+i*e),b.setDate(m-p+o*e);const g=b.getFullYear()-t.getFullYear(),w=b.getMonth()-t.getMonth(),E=Math.abs(Math.round((Number(b)-Number(t))/864e5))+p,v=Math.abs(g*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=g*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 B(s*e,i*e,r*e,o*e,a*e,l*e,c*e,u*e)}function Dl(n,t){const e=hi(n,t);if(e.blank)return[0,"second"];for(const s of ue){if(s==="millisecond")continue;const i=e[`${s}s`];if(i)return[i,s]}return[0,"second"]}var S=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)},Gt=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},R,Pt,$t,kt,ot,Qe,di,fi,mi,pi,mt;const _l=globalThis.HTMLElement||null,Be=new B,ps=new B(0,0,0,0,0,1);class Fl 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 gs(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 Pe=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=gs(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,gs(t)),t.update();this.time=Math.min(60*60*1e3,n),this.timer=setTimeout(()=>this.update(),this.time),this.time+=Date.now()}};class Bl extends _l{constructor(){super(...arguments),R.add(this),Pt.set(this,!1),$t.set(this,!1),ot.set(this,this.shadowRoot?this.shadowRoot:this.attachShadow?this.attachShadow({mode:"open"}):this),mt.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 S(this,mt,"f")}set onRelativeTimeUpdated(t){S(this,mt,"f")&&this.removeEventListener("relative-time-updated",S(this,mt,"f")),Gt(this,mt,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&&Cl(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 ue.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(){Pe.unobserve(this)}attributeChangedCallback(t,e,s){e!==s&&(t==="title"&&Gt(this,Pt,s!==null&&(this.date&&S(this,R,"m",Qe).call(this,this.date))!==s,"f"),!S(this,$t,"f")&&!(t==="title"&&S(this,Pt,"f"))&&Gt(this,$t,(async()=>{await Promise.resolve(),this.update(),Gt(this,$t,!1,"f")})(),"f"))}update(){const t=S(this,ot,"f").textContent||this.textContent||"",e=this.getAttribute("title")||"";let s=e;const i=this.date;if(typeof Intl>"u"||!Intl.DateTimeFormat||!i){S(this,ot,"f").textContent=t;return}const r=Date.now();S(this,Pt,"f")||(s=S(this,R,"m",Qe).call(this,i)||"",s&&!this.noTitle&&this.setAttribute("title",s));const o=Ll(i,this.precision,r),a=S(this,R,"m",di).call(this,o);let l=t;a==="duration"?l=S(this,R,"m",fi).call(this,o):a==="relative"?l=S(this,R,"m",mi).call(this,o):l=S(this,R,"m",pi).call(this,i),l?S(this,ot,"f").textContent=l:this.shadowRoot===S(this,ot,"f")&&this.textContent&&(S(this,ot,"f").textContent=this.textContent),(l!==t||s!==e)&&this.dispatchEvent(new Fl(t,l,e,s)),a==="relative"||a==="duration"?Pe.observe(this):Pe.unobserve(this)}}Pt=new WeakMap,$t=new WeakMap,ot=new WeakMap,mt=new WeakMap,R=new WeakSet,kt=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(S(this,R,"a",kt),{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)},di=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"||B.compare(t,this.threshold)===1)return"relative"}return"datetime"},fi=function(t){const e=S(this,R,"a",kt),s=this.format,i=this.formatStyle,r=this.tense;let o=Be;s==="micro"?(t=hi(t),o=ps,(this.tense==="past"&&t.sign!==-1||this.tense==="future"&&t.sign!==1)&&(t=ps)):(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})},mi=function(t){const e=new Intl.RelativeTimeFormat(S(this,R,"a",kt),{numeric:"auto",style:this.formatStyle}),s=this.tense;s==="future"&&t.sign!==1&&(t=Be),s==="past"&&t.sign!==-1&&(t=Be);const[i,r]=Dl(t);return r==="second"&&i<10?e.format(0,this.precision==="millisecond"?"second":this.precision):e.format(i,r)},pi=function(t){const e=new Intl.DateTimeFormat(S(this,R,"a",kt),{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 bs=typeof globalThis<"u"?globalThis:window;try{bs.RelativeTimeElement=Bl.define()}catch(n){if(!(bs.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class Pl extends I()({targets:{}}){}const $l=Object.freeze(Object.defineProperty({__proto__:null,default:Pl},Symbol.toStringTag,{value:"Module"})),de=class de extends Z{connect(){Ka(this)}save(){this.hasFormTarget?this.formTarget.requestSubmit():this.element.requestSubmit()}};de.debounces=["save"],de.targets=["form"];let tn=de;const Rl=Object.freeze(Object.defineProperty({__proto__:null,default:tn},Symbol.toStringTag,{value:"Module"}));class Nl extends I()({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(),pn(this,{childList:!0,subtree:!0})}mutate(){this.runCheck()}}const Il=Object.freeze(Object.defineProperty({__proto__:null,default:Nl},Symbol.toStringTag,{value:"Module"}));class jl extends I()({targets:{activator:HTMLElement,wrapper:HTMLDivElement,tooltip:HTMLDivElement,arrow:HTMLDivElement}}){async update(){ye(this.activatorTarget,this.tooltipTarget,{placement:"top",middleware:[ge(10),ve(),be({padding:5}),Na({element:this.arrowTarget})]}).then(({x:t,y:e,placement:s,middlewareData:i})=>{Object.assign(this.tooltipTarget.style,{left:`${t}px`,top:`${e}px`}),Object.assign(this.arrowTarget.style,{left:"",top:"",right:"",bottom:""});const{x:r,y:o}=i.arrow||{};switch(s.split("-")[0]){case"top":Object.assign(this.arrowTarget.style,{left:r?`${r}px`:"",bottom:"-4px"});break;case"bottom":Object.assign(this.arrowTarget.style,{left:r?`${r}px`:"",top:"-4px"});break;case"left":Object.assign(this.arrowTarget.style,{top:o?`${o}px`:"",right:"-4px"});break;case"right":Object.assign(this.arrowTarget.style,{top:o?`${o}px`:"",left:"-4px"});break}})}showTooltip(t){this.wrapperTarget.classList.add("ariadne-block"),this.wrapperTarget.classList.remove("ariadne-hidden"),this.update()}hideTooltip(t){this.wrapperTarget.classList.add("ariadne-hidden"),this.wrapperTarget.classList.remove("ariadne-block")}}const Vl=Object.freeze(Object.defineProperty({__proto__:null,default:jl},Symbol.toStringTag,{value:"Module"})),we=Wr.start();we.debug=!1;window.Stimulus=we;const Hl=Object.assign({"../../components/ariadne/form/toggle/component.ts":oo,"../../components/ariadne/ui/accordion/component.ts":Go,"../../components/ariadne/ui/clipboard_copy/component.ts":ra,"../../components/ariadne/ui/combobox/component.ts":Za,"../../components/ariadne/ui/dialog/component.ts":ll,"../../components/ariadne/ui/flash/component.ts":fl,"../../components/ariadne/ui/list/component.ts":pl,"../../components/ariadne/ui/overlay/component.ts":bl,"../../components/ariadne/ui/popover/component.ts":yl,"../../components/ariadne/ui/shortcut/component.ts":Al,"../../components/ariadne/ui/time_ago/component.ts":$l});for(const[n,t]of Object.entries(Hl)){const e=n.split("/"),s=e.slice(3,e.length-1).join("-").replaceAll("_","-").toLocaleLowerCase();we.register(s,t.default)}const Wl=Object.assign({"/controllers/form_autosubmit_controller.ts":Rl,"/controllers/form_validity_controller.ts":Il,"/controllers/tooltip_controller.ts":Vl});for(const[n,t]of Object.entries(Wl)){const e=n.split("/"),s=e[e.length-1].replace("_controller.ts","").replaceAll("_","-").toLocaleLowerCase();we.register(`ariadne-${s}`,t.default)}
99
99
  //# sourceMappingURL=ariadne_view_components.js.map