@webjsdev/core 0.7.16 → 0.7.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var Gr=Object.defineProperty;var le=(e,t)=>()=>(e&&(t=e(e=0)),t);var hn=(e,t)=>{for(var n in t)Gr(e,n,{get:t[n],enumerable:!0})};var rr={};hn(rr,{observeLazy:()=>Io,observeViewportOnce:()=>Bo});function nr(e){let t=$t.get(e);return t||(t=import(e).finally(()=>$t.delete(e)),$t.set(e,t),t)}function Io(e){for(let[t,n]of Object.entries(e))V.set(t.toLowerCase(),n);if(typeof IntersectionObserver>"u"){for(let t of V.values())nr(t);V.clear();return}Se||(Se=new IntersectionObserver(Po,{rootMargin:"200px"})),tr(),typeof MutationObserver<"u"&&new MutationObserver(()=>tr()).observe(document.body,{childList:!0,subtree:!0})}function tr(){if(!(!Se||!V.size))for(let e of V.keys())for(let t of document.querySelectorAll(e))Se.observe(t)}function Po(e){for(let t of e){if(!t.isIntersecting)continue;let n=t.target.tagName.toLowerCase(),r=V.get(n);r&&(nr(r),V.delete(n),Se?.unobserve(t.target))}}function Fo(e){for(let t of e){if(!t.isIntersecting)continue;let n=Je.get(t.target);Je.delete(t.target),we?.unobserve(t.target),n&&n()}}function Bo(e,t){return typeof IntersectionObserver>"u"?(t(),()=>{}):(we||(we=new IntersectionObserver(Fo,{rootMargin:"200px"})),Je.set(e,t),we.observe(e),()=>{Je.delete(e),we?.unobserve(e)})}var V,Se,$t,we,Je,sr=le(()=>{V=new Map,Se=null,$t=new Map;we=null,Je=new WeakMap});var qt,Ht=le(()=>{qt=typeof HTMLElement<"u"?class extends HTMLElement{constructor(){super(),this._webjsLoadedSrc=null,this._webjsLazyTeardown=null}static get observedAttributes(){return["src"]}connectedCallback(){this._webjsScheduleLoad()}disconnectedCallback(){this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null)}attributeChangedCallback(t,n,r){t==="src"&&this.isConnected&&this._webjsScheduleLoad()}_webjsScheduleLoad(){let t=this.getAttribute("src");if(!t){this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null),this._webjsLoadedSrc=null;return}let n=t;try{n=new URL(t,location.href).href}catch{}if(n===this._webjsLoadedSrc)return;this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null),(this.getAttribute("loading")||"eager").toLowerCase()==="lazy"?(this._webjsLoadedSrc=n,Promise.resolve().then(()=>(sr(),rr)).then(({observeViewportOnce:s})=>{this._webjsLoadedSrc!==n||!this.isConnected||(this._webjsLazyTeardown=s(this,()=>{this._webjsLazyTeardown=null,this._webjsLoad(n)}))})):(this._webjsLoadedSrc=n,this._webjsLoad(n))}_webjsLoad(t){Promise.resolve().then(()=>(Vt(),or)).then(({loadFrame:n})=>{this._webjsLoadedSrc!==t||!this.isConnected||n(this,t)})}}:null;typeof customElements<"u"&&qt&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",qt)});function Do(e,t,n){switch(e){case"append":n&&t.append(n);break;case"prepend":n&&t.prepend(n);break;case"before":n&&t.before(n);break;case"after":n&&t.after(n);break;case"replace":n&&t.replaceWith(n);break;case"update":n&&t.replaceChildren(n);break;case"remove":t.remove();break;default:break}}function Wt(e,t){let n=t||(typeof document<"u"?document:null);if(!n)return;let r=null;if(typeof e=="string"){let o=n.createElement("template");o.innerHTML=e,r=o.content}else if(e&&e.nodeType)r=e;else return;let s=r.querySelectorAll?Array.from(r.querySelectorAll("webjs-stream")):[];if(s.length)for(let o of s)n.body.append(o);else n.body.append(r)}var Uo,zt,Xe=le(()=>{Uo=new Set(["append","prepend","before","after","replace","update"]);zt=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this._webjsApplied||(this._webjsApplied=!0,this._webjsApply())}_webjsApply(){let t=(this.getAttribute("action")||"").toLowerCase(),n=this.ownerDocument||document,r=[],s=this.getAttribute("target");if(s){let i=n.getElementById(s);i&&(r=[i])}else{let i=this.getAttribute("targets");if(i)try{r=Array.from(n.querySelectorAll(i))}catch{r=[]}}let o=Uo.has(t)?this.querySelector("template"):null;try{for(let i of r){let a=o?o.content.cloneNode(!0):null;Do(t,i,a)}}finally{this.remove()}}}:null;typeof customElements<"u"&&zt&&!customElements.get("webjs-stream")&&customElements.define("webjs-stream",zt)});var ir,ar=le(()=>{ir=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this.style.display||(this.style.display="contents")}}:null;typeof customElements<"u"&&ir&&!customElements.get("webjs-suspense")&&customElements.define("webjs-suspense",ir)});var or={};hn(or,{_FRAME_TOP:()=>Ar,_LIVE_ATTRS:()=>Xt,_activeFrameId:()=>Sr,_addNewHeadElements:()=>Qt,_applyStreamedResolve:()=>zr,_blurOutgoingFocus:()=>et,_buildSubmitFormData:()=>_r,_bumpNavToken:()=>li,_clearFormBusy:()=>Ir,_clearFrameBusy:()=>Or,_collectChildrenSlots:()=>oe,_currentPageUrl:()=>ui,_diffElementInPlace:()=>it,_eligibleAnchorHref:()=>tt,_findAnchorInPath:()=>wr,_getSubmitAction:()=>gr,_getSubmitMethod:()=>yr,_isNonHtmlPath:()=>di,_keyOf:()=>se,_longestSharedPath:()=>vr,_markFormBusy:()=>Mr,_markFrameBusy:()=>Lr,_mergeHead:()=>qr,_navToken:()=>ci,_onPopState:()=>en,_onSubmit:()=>tn,_prefetch:()=>Ee,_prefetchInflightSize:()=>ii,_prefetchMode:()=>nt,_prefetchPeek:()=>oi,_prefetchSaysSaveData:()=>sn,_prefetchSuppressed:()=>Nr,_prefetchTake:()=>xr,_reactivateScripts:()=>at,_readStreamedShell:()=>Hr,_reconcileChildren:()=>an,_regraftPermanentElements:()=>Fr,_regraftPermanentInSlice:()=>on,_resetPrefetch:()=>ai,_resolveTargetFrameId:()=>nn,_restoreOptimistic:()=>Ae,_runWithTransition:()=>Ze,_setCurrentPageUrl:()=>fi,_snapshotCache:()=>E,_streamBoundariesProgressively:()=>Wr,_takeResolveUnit:()=>Vr,_viewTransitionsEnabled:()=>Pr,collectChildrenSlots:()=>oe,disableClientRouter:()=>hr,enableClientRouter:()=>Zt,loadFrame:()=>qo,longestSharedPath:()=>vr,navigate:()=>pr,revalidate:()=>mr});function dr(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}function $o(){Kt||typeof MutationObserver>"u"||typeof customElements>"u"||(Kt=new MutationObserver(e=>{for(let t of e)for(let n of t.addedNodes){if(n.nodeType!==1)continue;let r=n;r.tagName?.includes("-")&&customElements.upgrade(r);for(let s of r.querySelectorAll("*"))s.tagName?.includes("-")&&customElements.upgrade(s)}}),Kt.observe(document.body,{childList:!0,subtree:!0}))}function Zt(){K||typeof document>"u"||(K=!0,document.addEventListener("click",br,!1),document.addEventListener("submit",tn,!1),window.addEventListener("popstate",en),document.addEventListener("pointerover",re,!0),document.addEventListener("focusin",re,!0),document.addEventListener("touchstart",re,{capture:!0,passive:!0}),document.addEventListener("pointerout",jr,!0),document.addEventListener("webjs:navigate",Jt),$o(),Jt(),typeof history<"u"&&"scrollRestoration"in history&&(Qe=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(L=location.href))}function hr(){K&&(K=!1,document.removeEventListener("click",br,!1),document.removeEventListener("submit",tn,!1),window.removeEventListener("popstate",en),document.removeEventListener("pointerover",re,!0),document.removeEventListener("focusin",re,!0),document.removeEventListener("touchstart",re,{capture:!0}),document.removeEventListener("pointerout",jr,!0),document.removeEventListener("webjs:navigate",Jt),lt(),U&&(U.disconnect(),U=null),typeof history<"u"&&Qe!==null&&(history.scrollRestoration=Qe,Qe=null),L=null)}async function pr(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await rn(n.href,t?.replace??!1,null)}async function qo(e,t){if(typeof location>"u")return{ok:!1,status:null,aborted:!1};let n=e&&e.id;if(!n)return{ok:!1,status:null,aborted:!1};let r=new URL(t,location.href);if(r.origin!==location.origin)return{ok:!1,status:null,aborted:!1};T&&T.abort(),T=new AbortController;let s=T.signal,o=++g;return rt(r.href,n,!1,null,"GET",null,s,o)}function mr(e){if(!e){E.clear(),A.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;E.delete(n),A.delete(n)}function br(e){if(!K||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=wr(e);if(!t||t.hasAttribute("download")||t.hasAttribute("data-no-router")||t.target&&t.target!=="_self")return;let n=t.href;if(!n)return;let r=new URL(n);if(r.origin!==location.origin||r.pathname===location.pathname&&r.search===location.search&&r.hash||ct.test(r.pathname))return;e.preventDefault();let s=nn(t);rn(n,!1,s)}function en(e){rn(location.href,!0,null)}function tn(e){if(!K||e.defaultPrevented)return;let t=e.target;if(!t||t.nodeType!==1||t.tagName!=="FORM"||t.hasAttribute("data-no-router"))return;let n=e.submitter??null;if(n&&n.hasAttribute("data-no-router"))return;let r=n&&n.getAttribute("formtarget")||t.getAttribute("target")||"";if(r&&r!=="_self")return;let s=yr(t,n);if(s==="dialog")return;let o=gr(t,n),i;try{i=new URL(o,location.href)}catch{return}if(i.origin!==location.origin||ct.test(i.pathname))return;let a=_r(t,n);e.preventDefault();let c=nn(n||t);Wo(i.href,s,a,c,t)}function yr(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function gr(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function _r(e,t){try{return new FormData(e,t||void 0)}catch{let n=new FormData(e);return t&&t.getAttribute("name")&&n.append(t.getAttribute("name"),t.getAttribute("value")||""),n}}function wr(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function Sr(e){let t=e;for(;t;){let n=t.closest("webjs-frame");if(n&&n.id)return n.id;let r=t.getRootNode();if(r&&r.host)t=r.host;else break}return null}function nn(e){if(!e)return null;let t=e.closest&&e.closest("[data-webjs-frame]"),n=t?t.dataset?t.dataset.webjsFrame:t.getAttribute("data-webjs-frame"):null;if(n!=null&&n!==""){if(n===Ar)return null;let r=typeof document<"u"?document.getElementById(n):null;return r&&r.tagName&&r.tagName.toLowerCase()==="webjs-frame"?n:(Ho(`webjs:frame-unresolved:${n}`,`[webjs] data-webjs-frame="${n}" did not match a live <webjs-frame id="${n}">; performing a normal navigation instead.`),null)}return Sr(e)}function Ho(e,t){lr.has(e)||(lr.add(e),typeof console<"u"&&console.warn&&console.warn(t))}function oe(e){let t=new Map,n=[];function r(s){if(s.nodeType===8){let o=s,i=o.data,a=/^wj:children:(.+)$/.exec(i);if(a){n.push({path:a[1],start:o});return}if(i.trim()==="/wj:children"){let c=n.pop();c&&!t.has(c.path)&&t.set(c.path,{start:c.start,end:o});return}return}if(s.hasChildNodes&&s.hasChildNodes())for(let o=s.firstChild;o;o=o.nextSibling)r(o)}return r(e),t}function vr(e,t){let n=null;for(let r of e.keys())t.has(r)&&(n===null||r.length>n.length)&&(n=r);return n}function Cr(e){let t=G(e);E.has(t)&&E.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(E.set(t,n);E.size>Vo;){let r=E.keys().next().value;E.delete(r)}}function zo(e){let t=G(e),n=E.get(t);return n==null?null:(E.delete(t),E.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function G(e){let t=new URL(e,location.href);return t.pathname+t.search}async function rn(e,t,n){T&&T.abort(),T=new AbortController;let r=T.signal,s=++g;L&&Cr(L);let o=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),o=null},150),i=null;t||(i=Ur());try{if(t){let a=zo(e);if(a){let c=dr(a.html);if(c){Br(c,n,!0,null),typeof window<"u"&&window.scrollTo(a.scrollX,a.scrollY),rt(e,n,!1,i,"GET",null,r,s).catch(()=>{});return}}typeof window<"u"&&window.scrollTo(0,0)}await rt(e,n,!t,i,"GET",null,r,s)}finally{o&&clearTimeout(o),s===g&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(L=location.href))}}async function Wo(e,t,n,r,s){T&&T.abort(),T=new AbortController;let o=T.signal,i=++g,a=t==="get"||t==="head",c=new URL(e,location.href);if(a){c.search="";for(let[h,m]of n)c.searchParams.append(h,typeof m=="string"?m:m.name)}L&&Cr(L);let l=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),l=null},150),u=Ur(),p=s?Mr(s,i,c.href):null,d=!1;try{let h=await rt(c.href,r,!0,u,a?"GET":t.toUpperCase(),a?null:n,o,i);d=!!(h&&h.ok),!a&&i===g&&(E.clear(),A.clear())}finally{p&&Ir(p,i,c.href,d),l&&clearTimeout(l),i===g&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(L=location.href))}}function Er(){return[...oe(document.body).keys()].join(",")}function sn(){try{let e=typeof navigator<"u"?navigator.connection:null;if(e&&e.saveData===!0||typeof matchMedia=="function"&&matchMedia("(prefers-reduced-data: reduce)").matches)return!0}catch{}return!1}function Jo(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function tt(e){if(!e||!(e instanceof HTMLAnchorElement)||e.hasAttribute("download")||e.hasAttribute("data-no-router")||e.target&&e.target!=="_self")return null;let t=e.href;if(!t)return null;let n;try{n=new URL(t)}catch{return null}return n.origin!==location.origin||n.pathname===location.pathname&&n.search===location.search&&n.hash||ct.test(n.pathname)?null:t}function Nr(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=Jo(e);return t.includes("external")||t.includes("no-prefetch")}function nt(e){if(Nr(e))return"none";switch((e.getAttribute("data-prefetch")||"").toLowerCase().trim()){case"false":case"none":return"none";case"true":case"render":return"render";case"auto":case"viewport":return"viewport";case"intent":return"intent";default:return"intent"}}function Ee(e){if(typeof fetch!="function"||sn())return;let t=G(e);if(z.has(t)||ve.has(t))return;let n=A.get(t);if(n&&Yt()-n.at<kr)return;if(z.size>=Tr){for(ve.add(t),te.push(e);te.length>Go;){let o=te.shift();ve.delete(G(o))}return}z.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},s=Er();s&&(r["x-webjs-have"]=s),fetch(e,{method:"GET",headers:r,credentials:"same-origin"}).then(async o=>{let i=o.headers.get("content-type")||"";if(!/^text\/html\b/i.test(i)||o.status>=400)return;let a=o.headers.get("x-webjs-build"),c=o.redirected&&o.url?o.url:e,l=await o.text();Qo(t,{html:l,build:a,finalUrl:c,at:Yt()})}).catch(()=>{}).finally(()=>{z.delete(t),Xo()})}function Xo(){for(;te.length&&z.size<Tr;){let e=te.shift();ve.delete(G(e)),Ee(e)}}function Qo(e,t){for(A.has(e)&&A.delete(e),A.set(e,t);A.size>Ko;){let n=A.keys().next().value;A.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function xr(e){let t=G(e),n=A.get(t);return!n||(A.delete(t),Yt()-n.at>=kr)?null:n}function Yt(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function re(e){if(!K)return;let t=Rr(e.target);if(!t||nt(t)!=="intent")return;let n=tt(t);n&&(Ce===t&&ne||(lt(),Ce=t,ne=setTimeout(()=>{ne=null,Ce=null,Ee(n)},Yo)))}function jr(e){let t=Rr(e.target);t&&t===Ce&&lt()}function lt(){ne&&(clearTimeout(ne),ne=null),Ce=null}function Rr(e){let t=e;for(;t;){if(t instanceof HTMLAnchorElement)return t;let n=t.nodeType===1?t:null;if(n){let s=n.closest&&n.closest("a");if(s instanceof HTMLAnchorElement)return s}let r=t.getRootNode?t.getRootNode():null;t=r&&r.host?r.host:null}return null}function Jt(){if(typeof document>"u"||sn())return;let e=typeof IntersectionObserver<"u";e&&(U?U.disconnect():U=new IntersectionObserver(t=>{for(let n of t){if(!n.isIntersecting)continue;let r=n.target;U.unobserve(r);let s=tt(r);s&&nt(r)==="viewport"&&Ee(s)}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=nt(t);if(n==="render"){let r=tt(t);r&&Ee(r)}else n==="viewport"&&e&&U.observe(t)}}function Zo(e){if(typeof document>"u"||!document.body)return!1;let t=oe(document.body),n,r=-1;for(let[c,l]of t)c.length>r&&(r=c.length,n=l);if(!n)return!1;let s=n.start.parentNode;if(!s||n.start.parentNode!==n.end.parentNode)return!1;let o=document.createElement("div");o.setAttribute("role","alert"),o.setAttribute("data-webjs-nav-error","");let i=e?`This page could not be loaded. (status ${e})`:"This page could not be loaded.";o.textContent=i;let a=document.createRange();return a.setStartAfter(n.start),a.setEndBefore(n.end),a.deleteContents(),s.insertBefore(o,n.end),!0}function Gt(e,t,n){let r=new CustomEvent("webjs:navigation-error",{bubbles:!0,cancelable:!0,detail:{url:e,status:t??null,error:n||null}});if(typeof document<"u")try{document.dispatchEvent(r)}catch{}r.defaultPrevented||Zo(t)||typeof location<"u"&&(location.href=e)}async function rt(e,t,n,r,s,o,i,a){s=s||"GET";let c=typeof a=="number"?a:g,l,u=null,p=null,d=null,h=!1,m=e,ie=t?Lr(t,c):null;try{try{let f=s==="GET"&&!o&&!t?xr(e):null;if(f)l=f.html,p=f.build,m=f.finalUrl,d=200,h=!0;else{let k={"x-webjs-router":"1"},w=Er();w&&(k["x-webjs-have"]=w),t&&(k["x-webjs-frame"]=t),o!=null&&s!=="GET"&&s!=="HEAD"&&(k.accept=cr+", text/html");let x={method:s,headers:k,credentials:"same-origin"};i&&(x.signal=i),o!=null&&s!=="GET"&&s!=="HEAD"&&(x.body=o);let _=await fetch(e,x);d=_.status,h=_.ok;let ae=_.headers.get("content-type")||"",ce=/^text\/html\b/i.test(ae);if(ae.toLowerCase().indexOf(cr)===0){let Kr=await _.text();return c===g&&(Ae(r),Wt(Kr)),{ok:h,status:d,aborted:!1}}if(_.redirected&&_.url&&(m=_.url),_.status===204||_.status===205)return c===g&&n&&history.pushState(null,"",m),{ok:h,status:d,aborted:!1};if(!ce)return c===g&&(Ae(r),Gt(e,_.status,null)),{ok:!1,status:d,aborted:!1};p=_.headers.get("x-webjs-build");let C=await Hr(_);l=C.shell,C.streaming&&(u=C)}}catch(f){return f&&f.name==="AbortError"?{ok:!1,status:null,aborted:!0}:c!==g?{ok:!1,status:null,aborted:!0}:(Ae(r),Gt(e,null,f instanceof Error?f:new Error(String(f))),{ok:!1,status:null,aborted:!1})}if(c!==g){if(u&&u.reader)try{u.reader.cancel()}catch{}return{ok:!1,status:d,aborted:!0}}let v=dr(l);if(!v)return Ae(r),Gt(e,null,new Error("navigation response did not parse as HTML")),{ok:!1,status:d,aborted:!1};if(Br(v,t,!1,m,p),n&&history.pushState(null,"",m),n){let f=new URL(m);if(f.hash){let k=document.getElementById(f.hash.slice(1));k?k.scrollIntoView():window.scrollTo(0,0)}else window.scrollTo(0,0)}return u&&(u.reader||u.rest)&&Wr(u.reader,u.dec,u.rest,()=>c===g),document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:m,frameId:t,from:"navigate"}})),{ok:h,status:d,aborted:!1}}finally{ie&&Or(ie,c)}}function Lr(e,t){if(typeof document>"u")return null;let n=null;try{n=document.querySelector(`webjs-frame#${CSS.escape(e)}`)}catch{n=document.getElementById(e)}if(!n)return null;let r=st.has(n);return st.set(n,t),n.setAttribute("aria-busy","true"),r||n.dispatchEvent(new CustomEvent("webjs:frame-busy",{bubbles:!0,detail:{frameId:e,busy:!0}})),n}function Or(e,t){if(st.get(e)!==t)return;st.delete(e),e.setAttribute("aria-busy","false");let n=e.id||null;e.dispatchEvent(new CustomEvent("webjs:frame-busy",{bubbles:!0,detail:{frameId:n,busy:!1}}))}function Mr(e,t,n){let r=ot.has(e);return ot.set(e,t),e.setAttribute("aria-busy","true"),r||e.dispatchEvent(new CustomEvent("webjs:submit-start",{bubbles:!0,detail:{form:e,url:n}})),e}function Ir(e,t,n,r){if(ot.get(e)!==t)return;ot.delete(e),e.setAttribute("aria-busy","false");let s=new CustomEvent("webjs:submit-end",{bubbles:!0,detail:{form:e,url:n,ok:!!r}});e.isConnected?e.dispatchEvent(s):typeof document<"u"?document.dispatchEvent(s):e.dispatchEvent(s)}function ur(e){if(!e||!e.head)return"";let t=e.head.querySelectorAll('[data-webjs-track="reload"]');if(!t.length)return"";let n="";for(let r of t)n+=W(r);return n}function Pr(){if(typeof document>"u")return!1;let e=document.querySelector('meta[name="view-transition"]');return e?(e.getAttribute("content")||"").trim().toLowerCase()==="same-origin":!1}function Ze(e,t){let n=typeof document<"u"?document.startViewTransition:void 0;if(Pr()&&typeof n=="function"){let r=n.call(document,e);r&&r.finished&&typeof r.finished.then=="function"?r.finished.then(()=>{t&&t()}).catch(()=>{}):t&&t();return}e(),t&&t()}function Fr(e,t){if(!e||!t||typeof e.querySelectorAll!="function")return;let n=e.querySelectorAll("[data-webjs-permanent][id]");for(let r of n){let s=r.id;if(!s)continue;let o=null;try{o=t.querySelector(`#${CSS.escape(s)}`)}catch{o=null}if(!o||!r.hasAttribute||!r.hasAttribute("data-webjs-permanent"))continue;let i=o.parentNode;i&&o!==r&&i.replaceChild(r,o)}}function on(e,t){let n=[];for(let r of e){if(r.nodeType!==1)continue;let s=r;if(s.hasAttribute&&s.hasAttribute("data-webjs-permanent")&&s.id&&n.push(s),typeof s.querySelectorAll=="function")for(let o of s.querySelectorAll("[data-webjs-permanent][id]"))n.push(o)}if(n.length)for(let r of n){let s=r.id;if(!s)continue;let o=ei(t,s);if(!o||o===r)continue;let i=o.parentNode;if(i)i.replaceChild(r,o);else{let a=t.indexOf(o);a!==-1&&(t[a]=r)}}}function ei(e,t){for(let n of e){if(n.nodeType!==1)continue;let r=n;if(r.id===t)return r;if(typeof r.querySelector=="function"){let s=null;try{s=r.querySelector(`#${CSS.escape(t)}`)}catch{s=null}if(s)return s}}return null}function ti(e){if(!(!e||!e.start))for(let t=e.start.nextSibling;t&&t!==e.end;t=t.nextSibling)t.nodeType===1&&ee(t)}function Br(e,t,n,r,s){try{typeof sessionStorage<"u"&&(!r||t||n)&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}if(r&&!t&&!n){let u=document.querySelector('script[type="importmap"]'),p=u?u.getAttribute("data-webjs-build"):null,d=!1;if(s&&p&&(d=s!==p),!d&&e.head&&e.head.children.length>0){let h=ur(document),m=ur(e);h!==m&&(d=!0)}if(d&&typeof location<"u")try{let h="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(h))sessionStorage.removeItem(h);else{sessionStorage&&sessionStorage.setItem(h,"1"),location.href=r;return}}catch{location.href=r;return}else if(!d)try{typeof sessionStorage<"u"&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}}if(t){let u=document.querySelector(`webjs-frame#${CSS.escape(t)}`),p=e.querySelector(`webjs-frame#${CSS.escape(t)}`);if(u&&p){Qt(e.head),Ze(()=>{si(u,p),at(u),ee(u),et()},()=>ee(u)),fr(e.body);return}let d=new CustomEvent("webjs:frame-missing",{bubbles:!0,cancelable:!0,detail:{frameId:t,url:r||(typeof location<"u"?location.href:null),document:e}});(u||document).dispatchEvent(d),d.defaultPrevented||console.warn(`[webjs] frame "${t}" was not in the navigation response, leaving it unchanged. Handle "webjs:frame-missing" (preventDefault) to override.`);return}let o=oe(document.body),i=oe(e.body),a=vr(o,i);if(a){Qt(e.head),Ze(()=>{ni(o.get(a),i.get(a),e),et()},()=>ti(o.get(a))),fr(e.body);return}qr(e.head),Fr(document.body,e.body);let c=[...e.body.childNodes];Ze(()=>{document.body.replaceChildren(...c),at(document.body),ee(document.body),et()},()=>ee(document.body))}function et(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function ni(e,t,n){if(!e||!t)return;let r=e.start.parentNode;if(!r)return;let s=[];for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)s.push(i);let o=[];for(let i=t.start.nextSibling;i&&i!==t.end;i=i.nextSibling)o.push(document.importNode(i,!0));on(s,o),ri(r,e.start,e.end,s,o);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&(at(i),ee(i))}function ri(e,t,n,r,s){let o=new Map;for(let c of r){if(c.nodeType!==1)continue;let l=se(c);l&&o.set(l,c)}let i=n,a=[];for(let c of s){if(c.nodeType===1){let l=se(c);if(l&&o.has(l)){let u=o.get(l);it(u,c),a.push(u),o.delete(l);continue}}a.push(c)}for(let c of r)if(c.parentNode===e){if(c.nodeType===1&&a.includes(c))continue;e.removeChild(c)}for(let c of a)e.insertBefore(c,i)}function it(e,t){if(e===t)return;if(e.tagName!==t.tagName){e.replaceWith(t);return}let n=new Set;for(let r of t.attributes)n.add(r.name),!Xt.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])Xt.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);an(e,t)}function an(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(a=>document.importNode(a,!0));on(n,r);let s=new Map;for(let a of n){if(a.nodeType!==1)continue;let c=se(a);c&&s.set(c,a)}let o=[];for(let a=0;a<r.length;a++){let c=r[a];if(c.nodeType===1){let l=se(c);if(l&&s.has(l)){let p=s.get(l);it(p,c),o.push(p),s.delete(l);continue}let u=n[a];if(u&&u.nodeType===1&&!se(u)&&u.tagName===c.tagName){it(u,c),o.push(u);continue}}else if(c.nodeType===3){let l=n[a];if(l&&l.nodeType===3){l.nodeValue!==c.nodeValue&&(l.nodeValue=c.nodeValue),o.push(l);continue}}else if(c.nodeType===8){let l=n[a];if(l&&l.nodeType===8){l.nodeValue!==c.nodeValue&&(l.nodeValue=c.nodeValue),o.push(l);continue}}o.push(c)}let i=new Set(o);for(let a of n)!i.has(a)&&a.parentNode===e&&e.removeChild(a);for(let a=0;a<o.length;a++){let c=o[a];(c.parentNode!==e||e.childNodes[a]!==c)&&e.insertBefore(c,e.childNodes[a]||null)}}function se(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}function Ur(){let e=oe(document.body);if(e.size===0)return null;let t=null;for(let i of e.keys())(t===null||i.length>t.length)&&(t=i);if(t===null)return null;let n=document.getElementById(`wj-loading:${t}`);if(!(n instanceof HTMLTemplateElement))return null;let r=e.get(t),s=[];for(let i=r.start.nextSibling;i&&i!==r.end;i=i.nextSibling)s.push(i);let o=document.createRange();return o.setStartAfter(r.start),o.setEndBefore(r.end),o.deleteContents(),r.start.parentNode.insertBefore(n.content.cloneNode(!0),r.end),{slot:r,oldChildren:s,token:g}}function Ae(e){if(!e||e.token!==g)return;let{slot:t,oldChildren:n}=e;if(t.start.parentNode!==t.end.parentNode)return;let r=document.createRange();r.setStartAfter(t.start),r.setEndBefore(t.end),r.deleteContents();for(let s of n)t.start.parentNode.insertBefore(s,t.end)}function si(e,t){an(e,t)}function Dr(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function cn(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=Dr();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function $r(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=Dr();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function W(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function Qt(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(W(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(W(r))||(r.tagName==="SCRIPT"?document.head.appendChild(cn(r)):document.head.appendChild($r(r))))}function qr(e){let t=document.head,n=e.querySelector("title");n&&(document.title=n.textContent||"");let r=new Set;for(let o of t.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&r.add(W(o));let s=new Set;for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&s.add(W(o));for(let o of[...t.children])o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(s.has(W(o))||o.remove());for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(r.has(W(o))||(o.tagName==="SCRIPT"?t.appendChild(cn(o)):t.appendChild($r(o))))}function ee(e){typeof customElements>"u"||ln(e)}function ln(e){let t=e instanceof Element?[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(let n of t)n.tagName&&n.tagName.includes("-")&&(customElements.upgrade(n),n.shadowRoot&&ln(n.shadowRoot))}function fr(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]"))document.body.appendChild(t.cloneNode(!0))}async function Hr(e){if(!e.body||typeof e.body.getReader!="function")return{shell:await e.text(),streaming:!1};let t=e.body.getReader(),n=new TextDecoder,r="",s="<template data-webjs-resolve",o="<!--wj-stream-shell-->",i=/<\/html\s*>/i;for(;;){let{value:a,done:c}=await t.read();a&&(r+=n.decode(a,{stream:!0})),c&&(r+=n.decode());let l=r.indexOf(o);if(l!==-1)return{shell:r.slice(0,l),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(l+o.length)};let u=r.indexOf(s);if(u!==-1)return{shell:r.slice(0,u),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(u)};if(c)return{shell:r,streaming:!1};let p=i.exec(r);if(p){let d=p.index+p[0].length;return{shell:r.slice(0,d),streaming:!0,reader:t,dec:n,rest:r.slice(d)}}}}function Vr(e){let t=/<template\s+data-webjs-resolve="([^"]+)"\s*>/i.exec(e);if(!t)return null;let n=t[1],r=t.index+t[0].length,s=/<(\/?)template\b[^>]*>/gi;s.lastIndex=r;let o=1,i;for(;i=s.exec(e);)if(i[1]==="/"){if(o--,o===0)return{id:n,content:e.slice(r,i.index),rest:e.slice(i.index+i[0].length)}}else o++;return null}function zr(e,t){let n=document.getElementById(e);if(!n)return;let r=document.createElement("template");r.innerHTML=t;let s=[...r.content.childNodes];n.replaceWith(r.content);for(let o of s)o.nodeType===1&&ln(o)}async function Wr(e,t,n,r){let s=n,o=()=>{let i;for(;i=Vr(s);){if(!r())return!1;zr(i.id,i.content),s=i.rest}return!0};if(!e){o();return}try{for(;;){if(!o()){try{await e.cancel()}catch{}return}let{value:i,done:a}=await e.read();if(i&&(s+=t.decode(i,{stream:!0})),a){s+=t.decode(),o();return}}}catch{}}function at(e){for(let t of e.querySelectorAll("script"))t.replaceWith(cn(t))}function oi(e){return A.get(G(e))||null}function ii(){return z.size}function ai(){A.clear(),z.clear(),te.length=0,ve.clear(),lt()}function ci(){return g}function li(){return++g}function ui(){return L}function fi(e){L=e}function di(e){return ct.test(e)}var cr,K,T,g,Kt,L,Qe,ct,Ar,lr,Vo,E,Ko,kr,Tr,Go,Yo,A,z,te,ve,ne,Ce,U,st,ot,Xt,Vt=le(()=>{Ht();Xe();Xe();ar();cr="text/vnd.webjs-stream.html";K=!1,T=null,g=0,Kt=null;L=null,Qe=null;ct=/\.(?:pdf|zip|tar|gz|7z|rar|dmg|exe|msi|deb|rpm|apk|ipa|xlsx?|docx?|pptx?|csv|odt|ods|odp|rtf|epub|mobi|xml|json|rss|atom|txt|md|wasm|mp3|mp4|mov|avi|webm|ogg|flac|wav|m4a|m4v|mkv|png|jpe?g|gif|webp|avif|bmp|ico|svg|tiff?|heic)$/i;Ar="_top";lr=new Set;Vo=16,E=new Map;Ko=8,kr=3e4,Tr=3,Go=24,Yo=100,A=new Map,z=new Set,te=[],ve=new Set,ne=null,Ce=null,U=null;st=new WeakMap;ot=new WeakMap;Xt=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);Zt()});function Yr(e,...t){return{_$webjs:"template",strings:e,values:t}}function S(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var b="w$";function Jr(e,...t){let n=e[0];for(let r=1;r<e.length;r++)n+=String(t[r-1]??"")+e[r];return{_$webjsCss:!0,text:n}}function dt(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function ht(e,t){if(!(!t||!t.length))if("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){let n=t.map(r=>{let s=new CSSStyleSheet;return s.replaceSync(r.text),s});e.adoptedStyleSheets=n}else{let n=e,r=document.createElement("style");r.textContent=t.map(s=>s.text).join(`
2
- `),n.appendChild(r)}}function Xr(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
3
- `)}</style>`}function Qr(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zr(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}var pn=Symbol.for("webjs.repeat");function mn(e,t,n){return{[pn]:!0,items:[...e],keyFn:t,templateFn:n}}function ke(e){return!!e&&typeof e=="object"&&e[pn]===!0}function es(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function pt(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function ts(e){return{_$webjs:"live",value:e}}function mt(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function ns(e,t){return{_$webjs:"keyed",key:e,value:t}}function Te(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function rs(e,t){return{_$webjs:"guard",deps:e,fn:t}}function Ne(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function ss(e){return{_$webjs:"template-content",template:e}}function bt(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function os(e){return{_$webjs:"ref",target:e}}function xe(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function is(){return{value:void 0}}function as(e){return{_$webjs:"cache",value:e}}function je(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function cs(...e){return{_$webjs:"until",args:e}}function Re(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function ls(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function yt(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function us(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function gt(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function fs(e){return{_$webjs:"watch",signal:e}}function Le(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var N=null,M=!1,J=0,Y=null,_t=0,bn=(e,t)=>Object.is(e,t),Me=()=>{},yn=()=>!1;function gn(e,t){e.liveConsumers||(e.liveConsumers=new Set);let n=e.liveConsumers.size===0;if(e.liveConsumers.add(t),n){if(e.producers&&e.producers.length>0)for(let r of e.producers)gn(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function ue(e,t){if(e.liveConsumers&&(e.liveConsumers.delete(t),e.liveConsumers.size===0)){if(e.producers&&e.producers.length>0)for(let n of e.producers)ue(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function Et(e){if(M)throw new Error("Signal read during notification phase");if(N===null)return;let t=N,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&At(t)&&ue(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,At(t)&&gn(e,t)),t.producerLastReadVersions[n]=e.version}function At(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function _n(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=M;M=!0;try{for(let n of e.liveConsumers)n.dirty||ds(n)}finally{M=t}}function ds(e){e.dirty=!0,_n(e),e.consumerMarkedDirty.call(e.wrapper||e)}function Ie(e){if(!(!e.dirty&&e.lastCleanEpoch===J)){if(!e.producerMustRecompute()&&!hs(e)){e.dirty=!1,e.lastCleanEpoch=J;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=J}}function hs(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(Ie(n),r!==n.version))return!0}return!1}function vt(e){e&&(e.nextProducerIndex=0);let t=N;return N=e,t}function Ct(e,t){if(N=t,!!e){if(At(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)ue(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var Pe=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=J,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=yn,this.producerRecomputeValue=Me,this.consumerMarkedDirty=Me,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||bn,this.watched=n?.[kt],this.unwatched=n?.[Tt]}get(){return Et(this),this.__value}peek(){return this.__value}set(t){if(M)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,J++,Y!==null?wn(this):_n(this))}};function wn(e){let t=M;M=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?Y.add(n):wn(n))}finally{M=t}}var wt=Symbol("unset"),St=Symbol("computing"),Oe=Symbol("errored"),fe=class{constructor(t,n){this.__fn=t,this.__value=wt,this.__error=null,this.version=0,this.lastCleanEpoch=-1,this.dirty=!0,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!1,this.wrapper=this,this.__isSignal=!0,this.__isComputed=!0,this.__equal=n?.equals||bn,this.watched=n?.[kt],this.unwatched=n?.[Tt];let r=this;this.producerMustRecompute=function(){return r.__value===wt||r.__value===St},this.producerRecomputeValue=function(){if(r.__value===St)throw new Error("Detected cycle in computations.");let s=r.__value;r.__value=St;let o=vt(r),i,a=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=Oe,r.__error=l,a=!0}finally{Ct(r,o)}if(!a&&(s!==wt&&s!==Oe)&&r.__equal.call(r.wrapper,s,i)){r.__value=s;return}r.__value=i,r.version++},this.consumerMarkedDirty=Me}get(){if(Ie(this),Et(this),this.__value===Oe)throw this.__error;return this.__value}peek(){if(Ie(this),this.__value===Oe)throw this.__error;return this.__value}},Fe=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=J,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=yn,this.producerRecomputeValue=Me,this.wrapper=this,this.__isWatcher=!0;let n=this;this.consumerMarkedDirty=function(){n.__fire()}}__fire(){this.__notify&&this.__notify.call(this)}watch(...t){if(t.length===0){this.dirty=!1;return}let n=vt(this);try{for(let r of t)Et(r),r.__isComputed&&Ie(r)}finally{Ct(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(ue(this.producers[n],this),this.producers.splice(n,1),this.producerLastReadVersions.splice(n,1),this.nextProducerIndex=Math.min(this.nextProducerIndex,this.producers.length))}getPending(){return this.producers.filter(t=>t.__isComputed&&t.dirty)}observe(t){let n=vt(this),r;try{r=t()}finally{Ct(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)ue(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},kt=Symbol("watched"),Tt=Symbol("unwatched");function ps(e){let t=N;N=null;try{return e()}finally{N=t}}function ms(e){return e.producers.slice()}function bs(e){return e.liveConsumers?[...e.liveConsumers]:[]}function ys(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function gs(e){return e.producers.length>0}function _s(){return N&&N.__isComputed?N:null}function ws(e){_t++,Y===null&&(Y=new Set);try{e()}finally{if(_t--,_t===0){let t=Y;Y=null;for(let n of t)n.__fire()}}}var de={State:Pe,Computed:fe,subtle:{Watcher:Fe,untrack:ps,introspectSources:ms,introspectSinks:bs,hasSinks:ys,hasSources:gs,currentComputed:_s,watched:kt,unwatched:Tt}};function Ss(e,t){return new Pe(e,t)}function As(e,t){return new fe(e,t)}function vs(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function Cs(e){let t=!1,n=!1,r=new fe(e),s=new Fe(()=>{t||n||(t=!0,queueMicrotask(()=>{if(t=!1,!n){try{r.get()}catch(o){console.error(o)}s.watch()}}))});s.watch(r);try{r.get()}catch(o){console.error(o)}return()=>{n||(n=!0,s.dispose())}}var Es=`${b}s`,ks=`${b}e`;function Sn(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===Es||t===ks}function Ts(e){for(let t of e.addedNodes)if(Sn(t))return!0;for(let t of e.removedNodes)if(Sn(t))return!0;return!1}function kn(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var pe=kn(),D=Symbol("webjs.slot.state"),I="data-webjs-light",$="data-projection",me="actual",Tn="fallback",$e=Symbol("webjs.slot.fallbackFrag"),Ns=64,he=null,Nt=null,Be=null,An=!1;function xs(){An||(pe=kn(),pe&&(he=HTMLSlotElement.prototype.assignedNodes,Nt=HTMLSlotElement.prototype.assignedElements,Be=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(I)&&!vn(this)?xt(this,t):he?he.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(I)&&!vn(this)?xt(this,t).filter(n=>n.nodeType===1):Nt?Nt.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=Be&&Be.get?Be.get.call(this):null;return t||js(this)}}),An=!0))}xs();function vn(e){let t=e;for(let n=0;n<128;n++){let r=t.parentNode;if(!r||r===t)return!1;if(r.host)return!0;t=r}return!1}function xt(e,t){if(e.getAttribute($)===Tn)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:jt(n,new Set,0)}function jt(e,t,n){if(n>=Ns)return e.slice();let r=[];for(let s of e)if(s.nodeType===1&&s.tagName==="SLOT"){let o=s;if(t.has(o))continue;if(t.add(o),o.hasAttribute(I)){let i=xt(o,{flatten:!1});if(i.length>0)for(let a of jt(i,t,n+1))r.push(a);else for(let a of jt(Array.from(o.childNodes),t,n+1))r.push(a)}else if(he){let i=he.call(o,{flatten:!0});for(let a of i)r.push(a)}else r.push(s)}else r.push(s);return r}function js(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(I))return t.getAttribute($)===me?t:null;t=t.parentElement}return null}function P(e){let t=e,n=t[D];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[D]=n),n}function Rt(e){return!!e[D]}function Nn(e){let t=P(e);for(;e.firstChild;){let n=e.firstChild,r=Ue(n);De(t.assignedByName,r,n),e.removeChild(n)}}function xn(e){let t=P(e),n=e.querySelectorAll(`slot[${I}]`);for(let r of n){let s=r;if(s.getAttribute($)!==me)continue;let o=s.getAttribute("name")||null;if(!t.assignedByName.has(o)){let i=Array.from(s.childNodes);t.assignedByName.set(o,i),t.lastSnapshot.set(s,i.slice())}}}function Ue(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function De(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function jn(e,t,n){if(!n.length)return;let r=e.get(t);r||(r=[],e.set(t,r));for(let s of n)r.push(s)}function Rn(e){if(!pe)return;let t=P(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let s of n)if(!Ts(s)){if(s.type==="childList"){for(let o of s.addedNodes)o.parentElement===e&&(De(t.assignedByName,Ue(o),o),r=!0);for(let o of s.removedNodes)e.contains(o)||Cn(t,o)&&(r=!0)}else if(s.type==="attributes"&&s.attributeName==="slot"){let o=s.target;(Cn(t,o)||o.parentElement===e)&&(De(t.assignedByName,Ue(o),o),r=!0)}}r&&qe(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function Ln(e){let t=e[D];if(t){t.childObserver&&(t.childObserver.disconnect(),t.childObserver=null);for(let n of t.ownedSlots){let r=t.nameObservers.get(n);r&&(r.disconnect(),t.nameObservers.delete(n))}}}function Cn(e,t){for(let[n,r]of e.assignedByName){let s=r.indexOf(t);if(s!==-1)return r.splice(s,1),r.length===0&&e.assignedByName.delete(n),!0}return!1}function qe(e){let t=P(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,Rs(e)}))}function Rs(e){if(!pe)return;let t=e[D];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${I}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||Ls(t,i);for(let i of r)t.ownedSlots.has(i)||Is(e,i);t.ownedSlots=r;let s=new Map;for(let i of n){let a=i.getAttribute("name")||null,c=s.get(a);c||(c=[],s.set(a,c)),c.push(i)}for(let i of s.keys()){let a=t.pendingByName.get(i);if(a&&a.length){let c=t.assignedByName.get(i)||[],l=[];for(let u of a)l.push(u);for(let u of c)l.indexOf(u)===-1&&l.push(u);t.assignedByName.set(i,l),t.pendingByName.delete(i)}}let o=[];for(let[i,a]of s){let c=t.assignedByName.get(i)||[];for(let l=0;l<a.length;l++){let u=a[l];l===0&&c.length>0?Os(t,u,c)&&o.push(u):Ms(t,u)&&o.push(u)}}for(let i of o)Ps(i)}function Ls(e,t){let n=e.nameObservers.get(t);n&&(n.disconnect(),e.nameObservers.delete(t));let r=e.lastSnapshot.get(t);if(r&&r.length>0){let s=t.getAttribute("name")||null;jn(e.pendingByName,s,r)}e.lastSnapshot.delete(t)}function Os(e,t,n){let r=t.getAttribute($)!==me,s=e.lastSnapshot.get(t)||[];if(!r&&Fs(s,n))return!1;let i=t[$e];if(r&&i)for(;t.firstChild;)i.appendChild(t.firstChild);else for(;t.firstChild;)t.removeChild(t.firstChild);for(let a of n)t.appendChild(a);return t.setAttribute($,me),e.lastSnapshot.set(t,n.slice()),!0}function Ms(e,t){let n=t.getAttribute($)===me;if(t.setAttribute($,Tn),!n)return En(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return En(t),!0}function En(e){let t=e[$e];!t||t.childNodes.length===0||e.appendChild(t)}function Is(e,t){if(!pe)return;let n=P(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>qe(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function On(e,t){if(!Rt(e))return;let n=P(e),r=n.lastSnapshot.get(t);if(!r||r.length===0)return;let s=t.getAttribute("name")||null;for(let i of r)i.parentNode===t&&t.removeChild(i);jn(n.pendingByName,s,r),n.lastSnapshot.delete(t);let o=n.nameObservers.get(t);o&&(o.disconnect(),n.nameObservers.delete(t)),n.ownedSlots.delete(t)}function Ps(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function Fs(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var Mn=new WeakMap,Lt=Symbol.for("webjs.instance");function Z(e,t){let n=t,r=n[Lt];if(S(e)){let s=e;if(r&&r.strings===s.strings){X(r,s.values);return}r&&In(r,t);let o=t.firstChild;o&&o.nodeType===8&&o.data==="webjs-hydrate"&&o.remove();let i=Ds(s,t);n[Lt]=i;return}if(r&&In(r,t),n[Lt]=null,t.replaceChildren(),!(e==null||e===!1||e===!0)){if(Array.isArray(e)){for(let s of e){let o=document.createTextNode(String(s??""));t.appendChild(o)}return}t.appendChild(document.createTextNode(String(e)))}}function Ve(e){let{strings:t}=e,n=Mn.get(t);if(n)return n;let r=[],s="",o="text",i="",a=0,c="",l=0,u=null,p="",d="";for(let m=0;m<t.length;m++){let ie=t[m];for(let v=0;v<ie.length;v++){let f=ie[v];switch(o){case"text":s+=f,f==="<"&&(o="tag-open");break;case"tag-open":s+=f,f==="!"?o="bang-1":f==="/"?(o="tag-name",p=""):/[a-zA-Z]/.test(f)?(o="tag-name",p=f.toLowerCase()):o="text";break;case"bang-1":s+=f,o=f==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=f,f==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=f,f==="-"?l+=1:(f===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=f,f===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(d="")):/\s/.test(f)?o="in-tag":p+=f.toLowerCase();break;case"in-tag":s+=f,f===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(d="")):!/\s/.test(f)&&f!=="/"&&(o="attr-name",i=f,a=s.length-1);break;case"rawtext":s+=f,d=(d+f.toLowerCase()).slice(-9),(d.endsWith("<\/script>")||d.endsWith("</style>"))&&(o="text",d="",p="");break;case"attr-name":f==="="?(o="after-eq",s+=f):/\s/.test(f)?(o="in-tag",i="",s+=f):f===">"?(o="text",i="",s+=f):(i+=f,s+=f);break;case"after-eq":f==='"'||f==="'"?(o="attr-quoted",c=f,s+=f):/\s/.test(f)?(o="in-tag",i="",s+=f):f===">"?(o="text",i="",s+=f):(o="attr-unquoted",s+=f);break;case"attr-unquoted":/\s/.test(f)?(o="in-tag",i="",s+=f):(f===">"&&(o="text",i=""),s+=f);break;case"attr-quoted":s+=f,f===c&&(o="in-tag",i="");break;case"skip-attr":if(f===c){if(u){let k=u.firstPartIdx,w=[];for(let C=k;C<r.length;C++)(r[C].kind==="noop"||r[C].kind==="attr-mixed")&&w.push(C);let x=[],_=t[w[0]],ae=_.lastIndexOf(c);x.push(ae>=0?_.slice(ae+1):_);for(let C=1;C<w.length;C++)x.push(t[w[C]]);let ce=t[w[w.length-1]+1],ft=ce.indexOf(c);x.push(ft>=0?ce.slice(0,ft):ce),r[k]={kind:"attr-mixed",path:[],name:u.name,statics:x,group:w},u=null}o="in-tag",i=""}break}}if(m<t.length-1){let v=r.length;if(o==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(o==="rawtext"){d="",r.push({kind:"noop",path:[]});continue}if(o==="text")s+=`<!--${b}${v}-->`,r.push({kind:"child",path:[]});else if(o==="in-tag"){let f=`data-${b}${v}`;s+=`${f}=""`,r.push({kind:"element",path:[]})}else if(o==="after-eq"){let f=i[0],k=i.slice(1);if(f==="@"||f==="."||f==="?"){s=s.slice(0,a);let w=f==="@"?"event":f==="."?"prop":"bool",x=`data-${b}${v}`;s+=`${x}=""`,r.push({kind:w,path:[],name:k})}else{s=s.slice(0,a);let w=`data-${b}${v}`;s+=`${w}=""`,r.push({kind:"attr",path:[],name:i})}o="in-tag",i=""}else if(o==="attr-quoted"||o==="attr-unquoted"){s=s.slice(0,a);let f=`data-${b}${v}`;s+=`${f}=""`,u={name:i,firstPartIdx:v},r.push({kind:"noop",path:[]}),o="skip-attr"}else o==="skip-attr"&&r.push({kind:"noop",path:[]})}}let h=document.createElement("template");return h.innerHTML=s,Bs(h.content,r),Us(h.content,r),n={templateEl:h,parts:r},Mn.set(t,n),n}function Bs(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(I,"");let s=t.length;r.setAttribute(`data-${b}${s}`,""),t.push({kind:"slot",path:[]})}}function Us(e,t){let n=[];function r(s){for(let o=0;o<s.childNodes.length;o++){let i=s.childNodes[o];if(n.push(o),i.nodeType===8){let a=i.data;if(a.startsWith(b)){let c=Number(a.slice(b.length));t[c]&&t[c].kind==="child"&&(t[c].path=n.slice())}}else if(i.nodeType===1){let a=i,c=[];for(let l of a.attributes)if(l.name.startsWith(`data-${b}`)){let u=Number(l.name.slice(`data-${b}`.length));t[u]&&t[u].kind!=="child"&&(t[u].path=n.slice()),c.push(l.name)}for(let l of c)a.removeAttribute(l);r(i)}n.pop()}}r(e)}function Ds(e,t){let{templateEl:n,parts:r}=Ve(e),s=n.content.cloneNode(!0),o=document.createComment(`${b}s`),i=document.createComment(`${b}e`),a=r.map(l=>ze(l,s)),c=[];for(let l=0;l<e.values.length;l++)q(a[l],e.values[l],void 0,e.values),c.push(e.values[l]);t.replaceChildren(o,...s.childNodes,i);for(let l of a)l.kind==="slot"&&q(l,void 0,void 0,[]);return{strings:e.strings,bound:a,lastValues:c,startNode:o,endNode:i}}function ze(e,t){if(e.kind==="noop")return{kind:"noop"};let n=t;for(let s of e.path)n=n.childNodes[s];if(e.kind==="child")return{kind:"child",marker:n};let r=n;if(e.kind==="event"){let s={kind:"event",el:r,name:e.name||"",handler:null,dispatcher(o){s.handler?.(o)}};return r.addEventListener(s.name,s.dispatcher),s}if(e.kind==="attr")return{kind:"attr",el:r,name:e.name||""};if(e.kind==="attr-mixed")return{kind:"attr-mixed",el:r,name:e.name||"",statics:e.statics||[],group:e.group||[]};if(e.kind==="prop")return{kind:"prop",el:r,name:e.name||""};if(e.kind==="bool")return{kind:"bool",el:r,name:e.name||""};if(e.kind==="element")return{kind:"element",el:r};if(e.kind==="slot")return{kind:"slot",slotEl:r,applied:!1};throw new Error(`unknown part kind ${e.kind}`)}function X(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(q(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function In(e,t){for(let n of e.bound){if(n.kind==="event"&&n.el.removeEventListener(n.name,n.dispatcher),n.kind==="element"){let r=n.lastTarget;if(r){if(typeof r=="function")try{r(void 0)}catch{}else typeof r=="object"&&(r.value=void 0);n.lastTarget=void 0,n.__lastEl=void 0}}if(n.kind==="slot"){let r=Ot(n.slotEl);r&&On(r,n.slotEl)}}t.replaceChildren()}function q(e,t,n,r){if(mt(t)){let s=t.value;if(e.kind==="prop"&&e.el[e.name]===s||e.kind==="attr"&&e.el.getAttribute(e.name)===String(s)||e.kind==="bool"&&e.el.hasAttribute(e.name)===!!s)return;t=s}switch(e.kind){case"child":Hs(e,t);break;case"attr":{t==null||t===!1?e.el.removeAttribute(e.name):e.el.setAttribute(e.name,String(t));break}case"prop":e.el[e.name]=t;break;case"bool":t?e.el.setAttribute(e.name,""):e.el.removeAttribute(e.name);break;case"event":e.handler=typeof t=="function"?t:null;break;case"element":qs(e,t);break;case"attr-mixed":{let s=e,o=s.statics[0];for(let i=0;i<s.group.length;i++)o+=String((r?r[s.group[i]]:t)??""),o+=s.statics[i+1]||"";e.el.setAttribute(e.name,o);break}case"slot":{if(e.applied)break;let s=e.slotEl,o=()=>{e.applied=!0;let a=Ot(s);if(!a||$s(s))return;let c=document.createDocumentFragment();for(;s.firstChild;)c.appendChild(s.firstChild);s[$e]=c,qe(a)};Ot(s)?o():queueMicrotask(o);break}case"noop":break}}function Ot(e){let t=e.parentElement;for(;t;){if(t[D])return t;t=t.parentElement}return null}function $s(e){let t=e;for(let n=0;n<128;n++){let r=t.parentNode;if(!r||r===t)return!1;if(r.host)return!0;t=r}return!1}function qs(e,t){let n=e,r=xe(t)?t.target:void 0,s=n.__refTarget,o=r!==s;if(o&&s)if(typeof s=="function")try{s(void 0)}catch{}else typeof s=="object"&&(s.value=void 0);if(o||n.__refElement!==e.el){if(n.__refTarget=r,r)if(typeof r=="function"){if(!o&&n.__refElement!==void 0)try{r(void 0)}catch{}try{r(e.el)}catch{}}else typeof r=="object"&&(r.value=e.el);n.__refElement=e.el,e.lastTarget=r}}function Hs(e,t){return Qs(e,t),j(e,t)}function j(e,t){let n=e.marker;if(pt(t)){F(e);let s=String(t.value??""),o=document.createElement("template");o.innerHTML=s;let i=[...o.content.childNodes],a=document.createDocumentFragment();for(let c of i)a.appendChild(c);n.parentNode?.insertBefore(a,n),e.child=i;return}if(Te(t)){let s=t,o=e.__keyedKey;o!==void 0&&!Object.is(o,s.key)&&F(e),e.__keyedKey=s.key,j(e,s.value);return}if(Ne(t)){let s=t,o=e.__guardDeps,i=s.deps;if(o!==void 0&&(Array.isArray(o)&&Array.isArray(i)?Xs(o,i):Object.is(o,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,j(e,s.fn());return}if(bt(t)){F(e);let s=t.template;if(s&&s.content){let o=s.content.cloneNode(!0),i=[...o.childNodes];n.parentNode?.insertBefore(o,n),e.child=i}return}if(xe(t))return;if(je(t))return Zs(e,t.value);if(Re(t))return eo(e,t.args);if(Le(t))return to(e,t.signal);if(yt(t))return no(e,t);if(gt(t))return ro(e,t);if(ke(t)){if(e.child&&e.child.kind==="repeat"){Ws(e,t);return}F(e);let s={kind:"repeat",map:new Map};e.child=s,zs(n,s,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){Ys(e,t);return}F(e);let s={kind:"array",items:[]};e.child=s,Gs(n,s,t);return}if(e.child){let s=e.child;if(s.kind==="repeat")Pn(s),e.child=void 0;else if(s.kind==="array")Bn(s),e.child=void 0;else if(s.kind==="async-stream")qn(s),e.child=void 0;else if("strings"in e.child){let o=e.child;if(S(t)&&o.strings===t.strings){X(o,t.values);return}Q(o.startNode,o.endNode),e.child=void 0}else{for(let o of e.child)o.parentNode&&o.parentNode.removeChild(o);e.child=void 0}}if(t==null||t===!1||t===!0)return;if(S(t)){let s=t,{templateEl:o,parts:i}=Ve(s),a=o.content.cloneNode(!0),c=document.createComment(`${b}s`),l=document.createComment(`${b}e`),u=i.map(h=>ze(h,a)),p=[];for(let h=0;h<s.values.length;h++)q(u[h],s.values[h],void 0,s.values),p.push(s.values[h]);let d=[c,...a.childNodes,l];n.parentNode?.insertBefore(Vs(d),n);for(let h of u)h.kind==="slot"&&q(h,void 0,void 0,[]);e.child={strings:s.strings,bound:u,lastValues:p,startNode:c,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function Vs(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function Q(e,t){if(!e.parentNode)return;let n=e;for(;n&&n!==t;){let r=n.nextSibling;n.parentNode?.removeChild(n),n=r}t.parentNode===e.parentNode&&t.parentNode?.removeChild(t)}function It(e){let{templateEl:t,parts:n}=Ve(e),r=t.content.cloneNode(!0),s=document.createComment(`${b}s`),o=document.createComment(`${b}e`),i=n.map(l=>ze(l,r)),a=[];for(let l=0;l<e.values.length;l++)q(i[l],e.values[l],void 0,e.values),a.push(e.values[l]);let c=document.createDocumentFragment();for(c.appendChild(s);r.firstChild;)c.appendChild(r.firstChild);return c.appendChild(o),{inst:{strings:e.strings,bound:i,lastValues:a,startNode:s,endNode:o},frag:c}}function be(e){for(let t of e.bound)if(t.kind==="event"&&t.el.removeEventListener(t.name,t.dispatcher),t.kind==="element"){let n=t.lastTarget;if(n){if(typeof n=="function")try{n(void 0)}catch{}else typeof n=="object"&&(n.value=void 0);t.lastTarget=void 0,t.__lastEl=void 0}}}function zs(e,t,n){let{items:r,keyFn:s,templateFn:o}=n,i=e.parentNode;if(!i)return;let a=document.createDocumentFragment();for(let c=0;c<r.length;c++){let l=s(r[c],c),u=o(r[c],c);if(!S(u))continue;let{inst:p,frag:d}=It(u);t.map.set(l,p),a.appendChild(d)}i.insertBefore(a,e)}function Ws(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,{items:o,keyFn:i,templateFn:a}=t,c=new Map;for(let l=0;l<o.length;l++){let u=i(o[l],l),p=a(o[l],l);if(!S(p))continue;let d=s.map.get(u);if(d&&d.strings===p.strings)X(d,p.values),Mt(d.startNode,d.endNode,r,n),c.set(u,d),s.map.delete(u);else{d&&(be(d),Q(d.startNode,d.endNode),s.map.delete(u));let{inst:h,frag:m}=It(p);r.insertBefore(m,n),c.set(u,h)}}for(let l of s.map.values())be(l),Q(l.startNode,l.endNode);s.map=c}function Pn(e){for(let t of e.map.values())be(t),Q(t.startNode,t.endNode);e.map.clear()}function Ks(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function He(e){e.type==="tpl"?(be(e.inst),Q(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function Fn(e){if(S(e)){let{inst:t,frag:n}=It(e);return{item:{type:"tpl",inst:t},frag:n}}if(e!=null&&e!==!1&&e!==!0){let t=document.createTextNode(String(e));return{item:{type:"text",node:t},frag:t}}return{item:{type:"empty"},frag:null}}function Gs(e,t,n){let r=e.parentNode;if(!r)return;let s=document.createDocumentFragment(),o=[];for(let i of n){let{item:a,frag:c}=Fn(i);c&&s.appendChild(c),o.push(a)}r.insertBefore(s,e),t.items=o}function Ys(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,o=s.items,i=[];for(let a=0;a<t.length;a++){let c=t[a],l=o[a];if(S(c)){let d=c;if(l&&l.type==="tpl"&&l.inst.strings===d.strings){X(l.inst,d.values),i.push(l);continue}}else if(c!=null&&c!==!1&&c!==!0){if(l&&l.type==="text"){let d=String(c);l.node.data!==d&&(l.node.data=d),i.push(l);continue}}else{l&&He(l),i.push({type:"empty"});continue}let{item:u,frag:p}=Fn(c);p&&r.insertBefore(p,Js(o,a,n)),l&&He(l),i.push(u)}for(let a=t.length;a<o.length;a++)He(o[a]);s.items=i}function Js(e,t,n){for(let r=t;r<e.length;r++){let s=Ks(e[r]);if(s&&s.parentNode)return s}return n}function Bn(e){for(let t of e.items)He(t);e.items=[]}function Mt(e,t,n,r){if(t.nextSibling===r&&e.parentNode===n)return;let s=document.createDocumentFragment(),o=e;for(;o;){let i=o.nextSibling;if(s.appendChild(o),o===t)break;o=i}n.insertBefore(s,r)}function Xs(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function F(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&Un(t),!e.child)return;let n=e.child;if(n.kind==="repeat")Pn(n);else if(n.kind==="array")Bn(n);else if(n.kind==="async-stream")qn(n);else if("strings"in n){let r=e.child;be(r),Q(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function Qs(e,t){let n=e;n.__untilState&&!Re(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!Ne(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!je(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!Te(t)&&(n.__keyedKey=void 0),n.__watchSub&&!Le(t)&&Un(n)}function Zs(e,t){let n=e.marker,r=e,s=r.__cacheMap;s||(s=new Map,r.__cacheMap=s);let o=e.child;if(o&&"strings"in o){let a=o;if(S(t)&&a.strings===t.strings){X(a,t.values);return}let c=document.createDocumentFragment();Mt(a.startNode,a.endNode,c,null),s.set(a.strings,{inst:a,holder:c}),e.child=void 0}if(S(t)){let a=t,c=s.get(a.strings);if(c){s.delete(a.strings),e.child&&F(e),Mt(c.inst.startNode,c.inst.endNode,n.parentNode,n),X(c.inst,a.values),e.child=c.inst;return}}j(e,t)}function eo(e,t){let n=e,r=n.__untilState,s=n.__untilArgs,o=(d,h)=>!!(Object.is(d,h)||S(d)&&S(h)&&d.strings===h.strings),a=s&&s.length===t.length&&s.every((d,h)=>o(d,t[h]))&&r?r.highestResolved:1/0;r&&(r.aborted=!0),n.__untilArgs=t.slice();let c={aborted:!1,highestResolved:a};n.__untilState=c;let l=-1,u;for(let d=0;d<t.length;d++){let h=t[d];if(!h||typeof h.then!="function"){l=d,u=h;break}}l!==-1&&l<=c.highestResolved?(j(e,u),c.highestResolved=l):l===-1&&!n.__untilEverRendered&&j(e,""),n.__untilEverRendered=!0;let p=Math.min(l===-1?t.length:l,c.highestResolved);for(let d=0;d<p;d++){let h=t[d];!h||typeof h.then!="function"||Promise.resolve(h).then(m=>{c.aborted||d>=c.highestResolved||(c.highestResolved=d,j(e,m))},()=>{})}}function to(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let o;n.__watchSub.observe(()=>{o=t.get()}),j(e,o);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new de.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let o;r.observe(()=>{o=t.get()}),j(e,o)})});n.__watchSub=r;let s;r.observe(()=>{s=t.get()}),j(e,s)}function Un(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function no(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;F(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,Dn(s,e,t)}function ro(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;F(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,Dn(s,e,t)}async function Dn(e,t,n){let r=t.marker,s=0;try{for(;!e.aborted;){let o=await e.iterator.next();if(e.aborted||o.done)break;let i=n.mapper?n.mapper(o.value,s):o.value,a=$n(i);if(e.mode==="replace"){for(let l of e.nodes)l.parentNode&&l.parentNode.removeChild(l);e.nodes=[]}let c=document.createDocumentFragment();for(let l of a)c.appendChild(l);r.parentNode?.insertBefore(c,r),e.nodes.push(...a),s++}}catch(o){typeof console<"u"&&console.error("[webjs] asyncStream error:",o)}}function $n(e){if(e==null||e===!1||e===!0)return[];if(S(e)){let t=e,{templateEl:n,parts:r}=Ve(t),s=n.content.cloneNode(!0),o=r.map(i=>ze(i,s));for(let i=0;i<t.values.length;i++)q(o[i],t.values[i],void 0,t.values);return[...s.childNodes]}if(Array.isArray(e)){let t=[];for(let n of e)t.push(...$n(n));return t}return[document.createTextNode(String(e))]}function qn(e){e.aborted=!0;for(let t of e.nodes)t.parentNode&&t.parentNode.removeChild(t);e.nodes=[];try{e.iterator.return?.()?.catch?.(()=>{})}catch{}}var Hn=Symbol.for("webjs:registry"),Vn=Symbol.for("webjs:classToTag"),We=globalThis,R=We[Hn]||(We[Hn]=new Map),zn=We[Vn]||(We[Vn]=new WeakMap),Ke=typeof window<"u"&&typeof customElements<"u";function Pt(e,t){if(!e||typeof e!="string"||!e.includes("-"))throw new Error(`customElements.define: tag "${e}" must contain a hyphen (HTML spec)`);let n=t.lazy===!0,r=R.get(e);r?(r.cls=t,r.lazy=n):R.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),zn.set(t,e)}if(Ke){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),Pt(t,n)}}if(!Ke){let e=globalThis;e.customElements||(e.customElements={define(t,n){Pt(t,n)},get(t){return R.get(t)?.cls},upgrade(){},whenDefined(t){let n=R.get(t);return Promise.resolve(n?.cls)}})}function Ft(e,t){Ke?customElements.define(e,t):Pt(e,t)}function so(e,t){if(Ke)return;let n=R.get(e);if(n){n.moduleUrl=t;return}R.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function oo(e){return R.get(e)?.cls}function io(e){return R.get(e)?.moduleUrl||null}function ao(e){return R.get(e)?.lazy===!0}function Ge(e){return zn.get(e)}function co(){return[...R.keys()]}var y="_$wj";async function Bt(e){return JSON.stringify(await Wn(e))}function _e(e){return Kn(JSON.parse(e))}async function Wn(e){let t=lo();return await uo(e,t),H(e,t)}function Kn(e){return B(e,mo())}function lo(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map}}async function uo(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!yo(r))continue;let s=t.refCount.get(r)||0;if(t.refCount.set(r,s+1),!(s>0)){if(typeof Blob<"u"&&r instanceof Blob){let o=new Uint8Array(await r.arrayBuffer());t.blobBytes.set(r,o);continue}if(typeof FormData<"u"&&r instanceof FormData){for(let[,o]of r.entries())typeof o!="string"&&n.push(o);continue}if(Array.isArray(r))for(let o=0;o<r.length;o++)n.push(r[o]);else if(r instanceof Map)for(let[o,i]of r)n.push(o),n.push(i);else if(r instanceof Set)for(let o of r)n.push(o);else if(go(r))for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(r[o])}}for(let[r,s]of t.refCount)s>1&&t.idOf.set(r,t.nextId++)}function H(e,t){if(e===null)return null;if(e===void 0)return{[y]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[y]:"NaN"}:e===1/0?{[y]:"Inf"}:e===-1/0?{[y]:"-Inf"}:Object.is(e,-0)?{[y]:"-0"}:e;if(n==="bigint")return{[y]:"BigInt",v:e.toString()};if(n==="symbol"){let o=Symbol.keyFor(e);if(o===void 0)throw new TypeError("Cannot serialize a local Symbol; only Symbol.for() registered symbols are supported.");return{[y]:"Sym",v:o}}if(n==="function")throw new TypeError("Cannot serialize a function.");let r=t.idOf.get(e);if(r!==void 0&&t.emitted.has(r))return{[y]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let s;if(e instanceof Date)s={[y]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)s={[y]:"Error",v:{name:e.name,message:e.message,stack:e.stack||null}};else if(typeof Blob<"u"&&e instanceof Blob){let o=t.blobBytes.get(e);typeof File<"u"&&e instanceof File?s={[y]:"File",v:ge(o),n:e.name,t:e.type||"",m:e.lastModified}:s={[y]:"Blob",v:ge(o),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let o=[];for(let[i,a]of e.entries())o.push([i,H(a,t)]);s={[y]:"FD",v:o}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)s=fo(e);else if(e instanceof Map){let o=[];for(let[i,a]of e)o.push([H(i,t),H(a,t)]);s={[y]:"Map",v:o}}else if(e instanceof Set){let o=[];for(let i of e)o.push(H(i,t));s={[y]:"Set",v:o}}else if(Array.isArray(e))s=e.map(o=>H(o,t));else{s={};for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i=_o(o)?"_"+o:o;s[i]=H(e[o],t)}}if(r!==void 0){if(Array.isArray(s))return{[y]:"Arr",_id:r,v:s};s._id=r}return s}function fo(e){if(e instanceof ArrayBuffer)return{[y]:"buf",v:ge(new Uint8Array(e))};if(e instanceof DataView)return{[y]:"dv",v:ge(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=ho[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[y]:n,v:ge(r)}}var ho={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},po={i8:Int8Array,u8:Uint8Array,u8c:Uint8ClampedArray,i16:Int16Array,u16:Uint16Array,i32:Int32Array,u32:Uint32Array,f32:Float32Array,f64:Float64Array,bi64:typeof BigInt64Array<"u"?BigInt64Array:null,bu64:typeof BigUint64Array<"u"?BigUint64Array:null};function mo(){return{refs:new Map}}function B(e,t){if(e===null||typeof e!="object")return e;if(Array.isArray(e)){let o=[];for(let i=0;i<e.length;i++)o.push(B(e[i],t));return o}let n=e[y];if(typeof n=="string")return bo(e,n,t);let r={},s=e._id;typeof s=="number"&&t.refs.set(s,r);for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o)||o==="_id")continue;let i=wo(o)?o.slice(1):o;r[i]=B(e[o],t)}return r}function bo(e,t,n){let r=e._id,s=o=>(typeof r=="number"&&n.refs.set(r,o),o);switch(t){case"undef":return;case"NaN":return NaN;case"Inf":return 1/0;case"-Inf":return-1/0;case"-0":return-0;case"BigInt":return s(BigInt(e.v));case"Sym":return s(Symbol.for(e.v));case"Date":return s(e.v==null?new Date(NaN):new Date(e.v));case"Error":{let o=new Error(e.v.message);return o.name=e.v.name,e.v.stack&&(o.stack=e.v.stack),typeof r=="number"&&n.refs.set(r,o),o}case"Map":{let o=new Map;typeof r=="number"&&n.refs.set(r,o);for(let[i,a]of e.v)o.set(B(i,n),B(a,n));return o}case"Set":{let o=new Set;typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.add(B(i,n));return o}case"Arr":{let o=[];typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.push(B(i,n));return o}case"Ref":{let o=n.refs.get(e.v);if(o===void 0)throw new TypeError(`Dangling reference: id=${e.v}`);return o}case"Blob":{if(typeof Blob>"u")throw new TypeError("Blob is not available in this environment.");let o=ye(e.v);return s(new Blob([o],{type:e.t||""}))}case"File":{if(typeof File>"u")throw new TypeError("File is not available in this environment.");let o=ye(e.v);return s(new File([o],e.n,{type:e.t||"",lastModified:e.m}))}case"FD":{if(typeof FormData>"u")throw new TypeError("FormData is not available in this environment.");let o=new FormData;s(o);for(let[i,a]of e.v){let c=B(a,n);o.append(i,c)}return o}default:{if(t==="buf"){let i=ye(e.v);return s(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=ye(e.v);return s(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let o=po[t];if(o){let i=ye(e.v),a=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);return s(new o(a))}throw new TypeError(`Unknown serialization tag: ${t}`)}}}function yo(e){return e!==null&&typeof e=="object"}function go(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function _o(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function wo(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}var Gn=typeof Buffer<"u"&&typeof Buffer.from=="function";function ge(e){if(Gn)return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64");let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function ye(e){if(Gn){let r=Buffer.from(e,"base64");return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}var Xn=typeof window<"u"&&typeof HTMLElement<"u";function So(e,t){return e!==t}function Ao(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var Ye=class{constructor(){this.__ssrAttrs=new Map,this.__internals=null}get attributes(){return[...this.__ssrAttrs].map(([t,n])=>({name:t,value:n}))}getAttribute(t){let n=this.__ssrAttrs.get(String(t).toLowerCase());return n===void 0?null:n}setAttribute(t,n){this.__ssrAttrs.set(String(t).toLowerCase(),String(n))}removeAttribute(t){this.__ssrAttrs.delete(String(t).toLowerCase())}hasAttribute(t){return this.__ssrAttrs.has(String(t).toLowerCase())}toggleAttribute(t,n){let r=String(t).toLowerCase(),s=this.__ssrAttrs.has(r);return(n===void 0?!s:n)?(this.__ssrAttrs.set(r,""),!0):(this.__ssrAttrs.delete(r),!1)}getAttributeNames(){return[...this.__ssrAttrs.keys()]}closest(t){let n=String(t).trim().toLowerCase();if(!/^[a-z][a-z0-9-]*$/.test(n))return null;if(this.__ssrTag===n)return this;let r=this.__ssrAncestors;if(!Array.isArray(r))return null;for(let s=r.length-1;s>=0;s--)if(r[s]&&r[s].__ssrTag===n)return r[s];return null}get dataset(){if(this.__dataset)return this.__dataset;let t=this,n=r=>"data-"+String(r).replace(/[A-Z]/g,s=>"-"+s.toLowerCase());return this.__dataset=new Proxy({},{get(r,s){if(typeof s!="string")return;let o=t.getAttribute(n(s));return o===null?void 0:o},set(r,s,o){return typeof s=="string"&&t.setAttribute(n(s),o),!0},has(r,s){return typeof s=="string"&&t.hasAttribute(n(s))},deleteProperty(r,s){return typeof s=="string"&&t.removeAttribute(n(s)),!0},ownKeys(){return t.getAttributeNames().filter(r=>r.startsWith("data-")).map(r=>r.slice(5).replace(/-([a-z])/g,(s,o)=>o.toUpperCase()))},getOwnPropertyDescriptor(r,s){if(typeof s=="string"&&t.hasAttribute(n(s)))return{enumerable:!0,configurable:!0,value:t.getAttribute(n(s))}}}),this.__dataset}get className(){return this.getAttribute("class")??""}set className(t){this.setAttribute("class",t)}get hidden(){return this.hasAttribute("hidden")}set hidden(t){this.toggleAttribute("hidden",!!t)}get id(){return this.getAttribute("id")??""}set id(t){this.setAttribute("id",t)}get title(){return this.getAttribute("title")??""}set title(t){this.setAttribute("title",t)}get slot(){return this.getAttribute("slot")??""}set slot(t){this.setAttribute("slot",t)}get role(){return this.getAttribute("role")}set role(t){t==null?this.removeAttribute("role"):this.setAttribute("role",t)}get tabIndex(){let t=this.getAttribute("tabindex");return t===null?-1:Number.parseInt(t,10)||0}set tabIndex(t){this.setAttribute("tabindex",String(t))}addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return this.__internals=Ao(),this.__internals}},vo=["ariaAtomic","ariaAutoComplete","ariaBusy","ariaChecked","ariaColCount","ariaColIndex","ariaColSpan","ariaCurrent","ariaDescription","ariaDisabled","ariaExpanded","ariaHasPopup","ariaHidden","ariaInvalid","ariaKeyShortcuts","ariaLabel","ariaLevel","ariaLive","ariaModal","ariaMultiLine","ariaMultiSelectable","ariaOrientation","ariaPlaceholder","ariaPosInSet","ariaPressed","ariaReadOnly","ariaRequired","ariaRoleDescription","ariaRowCount","ariaRowIndex","ariaRowSpan","ariaSelected","ariaSetSize","ariaSort","ariaValueMax","ariaValueMin","ariaValueNow","ariaValueText"];for(let e of vo){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(Ye.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var Co=Xn?HTMLElement:Ye,Ut=class e extends Co{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){Ft(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(Yn)}constructor(){super(),this._renderRoot=null,this._scheduled=!1,this._connected=!1,this.__controllers=new Set,this.__firstRendered=!1,this._changedProperties=new Map,this._updateResolve=null,this._updatePromise=Promise.resolve(!0),this._isUpdating=!1,this._initializeProperties()}_initializeProperties(){let n=this.constructor.properties;if(!(!n||typeof n!="object")){this.__propValues={};for(let[r,s]of Object.entries(n)){let o=typeof s=="object"?s:{type:s},i=this[r];Object.defineProperty(this,r,{configurable:!0,enumerable:!0,get:()=>this.__propValues[r],set:a=>{let c=this.__propValues[r];(o.hasChanged||So)(a,c)&&(this.__propValues[r]=a,o.reflect&&!o.state&&this._connected&&this._reflectAttribute(r,a,o),this.requestUpdate(r,c))}}),i!==void 0&&(this.__propValues[r]=i)}}}_reflectAttribute(t,n,r){let s=Yn(t);if(!this.__reflectingAttribute){this.__reflectingAttribute=!0;try{if(r.converter&&r.converter.toAttribute){let o=r.converter.toAttribute(n,r.type);o==null?this.removeAttribute(s):this.setAttribute(s,o)}else r.type===Boolean?n?this.setAttribute(s,""):this.removeAttribute(s):n==null?this.removeAttribute(s):r.type===Object||r.type===Array?this.setAttribute(s,JSON.stringify(n)):this.setAttribute(s,String(n))}finally{this.__reflectingAttribute=!1}}}connectedCallback(){if(!Xn)return;if(this.__webjsPropsHydrated||(this.__webjsPropsHydrated=!0,this._hydratePropAttrs()),this.constructor.hydrate==="visible"&&typeof IntersectionObserver<"u"&&!this.__hydrationActivated){this.__hydrationActivated=!1,this.__hydrationObserver=new IntersectionObserver(n=>{for(let r of n)if(r.isIntersecting){this.__hydrationObserver.unobserve(this),this.__hydrationObserver.disconnect(),this.__hydrationObserver=null,this.__hydrationActivated=!0,this._activate();return}},{rootMargin:"200px"}),this.__hydrationObserver.observe(this);return}this._activate()}_hydratePropAttrs(){let t=[],n=this.attributes;for(let r=0;r<n.length;r++){let s=n[r].name;s.startsWith("data-webjs-prop-")&&t.push(s)}for(let r of t){let s=this.getAttribute(r);if(this.removeAttribute(r),s==null)continue;let o=Jn(r.slice(16));try{this[o]=_e(s)}catch(i){console.warn(`[webjs] failed to decode ${r} on <${this.tagName.toLowerCase()}>: ${i&&i.message}`)}}}_activate(){this._connected=!0,this._reflectDeclaredAttributes();let t=this.constructor;if(t.shadow===!0){let n=!!this.shadowRoot;this.shadowRoot||this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot;let r=t.styles,s=Array.isArray(r)?r:dt(r)?[r]:[];if(s.length){if(n){let o=this.shadowRoot.querySelector("style");o&&o.remove()}ht(this._renderRoot,s)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${Ge(t)||this.tagName?.toLowerCase()}> has static shadow = false AND static styles. static styles only works with shadow DOM (adoptedStyleSheets). For light DOM, use global CSS or <style> in render().`),Rt(this)||(this.__isHydrating()?(P(this),xn(this)):Nn(this));for(let n of this.__controllers)n.hostConnected&&n.hostConnected();this._updateResolve===null&&(this._updatePromise=new Promise(n=>{this._updateResolve=n})),this._scheduled=!0,queueMicrotask(()=>{this._scheduled=!1;try{this._performRender()}catch(n){console.error("[webjs] lifecycle hook threw during initial render:",n)}this._renderRoot===this&&Rn(this)})}__isHydrating(){let t=this.firstChild,n=t!=null&&t.nodeType===8&&t.data==="webjs-hydrate";return n&&(this.__hydratedAtActivate=!0),n}disconnectedCallback(){this._connected=!1,this.__hydrationObserver&&(this.__hydrationObserver.disconnect(),this.__hydrationObserver=null),this._renderRoot===this&&Ln(this),this.__signalWatcher&&(this.__signalWatcher.dispose(),this.__signalWatcher=void 0);for(let t of this.__controllers)t.hostDisconnected&&t.hostDisconnected()}attributeChangedCallback(t,n,r){if(this.__reflectingAttribute)return;let s=this.constructor,o=Jn(t),i=s.properties&&(s.properties[o]||s.properties[t]);if(!i)return;let a;if(i.converter&&i.converter.fromAttribute)a=i.converter.fromAttribute(r,i.type);else if(i.type===Number)a=r==null?null:Number(r);else if(i.type===Boolean)a=r!=null&&r!=="false";else if(i.type===Object||i.type===Array)try{a=r==null?null:JSON.parse(r)}catch{a=r}else a=r;this[o]!==a&&(this[o]=a,this._connected&&this.requestUpdate())}requestUpdate(t,n){t!==void 0&&!this._changedProperties.has(t)&&this._changedProperties.set(t,n),this._scheduleUpdate()}_scheduleUpdate(){this._updateResolve===null&&(this._updatePromise=new Promise(t=>{this._updateResolve=t})),!this._isUpdating&&(this._scheduled||!this._connected||(this._scheduled=!0,queueMicrotask(()=>{this._scheduled=!1;try{this._performRender()}catch(t){console.error("[webjs] lifecycle hook threw during update cycle:",t)}})))}_performRender(){if(!this._renderRoot)return;let t=this._changedProperties;this._isUpdating=!0;let n=!1,r=null;try{if(this.shouldUpdate(t)){this.willUpdate(t);for(let s of this.__controllers)s.hostUpdate&&s.hostUpdate();this.__renderToken=(this.__renderToken||0)+1;try{let s=this.update(t);s&&typeof s.then=="function"&&(r=s)}catch(s){this._handleRenderError(s)}if(!r){for(let s of this.__controllers)s.hostUpdated&&s.hostUpdated();n=!0}}}catch(s){console.error("[webjs] lifecycle hook threw during update phase:",s)}finally{this._isUpdating=!1,(n||r)&&(this._changedProperties=new Map)}if(r){let s=this.__renderToken;this.__pendingAsyncCommits=(this.__pendingAsyncCommits||0)+1,r.then(()=>{if(this.__pendingAsyncCommits--,s===this.__renderToken){for(let o of this.__controllers)o.hostUpdated&&o.hostUpdated();this._postCommit(t)}});return}n?this._postCommit(t):this.__pendingAsyncCommits||this._resolveUpdate()}_resolveUpdate(){if(this._updateResolve){let t=this._changedProperties.size===0;this._updateResolve(t),this._updateResolve=null}}performServerUpdate(){let t=this._changedProperties;this._isUpdating=!0;try{this.willUpdate(t);for(let n of this.__controllers)n.hostUpdate&&n.hostUpdate();this._reflectDeclaredAttributes()}finally{this._isUpdating=!1}}_reflectDeclaredAttributes(){let t=this.constructor.properties||{};for(let n of Object.keys(t)){let r=t[n];!r||!r.reflect||r.state||this._reflectAttribute(n,this[n],r)}}shouldUpdate(t){return!0}willUpdate(t){}update(t){this.__signalWatcher||(this.__signalWatcher=new de.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;if(this.__signalWatcher.observe(()=>{n=this.render()}),n&&typeof n.then=="function")return this._commitAsync(n);Z(n,this._renderRoot)}_commitAsync(t){let n=this.__renderToken;if(this.__firstRendered&&this._overridesRenderFallback())try{let r=this.renderFallback();r!==void 0&&Z(r,this._renderRoot)}catch(r){console.error("[webjs] renderFallback() threw:",r)}return Promise.resolve(t).then(r=>{n===this.__renderToken&&Z(r,this._renderRoot)},r=>{n===this.__renderToken&&this._handleRenderError(r instanceof Error?r:new Error(String(r)))})}_overridesRenderFallback(){return this.renderFallback!==e.prototype.renderFallback}_handleRenderError(t){console.error(`[webjs] render error in <${Ge(this.constructor)||this.tagName?.toLowerCase()}>:`,t);try{let n=this.renderError(t);n!==void 0&&Z(n,this._renderRoot)}catch(n){console.error("[webjs] renderError() also threw:",n)}}_postCommit(t){try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(n){console.error("[webjs] lifecycle hook threw during post-commit phase:",n)}finally{this._resolveUpdate()}}updated(t){}firstUpdated(t){}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}addController(t){this.__controllers.add(t),this._connected&&t.hostConnected&&t.hostConnected()}removeController(t){this.__controllers.delete(t)}render(){return""}renderError(t){}renderFallback(){}};function Yn(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function Jn(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}var Qn=Symbol.for("webjs.notFound"),Zn=Symbol.for("webjs.redirect");function Eo(){let e=new Error("webjs: notFound()");throw e.__webjs=Qn,e}function ko(e,t){let n=typeof t=="object"&&t!==null?t.status:t,r=new Error(`webjs: redirect(${e})`);throw r.__webjs=Zn,r.url=e,r.status=typeof n=="number"?n:void 0,r}function To(e){return!!e&&e.__webjs===Qn}function No(e){return!!e&&e.__webjs===Zn}var er=null;function xo(){if(!er)return"";try{return er()||""}catch{return""}}var Yi=Symbol.for("webjs.suspense");function jo(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function Ro(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}function Lo(e,t={}){let n=t.reconnect!==!1,r=0,s=!1,o=null,i=[];function a(){s||(o=new WebSocket(Oo(e),t.protocols),o.onopen=c=>{for(r=0;i.length&&o&&o.readyState===WebSocket.OPEN;)o.send(i.shift());t.onOpen?.(c)},o.onmessage=c=>{let l=c.data;if(typeof l=="string")try{l=JSON.parse(l)}catch{}t.onMessage?.(l,c)},o.onerror=c=>{t.onError?.(c)},o.onclose=c=>{if(t.onClose?.(c),!s&&n){let l=Math.min(1e3*2**r++,3e4);setTimeout(a,l)}})}return a(),{send(c){let l=typeof c=="string"||c instanceof ArrayBuffer||ArrayBuffer.isView(c)?c:JSON.stringify(c);o&&o.readyState===WebSocket.OPEN?o.send(l):i.push(l)},close(c,l){s=!0;try{o?.close(c,l)}catch{}},get socket(){return o},get readyState(){return o?.readyState??3}}}function Oo(e){if(/^wss?:\/\//i.test(e))return e;let t=typeof location<"u"&&location.protocol==="https:"?"wss:":"ws:",n=typeof location<"u"?location.host:"";return`${t}//${n}${e.startsWith("/")?e:"/"+e}`}var Dt="application/vnd.webjs+json";async function Mo(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",Dt);let r=t.body;r!=null&&typeof r=="object"&&!(r instanceof FormData)&&!(r instanceof Blob)&&!(r instanceof ArrayBuffer)&&!(r instanceof URLSearchParams)&&!(typeof ReadableStream<"u"&&r instanceof ReadableStream)&&!ArrayBuffer.isView(r)&&(r=await Bt(r),n.has("content-type")||n.set("content-type",Dt));let s=await fetch(e,{...t,headers:n,body:r}),o=s.headers.get("content-type")||"",i=await s.text(),a=o.includes(Dt)?i?_e(i):null:o.includes("application/json")?i?JSON.parse(i):null:i;if(!s.ok){let c=a&&a.error||`richFetch ${e} -> ${s.status}`,l=new Error(c);throw l.status=s.status,l.body=a,l}return a}Vt();Ht();Xe();async function hi(e,t,n){let r=e.get();e.set(t);let s;try{s=await n()}catch(o){throw e.set(r),o}return s&&s.success===!1&&e.set(r),s}var pi=Symbol.for("webjs.context");function mi(e){return{__context__:pi,name:e}}var ut=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},un=class{constructor(t,{context:n,initialValue:r}){this._host=t,this._context=n,this._value=r,this._subscriptions=new Set,this._onRequest=s=>{let o=s;if(o.context===this._context)if(s.stopPropagation(),o.subscribe){let i={callback:o.callback},a=()=>{this._subscriptions.delete(i)};this._subscriptions.add(i),o.callback(this._value,a)}else o.callback(this._value)},typeof t.addController=="function"&&t.addController(this)}get value(){return this._value}setValue(t){if(!Object.is(this._value,t)){this._value=t;for(let n of this._subscriptions){let r=()=>{this._subscriptions.delete(n)};n.callback(t,r)}}}hostConnected(){this._host.addEventListener("context-request",this._onRequest)}hostDisconnected(){this._host.removeEventListener("context-request",this._onRequest),this._subscriptions.clear()}},fn=class{constructor(t,{context:n,subscribe:r=!0}){this._host=t,this._context=n,this._subscribe=r,this._value=void 0,this._unsubscribe=void 0,typeof t.addController=="function"&&t.addController(this)}get value(){return this._value}hostConnected(){this._dispatchRequest()}hostDisconnected(){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=void 0)}_dispatchRequest(){let t=new ut(this._context,(n,r)=>{let s=this._value;this._value=n,r&&(this._unsubscribe=r),!Object.is(s,n)&&typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()},this._subscribe);this._host.dispatchEvent(t)}};function bi(){return typeof window<"u"}var O={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},dn=class{constructor(t,{task:n,args:r,autoRun:s=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=s,this._status=O.INITIAL,this._value=void 0,this._error=void 0,this._abortController=null,this._prevArgs=null,typeof t.addController=="function"&&t.addController(this)}get status(){return this._status}get value(){return this._value}get error(){return this._error}async run(){this.abort();let t=new AbortController;this._abortController=t;let n=this._argsFn();this._prevArgs=n,this._status=O.PENDING,this._error=void 0,this._requestHostUpdate();try{let r=await this._taskFn(...n,{signal:t.signal});if(t.signal.aborted)return;this._value=r,this._status=O.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=O.ERROR,this._value=void 0}finally{this._abortController===t&&(this._abortController=null)}this._requestHostUpdate()}abort(){this._abortController&&(this._abortController.abort(),this._abortController=null)}render(t={}){switch(this._status){case O.INITIAL:return t.initial?.();case O.PENDING:return t.pending?.();case O.COMPLETE:return t.complete?.(this._value);case O.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!bi())return;let t=this._argsFn();this._argsEqual(this._prevArgs,t)||this.run()}hostUpdated(){}hostConnected(){}hostDisconnected(){this.abort()}_requestHostUpdate(){typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()}_argsEqual(t,n){if(t===null||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r])return!1;return!0}};export{fn as ContextConsumer,un as ContextProvider,ut as ContextRequestEvent,b as MARKER,de as Signal,jo as Suspense,dn as Task,O as TaskStatus,Ut as WebComponent,qt as WebjsFrame,zt as WebjsStream,ht as adoptStyles,co as allTags,ls as asyncAppend,us as asyncReplace,ws as batch,as as cache,As as computed,Lo as connectWS,mi as createContext,is as createRef,xo as cspNonce,Jr as css,Kn as deserialize,hr as disableClientRouter,Cs as effect,Zt as enableClientRouter,Zr as escapeAttr,Qr as escapeText,rs as guard,Yr as html,yt as isAsyncAppend,gt as isAsyncReplace,dt as isCSS,je as isCache,Ne as isGuard,Te as isKeyed,ao as isLazy,mt as isLive,To as isNotFound,No as isRedirect,xe as isRef,ke as isRepeat,vs as isSignal,Ro as isSuspense,S as isTemplate,bt as isTemplateContent,pt as isUnsafeHTML,Re as isUntil,Le as isWatch,ns as keyed,ts as live,oo as lookup,io as lookupModuleUrl,pr as navigate,Eo as notFound,hi as optimistic,_e as parse,so as primeModuleUrl,ko as redirect,os as ref,Ft as register,Z as render,Wt as renderStream,mn as repeat,mr as revalidate,Mo as richFetch,Wn as serialize,Ss as signal,Bt as stringify,Xr as stylesToString,Ge as tagOf,ss as templateContent,es as unsafeHTML,cs as until,fs as watch};
1
+ var ts=Object.defineProperty;var D=(e,t)=>()=>(e&&(t=e(e=0)),t);var yn=(e,t)=>{for(var n in t)ts(e,n,{get:t[n],enumerable:!0})};async function $t(e){return JSON.stringify(await Jn(e))}function z(e){return Xn(JSON.parse(e))}async function Jn(e){let t=yo();return await go(e,t),V(e,t)}function Xn(e){return B(e,Ao())}function yo(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map}}async function go(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!Co(r))continue;let s=t.refCount.get(r)||0;if(t.refCount.set(r,s+1),!(s>0)){if(typeof Blob<"u"&&r instanceof Blob){let o=new Uint8Array(await r.arrayBuffer());t.blobBytes.set(r,o);continue}if(typeof FormData<"u"&&r instanceof FormData){for(let[,o]of r.entries())typeof o!="string"&&n.push(o);continue}if(Array.isArray(r))for(let o=0;o<r.length;o++)n.push(r[o]);else if(r instanceof Map)for(let[o,i]of r)n.push(o),n.push(i);else if(r instanceof Set)for(let o of r)n.push(o);else if(Eo(r))for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(r[o])}}for(let[r,s]of t.refCount)s>1&&t.idOf.set(r,t.nextId++)}function V(e,t){if(e===null)return null;if(e===void 0)return{[y]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[y]:"NaN"}:e===1/0?{[y]:"Inf"}:e===-1/0?{[y]:"-Inf"}:Object.is(e,-0)?{[y]:"-0"}:e;if(n==="bigint")return{[y]:"BigInt",v:e.toString()};if(n==="symbol"){let o=Symbol.keyFor(e);if(o===void 0)throw new TypeError("Cannot serialize a local Symbol; only Symbol.for() registered symbols are supported.");return{[y]:"Sym",v:o}}if(n==="function")throw new TypeError("Cannot serialize a function.");let r=t.idOf.get(e);if(r!==void 0&&t.emitted.has(r))return{[y]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let s;if(e instanceof Date)s={[y]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)s={[y]:"Error",v:{name:e.name,message:e.message,stack:e.stack||null}};else if(typeof Blob<"u"&&e instanceof Blob){let o=t.blobBytes.get(e);typeof File<"u"&&e instanceof File?s={[y]:"File",v:_e(o),n:e.name,t:e.type||"",m:e.lastModified}:s={[y]:"Blob",v:_e(o),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let o=[];for(let[i,a]of e.entries())o.push([i,V(a,t)]);s={[y]:"FD",v:o}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)s=_o(e);else if(e instanceof Map){let o=[];for(let[i,a]of e)o.push([V(i,t),V(a,t)]);s={[y]:"Map",v:o}}else if(e instanceof Set){let o=[];for(let i of e)o.push(V(i,t));s={[y]:"Set",v:o}}else if(Array.isArray(e))s=e.map(o=>V(o,t));else{s={};for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i=ko(o)?"_"+o:o;s[i]=V(e[o],t)}}if(r!==void 0){if(Array.isArray(s))return{[y]:"Arr",_id:r,v:s};s._id=r}return s}function _o(e){if(e instanceof ArrayBuffer)return{[y]:"buf",v:_e(new Uint8Array(e))};if(e instanceof DataView)return{[y]:"dv",v:_e(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=wo[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[y]:n,v:_e(r)}}function Ao(){return{refs:new Map}}function B(e,t){if(e===null||typeof e!="object")return e;if(Array.isArray(e)){let o=[];for(let i=0;i<e.length;i++)o.push(B(e[i],t));return o}let n=e[y];if(typeof n=="string")return vo(e,n,t);let r={},s=e._id;typeof s=="number"&&t.refs.set(s,r);for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o)||o==="_id")continue;let i=To(o)?o.slice(1):o;r[i]=B(e[o],t)}return r}function vo(e,t,n){let r=e._id,s=o=>(typeof r=="number"&&n.refs.set(r,o),o);switch(t){case"undef":return;case"NaN":return NaN;case"Inf":return 1/0;case"-Inf":return-1/0;case"-0":return-0;case"BigInt":return s(BigInt(e.v));case"Sym":return s(Symbol.for(e.v));case"Date":return s(e.v==null?new Date(NaN):new Date(e.v));case"Error":{let o=new Error(e.v.message);return o.name=e.v.name,e.v.stack&&(o.stack=e.v.stack),typeof r=="number"&&n.refs.set(r,o),o}case"Map":{let o=new Map;typeof r=="number"&&n.refs.set(r,o);for(let[i,a]of e.v)o.set(B(i,n),B(a,n));return o}case"Set":{let o=new Set;typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.add(B(i,n));return o}case"Arr":{let o=[];typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.push(B(i,n));return o}case"Ref":{let o=n.refs.get(e.v);if(o===void 0)throw new TypeError(`Dangling reference: id=${e.v}`);return o}case"Blob":{if(typeof Blob>"u")throw new TypeError("Blob is not available in this environment.");let o=ge(e.v);return s(new Blob([o],{type:e.t||""}))}case"File":{if(typeof File>"u")throw new TypeError("File is not available in this environment.");let o=ge(e.v);return s(new File([o],e.n,{type:e.t||"",lastModified:e.m}))}case"FD":{if(typeof FormData>"u")throw new TypeError("FormData is not available in this environment.");let o=new FormData;s(o);for(let[i,a]of e.v){let c=B(a,n);o.append(i,c)}return o}default:{if(t==="buf"){let i=ge(e.v);return s(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=ge(e.v);return s(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let o=So[t];if(o){let i=ge(e.v),a=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);return s(new o(a))}throw new TypeError(`Unknown serialization tag: ${t}`)}}}function Co(e){return e!==null&&typeof e=="object"}function Eo(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ko(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function To(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}function _e(e){if(Qn)return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64");let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function ge(e){if(Qn){let r=Buffer.from(e,"base64");return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}var y,wo,So,Qn,we=D(()=>{y="_$wj";wo={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},So={i8:Int8Array,u8:Uint8Array,u8c:Uint8ClampedArray,i16:Int16Array,u16:Uint16Array,i32:Int32Array,u32:Uint32Array,f32:Float32Array,f64:Float64Array,bi64:typeof BigInt64Array<"u"?BigInt64Array:null,bu64:typeof BigUint64Array<"u"?BigUint64Array:null};Qn=typeof Buffer<"u"&&typeof Buffer.from=="function"});var ar={};yn(ar,{observeLazy:()=>qo,observeViewportOnce:()=>zo});function ir(e){let t=Vt.get(e);return t||(t=import(e).finally(()=>Vt.delete(e)),Vt.set(e,t),t)}function qo(e){for(let[t,n]of Object.entries(e))W.set(t.toLowerCase(),n);if(typeof IntersectionObserver>"u"){for(let t of W.values())ir(t);W.clear();return}Ae||(Ae=new IntersectionObserver(Ho,{rootMargin:"200px"})),or(),typeof MutationObserver<"u"&&new MutationObserver(()=>or()).observe(document.body,{childList:!0,subtree:!0})}function or(){if(!(!Ae||!W.size))for(let e of W.keys())for(let t of document.querySelectorAll(e))Ae.observe(t)}function Ho(e){for(let t of e){if(!t.isIntersecting)continue;let n=t.target.tagName.toLowerCase(),r=W.get(n);r&&(ir(r),W.delete(n),Ae?.unobserve(t.target))}}function Vo(e){for(let t of e){if(!t.isIntersecting)continue;let n=Qe.get(t.target);Qe.delete(t.target),Se?.unobserve(t.target),n&&n()}}function zo(e,t){return typeof IntersectionObserver>"u"?(t(),()=>{}):(Se||(Se=new IntersectionObserver(Vo,{rootMargin:"200px"})),Qe.set(e,t),Se.observe(e),()=>{Qe.delete(e),Se?.unobserve(e)})}var W,Ae,Vt,Se,Qe,cr=D(()=>{W=new Map,Ae=null,Vt=new Map;Se=null,Qe=new WeakMap});var zt,Wt=D(()=>{zt=typeof HTMLElement<"u"?class extends HTMLElement{constructor(){super(),this._webjsLoadedSrc=null,this._webjsLazyTeardown=null}static get observedAttributes(){return["src"]}connectedCallback(){this._webjsScheduleLoad()}disconnectedCallback(){this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null)}attributeChangedCallback(t,n,r){t==="src"&&this.isConnected&&this._webjsScheduleLoad()}_webjsScheduleLoad(){let t=this.getAttribute("src");if(!t){this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null),this._webjsLoadedSrc=null;return}let n=t;try{n=new URL(t,location.href).href}catch{}if(n===this._webjsLoadedSrc)return;this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null),(this.getAttribute("loading")||"eager").toLowerCase()==="lazy"?(this._webjsLoadedSrc=n,Promise.resolve().then(()=>(cr(),ar)).then(({observeViewportOnce:s})=>{this._webjsLoadedSrc!==n||!this.isConnected||(this._webjsLazyTeardown=s(this,()=>{this._webjsLazyTeardown=null,this._webjsLoad(n)}))})):(this._webjsLoadedSrc=n,this._webjsLoad(n))}_webjsLoad(t){Promise.resolve().then(()=>(Kt(),lr)).then(({loadFrame:n})=>{this._webjsLoadedSrc!==t||!this.isConnected||n(this,t)})}}:null;typeof customElements<"u"&&zt&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",zt)});function Ko(e,t,n){switch(e){case"append":n&&t.append(n);break;case"prepend":n&&t.prepend(n);break;case"before":n&&t.before(n);break;case"after":n&&t.after(n);break;case"replace":n&&t.replaceWith(n);break;case"update":n&&t.replaceChildren(n);break;case"remove":t.remove();break;default:break}}function Yt(e,t){let n=t||(typeof document<"u"?document:null);if(!n)return;let r=null;if(typeof e=="string"){let o=n.createElement("template");o.innerHTML=e,r=o.content}else if(e&&e.nodeType)r=e;else return;let s=r.querySelectorAll?Array.from(r.querySelectorAll("webjs-stream")):[];if(s.length)for(let o of s)n.body.append(o);else n.body.append(r)}var Wo,Gt,Ze=D(()=>{Wo=new Set(["append","prepend","before","after","replace","update"]);Gt=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this._webjsApplied||(this._webjsApplied=!0,this._webjsApply())}_webjsApply(){let t=(this.getAttribute("action")||"").toLowerCase(),n=this.ownerDocument||document,r=[],s=this.getAttribute("target");if(s){let i=n.getElementById(s);i&&(r=[i])}else{let i=this.getAttribute("targets");if(i)try{r=Array.from(n.querySelectorAll(i))}catch{r=[]}}let o=Wo.has(t)?this.querySelector("template"):null;try{for(let i of r){let a=o?o.content.cloneNode(!0):null;Ko(t,i,a)}}finally{this.remove()}}}:null;typeof customElements<"u"&&Gt&&!customElements.get("webjs-stream")&&customElements.define("webjs-stream",Gt)});var ur,fr=D(()=>{ur=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this.style.display||(this.style.display="contents")}}:null;typeof customElements<"u"&&ur&&!customElements.get("webjs-suspense")&&customElements.define("webjs-suspense",ur)});function et(e){let t=e||(typeof document<"u"?document:null);if(!(!t||typeof t.querySelectorAll!="function")){for(let n of t.querySelectorAll('script[type="application/json"]#__webjs-seeds, script[type="application/json"][data-webjs-seeds]'))hr(n.textContent,n);for(let n of t.querySelectorAll("[data-webjs-seed]"))hr(n.getAttribute("data-webjs-seed"),n,()=>n.removeAttribute("data-webjs-seed"))}}function hr(e,t,n){if(e)try{let r=z(e);if(r&&typeof r=="object")for(let s in r)ve.has(s)||ve.set(s,r[s])}catch{}n?n():t.remove?.()}function Go(e,t,n){dr||(dr=!0,et());let r=`${e}/${t}/${n}`;if(ve.has(r)){let s=ve.get(r);return ve.delete(r),s}return pr}var ve,pr,dr,Jt=D(()=>{we();ve=new Map,pr=Symbol("webjs.seed.miss"),dr=!1});var lr={};yn(lr,{_FRAME_TOP:()=>xr,_LIVE_ATTRS:()=>tn,_activeFrameId:()=>Nr,_addNewHeadElements:()=>nn,_applyStreamedResolve:()=>Qr,_blurOutgoingFocus:()=>rt,_buildSubmitFormData:()=>kr,_bumpNavToken:()=>yi,_clearFormBusy:()=>qr,_clearFrameBusy:()=>Dr,_collectChildrenSlots:()=>ae,_currentPageUrl:()=>gi,_diffElementInPlace:()=>lt,_eligibleAnchorHref:()=>st,_findAnchorInPath:()=>Tr,_getSubmitAction:()=>Er,_getSubmitMethod:()=>Cr,_isNonHtmlPath:()=>wi,_keyOf:()=>ie,_longestSharedPath:()=>jr,_markFormBusy:()=>$r,_markFrameBusy:()=>Ur,_mergeHead:()=>Yr,_navToken:()=>bi,_onPopState:()=>sn,_onSubmit:()=>on,_prefetch:()=>Te,_prefetchInflightSize:()=>pi,_prefetchMode:()=>ot,_prefetchPeek:()=>hi,_prefetchSaysSaveData:()=>ln,_prefetchSuppressed:()=>Ir,_prefetchTake:()=>Pr,_reactivateScripts:()=>ut,_readStreamedShell:()=>Jr,_reconcileChildren:()=>fn,_regraftPermanentElements:()=>Vr,_regraftPermanentInSlice:()=>un,_resetPrefetch:()=>mi,_resolveTargetFrameId:()=>an,_restoreOptimistic:()=>Ce,_runWithTransition:()=>nt,_setCurrentPageUrl:()=>_i,_snapshotCache:()=>E,_streamBoundariesProgressively:()=>Zr,_takeResolveUnit:()=>Xr,_viewTransitionsEnabled:()=>Hr,collectChildrenSlots:()=>ae,disableClientRouter:()=>wr,enableClientRouter:()=>rn,loadFrame:()=>Jo,longestSharedPath:()=>jr,navigate:()=>Sr,revalidate:()=>Ar});function _r(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}function Yo(){Xt||typeof MutationObserver>"u"||typeof customElements>"u"||(Xt=new MutationObserver(e=>{for(let t of e)for(let n of t.addedNodes){if(n.nodeType!==1)continue;let r=n;r.tagName?.includes("-")&&customElements.upgrade(r);for(let s of r.querySelectorAll("*"))s.tagName?.includes("-")&&customElements.upgrade(s)}}),Xt.observe(document.body,{childList:!0,subtree:!0}))}function rn(){Y||typeof document>"u"||(Y=!0,document.addEventListener("click",vr,!1),document.addEventListener("submit",on,!1),window.addEventListener("popstate",sn),document.addEventListener("pointerover",oe,!0),document.addEventListener("focusin",oe,!0),document.addEventListener("touchstart",oe,{capture:!0,passive:!0}),document.addEventListener("pointerout",Fr,!0),document.addEventListener("webjs:navigate",en),Yo(),en(),typeof history<"u"&&"scrollRestoration"in history&&(tt=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(L=location.href))}function wr(){Y&&(Y=!1,document.removeEventListener("click",vr,!1),document.removeEventListener("submit",on,!1),window.removeEventListener("popstate",sn),document.removeEventListener("pointerover",oe,!0),document.removeEventListener("focusin",oe,!0),document.removeEventListener("touchstart",oe,{capture:!0}),document.removeEventListener("pointerout",Fr,!0),document.removeEventListener("webjs:navigate",en),dt(),U&&(U.disconnect(),U=null),typeof history<"u"&&tt!==null&&(history.scrollRestoration=tt,tt=null),L=null)}async function Sr(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await cn(n.href,t?.replace??!1,null)}async function Jo(e,t){if(typeof location>"u")return{ok:!1,status:null,aborted:!1};let n=e&&e.id;if(!n)return{ok:!1,status:null,aborted:!1};let r=new URL(t,location.href);if(r.origin!==location.origin)return{ok:!1,status:null,aborted:!1};T&&T.abort(),T=new AbortController;let s=T.signal,o=++g;return it(r.href,n,!1,null,"GET",null,s,o)}function Ar(e){if(!e){E.clear(),A.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;E.delete(n),A.delete(n)}function vr(e){if(!Y||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=Tr(e);if(!t||t.hasAttribute("download")||t.hasAttribute("data-no-router")||t.target&&t.target!=="_self")return;let n=t.href;if(!n)return;let r=new URL(n);if(r.origin!==location.origin||r.pathname===location.pathname&&r.search===location.search&&r.hash||ft.test(r.pathname))return;e.preventDefault();let s=an(t);cn(n,!1,s)}function sn(e){cn(location.href,!0,null)}function on(e){if(!Y||e.defaultPrevented)return;let t=e.target;if(!t||t.nodeType!==1||t.tagName!=="FORM"||t.hasAttribute("data-no-router"))return;let n=e.submitter??null;if(n&&n.hasAttribute("data-no-router"))return;let r=n&&n.getAttribute("formtarget")||t.getAttribute("target")||"";if(r&&r!=="_self")return;let s=Cr(t,n);if(s==="dialog")return;let o=Er(t,n),i;try{i=new URL(o,location.href)}catch{return}if(i.origin!==location.origin||ft.test(i.pathname))return;let a=kr(t,n);e.preventDefault();let c=an(n||t);ei(i.href,s,a,c,t)}function Cr(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function Er(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function kr(e,t){try{return new FormData(e,t||void 0)}catch{let n=new FormData(e);return t&&t.getAttribute("name")&&n.append(t.getAttribute("name"),t.getAttribute("value")||""),n}}function Tr(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function Nr(e){let t=e;for(;t;){let n=t.closest("webjs-frame");if(n&&n.id)return n.id;let r=t.getRootNode();if(r&&r.host)t=r.host;else break}return null}function an(e){if(!e)return null;let t=e.closest&&e.closest("[data-webjs-frame]"),n=t?t.dataset?t.dataset.webjsFrame:t.getAttribute("data-webjs-frame"):null;if(n!=null&&n!==""){if(n===xr)return null;let r=typeof document<"u"?document.getElementById(n):null;return r&&r.tagName&&r.tagName.toLowerCase()==="webjs-frame"?n:(Xo(`webjs:frame-unresolved:${n}`,`[webjs] data-webjs-frame="${n}" did not match a live <webjs-frame id="${n}">; performing a normal navigation instead.`),null)}return Nr(e)}function Xo(e,t){br.has(e)||(br.add(e),typeof console<"u"&&console.warn&&console.warn(t))}function ae(e){let t=new Map,n=[];function r(s){if(s.nodeType===8){let o=s,i=o.data,a=/^wj:children:(.+)$/.exec(i);if(a){n.push({path:a[1],start:o});return}if(i.trim()==="/wj:children"){let c=n.pop();c&&!t.has(c.path)&&t.set(c.path,{start:c.start,end:o});return}return}if(s.hasChildNodes&&s.hasChildNodes())for(let o=s.firstChild;o;o=o.nextSibling)r(o)}return r(e),t}function jr(e,t){let n=null;for(let r of e.keys())t.has(r)&&(n===null||r.length>n.length)&&(n=r);return n}function Rr(e){let t=J(e);E.has(t)&&E.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(E.set(t,n);E.size>Qo;){let r=E.keys().next().value;E.delete(r)}}function Zo(e){let t=J(e),n=E.get(t);return n==null?null:(E.delete(t),E.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function J(e){let t=new URL(e,location.href);return t.pathname+t.search}async function cn(e,t,n){T&&T.abort(),T=new AbortController;let r=T.signal,s=++g;L&&Rr(L);let o=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),o=null},150),i=null;t||(i=Wr());try{if(t){let a=Zo(e);if(a){let c=_r(a.html);if(c){zr(c,n,!0,null),typeof window<"u"&&window.scrollTo(a.scrollX,a.scrollY),it(e,n,!1,i,"GET",null,r,s).catch(()=>{});return}}typeof window<"u"&&window.scrollTo(0,0)}await it(e,n,!t,i,"GET",null,r,s)}finally{o&&clearTimeout(o),s===g&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(L=location.href))}}async function ei(e,t,n,r,s){T&&T.abort(),T=new AbortController;let o=T.signal,i=++g,a=t==="get"||t==="head",c=new URL(e,location.href);if(a){c.search="";for(let[h,m]of n)c.searchParams.append(h,typeof m=="string"?m:m.name)}L&&Rr(L);let l=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),l=null},150),u=Wr(),p=s?$r(s,i,c.href):null,d=!1;try{let h=await it(c.href,r,!0,u,a?"GET":t.toUpperCase(),a?null:n,o,i);d=!!(h&&h.ok),!a&&i===g&&(E.clear(),A.clear())}finally{p&&qr(p,i,c.href,d),l&&clearTimeout(l),i===g&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(L=location.href))}}function Lr(){return[...ae(document.body).keys()].join(",")}function ln(){try{let e=typeof navigator<"u"?navigator.connection:null;if(e&&e.saveData===!0||typeof matchMedia=="function"&&matchMedia("(prefers-reduced-data: reduce)").matches)return!0}catch{}return!1}function si(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function st(e){if(!e||!(e instanceof HTMLAnchorElement)||e.hasAttribute("download")||e.hasAttribute("data-no-router")||e.target&&e.target!=="_self")return null;let t=e.href;if(!t)return null;let n;try{n=new URL(t)}catch{return null}return n.origin!==location.origin||n.pathname===location.pathname&&n.search===location.search&&n.hash||ft.test(n.pathname)?null:t}function Ir(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=si(e);return t.includes("external")||t.includes("no-prefetch")}function ot(e){if(Ir(e))return"none";switch((e.getAttribute("data-prefetch")||"").toLowerCase().trim()){case"false":case"none":return"none";case"true":case"render":return"render";case"auto":case"viewport":return"viewport";case"intent":return"intent";default:return"intent"}}function Te(e){if(typeof fetch!="function"||ln())return;let t=J(e);if(K.has(t)||Ee.has(t))return;let n=A.get(t);if(n&&Zt()-n.at<Or)return;if(K.size>=Mr){for(Ee.add(t),re.push(e);re.length>ni;){let o=re.shift();Ee.delete(J(o))}return}K.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},s=Lr();s&&(r["x-webjs-have"]=s),fetch(e,{method:"GET",headers:r,credentials:"same-origin"}).then(async o=>{let i=o.headers.get("content-type")||"";if(!/^text\/html\b/i.test(i)||o.status>=400)return;let a=o.headers.get("x-webjs-build"),c=o.redirected&&o.url?o.url:e,l=await o.text();ii(t,{html:l,build:a,finalUrl:c,at:Zt()})}).catch(()=>{}).finally(()=>{K.delete(t),oi()})}function oi(){for(;re.length&&K.size<Mr;){let e=re.shift();Ee.delete(J(e)),Te(e)}}function ii(e,t){for(A.has(e)&&A.delete(e),A.set(e,t);A.size>ti;){let n=A.keys().next().value;A.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function Pr(e){let t=J(e),n=A.get(t);return!n||(A.delete(t),Zt()-n.at>=Or)?null:n}function Zt(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function oe(e){if(!Y)return;let t=Br(e.target);if(!t||ot(t)!=="intent")return;let n=st(t);n&&(ke===t&&se||(dt(),ke=t,se=setTimeout(()=>{se=null,ke=null,Te(n)},ri)))}function Fr(e){let t=Br(e.target);t&&t===ke&&dt()}function dt(){se&&(clearTimeout(se),se=null),ke=null}function Br(e){let t=e;for(;t;){if(t instanceof HTMLAnchorElement)return t;let n=t.nodeType===1?t:null;if(n){let s=n.closest&&n.closest("a");if(s instanceof HTMLAnchorElement)return s}let r=t.getRootNode?t.getRootNode():null;t=r&&r.host?r.host:null}return null}function en(){if(typeof document>"u"||ln())return;let e=typeof IntersectionObserver<"u";e&&(U?U.disconnect():U=new IntersectionObserver(t=>{for(let n of t){if(!n.isIntersecting)continue;let r=n.target;U.unobserve(r);let s=st(r);s&&ot(r)==="viewport"&&Te(s)}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=ot(t);if(n==="render"){let r=st(t);r&&Te(r)}else n==="viewport"&&e&&U.observe(t)}}function ai(e){if(typeof document>"u"||!document.body)return!1;let t=ae(document.body),n,r=-1;for(let[c,l]of t)c.length>r&&(r=c.length,n=l);if(!n)return!1;let s=n.start.parentNode;if(!s||n.start.parentNode!==n.end.parentNode)return!1;let o=document.createElement("div");o.setAttribute("role","alert"),o.setAttribute("data-webjs-nav-error","");let i=e?`This page could not be loaded. (status ${e})`:"This page could not be loaded.";o.textContent=i;let a=document.createRange();return a.setStartAfter(n.start),a.setEndBefore(n.end),a.deleteContents(),s.insertBefore(o,n.end),!0}function Qt(e,t,n){let r=new CustomEvent("webjs:navigation-error",{bubbles:!0,cancelable:!0,detail:{url:e,status:t??null,error:n||null}});if(typeof document<"u")try{document.dispatchEvent(r)}catch{}r.defaultPrevented||ai(t)||typeof location<"u"&&(location.href=e)}async function it(e,t,n,r,s,o,i,a){s=s||"GET";let c=typeof a=="number"?a:g,l,u=null,p=null,d=null,h=!1,m=e,ce=t?Ur(t,c):null;try{try{let f=s==="GET"&&!o&&!t?Pr(e):null;if(f)l=f.html,p=f.build,m=f.finalUrl,d=200,h=!0;else{let k={"x-webjs-router":"1"},w=Lr();w&&(k["x-webjs-have"]=w),t&&(k["x-webjs-frame"]=t),o!=null&&s!=="GET"&&s!=="HEAD"&&(k.accept=mr+", text/html");let x={method:s,headers:k,credentials:"same-origin"};i&&(x.signal=i),o!=null&&s!=="GET"&&s!=="HEAD"&&(x.body=o);let _=await fetch(e,x);d=_.status,h=_.ok;let le=_.headers.get("content-type")||"",ue=/^text\/html\b/i.test(le);if(le.toLowerCase().indexOf(mr)===0){let es=await _.text();return c===g&&(Ce(r),Yt(es)),{ok:h,status:d,aborted:!1}}if(_.redirected&&_.url&&(m=_.url),_.status===204||_.status===205)return c===g&&n&&history.pushState(null,"",m),{ok:h,status:d,aborted:!1};if(!ue)return c===g&&(Ce(r),Qt(e,_.status,null)),{ok:!1,status:d,aborted:!1};p=_.headers.get("x-webjs-build");let C=await Jr(_);l=C.shell,C.streaming&&(u=C)}}catch(f){return f&&f.name==="AbortError"?{ok:!1,status:null,aborted:!0}:c!==g?{ok:!1,status:null,aborted:!0}:(Ce(r),Qt(e,null,f instanceof Error?f:new Error(String(f))),{ok:!1,status:null,aborted:!1})}if(c!==g){if(u&&u.reader)try{u.reader.cancel()}catch{}return{ok:!1,status:d,aborted:!0}}let v=_r(l);if(!v)return Ce(r),Qt(e,null,new Error("navigation response did not parse as HTML")),{ok:!1,status:d,aborted:!1};if(zr(v,t,!1,m,p),n&&history.pushState(null,"",m),n){let f=new URL(m);if(f.hash){let k=document.getElementById(f.hash.slice(1));k?k.scrollIntoView():window.scrollTo(0,0)}else window.scrollTo(0,0)}return u&&(u.reader||u.rest)&&Zr(u.reader,u.dec,u.rest,()=>c===g),document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:m,frameId:t,from:"navigate"}})),{ok:h,status:d,aborted:!1}}finally{ce&&Dr(ce,c)}}function Ur(e,t){if(typeof document>"u")return null;let n=null;try{n=document.querySelector(`webjs-frame#${CSS.escape(e)}`)}catch{n=document.getElementById(e)}if(!n)return null;let r=at.has(n);return at.set(n,t),n.setAttribute("aria-busy","true"),r||n.dispatchEvent(new CustomEvent("webjs:frame-busy",{bubbles:!0,detail:{frameId:e,busy:!0}})),n}function Dr(e,t){if(at.get(e)!==t)return;at.delete(e),e.setAttribute("aria-busy","false");let n=e.id||null;e.dispatchEvent(new CustomEvent("webjs:frame-busy",{bubbles:!0,detail:{frameId:n,busy:!1}}))}function $r(e,t,n){let r=ct.has(e);return ct.set(e,t),e.setAttribute("aria-busy","true"),r||e.dispatchEvent(new CustomEvent("webjs:submit-start",{bubbles:!0,detail:{form:e,url:n}})),e}function qr(e,t,n,r){if(ct.get(e)!==t)return;ct.delete(e),e.setAttribute("aria-busy","false");let s=new CustomEvent("webjs:submit-end",{bubbles:!0,detail:{form:e,url:n,ok:!!r}});e.isConnected?e.dispatchEvent(s):typeof document<"u"?document.dispatchEvent(s):e.dispatchEvent(s)}function yr(e){if(!e||!e.head)return"";let t=e.head.querySelectorAll('[data-webjs-track="reload"]');if(!t.length)return"";let n="";for(let r of t)n+=G(r);return n}function Hr(){if(typeof document>"u")return!1;let e=document.querySelector('meta[name="view-transition"]');return e?(e.getAttribute("content")||"").trim().toLowerCase()==="same-origin":!1}function nt(e,t){let n=typeof document<"u"?document.startViewTransition:void 0;if(Hr()&&typeof n=="function"){let r=n.call(document,e);r&&r.finished&&typeof r.finished.then=="function"?r.finished.then(()=>{t&&t()}).catch(()=>{}):t&&t();return}e(),t&&t()}function Vr(e,t){if(!e||!t||typeof e.querySelectorAll!="function")return;let n=e.querySelectorAll("[data-webjs-permanent][id]");for(let r of n){let s=r.id;if(!s)continue;let o=null;try{o=t.querySelector(`#${CSS.escape(s)}`)}catch{o=null}if(!o||!r.hasAttribute||!r.hasAttribute("data-webjs-permanent"))continue;let i=o.parentNode;i&&o!==r&&i.replaceChild(r,o)}}function un(e,t){let n=[];for(let r of e){if(r.nodeType!==1)continue;let s=r;if(s.hasAttribute&&s.hasAttribute("data-webjs-permanent")&&s.id&&n.push(s),typeof s.querySelectorAll=="function")for(let o of s.querySelectorAll("[data-webjs-permanent][id]"))n.push(o)}if(n.length)for(let r of n){let s=r.id;if(!s)continue;let o=ci(t,s);if(!o||o===r)continue;let i=o.parentNode;if(i)i.replaceChild(r,o);else{let a=t.indexOf(o);a!==-1&&(t[a]=r)}}}function ci(e,t){for(let n of e){if(n.nodeType!==1)continue;let r=n;if(r.id===t)return r;if(typeof r.querySelector=="function"){let s=null;try{s=r.querySelector(`#${CSS.escape(t)}`)}catch{s=null}if(s)return s}}return null}function li(e){if(!(!e||!e.start))for(let t=e.start.nextSibling;t&&t!==e.end;t=t.nextSibling)t.nodeType===1&&ne(t)}function zr(e,t,n,r,s){try{et(e)}catch{}try{typeof sessionStorage<"u"&&(!r||t||n)&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}if(r&&!t&&!n){let u=document.querySelector('script[type="importmap"]'),p=u?u.getAttribute("data-webjs-build"):null,d=!1;if(s&&p&&(d=s!==p),!d&&e.head&&e.head.children.length>0){let h=yr(document),m=yr(e);h!==m&&(d=!0)}if(d&&typeof location<"u")try{let h="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(h))sessionStorage.removeItem(h);else{sessionStorage&&sessionStorage.setItem(h,"1"),location.href=r;return}}catch{location.href=r;return}else if(!d)try{typeof sessionStorage<"u"&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}}if(t){let u=document.querySelector(`webjs-frame#${CSS.escape(t)}`),p=e.querySelector(`webjs-frame#${CSS.escape(t)}`);if(u&&p){nn(e.head),nt(()=>{di(u,p),ut(u),ne(u),rt()},()=>ne(u)),gr(e.body);return}let d=new CustomEvent("webjs:frame-missing",{bubbles:!0,cancelable:!0,detail:{frameId:t,url:r||(typeof location<"u"?location.href:null),document:e}});(u||document).dispatchEvent(d),d.defaultPrevented||console.warn(`[webjs] frame "${t}" was not in the navigation response, leaving it unchanged. Handle "webjs:frame-missing" (preventDefault) to override.`);return}let o=ae(document.body),i=ae(e.body),a=jr(o,i);if(a){nn(e.head),nt(()=>{ui(o.get(a),i.get(a),e),rt()},()=>li(o.get(a))),gr(e.body);return}Yr(e.head),Vr(document.body,e.body);let c=[...e.body.childNodes];nt(()=>{document.body.replaceChildren(...c),ut(document.body),ne(document.body),rt()},()=>ne(document.body))}function rt(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function ui(e,t,n){if(!e||!t)return;let r=e.start.parentNode;if(!r)return;let s=[];for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)s.push(i);let o=[];for(let i=t.start.nextSibling;i&&i!==t.end;i=i.nextSibling)o.push(document.importNode(i,!0));un(s,o),fi(r,e.start,e.end,s,o);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&(ut(i),ne(i))}function fi(e,t,n,r,s){let o=new Map;for(let c of r){if(c.nodeType!==1)continue;let l=ie(c);l&&o.set(l,c)}let i=n,a=[];for(let c of s){if(c.nodeType===1){let l=ie(c);if(l&&o.has(l)){let u=o.get(l);lt(u,c),a.push(u),o.delete(l);continue}}a.push(c)}for(let c of r)if(c.parentNode===e){if(c.nodeType===1&&a.includes(c))continue;e.removeChild(c)}for(let c of a)e.insertBefore(c,i)}function lt(e,t){if(e===t)return;if(e.tagName!==t.tagName){e.replaceWith(t);return}let n=new Set;for(let r of t.attributes)n.add(r.name),!tn.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])tn.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);fn(e,t)}function fn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(a=>document.importNode(a,!0));un(n,r);let s=new Map;for(let a of n){if(a.nodeType!==1)continue;let c=ie(a);c&&s.set(c,a)}let o=[];for(let a=0;a<r.length;a++){let c=r[a];if(c.nodeType===1){let l=ie(c);if(l&&s.has(l)){let p=s.get(l);lt(p,c),o.push(p),s.delete(l);continue}let u=n[a];if(u&&u.nodeType===1&&!ie(u)&&u.tagName===c.tagName){lt(u,c),o.push(u);continue}}else if(c.nodeType===3){let l=n[a];if(l&&l.nodeType===3){l.nodeValue!==c.nodeValue&&(l.nodeValue=c.nodeValue),o.push(l);continue}}else if(c.nodeType===8){let l=n[a];if(l&&l.nodeType===8){l.nodeValue!==c.nodeValue&&(l.nodeValue=c.nodeValue),o.push(l);continue}}o.push(c)}let i=new Set(o);for(let a of n)!i.has(a)&&a.parentNode===e&&e.removeChild(a);for(let a=0;a<o.length;a++){let c=o[a];(c.parentNode!==e||e.childNodes[a]!==c)&&e.insertBefore(c,e.childNodes[a]||null)}}function ie(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}function Wr(){let e=ae(document.body);if(e.size===0)return null;let t=null;for(let i of e.keys())(t===null||i.length>t.length)&&(t=i);if(t===null)return null;let n=document.getElementById(`wj-loading:${t}`);if(!(n instanceof HTMLTemplateElement))return null;let r=e.get(t),s=[];for(let i=r.start.nextSibling;i&&i!==r.end;i=i.nextSibling)s.push(i);let o=document.createRange();return o.setStartAfter(r.start),o.setEndBefore(r.end),o.deleteContents(),r.start.parentNode.insertBefore(n.content.cloneNode(!0),r.end),{slot:r,oldChildren:s,token:g}}function Ce(e){if(!e||e.token!==g)return;let{slot:t,oldChildren:n}=e;if(t.start.parentNode!==t.end.parentNode)return;let r=document.createRange();r.setStartAfter(t.start),r.setEndBefore(t.end),r.deleteContents();for(let s of n)t.start.parentNode.insertBefore(s,t.end)}function di(e,t){fn(e,t)}function Kr(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function dn(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=Kr();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function Gr(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=Kr();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function G(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function nn(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(G(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(G(r))||(r.tagName==="SCRIPT"?document.head.appendChild(dn(r)):document.head.appendChild(Gr(r))))}function Yr(e){let t=document.head,n=e.querySelector("title");n&&(document.title=n.textContent||"");let r=new Set;for(let o of t.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&r.add(G(o));let s=new Set;for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&s.add(G(o));for(let o of[...t.children])o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(s.has(G(o))||o.remove());for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(r.has(G(o))||(o.tagName==="SCRIPT"?t.appendChild(dn(o)):t.appendChild(Gr(o))))}function ne(e){typeof customElements>"u"||hn(e)}function hn(e){let t=e instanceof Element?[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(let n of t)n.tagName&&n.tagName.includes("-")&&(customElements.upgrade(n),n.shadowRoot&&hn(n.shadowRoot))}function gr(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]"))document.body.appendChild(t.cloneNode(!0))}async function Jr(e){if(!e.body||typeof e.body.getReader!="function")return{shell:await e.text(),streaming:!1};let t=e.body.getReader(),n=new TextDecoder,r="",s="<template data-webjs-resolve",o="<!--wj-stream-shell-->",i=/<\/html\s*>/i;for(;;){let{value:a,done:c}=await t.read();a&&(r+=n.decode(a,{stream:!0})),c&&(r+=n.decode());let l=r.indexOf(o);if(l!==-1)return{shell:r.slice(0,l),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(l+o.length)};let u=r.indexOf(s);if(u!==-1)return{shell:r.slice(0,u),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(u)};if(c)return{shell:r,streaming:!1};let p=i.exec(r);if(p){let d=p.index+p[0].length;return{shell:r.slice(0,d),streaming:!0,reader:t,dec:n,rest:r.slice(d)}}}}function Xr(e){let t=/<template\s+data-webjs-resolve="([^"]+)"\s*>/i.exec(e);if(!t)return null;let n=t[1],r=t.index+t[0].length,s=/<(\/?)template\b[^>]*>/gi;s.lastIndex=r;let o=1,i;for(;i=s.exec(e);)if(i[1]==="/"){if(o--,o===0)return{id:n,content:e.slice(r,i.index),rest:e.slice(i.index+i[0].length)}}else o++;return null}function Qr(e,t){let n=document.getElementById(e);if(!n)return;let r=document.createElement("template");r.innerHTML=t;let s=[...r.content.childNodes];n.replaceWith(r.content);for(let o of s)o.nodeType===1&&hn(o)}async function Zr(e,t,n,r){let s=n,o=()=>{let i;for(;i=Xr(s);){if(!r())return!1;Qr(i.id,i.content),s=i.rest}return!0};if(!e){o();return}try{for(;;){if(!o()){try{await e.cancel()}catch{}return}let{value:i,done:a}=await e.read();if(i&&(s+=t.decode(i,{stream:!0})),a){s+=t.decode(),o();return}}}catch{}}function ut(e){for(let t of e.querySelectorAll("script"))t.replaceWith(dn(t))}function hi(e){return A.get(J(e))||null}function pi(){return K.size}function mi(){A.clear(),K.clear(),re.length=0,Ee.clear(),dt()}function bi(){return g}function yi(){return++g}function gi(){return L}function _i(e){L=e}function wi(e){return ft.test(e)}var mr,Y,T,g,Xt,L,tt,ft,xr,br,Qo,E,ti,Or,Mr,ni,ri,A,K,re,Ee,se,ke,U,at,ct,tn,Kt=D(()=>{Wt();Ze();Ze();fr();Jt();mr="text/vnd.webjs-stream.html";Y=!1,T=null,g=0,Xt=null;L=null,tt=null;ft=/\.(?:pdf|zip|tar|gz|7z|rar|dmg|exe|msi|deb|rpm|apk|ipa|xlsx?|docx?|pptx?|csv|odt|ods|odp|rtf|epub|mobi|xml|json|rss|atom|txt|md|wasm|mp3|mp4|mov|avi|webm|ogg|flac|wav|m4a|m4v|mkv|png|jpe?g|gif|webp|avif|bmp|ico|svg|tiff?|heic)$/i;xr="_top";br=new Set;Qo=16,E=new Map;ti=8,Or=3e4,Mr=3,ni=24,ri=100,A=new Map,K=new Set,re=[],Ee=new Set,se=null,ke=null,U=null;at=new WeakMap;ct=new WeakMap;tn=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);rn()});function ns(e,...t){return{_$webjs:"template",strings:e,values:t}}function S(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var b="w$";function rs(e,...t){let n=e[0];for(let r=1;r<e.length;r++)n+=String(t[r-1]??"")+e[r];return{_$webjsCss:!0,text:n}}function mt(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function bt(e,t){if(!(!t||!t.length))if("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){let n=t.map(r=>{let s=new CSSStyleSheet;return s.replaceSync(r.text),s});e.adoptedStyleSheets=n}else{let n=e,r=document.createElement("style");r.textContent=t.map(s=>s.text).join(`
2
+ `),n.appendChild(r)}}function ss(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
3
+ `)}</style>`}function os(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function is(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}var gn=Symbol.for("webjs.repeat");function _n(e,t,n){return{[gn]:!0,items:[...e],keyFn:t,templateFn:n}}function Ne(e){return!!e&&typeof e=="object"&&e[gn]===!0}function as(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function yt(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function cs(e){return{_$webjs:"live",value:e}}function gt(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function ls(e,t){return{_$webjs:"keyed",key:e,value:t}}function xe(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function us(e,t){return{_$webjs:"guard",deps:e,fn:t}}function je(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function fs(e){return{_$webjs:"template-content",template:e}}function _t(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function ds(e){return{_$webjs:"ref",target:e}}function Re(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function hs(){return{value:void 0}}function ps(e){return{_$webjs:"cache",value:e}}function Le(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function ms(...e){return{_$webjs:"until",args:e}}function Oe(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function bs(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function wt(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function ys(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function St(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function gs(e){return{_$webjs:"watch",signal:e}}function Me(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var N=null,M=!1,Q=0,X=null,At=0,wn=(e,t)=>Object.is(e,t),Pe=()=>{},Sn=()=>!1;function An(e,t){e.liveConsumers||(e.liveConsumers=new Set);let n=e.liveConsumers.size===0;if(e.liveConsumers.add(t),n){if(e.producers&&e.producers.length>0)for(let r of e.producers)An(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function fe(e,t){if(e.liveConsumers&&(e.liveConsumers.delete(t),e.liveConsumers.size===0)){if(e.producers&&e.producers.length>0)for(let n of e.producers)fe(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function Nt(e){if(M)throw new Error("Signal read during notification phase");if(N===null)return;let t=N,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&Et(t)&&fe(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,Et(t)&&An(e,t)),t.producerLastReadVersions[n]=e.version}function Et(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function vn(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=M;M=!0;try{for(let n of e.liveConsumers)n.dirty||_s(n)}finally{M=t}}function _s(e){e.dirty=!0,vn(e),e.consumerMarkedDirty.call(e.wrapper||e)}function Fe(e){if(!(!e.dirty&&e.lastCleanEpoch===Q)){if(!e.producerMustRecompute()&&!ws(e)){e.dirty=!1,e.lastCleanEpoch=Q;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=Q}}function ws(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(Fe(n),r!==n.version))return!0}return!1}function kt(e){e&&(e.nextProducerIndex=0);let t=N;return N=e,t}function Tt(e,t){if(N=t,!!e){if(Et(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)fe(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var Be=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=Q,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=Sn,this.producerRecomputeValue=Pe,this.consumerMarkedDirty=Pe,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||wn,this.watched=n?.[xt],this.unwatched=n?.[jt]}get(){return Nt(this),this.__value}peek(){return this.__value}set(t){if(M)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,Q++,X!==null?Cn(this):vn(this))}};function Cn(e){let t=M;M=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?X.add(n):Cn(n))}finally{M=t}}var vt=Symbol("unset"),Ct=Symbol("computing"),Ie=Symbol("errored"),de=class{constructor(t,n){this.__fn=t,this.__value=vt,this.__error=null,this.version=0,this.lastCleanEpoch=-1,this.dirty=!0,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!1,this.wrapper=this,this.__isSignal=!0,this.__isComputed=!0,this.__equal=n?.equals||wn,this.watched=n?.[xt],this.unwatched=n?.[jt];let r=this;this.producerMustRecompute=function(){return r.__value===vt||r.__value===Ct},this.producerRecomputeValue=function(){if(r.__value===Ct)throw new Error("Detected cycle in computations.");let s=r.__value;r.__value=Ct;let o=kt(r),i,a=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=Ie,r.__error=l,a=!0}finally{Tt(r,o)}if(!a&&(s!==vt&&s!==Ie)&&r.__equal.call(r.wrapper,s,i)){r.__value=s;return}r.__value=i,r.version++},this.consumerMarkedDirty=Pe}get(){if(Fe(this),Nt(this),this.__value===Ie)throw this.__error;return this.__value}peek(){if(Fe(this),this.__value===Ie)throw this.__error;return this.__value}},Ue=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=Q,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=Sn,this.producerRecomputeValue=Pe,this.wrapper=this,this.__isWatcher=!0;let n=this;this.consumerMarkedDirty=function(){n.__fire()}}__fire(){this.__notify&&this.__notify.call(this)}watch(...t){if(t.length===0){this.dirty=!1;return}let n=kt(this);try{for(let r of t)Nt(r),r.__isComputed&&Fe(r)}finally{Tt(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(fe(this.producers[n],this),this.producers.splice(n,1),this.producerLastReadVersions.splice(n,1),this.nextProducerIndex=Math.min(this.nextProducerIndex,this.producers.length))}getPending(){return this.producers.filter(t=>t.__isComputed&&t.dirty)}observe(t){let n=kt(this),r;try{r=t()}finally{Tt(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)fe(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},xt=Symbol("watched"),jt=Symbol("unwatched");function Ss(e){let t=N;N=null;try{return e()}finally{N=t}}function As(e){return e.producers.slice()}function vs(e){return e.liveConsumers?[...e.liveConsumers]:[]}function Cs(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function Es(e){return e.producers.length>0}function ks(){return N&&N.__isComputed?N:null}function Ts(e){At++,X===null&&(X=new Set);try{e()}finally{if(At--,At===0){let t=X;X=null;for(let n of t)n.__fire()}}}var he={State:Be,Computed:de,subtle:{Watcher:Ue,untrack:Ss,introspectSources:As,introspectSinks:vs,hasSinks:Cs,hasSources:Es,currentComputed:ks,watched:xt,unwatched:jt}};function Ns(e,t){return new Be(e,t)}function xs(e,t){return new de(e,t)}function js(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function Rs(e){let t=!1,n=!1,r=new de(e),s=new Ue(()=>{t||n||(t=!0,queueMicrotask(()=>{if(t=!1,!n){try{r.get()}catch(o){console.error(o)}s.watch()}}))});s.watch(r);try{r.get()}catch(o){console.error(o)}return()=>{n||(n=!0,s.dispose())}}var Ls=`${b}s`,Os=`${b}e`;function En(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===Ls||t===Os}function Ms(e){for(let t of e.addedNodes)if(En(t))return!0;for(let t of e.removedNodes)if(En(t))return!0;return!1}function jn(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var me=jn(),$=Symbol("webjs.slot.state"),I="data-webjs-light",q="data-projection",be="actual",Rn="fallback",He=Symbol("webjs.slot.fallbackFrag"),Is=64,pe=null,Rt=null,De=null,kn=!1;function Ps(){kn||(me=jn(),me&&(pe=HTMLSlotElement.prototype.assignedNodes,Rt=HTMLSlotElement.prototype.assignedElements,De=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(I)&&!Tn(this)?Lt(this,t):pe?pe.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(I)&&!Tn(this)?Lt(this,t).filter(n=>n.nodeType===1):Rt?Rt.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=De&&De.get?De.get.call(this):null;return t||Fs(this)}}),kn=!0))}Ps();function Tn(e){let t=e;for(let n=0;n<128;n++){let r=t.parentNode;if(!r||r===t)return!1;if(r.host)return!0;t=r}return!1}function Lt(e,t){if(e.getAttribute(q)===Rn)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:Ot(n,new Set,0)}function Ot(e,t,n){if(n>=Is)return e.slice();let r=[];for(let s of e)if(s.nodeType===1&&s.tagName==="SLOT"){let o=s;if(t.has(o))continue;if(t.add(o),o.hasAttribute(I)){let i=Lt(o,{flatten:!1});if(i.length>0)for(let a of Ot(i,t,n+1))r.push(a);else for(let a of Ot(Array.from(o.childNodes),t,n+1))r.push(a)}else if(pe){let i=pe.call(o,{flatten:!0});for(let a of i)r.push(a)}else r.push(s)}else r.push(s);return r}function Fs(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(I))return t.getAttribute(q)===be?t:null;t=t.parentElement}return null}function P(e){let t=e,n=t[$];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[$]=n),n}function Mt(e){return!!e[$]}function Ln(e){let t=P(e);for(;e.firstChild;){let n=e.firstChild,r=$e(n);qe(t.assignedByName,r,n),e.removeChild(n)}}function On(e){let t=P(e),n=e.querySelectorAll(`slot[${I}]`);for(let r of n){let s=r;if(s.getAttribute(q)!==be)continue;let o=s.getAttribute("name")||null;if(!t.assignedByName.has(o)){let i=Array.from(s.childNodes);t.assignedByName.set(o,i),t.lastSnapshot.set(s,i.slice())}}}function $e(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function qe(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function Mn(e,t,n){if(!n.length)return;let r=e.get(t);r||(r=[],e.set(t,r));for(let s of n)r.push(s)}function In(e){if(!me)return;let t=P(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let s of n)if(!Ms(s)){if(s.type==="childList"){for(let o of s.addedNodes)o.parentElement===e&&(qe(t.assignedByName,$e(o),o),r=!0);for(let o of s.removedNodes)e.contains(o)||Nn(t,o)&&(r=!0)}else if(s.type==="attributes"&&s.attributeName==="slot"){let o=s.target;(Nn(t,o)||o.parentElement===e)&&(qe(t.assignedByName,$e(o),o),r=!0)}}r&&Ve(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function Pn(e){let t=e[$];if(t){t.childObserver&&(t.childObserver.disconnect(),t.childObserver=null);for(let n of t.ownedSlots){let r=t.nameObservers.get(n);r&&(r.disconnect(),t.nameObservers.delete(n))}}}function Nn(e,t){for(let[n,r]of e.assignedByName){let s=r.indexOf(t);if(s!==-1)return r.splice(s,1),r.length===0&&e.assignedByName.delete(n),!0}return!1}function Ve(e){let t=P(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,Bs(e)}))}function Bs(e){if(!me)return;let t=e[$];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${I}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||Us(t,i);for(let i of r)t.ownedSlots.has(i)||qs(e,i);t.ownedSlots=r;let s=new Map;for(let i of n){let a=i.getAttribute("name")||null,c=s.get(a);c||(c=[],s.set(a,c)),c.push(i)}for(let i of s.keys()){let a=t.pendingByName.get(i);if(a&&a.length){let c=t.assignedByName.get(i)||[],l=[];for(let u of a)l.push(u);for(let u of c)l.indexOf(u)===-1&&l.push(u);t.assignedByName.set(i,l),t.pendingByName.delete(i)}}let o=[];for(let[i,a]of s){let c=t.assignedByName.get(i)||[];for(let l=0;l<a.length;l++){let u=a[l];l===0&&c.length>0?Ds(t,u,c)&&o.push(u):$s(t,u)&&o.push(u)}}for(let i of o)Hs(i)}function Us(e,t){let n=e.nameObservers.get(t);n&&(n.disconnect(),e.nameObservers.delete(t));let r=e.lastSnapshot.get(t);if(r&&r.length>0){let s=t.getAttribute("name")||null;Mn(e.pendingByName,s,r)}e.lastSnapshot.delete(t)}function Ds(e,t,n){let r=t.getAttribute(q)!==be,s=e.lastSnapshot.get(t)||[];if(!r&&Vs(s,n))return!1;let i=t[He];if(r&&i)for(;t.firstChild;)i.appendChild(t.firstChild);else for(;t.firstChild;)t.removeChild(t.firstChild);for(let a of n)t.appendChild(a);return t.setAttribute(q,be),e.lastSnapshot.set(t,n.slice()),!0}function $s(e,t){let n=t.getAttribute(q)===be;if(t.setAttribute(q,Rn),!n)return xn(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return xn(t),!0}function xn(e){let t=e[He];!t||t.childNodes.length===0||e.appendChild(t)}function qs(e,t){if(!me)return;let n=P(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>Ve(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function Fn(e,t){if(!Mt(e))return;let n=P(e),r=n.lastSnapshot.get(t);if(!r||r.length===0)return;let s=t.getAttribute("name")||null;for(let i of r)i.parentNode===t&&t.removeChild(i);Mn(n.pendingByName,s,r),n.lastSnapshot.delete(t);let o=n.nameObservers.get(t);o&&(o.disconnect(),n.nameObservers.delete(t)),n.ownedSlots.delete(t)}function Hs(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function Vs(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var Bn=new WeakMap,It=Symbol.for("webjs.instance");function te(e,t){let n=t,r=n[It];if(S(e)){let s=e;if(r&&r.strings===s.strings){Z(r,s.values);return}r&&Un(r,t);let o=t.firstChild;o&&o.nodeType===8&&o.data==="webjs-hydrate"&&o.remove();let i=Ks(s,t);n[It]=i;return}if(r&&Un(r,t),n[It]=null,t.replaceChildren(),!(e==null||e===!1||e===!0)){if(Array.isArray(e)){for(let s of e){let o=document.createTextNode(String(s??""));t.appendChild(o)}return}t.appendChild(document.createTextNode(String(e)))}}function We(e){let{strings:t}=e,n=Bn.get(t);if(n)return n;let r=[],s="",o="text",i="",a=0,c="",l=0,u=null,p="",d="";for(let m=0;m<t.length;m++){let ce=t[m];for(let v=0;v<ce.length;v++){let f=ce[v];switch(o){case"text":s+=f,f==="<"&&(o="tag-open");break;case"tag-open":s+=f,f==="!"?o="bang-1":f==="/"?(o="tag-name",p=""):/[a-zA-Z]/.test(f)?(o="tag-name",p=f.toLowerCase()):o="text";break;case"bang-1":s+=f,o=f==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=f,f==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=f,f==="-"?l+=1:(f===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=f,f===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(d="")):/\s/.test(f)?o="in-tag":p+=f.toLowerCase();break;case"in-tag":s+=f,f===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(d="")):!/\s/.test(f)&&f!=="/"&&(o="attr-name",i=f,a=s.length-1);break;case"rawtext":s+=f,d=(d+f.toLowerCase()).slice(-9),(d.endsWith("<\/script>")||d.endsWith("</style>"))&&(o="text",d="",p="");break;case"attr-name":f==="="?(o="after-eq",s+=f):/\s/.test(f)?(o="in-tag",i="",s+=f):f===">"?(o="text",i="",s+=f):(i+=f,s+=f);break;case"after-eq":f==='"'||f==="'"?(o="attr-quoted",c=f,s+=f):/\s/.test(f)?(o="in-tag",i="",s+=f):f===">"?(o="text",i="",s+=f):(o="attr-unquoted",s+=f);break;case"attr-unquoted":/\s/.test(f)?(o="in-tag",i="",s+=f):(f===">"&&(o="text",i=""),s+=f);break;case"attr-quoted":s+=f,f===c&&(o="in-tag",i="");break;case"skip-attr":if(f===c){if(u){let k=u.firstPartIdx,w=[];for(let C=k;C<r.length;C++)(r[C].kind==="noop"||r[C].kind==="attr-mixed")&&w.push(C);let x=[],_=t[w[0]],le=_.lastIndexOf(c);x.push(le>=0?_.slice(le+1):_);for(let C=1;C<w.length;C++)x.push(t[w[C]]);let ue=t[w[w.length-1]+1],pt=ue.indexOf(c);x.push(pt>=0?ue.slice(0,pt):ue),r[k]={kind:"attr-mixed",path:[],name:u.name,statics:x,group:w},u=null}o="in-tag",i=""}break}}if(m<t.length-1){let v=r.length;if(o==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(o==="rawtext"){d="",r.push({kind:"noop",path:[]});continue}if(o==="text")s+=`<!--${b}${v}-->`,r.push({kind:"child",path:[]});else if(o==="in-tag"){let f=`data-${b}${v}`;s+=`${f}=""`,r.push({kind:"element",path:[]})}else if(o==="after-eq"){let f=i[0],k=i.slice(1);if(f==="@"||f==="."||f==="?"){s=s.slice(0,a);let w=f==="@"?"event":f==="."?"prop":"bool",x=`data-${b}${v}`;s+=`${x}=""`,r.push({kind:w,path:[],name:k})}else{s=s.slice(0,a);let w=`data-${b}${v}`;s+=`${w}=""`,r.push({kind:"attr",path:[],name:i})}o="in-tag",i=""}else if(o==="attr-quoted"||o==="attr-unquoted"){s=s.slice(0,a);let f=`data-${b}${v}`;s+=`${f}=""`,u={name:i,firstPartIdx:v},r.push({kind:"noop",path:[]}),o="skip-attr"}else o==="skip-attr"&&r.push({kind:"noop",path:[]})}}let h=document.createElement("template");return h.innerHTML=s,zs(h.content,r),Ws(h.content,r),n={templateEl:h,parts:r},Bn.set(t,n),n}function zs(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(I,"");let s=t.length;r.setAttribute(`data-${b}${s}`,""),t.push({kind:"slot",path:[]})}}function Ws(e,t){let n=[];function r(s){for(let o=0;o<s.childNodes.length;o++){let i=s.childNodes[o];if(n.push(o),i.nodeType===8){let a=i.data;if(a.startsWith(b)){let c=Number(a.slice(b.length));t[c]&&t[c].kind==="child"&&(t[c].path=n.slice())}}else if(i.nodeType===1){let a=i,c=[];for(let l of a.attributes)if(l.name.startsWith(`data-${b}`)){let u=Number(l.name.slice(`data-${b}`.length));t[u]&&t[u].kind!=="child"&&(t[u].path=n.slice()),c.push(l.name)}for(let l of c)a.removeAttribute(l);r(i)}n.pop()}}r(e)}function Ks(e,t){let{templateEl:n,parts:r}=We(e),s=n.content.cloneNode(!0),o=document.createComment(`${b}s`),i=document.createComment(`${b}e`),a=r.map(l=>Ke(l,s)),c=[];for(let l=0;l<e.values.length;l++)H(a[l],e.values[l],void 0,e.values),c.push(e.values[l]);t.replaceChildren(o,...s.childNodes,i);for(let l of a)l.kind==="slot"&&H(l,void 0,void 0,[]);return{strings:e.strings,bound:a,lastValues:c,startNode:o,endNode:i}}function Ke(e,t){if(e.kind==="noop")return{kind:"noop"};let n=t;for(let s of e.path)n=n.childNodes[s];if(e.kind==="child")return{kind:"child",marker:n};let r=n;if(e.kind==="event"){let s={kind:"event",el:r,name:e.name||"",handler:null,dispatcher(o){s.handler?.(o)}};return r.addEventListener(s.name,s.dispatcher),s}if(e.kind==="attr")return{kind:"attr",el:r,name:e.name||""};if(e.kind==="attr-mixed")return{kind:"attr-mixed",el:r,name:e.name||"",statics:e.statics||[],group:e.group||[]};if(e.kind==="prop")return{kind:"prop",el:r,name:e.name||""};if(e.kind==="bool")return{kind:"bool",el:r,name:e.name||""};if(e.kind==="element")return{kind:"element",el:r};if(e.kind==="slot")return{kind:"slot",slotEl:r,applied:!1};throw new Error(`unknown part kind ${e.kind}`)}function Z(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(H(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function Un(e,t){for(let n of e.bound){if(n.kind==="event"&&n.el.removeEventListener(n.name,n.dispatcher),n.kind==="element"){let r=n.lastTarget;if(r){if(typeof r=="function")try{r(void 0)}catch{}else typeof r=="object"&&(r.value=void 0);n.lastTarget=void 0,n.__lastEl=void 0}}if(n.kind==="slot"){let r=Pt(n.slotEl);r&&Fn(r,n.slotEl)}}t.replaceChildren()}function H(e,t,n,r){if(gt(t)){let s=t.value;if(e.kind==="prop"&&e.el[e.name]===s||e.kind==="attr"&&e.el.getAttribute(e.name)===String(s)||e.kind==="bool"&&e.el.hasAttribute(e.name)===!!s)return;t=s}switch(e.kind){case"child":Js(e,t);break;case"attr":{t==null||t===!1?e.el.removeAttribute(e.name):e.el.setAttribute(e.name,String(t));break}case"prop":e.el[e.name]=t;break;case"bool":t?e.el.setAttribute(e.name,""):e.el.removeAttribute(e.name);break;case"event":e.handler=typeof t=="function"?t:null;break;case"element":Ys(e,t);break;case"attr-mixed":{let s=e,o=s.statics[0];for(let i=0;i<s.group.length;i++)o+=String((r?r[s.group[i]]:t)??""),o+=s.statics[i+1]||"";e.el.setAttribute(e.name,o);break}case"slot":{if(e.applied)break;let s=e.slotEl,o=()=>{e.applied=!0;let a=Pt(s);if(!a||Gs(s))return;let c=document.createDocumentFragment();for(;s.firstChild;)c.appendChild(s.firstChild);s[He]=c,Ve(a)};Pt(s)?o():queueMicrotask(o);break}case"noop":break}}function Pt(e){let t=e.parentElement;for(;t;){if(t[$])return t;t=t.parentElement}return null}function Gs(e){let t=e;for(let n=0;n<128;n++){let r=t.parentNode;if(!r||r===t)return!1;if(r.host)return!0;t=r}return!1}function Ys(e,t){let n=e,r=Re(t)?t.target:void 0,s=n.__refTarget,o=r!==s;if(o&&s)if(typeof s=="function")try{s(void 0)}catch{}else typeof s=="object"&&(s.value=void 0);if(o||n.__refElement!==e.el){if(n.__refTarget=r,r)if(typeof r=="function"){if(!o&&n.__refElement!==void 0)try{r(void 0)}catch{}try{r(e.el)}catch{}}else typeof r=="object"&&(r.value=e.el);n.__refElement=e.el,e.lastTarget=r}}function Js(e,t){return oo(e,t),j(e,t)}function j(e,t){let n=e.marker;if(yt(t)){F(e);let s=String(t.value??""),o=document.createElement("template");o.innerHTML=s;let i=[...o.content.childNodes],a=document.createDocumentFragment();for(let c of i)a.appendChild(c);n.parentNode?.insertBefore(a,n),e.child=i;return}if(xe(t)){let s=t,o=e.__keyedKey;o!==void 0&&!Object.is(o,s.key)&&F(e),e.__keyedKey=s.key,j(e,s.value);return}if(je(t)){let s=t,o=e.__guardDeps,i=s.deps;if(o!==void 0&&(Array.isArray(o)&&Array.isArray(i)?so(o,i):Object.is(o,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,j(e,s.fn());return}if(_t(t)){F(e);let s=t.template;if(s&&s.content){let o=s.content.cloneNode(!0),i=[...o.childNodes];n.parentNode?.insertBefore(o,n),e.child=i}return}if(Re(t))return;if(Le(t))return io(e,t.value);if(Oe(t))return ao(e,t.args);if(Me(t))return co(e,t.signal);if(wt(t))return lo(e,t);if(St(t))return uo(e,t);if(Ne(t)){if(e.child&&e.child.kind==="repeat"){Zs(e,t);return}F(e);let s={kind:"repeat",map:new Map};e.child=s,Qs(n,s,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){no(e,t);return}F(e);let s={kind:"array",items:[]};e.child=s,to(n,s,t);return}if(e.child){let s=e.child;if(s.kind==="repeat")Dn(s),e.child=void 0;else if(s.kind==="array")qn(s),e.child=void 0;else if(s.kind==="async-stream")Wn(s),e.child=void 0;else if("strings"in e.child){let o=e.child;if(S(t)&&o.strings===t.strings){Z(o,t.values);return}ee(o.startNode,o.endNode),e.child=void 0}else{for(let o of e.child)o.parentNode&&o.parentNode.removeChild(o);e.child=void 0}}if(t==null||t===!1||t===!0)return;if(S(t)){let s=t,{templateEl:o,parts:i}=We(s),a=o.content.cloneNode(!0),c=document.createComment(`${b}s`),l=document.createComment(`${b}e`),u=i.map(h=>Ke(h,a)),p=[];for(let h=0;h<s.values.length;h++)H(u[h],s.values[h],void 0,s.values),p.push(s.values[h]);let d=[c,...a.childNodes,l];n.parentNode?.insertBefore(Xs(d),n);for(let h of u)h.kind==="slot"&&H(h,void 0,void 0,[]);e.child={strings:s.strings,bound:u,lastValues:p,startNode:c,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function Xs(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function ee(e,t){if(!e.parentNode)return;let n=e;for(;n&&n!==t;){let r=n.nextSibling;n.parentNode?.removeChild(n),n=r}t.parentNode===e.parentNode&&t.parentNode?.removeChild(t)}function Bt(e){let{templateEl:t,parts:n}=We(e),r=t.content.cloneNode(!0),s=document.createComment(`${b}s`),o=document.createComment(`${b}e`),i=n.map(l=>Ke(l,r)),a=[];for(let l=0;l<e.values.length;l++)H(i[l],e.values[l],void 0,e.values),a.push(e.values[l]);let c=document.createDocumentFragment();for(c.appendChild(s);r.firstChild;)c.appendChild(r.firstChild);return c.appendChild(o),{inst:{strings:e.strings,bound:i,lastValues:a,startNode:s,endNode:o},frag:c}}function ye(e){for(let t of e.bound)if(t.kind==="event"&&t.el.removeEventListener(t.name,t.dispatcher),t.kind==="element"){let n=t.lastTarget;if(n){if(typeof n=="function")try{n(void 0)}catch{}else typeof n=="object"&&(n.value=void 0);t.lastTarget=void 0,t.__lastEl=void 0}}}function Qs(e,t,n){let{items:r,keyFn:s,templateFn:o}=n,i=e.parentNode;if(!i)return;let a=document.createDocumentFragment();for(let c=0;c<r.length;c++){let l=s(r[c],c),u=o(r[c],c);if(!S(u))continue;let{inst:p,frag:d}=Bt(u);t.map.set(l,p),a.appendChild(d)}i.insertBefore(a,e)}function Zs(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,{items:o,keyFn:i,templateFn:a}=t,c=new Map;for(let l=0;l<o.length;l++){let u=i(o[l],l),p=a(o[l],l);if(!S(p))continue;let d=s.map.get(u);if(d&&d.strings===p.strings)Z(d,p.values),Ft(d.startNode,d.endNode,r,n),c.set(u,d),s.map.delete(u);else{d&&(ye(d),ee(d.startNode,d.endNode),s.map.delete(u));let{inst:h,frag:m}=Bt(p);r.insertBefore(m,n),c.set(u,h)}}for(let l of s.map.values())ye(l),ee(l.startNode,l.endNode);s.map=c}function Dn(e){for(let t of e.map.values())ye(t),ee(t.startNode,t.endNode);e.map.clear()}function eo(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function ze(e){e.type==="tpl"?(ye(e.inst),ee(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function $n(e){if(S(e)){let{inst:t,frag:n}=Bt(e);return{item:{type:"tpl",inst:t},frag:n}}if(e!=null&&e!==!1&&e!==!0){let t=document.createTextNode(String(e));return{item:{type:"text",node:t},frag:t}}return{item:{type:"empty"},frag:null}}function to(e,t,n){let r=e.parentNode;if(!r)return;let s=document.createDocumentFragment(),o=[];for(let i of n){let{item:a,frag:c}=$n(i);c&&s.appendChild(c),o.push(a)}r.insertBefore(s,e),t.items=o}function no(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,o=s.items,i=[];for(let a=0;a<t.length;a++){let c=t[a],l=o[a];if(S(c)){let d=c;if(l&&l.type==="tpl"&&l.inst.strings===d.strings){Z(l.inst,d.values),i.push(l);continue}}else if(c!=null&&c!==!1&&c!==!0){if(l&&l.type==="text"){let d=String(c);l.node.data!==d&&(l.node.data=d),i.push(l);continue}}else{l&&ze(l),i.push({type:"empty"});continue}let{item:u,frag:p}=$n(c);p&&r.insertBefore(p,ro(o,a,n)),l&&ze(l),i.push(u)}for(let a=t.length;a<o.length;a++)ze(o[a]);s.items=i}function ro(e,t,n){for(let r=t;r<e.length;r++){let s=eo(e[r]);if(s&&s.parentNode)return s}return n}function qn(e){for(let t of e.items)ze(t);e.items=[]}function Ft(e,t,n,r){if(t.nextSibling===r&&e.parentNode===n)return;let s=document.createDocumentFragment(),o=e;for(;o;){let i=o.nextSibling;if(s.appendChild(o),o===t)break;o=i}n.insertBefore(s,r)}function so(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function F(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&Hn(t),!e.child)return;let n=e.child;if(n.kind==="repeat")Dn(n);else if(n.kind==="array")qn(n);else if(n.kind==="async-stream")Wn(n);else if("strings"in n){let r=e.child;ye(r),ee(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function oo(e,t){let n=e;n.__untilState&&!Oe(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!je(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!Le(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!xe(t)&&(n.__keyedKey=void 0),n.__watchSub&&!Me(t)&&Hn(n)}function io(e,t){let n=e.marker,r=e,s=r.__cacheMap;s||(s=new Map,r.__cacheMap=s);let o=e.child;if(o&&"strings"in o){let a=o;if(S(t)&&a.strings===t.strings){Z(a,t.values);return}let c=document.createDocumentFragment();Ft(a.startNode,a.endNode,c,null),s.set(a.strings,{inst:a,holder:c}),e.child=void 0}if(S(t)){let a=t,c=s.get(a.strings);if(c){s.delete(a.strings),e.child&&F(e),Ft(c.inst.startNode,c.inst.endNode,n.parentNode,n),Z(c.inst,a.values),e.child=c.inst;return}}j(e,t)}function ao(e,t){let n=e,r=n.__untilState,s=n.__untilArgs,o=(d,h)=>!!(Object.is(d,h)||S(d)&&S(h)&&d.strings===h.strings),a=s&&s.length===t.length&&s.every((d,h)=>o(d,t[h]))&&r?r.highestResolved:1/0;r&&(r.aborted=!0),n.__untilArgs=t.slice();let c={aborted:!1,highestResolved:a};n.__untilState=c;let l=-1,u;for(let d=0;d<t.length;d++){let h=t[d];if(!h||typeof h.then!="function"){l=d,u=h;break}}l!==-1&&l<=c.highestResolved?(j(e,u),c.highestResolved=l):l===-1&&!n.__untilEverRendered&&j(e,""),n.__untilEverRendered=!0;let p=Math.min(l===-1?t.length:l,c.highestResolved);for(let d=0;d<p;d++){let h=t[d];!h||typeof h.then!="function"||Promise.resolve(h).then(m=>{c.aborted||d>=c.highestResolved||(c.highestResolved=d,j(e,m))},()=>{})}}function co(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let o;n.__watchSub.observe(()=>{o=t.get()}),j(e,o);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new he.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let o;r.observe(()=>{o=t.get()}),j(e,o)})});n.__watchSub=r;let s;r.observe(()=>{s=t.get()}),j(e,s)}function Hn(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function lo(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;F(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,Vn(s,e,t)}function uo(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;F(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,Vn(s,e,t)}async function Vn(e,t,n){let r=t.marker,s=0;try{for(;!e.aborted;){let o=await e.iterator.next();if(e.aborted||o.done)break;let i=n.mapper?n.mapper(o.value,s):o.value,a=zn(i);if(e.mode==="replace"){for(let l of e.nodes)l.parentNode&&l.parentNode.removeChild(l);e.nodes=[]}let c=document.createDocumentFragment();for(let l of a)c.appendChild(l);r.parentNode?.insertBefore(c,r),e.nodes.push(...a),s++}}catch(o){typeof console<"u"&&console.error("[webjs] asyncStream error:",o)}}function zn(e){if(e==null||e===!1||e===!0)return[];if(S(e)){let t=e,{templateEl:n,parts:r}=We(t),s=n.content.cloneNode(!0),o=r.map(i=>Ke(i,s));for(let i=0;i<t.values.length;i++)H(o[i],t.values[i],void 0,t.values);return[...s.childNodes]}if(Array.isArray(e)){let t=[];for(let n of e)t.push(...zn(n));return t}return[document.createTextNode(String(e))]}function Wn(e){e.aborted=!0;for(let t of e.nodes)t.parentNode&&t.parentNode.removeChild(t);e.nodes=[];try{e.iterator.return?.()?.catch?.(()=>{})}catch{}}var Kn=Symbol.for("webjs:registry"),Gn=Symbol.for("webjs:classToTag"),Ge=globalThis,R=Ge[Kn]||(Ge[Kn]=new Map),Yn=Ge[Gn]||(Ge[Gn]=new WeakMap),Ye=typeof window<"u"&&typeof customElements<"u";function Ut(e,t){if(!e||typeof e!="string"||!e.includes("-"))throw new Error(`customElements.define: tag "${e}" must contain a hyphen (HTML spec)`);let n=t.lazy===!0,r=R.get(e);r?(r.cls=t,r.lazy=n):R.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),Yn.set(t,e)}if(Ye){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),Ut(t,n)}}if(!Ye){let e=globalThis;e.customElements||(e.customElements={define(t,n){Ut(t,n)},get(t){return R.get(t)?.cls},upgrade(){},whenDefined(t){let n=R.get(t);return Promise.resolve(n?.cls)}})}function Dt(e,t){Ye?customElements.define(e,t):Ut(e,t)}function fo(e,t){if(Ye)return;let n=R.get(e);if(n){n.moduleUrl=t;return}R.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function ho(e){return R.get(e)?.cls}function po(e){return R.get(e)?.moduleUrl||null}function mo(e){return R.get(e)?.lazy===!0}function Je(e){return Yn.get(e)}function bo(){return[...R.keys()]}we();var tr=typeof window<"u"&&typeof HTMLElement<"u";function No(e,t){return e!==t}function xo(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var Xe=class{constructor(){this.__ssrAttrs=new Map,this.__internals=null}get attributes(){return[...this.__ssrAttrs].map(([t,n])=>({name:t,value:n}))}getAttribute(t){let n=this.__ssrAttrs.get(String(t).toLowerCase());return n===void 0?null:n}setAttribute(t,n){this.__ssrAttrs.set(String(t).toLowerCase(),String(n))}removeAttribute(t){this.__ssrAttrs.delete(String(t).toLowerCase())}hasAttribute(t){return this.__ssrAttrs.has(String(t).toLowerCase())}toggleAttribute(t,n){let r=String(t).toLowerCase(),s=this.__ssrAttrs.has(r);return(n===void 0?!s:n)?(this.__ssrAttrs.set(r,""),!0):(this.__ssrAttrs.delete(r),!1)}getAttributeNames(){return[...this.__ssrAttrs.keys()]}closest(t){let n=String(t).trim().toLowerCase();if(!/^[a-z][a-z0-9-]*$/.test(n))return null;if(this.__ssrTag===n)return this;let r=this.__ssrAncestors;if(!Array.isArray(r))return null;for(let s=r.length-1;s>=0;s--)if(r[s]&&r[s].__ssrTag===n)return r[s];return null}get dataset(){if(this.__dataset)return this.__dataset;let t=this,n=r=>"data-"+String(r).replace(/[A-Z]/g,s=>"-"+s.toLowerCase());return this.__dataset=new Proxy({},{get(r,s){if(typeof s!="string")return;let o=t.getAttribute(n(s));return o===null?void 0:o},set(r,s,o){return typeof s=="string"&&t.setAttribute(n(s),o),!0},has(r,s){return typeof s=="string"&&t.hasAttribute(n(s))},deleteProperty(r,s){return typeof s=="string"&&t.removeAttribute(n(s)),!0},ownKeys(){return t.getAttributeNames().filter(r=>r.startsWith("data-")).map(r=>r.slice(5).replace(/-([a-z])/g,(s,o)=>o.toUpperCase()))},getOwnPropertyDescriptor(r,s){if(typeof s=="string"&&t.hasAttribute(n(s)))return{enumerable:!0,configurable:!0,value:t.getAttribute(n(s))}}}),this.__dataset}get className(){return this.getAttribute("class")??""}set className(t){this.setAttribute("class",t)}get hidden(){return this.hasAttribute("hidden")}set hidden(t){this.toggleAttribute("hidden",!!t)}get id(){return this.getAttribute("id")??""}set id(t){this.setAttribute("id",t)}get title(){return this.getAttribute("title")??""}set title(t){this.setAttribute("title",t)}get slot(){return this.getAttribute("slot")??""}set slot(t){this.setAttribute("slot",t)}get role(){return this.getAttribute("role")}set role(t){t==null?this.removeAttribute("role"):this.setAttribute("role",t)}get tabIndex(){let t=this.getAttribute("tabindex");return t===null?-1:Number.parseInt(t,10)||0}set tabIndex(t){this.setAttribute("tabindex",String(t))}addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return this.__internals=xo(),this.__internals}},jo=["ariaAtomic","ariaAutoComplete","ariaBusy","ariaChecked","ariaColCount","ariaColIndex","ariaColSpan","ariaCurrent","ariaDescription","ariaDisabled","ariaExpanded","ariaHasPopup","ariaHidden","ariaInvalid","ariaKeyShortcuts","ariaLabel","ariaLevel","ariaLive","ariaModal","ariaMultiLine","ariaMultiSelectable","ariaOrientation","ariaPlaceholder","ariaPosInSet","ariaPressed","ariaReadOnly","ariaRequired","ariaRoleDescription","ariaRowCount","ariaRowIndex","ariaRowSpan","ariaSelected","ariaSetSize","ariaSort","ariaValueMax","ariaValueMin","ariaValueNow","ariaValueText"];for(let e of jo){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(Xe.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var Ro=tr?HTMLElement:Xe,qt=class e extends Ro{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){Dt(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(Zn)}constructor(){super(),this._renderRoot=null,this._scheduled=!1,this._connected=!1,this.__controllers=new Set,this.__firstRendered=!1,this._changedProperties=new Map,this._updateResolve=null,this._updatePromise=Promise.resolve(!0),this._isUpdating=!1,this._initializeProperties()}_initializeProperties(){let n=this.constructor.properties;if(!(!n||typeof n!="object")){this.__propValues={};for(let[r,s]of Object.entries(n)){let o=typeof s=="object"?s:{type:s},i=this[r];Object.defineProperty(this,r,{configurable:!0,enumerable:!0,get:()=>this.__propValues[r],set:a=>{let c=this.__propValues[r];(o.hasChanged||No)(a,c)&&(this.__propValues[r]=a,o.reflect&&!o.state&&this._connected&&this._reflectAttribute(r,a,o),this.requestUpdate(r,c))}}),i!==void 0&&(this.__propValues[r]=i)}}}_reflectAttribute(t,n,r){let s=Zn(t);if(!this.__reflectingAttribute){this.__reflectingAttribute=!0;try{if(r.converter&&r.converter.toAttribute){let o=r.converter.toAttribute(n,r.type);o==null?this.removeAttribute(s):this.setAttribute(s,o)}else r.type===Boolean?n?this.setAttribute(s,""):this.removeAttribute(s):n==null?this.removeAttribute(s):r.type===Object||r.type===Array?this.setAttribute(s,JSON.stringify(n)):this.setAttribute(s,String(n))}finally{this.__reflectingAttribute=!1}}}connectedCallback(){if(!tr)return;if(this.__webjsPropsHydrated||(this.__webjsPropsHydrated=!0,this._hydratePropAttrs()),this.constructor.hydrate==="visible"&&typeof IntersectionObserver<"u"&&!this.__hydrationActivated){this.__hydrationActivated=!1,this.__hydrationObserver=new IntersectionObserver(n=>{for(let r of n)if(r.isIntersecting){this.__hydrationObserver.unobserve(this),this.__hydrationObserver.disconnect(),this.__hydrationObserver=null,this.__hydrationActivated=!0,this._activate();return}},{rootMargin:"200px"}),this.__hydrationObserver.observe(this);return}this._activate()}_hydratePropAttrs(){let t=[],n=this.attributes;for(let r=0;r<n.length;r++){let s=n[r].name;s.startsWith("data-webjs-prop-")&&t.push(s)}for(let r of t){let s=this.getAttribute(r);if(this.removeAttribute(r),s==null)continue;let o=er(r.slice(16));try{this[o]=z(s)}catch(i){console.warn(`[webjs] failed to decode ${r} on <${this.tagName.toLowerCase()}>: ${i&&i.message}`)}}}_activate(){this._connected=!0,this._reflectDeclaredAttributes();let t=this.constructor;if(t.shadow===!0){let n=!!this.shadowRoot;this.shadowRoot||this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot;let r=t.styles,s=Array.isArray(r)?r:mt(r)?[r]:[];if(s.length){if(n){let o=this.shadowRoot.querySelector("style");o&&o.remove()}bt(this._renderRoot,s)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${Je(t)||this.tagName?.toLowerCase()}> has static shadow = false AND static styles. static styles only works with shadow DOM (adoptedStyleSheets). For light DOM, use global CSS or <style> in render().`),Mt(this)||(this.__isHydrating()?(P(this),On(this)):Ln(this));for(let n of this.__controllers)n.hostConnected&&n.hostConnected();this._updateResolve===null&&(this._updatePromise=new Promise(n=>{this._updateResolve=n})),this._scheduled=!0,queueMicrotask(()=>{this._scheduled=!1;try{this._performRender()}catch(n){console.error("[webjs] lifecycle hook threw during initial render:",n)}this._renderRoot===this&&In(this)})}__isHydrating(){let t=this.firstChild,n=t!=null&&t.nodeType===8&&t.data==="webjs-hydrate";return n&&(this.__hydratedAtActivate=!0),n}disconnectedCallback(){this._connected=!1,this.__hydrationObserver&&(this.__hydrationObserver.disconnect(),this.__hydrationObserver=null),this._renderRoot===this&&Pn(this),this.__signalWatcher&&(this.__signalWatcher.dispose(),this.__signalWatcher=void 0);for(let t of this.__controllers)t.hostDisconnected&&t.hostDisconnected()}attributeChangedCallback(t,n,r){if(this.__reflectingAttribute)return;let s=this.constructor,o=er(t),i=s.properties&&(s.properties[o]||s.properties[t]);if(!i)return;let a;if(i.converter&&i.converter.fromAttribute)a=i.converter.fromAttribute(r,i.type);else if(i.type===Number)a=r==null?null:Number(r);else if(i.type===Boolean)a=r!=null&&r!=="false";else if(i.type===Object||i.type===Array)try{a=r==null?null:JSON.parse(r)}catch{a=r}else a=r;this[o]!==a&&(this[o]=a,this._connected&&this.requestUpdate())}requestUpdate(t,n){t!==void 0&&!this._changedProperties.has(t)&&this._changedProperties.set(t,n),this._scheduleUpdate()}_scheduleUpdate(){this._updateResolve===null&&(this._updatePromise=new Promise(t=>{this._updateResolve=t})),!this._isUpdating&&(this._scheduled||!this._connected||(this._scheduled=!0,queueMicrotask(()=>{this._scheduled=!1;try{this._performRender()}catch(t){console.error("[webjs] lifecycle hook threw during update cycle:",t)}})))}_performRender(){if(!this._renderRoot)return;let t=this._changedProperties;this._isUpdating=!0;let n=!1,r=null;try{if(this.shouldUpdate(t)){this.willUpdate(t);for(let s of this.__controllers)s.hostUpdate&&s.hostUpdate();this.__renderToken=(this.__renderToken||0)+1;try{let s=this.update(t);s&&typeof s.then=="function"&&(r=s)}catch(s){this._handleRenderError(s)}if(!r){for(let s of this.__controllers)s.hostUpdated&&s.hostUpdated();n=!0}}}catch(s){console.error("[webjs] lifecycle hook threw during update phase:",s)}finally{this._isUpdating=!1,(n||r)&&(this._changedProperties=new Map)}if(r){let s=this.__renderToken;this.__pendingAsyncCommits=(this.__pendingAsyncCommits||0)+1,r.then(()=>{if(this.__pendingAsyncCommits--,s===this.__renderToken){for(let o of this.__controllers)o.hostUpdated&&o.hostUpdated();this._postCommit(t)}});return}n?this._postCommit(t):this.__pendingAsyncCommits||this._resolveUpdate()}_resolveUpdate(){if(this._updateResolve){let t=this._changedProperties.size===0;this._updateResolve(t),this._updateResolve=null}}performServerUpdate(){let t=this._changedProperties;this._isUpdating=!0;try{this.willUpdate(t);for(let n of this.__controllers)n.hostUpdate&&n.hostUpdate();this._reflectDeclaredAttributes()}finally{this._isUpdating=!1}}_reflectDeclaredAttributes(){let t=this.constructor.properties||{};for(let n of Object.keys(t)){let r=t[n];!r||!r.reflect||r.state||this._reflectAttribute(n,this[n],r)}}shouldUpdate(t){return!0}willUpdate(t){}update(t){this.__signalWatcher||(this.__signalWatcher=new he.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;if(this.__signalWatcher.observe(()=>{n=this.render()}),n&&typeof n.then=="function")return this._commitAsync(n);te(n,this._renderRoot)}_commitAsync(t){let n=this.__renderToken;if(this.__firstRendered&&this._overridesRenderFallback())try{let r=this.renderFallback();r!==void 0&&te(r,this._renderRoot)}catch(r){console.error("[webjs] renderFallback() threw:",r)}return Promise.resolve(t).then(r=>{n===this.__renderToken&&te(r,this._renderRoot)},r=>{n===this.__renderToken&&this._handleRenderError(r instanceof Error?r:new Error(String(r)))})}_overridesRenderFallback(){return this.renderFallback!==e.prototype.renderFallback}_handleRenderError(t){console.error(`[webjs] render error in <${Je(this.constructor)||this.tagName?.toLowerCase()}>:`,t);try{let n=this.renderError(t);n!==void 0&&te(n,this._renderRoot)}catch(n){console.error("[webjs] renderError() also threw:",n)}}_postCommit(t){try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(n){console.error("[webjs] lifecycle hook threw during post-commit phase:",n)}finally{this._resolveUpdate()}}updated(t){}firstUpdated(t){}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}addController(t){this.__controllers.add(t),this._connected&&t.hostConnected&&t.hostConnected()}removeController(t){this.__controllers.delete(t)}render(){return""}renderError(t){}renderFallback(){}};function Zn(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function er(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}var nr=Symbol.for("webjs.notFound"),rr=Symbol.for("webjs.redirect");function Lo(){let e=new Error("webjs: notFound()");throw e.__webjs=nr,e}function Oo(e,t){let n=typeof t=="object"&&t!==null?t.status:t,r=new Error(`webjs: redirect(${e})`);throw r.__webjs=rr,r.url=e,r.status=typeof n=="number"?n:void 0,r}function Mo(e){return!!e&&e.__webjs===nr}function Io(e){return!!e&&e.__webjs===rr}var sr=null;function Po(){if(!sr)return"";try{return sr()||""}catch{return""}}var ra=Symbol.for("webjs.suspense");function Fo(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function Bo(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}function Uo(e,t={}){let n=t.reconnect!==!1,r=0,s=!1,o=null,i=[];function a(){s||(o=new WebSocket(Do(e),t.protocols),o.onopen=c=>{for(r=0;i.length&&o&&o.readyState===WebSocket.OPEN;)o.send(i.shift());t.onOpen?.(c)},o.onmessage=c=>{let l=c.data;if(typeof l=="string")try{l=JSON.parse(l)}catch{}t.onMessage?.(l,c)},o.onerror=c=>{t.onError?.(c)},o.onclose=c=>{if(t.onClose?.(c),!s&&n){let l=Math.min(1e3*2**r++,3e4);setTimeout(a,l)}})}return a(),{send(c){let l=typeof c=="string"||c instanceof ArrayBuffer||ArrayBuffer.isView(c)?c:JSON.stringify(c);o&&o.readyState===WebSocket.OPEN?o.send(l):i.push(l)},close(c,l){s=!0;try{o?.close(c,l)}catch{}},get socket(){return o},get readyState(){return o?.readyState??3}}}function Do(e){if(/^wss?:\/\//i.test(e))return e;let t=typeof location<"u"&&location.protocol==="https:"?"wss:":"ws:",n=typeof location<"u"?location.host:"";return`${t}//${n}${e.startsWith("/")?e:"/"+e}`}we();var Ht="application/vnd.webjs+json";async function $o(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",Ht);let r=t.body;r!=null&&typeof r=="object"&&!(r instanceof FormData)&&!(r instanceof Blob)&&!(r instanceof ArrayBuffer)&&!(r instanceof URLSearchParams)&&!(typeof ReadableStream<"u"&&r instanceof ReadableStream)&&!ArrayBuffer.isView(r)&&(r=await $t(r),n.has("content-type")||n.set("content-type",Ht));let s=await fetch(e,{...t,headers:n,body:r}),o=s.headers.get("content-type")||"",i=await s.text(),a=o.includes(Ht)?i?z(i):null:o.includes("application/json")?i?JSON.parse(i):null:i;if(!s.ok){let c=a&&a.error||`richFetch ${e} -> ${s.status}`,l=new Error(c);throw l.status=s.status,l.body=a,l}return a}we();Kt();Wt();Ze();async function Si(e,t,n){let r=e.get();e.set(t);let s;try{s=await n()}catch(o){throw e.set(r),o}return s&&s.success===!1&&e.set(r),s}Jt();var Ai=Symbol.for("webjs.context");function vi(e){return{__context__:Ai,name:e}}var ht=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},pn=class{constructor(t,{context:n,initialValue:r}){this._host=t,this._context=n,this._value=r,this._subscriptions=new Set,this._onRequest=s=>{let o=s;if(o.context===this._context)if(s.stopPropagation(),o.subscribe){let i={callback:o.callback},a=()=>{this._subscriptions.delete(i)};this._subscriptions.add(i),o.callback(this._value,a)}else o.callback(this._value)},typeof t.addController=="function"&&t.addController(this)}get value(){return this._value}setValue(t){if(!Object.is(this._value,t)){this._value=t;for(let n of this._subscriptions){let r=()=>{this._subscriptions.delete(n)};n.callback(t,r)}}}hostConnected(){this._host.addEventListener("context-request",this._onRequest)}hostDisconnected(){this._host.removeEventListener("context-request",this._onRequest),this._subscriptions.clear()}},mn=class{constructor(t,{context:n,subscribe:r=!0}){this._host=t,this._context=n,this._subscribe=r,this._value=void 0,this._unsubscribe=void 0,typeof t.addController=="function"&&t.addController(this)}get value(){return this._value}hostConnected(){this._dispatchRequest()}hostDisconnected(){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=void 0)}_dispatchRequest(){let t=new ht(this._context,(n,r)=>{let s=this._value;this._value=n,r&&(this._unsubscribe=r),!Object.is(s,n)&&typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()},this._subscribe);this._host.dispatchEvent(t)}};function Ci(){return typeof window<"u"}var O={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},bn=class{constructor(t,{task:n,args:r,autoRun:s=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=s,this._status=O.INITIAL,this._value=void 0,this._error=void 0,this._abortController=null,this._prevArgs=null,typeof t.addController=="function"&&t.addController(this)}get status(){return this._status}get value(){return this._value}get error(){return this._error}async run(){this.abort();let t=new AbortController;this._abortController=t;let n=this._argsFn();this._prevArgs=n,this._status=O.PENDING,this._error=void 0,this._requestHostUpdate();try{let r=await this._taskFn(...n,{signal:t.signal});if(t.signal.aborted)return;this._value=r,this._status=O.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=O.ERROR,this._value=void 0}finally{this._abortController===t&&(this._abortController=null)}this._requestHostUpdate()}abort(){this._abortController&&(this._abortController.abort(),this._abortController=null)}render(t={}){switch(this._status){case O.INITIAL:return t.initial?.();case O.PENDING:return t.pending?.();case O.COMPLETE:return t.complete?.(this._value);case O.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!Ci())return;let t=this._argsFn();this._argsEqual(this._prevArgs,t)||this.run()}hostUpdated(){}hostConnected(){}hostDisconnected(){this.abort()}_requestHostUpdate(){typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()}_argsEqual(t,n){if(t===null||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r])return!1;return!0}};export{mn as ContextConsumer,pn as ContextProvider,ht as ContextRequestEvent,b as MARKER,pr as SEED_MISS,he as Signal,Fo as Suspense,bn as Task,O as TaskStatus,qt as WebComponent,zt as WebjsFrame,Gt as WebjsStream,bt as adoptStyles,bo as allTags,bs as asyncAppend,ys as asyncReplace,Ts as batch,ps as cache,xs as computed,Uo as connectWS,vi as createContext,hs as createRef,Po as cspNonce,rs as css,Xn as deserialize,wr as disableClientRouter,Rs as effect,rn as enableClientRouter,is as escapeAttr,os as escapeText,us as guard,ns as html,wt as isAsyncAppend,St as isAsyncReplace,mt as isCSS,Le as isCache,je as isGuard,xe as isKeyed,mo as isLazy,gt as isLive,Mo as isNotFound,Io as isRedirect,Re as isRef,Ne as isRepeat,js as isSignal,Bo as isSuspense,S as isTemplate,_t as isTemplateContent,yt as isUnsafeHTML,Oe as isUntil,Me as isWatch,ls as keyed,cs as live,ho as lookup,po as lookupModuleUrl,Sr as navigate,Lo as notFound,Si as optimistic,z as parse,fo as primeModuleUrl,Oo as redirect,ds as ref,Dt as register,te as render,Yt as renderStream,_n as repeat,Ar as revalidate,$o as richFetch,et as scanSeeds,Jn as serialize,Ns as signal,$t as stringify,ss as stylesToString,Je as tagOf,Go as takeSeed,fs as templateContent,as as unsafeHTML,ms as until,gs as watch};
4
4
  //# sourceMappingURL=webjs-core-browser.js.map