@webjsdev/core 0.7.17 → 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.
- package/dist/webjs-core-browser.js +3 -3
- package/dist/webjs-core-browser.js.map +3 -3
- package/dist/webjs-core.js +5 -5
- package/dist/webjs-core.js.map +3 -3
- package/index-browser.js +4 -0
- package/index.d.ts +1 -0
- package/index.js +4 -0
- package/package.json +1 -1
- package/src/action-seed-client.d.ts +17 -0
- package/src/action-seed-client.js +107 -0
- package/src/router-client.js +10 -0
- package/src/webjs-config.d.ts +9 -0
package/dist/webjs-core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var vs=Object.defineProperty;var Re=(e,t)=>()=>(e&&(t=e(e=0)),t);var Bn=(e,t)=>{for(var n in t)vs(e,n,{get:t[n],enumerable:!0})};var jr={};Bn(jr,{observeLazy:()=>xi,observeViewportOnce:()=>ji});function Nr(e){let t=dn.get(e);return t||(t=import(e).finally(()=>dn.delete(e)),dn.set(e,t),t)}function xi(e){for(let[t,n]of Object.entries(e))ce.set(t.toLowerCase(),n);if(typeof IntersectionObserver>"u"){for(let t of ce.values())Nr(t);ce.clear();return}ze||(ze=new IntersectionObserver(Ti,{rootMargin:"200px"})),Tr(),typeof MutationObserver<"u"&&new MutationObserver(()=>Tr()).observe(document.body,{childList:!0,subtree:!0})}function Tr(){if(!(!ze||!ce.size))for(let e of ce.keys())for(let t of document.querySelectorAll(e))ze.observe(t)}function Ti(e){for(let t of e){if(!t.isIntersecting)continue;let n=t.target.tagName.toLowerCase(),r=ce.get(n);r&&(Nr(r),ce.delete(n),ze?.unobserve(t.target))}}function Ni(e){for(let t of e){if(!t.isIntersecting)continue;let n=_t.get(t.target);_t.delete(t.target),We?.unobserve(t.target),n&&n()}}function ji(e,t){return typeof IntersectionObserver>"u"?(t(),()=>{}):(We||(We=new IntersectionObserver(Ni,{rootMargin:"200px"})),_t.set(e,t),We.observe(e),()=>{_t.delete(e),We?.unobserve(e)})}var ce,ze,dn,We,_t,Rr=Re(()=>{ce=new Map,ze=null,dn=new Map;We=null,_t=new WeakMap});var hn,pn=Re(()=>{hn=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(()=>(Rr(),jr)).then(({observeViewportOnce:o})=>{this._webjsLoadedSrc!==n||!this.isConnected||(this._webjsLazyTeardown=o(this,()=>{this._webjsLazyTeardown=null,this._webjsLoad(n)}))})):(this._webjsLoadedSrc=n,this._webjsLoad(n))}_webjsLoad(t){Promise.resolve().then(()=>(mn(),Lr)).then(({loadFrame:n})=>{this._webjsLoadedSrc!==t||!this.isConnected||n(this,t)})}}:null;typeof customElements<"u"&&hn&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",hn)});function Li(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 gn(e,t){let n=t||(typeof document<"u"?document:null);if(!n)return;let r=null;if(typeof e=="string"){let s=n.createElement("template");s.innerHTML=e,r=s.content}else if(e&&e.nodeType)r=e;else return;let o=r.querySelectorAll?Array.from(r.querySelectorAll("webjs-stream")):[];if(o.length)for(let s of o)n.body.append(s);else n.body.append(r)}var Ri,bn,St=Re(()=>{Ri=new Set(["append","prepend","before","after","replace","update"]);bn=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=[],o=this.getAttribute("target");if(o){let i=n.getElementById(o);i&&(r=[i])}else{let i=this.getAttribute("targets");if(i)try{r=Array.from(n.querySelectorAll(i))}catch{r=[]}}let s=Ri.has(t)?this.querySelector("template"):null;try{for(let i of r){let a=s?s.content.cloneNode(!0):null;Li(t,i,a)}}finally{this.remove()}}}:null;typeof customElements<"u"&&bn&&!customElements.get("webjs-stream")&&customElements.define("webjs-stream",bn)});var Or,Ir=Re(()=>{Or=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this.style.display||(this.style.display="contents")}}:null;typeof customElements<"u"&&Or&&!customElements.get("webjs-suspense")&&customElements.define("webjs-suspense",Or)});var Lr={};Bn(Lr,{_FRAME_TOP:()=>Yr,_LIVE_ATTRS:()=>An,_activeFrameId:()=>Gr,_addNewHeadElements:()=>Cn,_applyStreamedResolve:()=>ys,_blurOutgoingFocus:()=>vt,_buildSubmitFormData:()=>Vr,_bumpNavToken:()=>ta,_clearFormBusy:()=>cs,_clearFrameBusy:()=>is,_collectChildrenSlots:()=>je,_currentPageUrl:()=>na,_diffElementInPlace:()=>jt,_eligibleAnchorHref:()=>Et,_findAnchorInPath:()=>Kr,_getSubmitAction:()=>zr,_getSubmitMethod:()=>Wr,_isNonHtmlPath:()=>sa,_keyOf:()=>Ne,_longestSharedPath:()=>Jr,_markFormBusy:()=>as,_markFrameBusy:()=>os,_mergeHead:()=>ms,_navToken:()=>ea,_onPopState:()=>En,_onSubmit:()=>kn,_prefetch:()=>Ye,_prefetchInflightSize:()=>Qi,_prefetchMode:()=>kt,_prefetchPeek:()=>Zi,_prefetchSaysSaveData:()=>Nn,_prefetchSuppressed:()=>ts,_prefetchTake:()=>ns,_reactivateScripts:()=>Rt,_readStreamedShell:()=>bs,_reconcileChildren:()=>Rn,_regraftPermanentElements:()=>us,_regraftPermanentInSlice:()=>jn,_resetPrefetch:()=>Xi,_resolveTargetFrameId:()=>xn,_restoreOptimistic:()=>Ve,_runWithTransition:()=>Ct,_setCurrentPageUrl:()=>ra,_snapshotCache:()=>O,_streamBoundariesProgressively:()=>ws,_takeResolveUnit:()=>gs,_viewTransitionsEnabled:()=>ls,collectChildrenSlots:()=>je,disableClientRouter:()=>qr,enableClientRouter:()=>vn,loadFrame:()=>Ii,longestSharedPath:()=>Jr,navigate:()=>Ur,revalidate:()=>Dr});function Fr(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}function Oi(){yn||typeof MutationObserver>"u"||typeof customElements>"u"||(yn=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 o of r.querySelectorAll("*"))o.tagName?.includes("-")&&customElements.upgrade(o)}}),yn.observe(document.body,{childList:!0,subtree:!0}))}function vn(){fe||typeof document>"u"||(fe=!0,document.addEventListener("click",Hr,!1),document.addEventListener("submit",kn,!1),window.addEventListener("popstate",En),document.addEventListener("pointerover",Te,!0),document.addEventListener("focusin",Te,!0),document.addEventListener("touchstart",Te,{capture:!0,passive:!0}),document.addEventListener("pointerout",rs,!0),document.addEventListener("webjs:navigate",Sn),Oi(),Sn(),typeof history<"u"&&"scrollRestoration"in history&&(At=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(U=location.href))}function qr(){fe&&(fe=!1,document.removeEventListener("click",Hr,!1),document.removeEventListener("submit",kn,!1),window.removeEventListener("popstate",En),document.removeEventListener("pointerover",Te,!0),document.removeEventListener("focusin",Te,!0),document.removeEventListener("touchstart",Te,{capture:!0}),document.removeEventListener("pointerout",rs,!0),document.removeEventListener("webjs:navigate",Sn),Ot(),Y&&(Y.disconnect(),Y=null),typeof history<"u"&&At!==null&&(history.scrollRestoration=At,At=null),U=null)}async function Ur(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await Tn(n.href,t?.replace??!1,null)}async function Ii(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};I&&I.abort(),I=new AbortController;let o=I.signal,s=++j;return xt(r.href,n,!1,null,"GET",null,o,s)}function Dr(e){if(!e){O.clear(),L.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;O.delete(n),L.delete(n)}function Hr(e){if(!fe||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=Kr(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||Lt.test(r.pathname))return;e.preventDefault();let o=xn(t);Tn(n,!1,o)}function En(e){Tn(location.href,!0,null)}function kn(e){if(!fe||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 o=Wr(t,n);if(o==="dialog")return;let s=zr(t,n),i;try{i=new URL(s,location.href)}catch{return}if(i.origin!==location.origin||Lt.test(i.pathname))return;let a=Vr(t,n);e.preventDefault();let c=xn(n||t);Bi(i.href,o,a,c,t)}function Wr(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function zr(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function Vr(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 Kr(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function Gr(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 xn(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===Yr)return null;let r=typeof document<"u"?document.getElementById(n):null;return r&&r.tagName&&r.tagName.toLowerCase()==="webjs-frame"?n:(Mi(`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 Gr(e)}function Mi(e,t){$r.has(e)||($r.add(e),typeof console<"u"&&console.warn&&console.warn(t))}function je(e){let t=new Map,n=[];function r(o){if(o.nodeType===8){let s=o,i=s.data,a=/^wj:children:(.+)$/.exec(i);if(a){n.push({path:a[1],start:s});return}if(i.trim()==="/wj:children"){let c=n.pop();c&&!t.has(c.path)&&t.set(c.path,{start:c.start,end:s});return}return}if(o.hasChildNodes&&o.hasChildNodes())for(let s=o.firstChild;s;s=s.nextSibling)r(s)}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 Zr(e){let t=de(e);O.has(t)&&O.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(O.set(t,n);O.size>$i;){let r=O.keys().next().value;O.delete(r)}}function Pi(e){let t=de(e),n=O.get(t);return n==null?null:(O.delete(t),O.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function de(e){let t=new URL(e,location.href);return t.pathname+t.search}async function Tn(e,t,n){I&&I.abort(),I=new AbortController;let r=I.signal,o=++j;U&&Zr(U);let s=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),s=null},150),i=null;t||(i=ds());try{if(t){let a=Pi(e);if(a){let c=Fr(a.html);if(c){fs(c,n,!0,null),typeof window<"u"&&window.scrollTo(a.scrollX,a.scrollY),xt(e,n,!1,i,"GET",null,r,o).catch(()=>{});return}}typeof window<"u"&&window.scrollTo(0,0)}await xt(e,n,!t,i,"GET",null,r,o)}finally{s&&clearTimeout(s),o===j&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(U=location.href))}}async function Bi(e,t,n,r,o){I&&I.abort(),I=new AbortController;let s=I.signal,i=++j,a=t==="get"||t==="head",c=new URL(e,location.href);if(a){c.search="";for(let[b,g]of n)c.searchParams.append(b,typeof g=="string"?g:g.name)}U&&Zr(U);let l=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),l=null},150),f=ds(),h=o?as(o,i,c.href):null,u=!1;try{let b=await xt(c.href,r,!0,f,a?"GET":t.toUpperCase(),a?null:n,s,i);u=!!(b&&b.ok),!a&&i===j&&(O.clear(),L.clear())}finally{h&&cs(h,i,c.href,u),l&&clearTimeout(l),i===j&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(U=location.href))}}function Qr(){return[...je(document.body).keys()].join(",")}function Nn(){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 Di(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function Et(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||Lt.test(n.pathname)?null:t}function ts(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=Di(e);return t.includes("external")||t.includes("no-prefetch")}function kt(e){if(ts(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 Ye(e){if(typeof fetch!="function"||Nn())return;let t=de(e);if(le.has(t)||Ke.has(t))return;let n=L.get(t);if(n&&_n()-n.at<Xr)return;if(le.size>=es){for(Ke.add(t),ke.push(e);ke.length>qi;){let s=ke.shift();Ke.delete(de(s))}return}le.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},o=Qr();o&&(r["x-webjs-have"]=o),fetch(e,{method:"GET",headers:r,credentials:"same-origin"}).then(async s=>{let i=s.headers.get("content-type")||"";if(!/^text\/html\b/i.test(i)||s.status>=400)return;let a=s.headers.get("x-webjs-build"),c=s.redirected&&s.url?s.url:e,l=await s.text();Wi(t,{html:l,build:a,finalUrl:c,at:_n()})}).catch(()=>{}).finally(()=>{le.delete(t),Hi()})}function Hi(){for(;ke.length&&le.size<es;){let e=ke.shift();Ke.delete(de(e)),Ye(e)}}function Wi(e,t){for(L.has(e)&&L.delete(e),L.set(e,t);L.size>Fi;){let n=L.keys().next().value;L.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function ns(e){let t=de(e),n=L.get(t);return!n||(L.delete(t),_n()-n.at>=Xr)?null:n}function _n(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function Te(e){if(!fe)return;let t=ss(e.target);if(!t||kt(t)!=="intent")return;let n=Et(t);n&&(Ge===t&&xe||(Ot(),Ge=t,xe=setTimeout(()=>{xe=null,Ge=null,Ye(n)},Ui)))}function rs(e){let t=ss(e.target);t&&t===Ge&&Ot()}function Ot(){xe&&(clearTimeout(xe),xe=null),Ge=null}function ss(e){let t=e;for(;t;){if(t instanceof HTMLAnchorElement)return t;let n=t.nodeType===1?t:null;if(n){let o=n.closest&&n.closest("a");if(o instanceof HTMLAnchorElement)return o}let r=t.getRootNode?t.getRootNode():null;t=r&&r.host?r.host:null}return null}function Sn(){if(typeof document>"u"||Nn())return;let e=typeof IntersectionObserver<"u";e&&(Y?Y.disconnect():Y=new IntersectionObserver(t=>{for(let n of t){if(!n.isIntersecting)continue;let r=n.target;Y.unobserve(r);let o=Et(r);o&&kt(r)==="viewport"&&Ye(o)}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=kt(t);if(n==="render"){let r=Et(t);r&&Ye(r)}else n==="viewport"&&e&&Y.observe(t)}}function zi(e){if(typeof document>"u"||!document.body)return!1;let t=je(document.body),n,r=-1;for(let[c,l]of t)c.length>r&&(r=c.length,n=l);if(!n)return!1;let o=n.start.parentNode;if(!o||n.start.parentNode!==n.end.parentNode)return!1;let s=document.createElement("div");s.setAttribute("role","alert"),s.setAttribute("data-webjs-nav-error","");let i=e?`This page could not be loaded. (status ${e})`:"This page could not be loaded.";s.textContent=i;let a=document.createRange();return a.setStartAfter(n.start),a.setEndBefore(n.end),a.deleteContents(),o.insertBefore(s,n.end),!0}function wn(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||zi(t)||typeof location<"u"&&(location.href=e)}async function xt(e,t,n,r,o,s,i,a){o=o||"GET";let c=typeof a=="number"?a:j,l,f=null,h=null,u=null,b=!1,g=e,m=t?os(t,c):null;try{try{let d=o==="GET"&&!s&&!t?ns(e):null;if(d)l=d.html,h=d.build,g=d.finalUrl,u=200,b=!0;else{let y={"x-webjs-router":"1"},w=Qr();w&&(y["x-webjs-have"]=w),t&&(y["x-webjs-frame"]=t),s!=null&&o!=="GET"&&o!=="HEAD"&&(y.accept=Mr+", text/html");let S={method:o,headers:y,credentials:"same-origin"};i&&(S.signal=i),s!=null&&o!=="GET"&&o!=="HEAD"&&(S.body=s);let A=await fetch(e,S);u=A.status,b=A.ok;let E=A.headers.get("content-type")||"",T=/^text\/html\b/i.test(E);if(E.toLowerCase().indexOf(Mr)===0){let _=await A.text();return c===j&&(Ve(r),gn(_)),{ok:b,status:u,aborted:!1}}if(A.redirected&&A.url&&(g=A.url),A.status===204||A.status===205)return c===j&&n&&history.pushState(null,"",g),{ok:b,status:u,aborted:!1};if(!T)return c===j&&(Ve(r),wn(e,A.status,null)),{ok:!1,status:u,aborted:!1};h=A.headers.get("x-webjs-build");let C=await bs(A);l=C.shell,C.streaming&&(f=C)}}catch(d){return d&&d.name==="AbortError"?{ok:!1,status:null,aborted:!0}:c!==j?{ok:!1,status:null,aborted:!0}:(Ve(r),wn(e,null,d instanceof Error?d:new Error(String(d))),{ok:!1,status:null,aborted:!1})}if(c!==j){if(f&&f.reader)try{f.reader.cancel()}catch{}return{ok:!1,status:u,aborted:!0}}let p=Fr(l);if(!p)return Ve(r),wn(e,null,new Error("navigation response did not parse as HTML")),{ok:!1,status:u,aborted:!1};if(fs(p,t,!1,g,h),n&&history.pushState(null,"",g),n){let d=new URL(g);if(d.hash){let y=document.getElementById(d.hash.slice(1));y?y.scrollIntoView():window.scrollTo(0,0)}else window.scrollTo(0,0)}return f&&(f.reader||f.rest)&&ws(f.reader,f.dec,f.rest,()=>c===j),document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:g,frameId:t,from:"navigate"}})),{ok:b,status:u,aborted:!1}}finally{m&&is(m,c)}}function os(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=Tt.has(n);return Tt.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 is(e,t){if(Tt.get(e)!==t)return;Tt.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 as(e,t,n){let r=Nt.has(e);return Nt.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 cs(e,t,n,r){if(Nt.get(e)!==t)return;Nt.delete(e),e.setAttribute("aria-busy","false");let o=new CustomEvent("webjs:submit-end",{bubbles:!0,detail:{form:e,url:n,ok:!!r}});e.isConnected?e.dispatchEvent(o):typeof document<"u"?document.dispatchEvent(o):e.dispatchEvent(o)}function Pr(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+=ue(r);return n}function ls(){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 Ct(e,t){let n=typeof document<"u"?document.startViewTransition:void 0;if(ls()&&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 us(e,t){if(!e||!t||typeof e.querySelectorAll!="function")return;let n=e.querySelectorAll("[data-webjs-permanent][id]");for(let r of n){let o=r.id;if(!o)continue;let s=null;try{s=t.querySelector(`#${CSS.escape(o)}`)}catch{s=null}if(!s||!r.hasAttribute||!r.hasAttribute("data-webjs-permanent"))continue;let i=s.parentNode;i&&s!==r&&i.replaceChild(r,s)}}function jn(e,t){let n=[];for(let r of e){if(r.nodeType!==1)continue;let o=r;if(o.hasAttribute&&o.hasAttribute("data-webjs-permanent")&&o.id&&n.push(o),typeof o.querySelectorAll=="function")for(let s of o.querySelectorAll("[data-webjs-permanent][id]"))n.push(s)}if(n.length)for(let r of n){let o=r.id;if(!o)continue;let s=Vi(t,o);if(!s||s===r)continue;let i=s.parentNode;if(i)i.replaceChild(r,s);else{let a=t.indexOf(s);a!==-1&&(t[a]=r)}}}function Vi(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 o=null;try{o=r.querySelector(`#${CSS.escape(t)}`)}catch{o=null}if(o)return o}}return null}function Ki(e){if(!(!e||!e.start))for(let t=e.start.nextSibling;t&&t!==e.end;t=t.nextSibling)t.nodeType===1&&Ee(t)}function fs(e,t,n,r,o){try{typeof sessionStorage<"u"&&(!r||t||n)&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}if(r&&!t&&!n){let f=document.querySelector('script[type="importmap"]'),h=f?f.getAttribute("data-webjs-build"):null,u=!1;if(o&&h&&(u=o!==h),!u&&e.head&&e.head.children.length>0){let b=Pr(document),g=Pr(e);b!==g&&(u=!0)}if(u&&typeof location<"u")try{let b="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(b))sessionStorage.removeItem(b);else{sessionStorage&&sessionStorage.setItem(b,"1"),location.href=r;return}}catch{location.href=r;return}else if(!u)try{typeof sessionStorage<"u"&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}}if(t){let f=document.querySelector(`webjs-frame#${CSS.escape(t)}`),h=e.querySelector(`webjs-frame#${CSS.escape(t)}`);if(f&&h){Cn(e.head),Ct(()=>{Ji(f,h),Rt(f),Ee(f),vt()},()=>Ee(f)),Br(e.body);return}let u=new CustomEvent("webjs:frame-missing",{bubbles:!0,cancelable:!0,detail:{frameId:t,url:r||(typeof location<"u"?location.href:null),document:e}});(f||document).dispatchEvent(u),u.defaultPrevented||console.warn(`[webjs] frame "${t}" was not in the navigation response, leaving it unchanged. Handle "webjs:frame-missing" (preventDefault) to override.`);return}let s=je(document.body),i=je(e.body),a=Jr(s,i);if(a){Cn(e.head),Ct(()=>{Gi(s.get(a),i.get(a),e),vt()},()=>Ki(s.get(a))),Br(e.body);return}ms(e.head),us(document.body,e.body);let c=[...e.body.childNodes];Ct(()=>{document.body.replaceChildren(...c),Rt(document.body),Ee(document.body),vt()},()=>Ee(document.body))}function vt(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function Gi(e,t,n){if(!e||!t)return;let r=e.start.parentNode;if(!r)return;let o=[];for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)o.push(i);let s=[];for(let i=t.start.nextSibling;i&&i!==t.end;i=i.nextSibling)s.push(document.importNode(i,!0));jn(o,s),Yi(r,e.start,e.end,o,s);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&(Rt(i),Ee(i))}function Yi(e,t,n,r,o){let s=new Map;for(let c of r){if(c.nodeType!==1)continue;let l=Ne(c);l&&s.set(l,c)}let i=n,a=[];for(let c of o){if(c.nodeType===1){let l=Ne(c);if(l&&s.has(l)){let f=s.get(l);jt(f,c),a.push(f),s.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 jt(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),!An.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])An.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);Rn(e,t)}function Rn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(a=>document.importNode(a,!0));jn(n,r);let o=new Map;for(let a of n){if(a.nodeType!==1)continue;let c=Ne(a);c&&o.set(c,a)}let s=[];for(let a=0;a<r.length;a++){let c=r[a];if(c.nodeType===1){let l=Ne(c);if(l&&o.has(l)){let h=o.get(l);jt(h,c),s.push(h),o.delete(l);continue}let f=n[a];if(f&&f.nodeType===1&&!Ne(f)&&f.tagName===c.tagName){jt(f,c),s.push(f);continue}}else if(c.nodeType===3){let l=n[a];if(l&&l.nodeType===3){l.nodeValue!==c.nodeValue&&(l.nodeValue=c.nodeValue),s.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),s.push(l);continue}}s.push(c)}let i=new Set(s);for(let a of n)!i.has(a)&&a.parentNode===e&&e.removeChild(a);for(let a=0;a<s.length;a++){let c=s[a];(c.parentNode!==e||e.childNodes[a]!==c)&&e.insertBefore(c,e.childNodes[a]||null)}}function Ne(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}function ds(){let e=je(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),o=[];for(let i=r.start.nextSibling;i&&i!==r.end;i=i.nextSibling)o.push(i);let s=document.createRange();return s.setStartAfter(r.start),s.setEndBefore(r.end),s.deleteContents(),r.start.parentNode.insertBefore(n.content.cloneNode(!0),r.end),{slot:r,oldChildren:o,token:j}}function Ve(e){if(!e||e.token!==j)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 o of n)t.start.parentNode.insertBefore(o,t.end)}function Ji(e,t){Rn(e,t)}function hs(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function Ln(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=hs();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function ps(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=hs();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function ue(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function Cn(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(ue(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(ue(r))||(r.tagName==="SCRIPT"?document.head.appendChild(Ln(r)):document.head.appendChild(ps(r))))}function ms(e){let t=document.head,n=e.querySelector("title");n&&(document.title=n.textContent||"");let r=new Set;for(let s of t.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&r.add(ue(s));let o=new Set;for(let s of e.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&o.add(ue(s));for(let s of[...t.children])s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&s.tagName!=="TITLE"&&(o.has(ue(s))||s.remove());for(let s of e.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&s.tagName!=="TITLE"&&(r.has(ue(s))||(s.tagName==="SCRIPT"?t.appendChild(Ln(s)):t.appendChild(ps(s))))}function Ee(e){typeof customElements>"u"||On(e)}function On(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&&On(n.shadowRoot))}function Br(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]"))document.body.appendChild(t.cloneNode(!0))}async function bs(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="",o="<template data-webjs-resolve",s="<!--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(s);if(l!==-1)return{shell:r.slice(0,l),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(l+s.length)};let f=r.indexOf(o);if(f!==-1)return{shell:r.slice(0,f),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(f)};if(c)return{shell:r,streaming:!1};let h=i.exec(r);if(h){let u=h.index+h[0].length;return{shell:r.slice(0,u),streaming:!0,reader:t,dec:n,rest:r.slice(u)}}}}function gs(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,o=/<(\/?)template\b[^>]*>/gi;o.lastIndex=r;let s=1,i;for(;i=o.exec(e);)if(i[1]==="/"){if(s--,s===0)return{id:n,content:e.slice(r,i.index),rest:e.slice(i.index+i[0].length)}}else s++;return null}function ys(e,t){let n=document.getElementById(e);if(!n)return;let r=document.createElement("template");r.innerHTML=t;let o=[...r.content.childNodes];n.replaceWith(r.content);for(let s of o)s.nodeType===1&&On(s)}async function ws(e,t,n,r){let o=n,s=()=>{let i;for(;i=gs(o);){if(!r())return!1;ys(i.id,i.content),o=i.rest}return!0};if(!e){s();return}try{for(;;){if(!s()){try{await e.cancel()}catch{}return}let{value:i,done:a}=await e.read();if(i&&(o+=t.decode(i,{stream:!0})),a){o+=t.decode(),s();return}}}catch{}}function Rt(e){for(let t of e.querySelectorAll("script"))t.replaceWith(Ln(t))}function Zi(e){return L.get(de(e))||null}function Qi(){return le.size}function Xi(){L.clear(),le.clear(),ke.length=0,Ke.clear(),Ot()}function ea(){return j}function ta(){return++j}function na(){return U}function ra(e){U=e}function sa(e){return Lt.test(e)}var Mr,fe,I,j,yn,U,At,Lt,Yr,$r,$i,O,Fi,Xr,es,qi,Ui,L,le,ke,Ke,xe,Ge,Y,Tt,Nt,An,mn=Re(()=>{pn();St();St();Ir();Mr="text/vnd.webjs-stream.html";fe=!1,I=null,j=0,yn=null;U=null,At=null;Lt=/\.(?: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;Yr="_top";$r=new Set;$i=16,O=new Map;Fi=8,Xr=3e4,es=3,qi=24,Ui=100,L=new Map,le=new Set,ke=[],Ke=new Set,xe=null,Ge=null,Y=null;Tt=new WeakMap;Nt=new WeakMap;An=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);vn()});function $t(e,...t){return{_$webjs:"template",strings:e,values:t}}function N(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var v="w$";function Es(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 pe(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function Pt(e,t){if(!(!t||!t.length))if("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){let n=t.map(r=>{let o=new CSSStyleSheet;return o.replaceSync(r.text),o});e.adoptedStyleSheets=n}else{let n=e,r=document.createElement("style");r.textContent=t.map(o=>o.text).join(`
|
|
2
|
-
`),n.appendChild(r)}}function
|
|
3
|
-
`)}</style>`}function Xe(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function P(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}var Fn=Symbol.for("webjs.repeat");function qn(e,t,n){return{[Fn]:!0,items:[...e],keyFn:t,templateFn:n}}function J(e){return!!e&&typeof e=="object"&&e[Fn]===!0}function Bt(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function me(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function ks(e){return{_$webjs:"live",value:e}}function be(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function xs(e,t){return{_$webjs:"keyed",key:e,value:t}}function Z(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function Ts(e,t){return{_$webjs:"guard",deps:e,fn:t}}function Q(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function Ns(e){return{_$webjs:"template-content",template:e}}function ge(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function js(e){return{_$webjs:"ref",target:e}}function X(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function Rs(){return{value:void 0}}function Ls(e){return{_$webjs:"cache",value:e}}function ee(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function Os(...e){return{_$webjs:"until",args:e}}function te(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function Is(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function ye(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function Ms(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function we(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function $s(e){return{_$webjs:"watch",signal:e}}function ne(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var B=null,H=!1,Se=0,_e=null,Ft=0,Un=(e,t)=>Object.is(e,t),tt=()=>{},Dn=()=>!1;function Hn(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)Hn(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function Le(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)Le(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function zt(e){if(H)throw new Error("Signal read during notification phase");if(B===null)return;let t=B,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&Dt(t)&&Le(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,Dt(t)&&Hn(e,t)),t.producerLastReadVersions[n]=e.version}function Dt(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function Wn(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=H;H=!0;try{for(let n of e.liveConsumers)n.dirty||Ps(n)}finally{H=t}}function Ps(e){e.dirty=!0,Wn(e),e.consumerMarkedDirty.call(e.wrapper||e)}function nt(e){if(!(!e.dirty&&e.lastCleanEpoch===Se)){if(!e.producerMustRecompute()&&!Bs(e)){e.dirty=!1,e.lastCleanEpoch=Se;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=Se}}function Bs(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(nt(n),r!==n.version))return!0}return!1}function Ht(e){e&&(e.nextProducerIndex=0);let t=B;return B=e,t}function Wt(e,t){if(B=t,!!e){if(Dt(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)Le(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var rt=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=Se,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=Dn,this.producerRecomputeValue=tt,this.consumerMarkedDirty=tt,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||Un,this.watched=n?.[Vt],this.unwatched=n?.[Kt]}get(){return zt(this),this.__value}peek(){return this.__value}set(t){if(H)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,Se++,_e!==null?zn(this):Wn(this))}};function zn(e){let t=H;H=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?_e.add(n):zn(n))}finally{H=t}}var qt=Symbol("unset"),Ut=Symbol("computing"),et=Symbol("errored"),Oe=class{constructor(t,n){this.__fn=t,this.__value=qt,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||Un,this.watched=n?.[Vt],this.unwatched=n?.[Kt];let r=this;this.producerMustRecompute=function(){return r.__value===qt||r.__value===Ut},this.producerRecomputeValue=function(){if(r.__value===Ut)throw new Error("Detected cycle in computations.");let o=r.__value;r.__value=Ut;let s=Ht(r),i,a=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=et,r.__error=l,a=!0}finally{Wt(r,s)}if(!a&&(o!==qt&&o!==et)&&r.__equal.call(r.wrapper,o,i)){r.__value=o;return}r.__value=i,r.version++},this.consumerMarkedDirty=tt}get(){if(nt(this),zt(this),this.__value===et)throw this.__error;return this.__value}peek(){if(nt(this),this.__value===et)throw this.__error;return this.__value}},st=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=Se,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=Dn,this.producerRecomputeValue=tt,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=Ht(this);try{for(let r of t)zt(r),r.__isComputed&&nt(r)}finally{Wt(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(Le(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=Ht(this),r;try{r=t()}finally{Wt(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)Le(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},Vt=Symbol("watched"),Kt=Symbol("unwatched");function Fs(e){let t=B;B=null;try{return e()}finally{B=t}}function qs(e){return e.producers.slice()}function Us(e){return e.liveConsumers?[...e.liveConsumers]:[]}function Ds(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function Hs(e){return e.producers.length>0}function Ws(){return B&&B.__isComputed?B:null}function zs(e){Ft++,_e===null&&(_e=new Set);try{e()}finally{if(Ft--,Ft===0){let t=_e;_e=null;for(let n of t)n.__fire()}}}var Ie={State:rt,Computed:Oe,subtle:{Watcher:st,untrack:Fs,introspectSources:qs,introspectSinks:Us,hasSinks:Ds,hasSources:Hs,currentComputed:Ws,watched:Vt,unwatched:Kt}};function Vs(e,t){return new rt(e,t)}function Ks(e,t){return new Oe(e,t)}function Gs(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function Ys(e){let t=!1,n=!1,r=new Oe(e),o=new st(()=>{t||n||(t=!0,queueMicrotask(()=>{if(t=!1,!n){try{r.get()}catch(s){console.error(s)}o.watch()}}))});o.watch(r);try{r.get()}catch(s){console.error(s)}return()=>{n||(n=!0,o.dispose())}}var Js=`${v}s`,Zs=`${v}e`;function Vn(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===Js||t===Zs}function Qs(e){for(let t of e.addedNodes)if(Vn(t))return!0;for(let t of e.removedNodes)if(Vn(t))return!0;return!1}function Zn(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var $e=Zn(),re=Symbol("webjs.slot.state"),W="data-webjs-light",se="data-projection",Pe="actual",Qn="fallback",ct=Symbol("webjs.slot.fallbackFrag"),Xs=64,Me=null,Gt=null,ot=null,Kn=!1;function eo(){Kn||($e=Zn(),$e&&(Me=HTMLSlotElement.prototype.assignedNodes,Gt=HTMLSlotElement.prototype.assignedElements,ot=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(W)&&!Gn(this)?Yt(this,t):Me?Me.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(W)&&!Gn(this)?Yt(this,t).filter(n=>n.nodeType===1):Gt?Gt.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=ot&&ot.get?ot.get.call(this):null;return t||to(this)}}),Kn=!0))}eo();function Gn(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 Yt(e,t){if(e.getAttribute(se)===Qn)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:Jt(n,new Set,0)}function Jt(e,t,n){if(n>=Xs)return e.slice();let r=[];for(let o of e)if(o.nodeType===1&&o.tagName==="SLOT"){let s=o;if(t.has(s))continue;if(t.add(s),s.hasAttribute(W)){let i=Yt(s,{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(s.childNodes),t,n+1))r.push(a)}else if(Me){let i=Me.call(s,{flatten:!0});for(let a of i)r.push(a)}else r.push(o)}else r.push(o);return r}function to(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(W))return t.getAttribute(se)===Pe?t:null;t=t.parentElement}return null}function z(e){let t=e,n=t[re];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[re]=n),n}function Zt(e){return!!e[re]}function Xn(e){let t=z(e);for(;e.firstChild;){let n=e.firstChild,r=it(n);at(t.assignedByName,r,n),e.removeChild(n)}}function er(e){let t=z(e),n=e.querySelectorAll(`slot[${W}]`);for(let r of n){let o=r;if(o.getAttribute(se)!==Pe)continue;let s=o.getAttribute("name")||null;if(!t.assignedByName.has(s)){let i=Array.from(o.childNodes);t.assignedByName.set(s,i),t.lastSnapshot.set(o,i.slice())}}}function it(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function at(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function tr(e,t,n){if(!n.length)return;let r=e.get(t);r||(r=[],e.set(t,r));for(let o of n)r.push(o)}function nr(e){if(!$e)return;let t=z(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let o of n)if(!Qs(o)){if(o.type==="childList"){for(let s of o.addedNodes)s.parentElement===e&&(at(t.assignedByName,it(s),s),r=!0);for(let s of o.removedNodes)e.contains(s)||Yn(t,s)&&(r=!0)}else if(o.type==="attributes"&&o.attributeName==="slot"){let s=o.target;(Yn(t,s)||s.parentElement===e)&&(at(t.assignedByName,it(s),s),r=!0)}}r&<(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function rr(e){let t=e[re];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 Yn(e,t){for(let[n,r]of e.assignedByName){let o=r.indexOf(t);if(o!==-1)return r.splice(o,1),r.length===0&&e.assignedByName.delete(n),!0}return!1}function lt(e){let t=z(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,no(e)}))}function no(e){if(!$e)return;let t=e[re];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${W}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||ro(t,i);for(let i of r)t.ownedSlots.has(i)||io(e,i);t.ownedSlots=r;let o=new Map;for(let i of n){let a=i.getAttribute("name")||null,c=o.get(a);c||(c=[],o.set(a,c)),c.push(i)}for(let i of o.keys()){let a=t.pendingByName.get(i);if(a&&a.length){let c=t.assignedByName.get(i)||[],l=[];for(let f of a)l.push(f);for(let f of c)l.indexOf(f)===-1&&l.push(f);t.assignedByName.set(i,l),t.pendingByName.delete(i)}}let s=[];for(let[i,a]of o){let c=t.assignedByName.get(i)||[];for(let l=0;l<a.length;l++){let f=a[l];l===0&&c.length>0?so(t,f,c)&&s.push(f):oo(t,f)&&s.push(f)}}for(let i of s)ao(i)}function ro(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 o=t.getAttribute("name")||null;tr(e.pendingByName,o,r)}e.lastSnapshot.delete(t)}function so(e,t,n){let r=t.getAttribute(se)!==Pe,o=e.lastSnapshot.get(t)||[];if(!r&&co(o,n))return!1;let i=t[ct];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(se,Pe),e.lastSnapshot.set(t,n.slice()),!0}function oo(e,t){let n=t.getAttribute(se)===Pe;if(t.setAttribute(se,Qn),!n)return Jn(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return Jn(t),!0}function Jn(e){let t=e[ct];!t||t.childNodes.length===0||e.appendChild(t)}function io(e,t){if(!$e)return;let n=z(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>lt(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function sr(e,t){if(!Zt(e))return;let n=z(e),r=n.lastSnapshot.get(t);if(!r||r.length===0)return;let o=t.getAttribute("name")||null;for(let i of r)i.parentNode===t&&t.removeChild(i);tr(n.pendingByName,o,r),n.lastSnapshot.delete(t);let s=n.nameObservers.get(t);s&&(s.disconnect(),n.nameObservers.delete(t)),n.ownedSlots.delete(t)}function ao(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function co(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 or=new WeakMap,Qt=Symbol.for("webjs.instance");function ve(e,t){let n=t,r=n[Qt];if(N(e)){let o=e;if(r&&r.strings===o.strings){Ae(r,o.values);return}r&&ir(r,t);let s=t.firstChild;s&&s.nodeType===8&&s.data==="webjs-hydrate"&&s.remove();let i=fo(o,t);n[Qt]=i;return}if(r&&ir(r,t),n[Qt]=null,t.replaceChildren(),!(e==null||e===!1||e===!0)){if(Array.isArray(e)){for(let o of e){let s=document.createTextNode(String(o??""));t.appendChild(s)}return}t.appendChild(document.createTextNode(String(e)))}}function ft(e){let{strings:t}=e,n=or.get(t);if(n)return n;let r=[],o="",s="text",i="",a=0,c="",l=0,f=null,h="",u="";for(let g=0;g<t.length;g++){let m=t[g];for(let p=0;p<m.length;p++){let d=m[p];switch(s){case"text":o+=d,d==="<"&&(s="tag-open");break;case"tag-open":o+=d,d==="!"?s="bang-1":d==="/"?(s="tag-name",h=""):/[a-zA-Z]/.test(d)?(s="tag-name",h=d.toLowerCase()):s="text";break;case"bang-1":o+=d,s=d==="-"?"bang-dash":"tag-name";break;case"bang-dash":o+=d,d==="-"?(s="comment",l=0):s="tag-name";break;case"comment":o+=d,d==="-"?l+=1:(d===">"&&l>=2&&(s="text"),l=0);break;case"tag-name":o+=d,d===">"?(s=h==="script"||h==="style"?"rawtext":"text",s==="rawtext"&&(u="")):/\s/.test(d)?s="in-tag":h+=d.toLowerCase();break;case"in-tag":o+=d,d===">"?(s=h==="script"||h==="style"?"rawtext":"text",s==="rawtext"&&(u="")):!/\s/.test(d)&&d!=="/"&&(s="attr-name",i=d,a=o.length-1);break;case"rawtext":o+=d,u=(u+d.toLowerCase()).slice(-9),(u.endsWith("<\/script>")||u.endsWith("</style>"))&&(s="text",u="",h="");break;case"attr-name":d==="="?(s="after-eq",o+=d):/\s/.test(d)?(s="in-tag",i="",o+=d):d===">"?(s="text",i="",o+=d):(i+=d,o+=d);break;case"after-eq":d==='"'||d==="'"?(s="attr-quoted",c=d,o+=d):/\s/.test(d)?(s="in-tag",i="",o+=d):d===">"?(s="text",i="",o+=d):(s="attr-unquoted",o+=d);break;case"attr-unquoted":/\s/.test(d)?(s="in-tag",i="",o+=d):(d===">"&&(s="text",i=""),o+=d);break;case"attr-quoted":o+=d,d===c&&(s="in-tag",i="");break;case"skip-attr":if(d===c){if(f){let y=f.firstPartIdx,w=[];for(let C=y;C<r.length;C++)(r[C].kind==="noop"||r[C].kind==="attr-mixed")&&w.push(C);let S=[],A=t[w[0]],E=A.lastIndexOf(c);S.push(E>=0?A.slice(E+1):A);for(let C=1;C<w.length;C++)S.push(t[w[C]]);let T=t[w[w.length-1]+1],M=T.indexOf(c);S.push(M>=0?T.slice(0,M):T),r[y]={kind:"attr-mixed",path:[],name:f.name,statics:S,group:w},f=null}s="in-tag",i=""}break}}if(g<t.length-1){let p=r.length;if(s==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(s==="rawtext"){u="",r.push({kind:"noop",path:[]});continue}if(s==="text")o+=`<!--${v}${p}-->`,r.push({kind:"child",path:[]});else if(s==="in-tag"){let d=`data-${v}${p}`;o+=`${d}=""`,r.push({kind:"element",path:[]})}else if(s==="after-eq"){let d=i[0],y=i.slice(1);if(d==="@"||d==="."||d==="?"){o=o.slice(0,a);let w=d==="@"?"event":d==="."?"prop":"bool",S=`data-${v}${p}`;o+=`${S}=""`,r.push({kind:w,path:[],name:y})}else{o=o.slice(0,a);let w=`data-${v}${p}`;o+=`${w}=""`,r.push({kind:"attr",path:[],name:i})}s="in-tag",i=""}else if(s==="attr-quoted"||s==="attr-unquoted"){o=o.slice(0,a);let d=`data-${v}${p}`;o+=`${d}=""`,f={name:i,firstPartIdx:p},r.push({kind:"noop",path:[]}),s="skip-attr"}else s==="skip-attr"&&r.push({kind:"noop",path:[]})}}let b=document.createElement("template");return b.innerHTML=o,lo(b.content,r),uo(b.content,r),n={templateEl:b,parts:r},or.set(t,n),n}function lo(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(W,"");let o=t.length;r.setAttribute(`data-${v}${o}`,""),t.push({kind:"slot",path:[]})}}function uo(e,t){let n=[];function r(o){for(let s=0;s<o.childNodes.length;s++){let i=o.childNodes[s];if(n.push(s),i.nodeType===8){let a=i.data;if(a.startsWith(v)){let c=Number(a.slice(v.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-${v}`)){let f=Number(l.name.slice(`data-${v}`.length));t[f]&&t[f].kind!=="child"&&(t[f].path=n.slice()),c.push(l.name)}for(let l of c)a.removeAttribute(l);r(i)}n.pop()}}r(e)}function fo(e,t){let{templateEl:n,parts:r}=ft(e),o=n.content.cloneNode(!0),s=document.createComment(`${v}s`),i=document.createComment(`${v}e`),a=r.map(l=>dt(l,o)),c=[];for(let l=0;l<e.values.length;l++)oe(a[l],e.values[l],void 0,e.values),c.push(e.values[l]);t.replaceChildren(s,...o.childNodes,i);for(let l of a)l.kind==="slot"&&oe(l,void 0,void 0,[]);return{strings:e.strings,bound:a,lastValues:c,startNode:s,endNode:i}}function dt(e,t){if(e.kind==="noop")return{kind:"noop"};let n=t;for(let o of e.path)n=n.childNodes[o];if(e.kind==="child")return{kind:"child",marker:n};let r=n;if(e.kind==="event"){let o={kind:"event",el:r,name:e.name||"",handler:null,dispatcher(s){o.handler?.(s)}};return r.addEventListener(o.name,o.dispatcher),o}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 Ae(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(oe(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function ir(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=Xt(n.slotEl);r&&sr(r,n.slotEl)}}t.replaceChildren()}function oe(e,t,n,r){if(be(t)){let o=t.value;if(e.kind==="prop"&&e.el[e.name]===o||e.kind==="attr"&&e.el.getAttribute(e.name)===String(o)||e.kind==="bool"&&e.el.hasAttribute(e.name)===!!o)return;t=o}switch(e.kind){case"child":mo(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":po(e,t);break;case"attr-mixed":{let o=e,s=o.statics[0];for(let i=0;i<o.group.length;i++)s+=String((r?r[o.group[i]]:t)??""),s+=o.statics[i+1]||"";e.el.setAttribute(e.name,s);break}case"slot":{if(e.applied)break;let o=e.slotEl,s=()=>{e.applied=!0;let a=Xt(o);if(!a||ho(o))return;let c=document.createDocumentFragment();for(;o.firstChild;)c.appendChild(o.firstChild);o[ct]=c,lt(a)};Xt(o)?s():queueMicrotask(s);break}case"noop":break}}function Xt(e){let t=e.parentElement;for(;t;){if(t[re])return t;t=t.parentElement}return null}function ho(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 po(e,t){let n=e,r=X(t)?t.target:void 0,o=n.__refTarget,s=r!==o;if(s&&o)if(typeof o=="function")try{o(void 0)}catch{}else typeof o=="object"&&(o.value=void 0);if(s||n.__refElement!==e.el){if(n.__refTarget=r,r)if(typeof r=="function"){if(!s&&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 mo(e,t){return vo(e,t),F(e,t)}function F(e,t){let n=e.marker;if(me(t)){V(e);let o=String(t.value??""),s=document.createElement("template");s.innerHTML=o;let i=[...s.content.childNodes],a=document.createDocumentFragment();for(let c of i)a.appendChild(c);n.parentNode?.insertBefore(a,n),e.child=i;return}if(Z(t)){let o=t,s=e.__keyedKey;s!==void 0&&!Object.is(s,o.key)&&V(e),e.__keyedKey=o.key,F(e,o.value);return}if(Q(t)){let o=t,s=e.__guardDeps,i=o.deps;if(s!==void 0&&(Array.isArray(s)&&Array.isArray(i)?Co(s,i):Object.is(s,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,F(e,o.fn());return}if(ge(t)){V(e);let o=t.template;if(o&&o.content){let s=o.content.cloneNode(!0),i=[...s.childNodes];n.parentNode?.insertBefore(s,n),e.child=i}return}if(X(t))return;if(ee(t))return Eo(e,t.value);if(te(t))return ko(e,t.args);if(ne(t))return xo(e,t.signal);if(ye(t))return To(e,t);if(we(t))return No(e,t);if(J(t)){if(e.child&&e.child.kind==="repeat"){yo(e,t);return}V(e);let o={kind:"repeat",map:new Map};e.child=o,go(n,o,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){So(e,t);return}V(e);let o={kind:"array",items:[]};e.child=o,_o(n,o,t);return}if(e.child){let o=e.child;if(o.kind==="repeat")ar(o),e.child=void 0;else if(o.kind==="array")lr(o),e.child=void 0;else if(o.kind==="async-stream")hr(o),e.child=void 0;else if("strings"in e.child){let s=e.child;if(N(t)&&s.strings===t.strings){Ae(s,t.values);return}Ce(s.startNode,s.endNode),e.child=void 0}else{for(let s of e.child)s.parentNode&&s.parentNode.removeChild(s);e.child=void 0}}if(t==null||t===!1||t===!0)return;if(N(t)){let o=t,{templateEl:s,parts:i}=ft(o),a=s.content.cloneNode(!0),c=document.createComment(`${v}s`),l=document.createComment(`${v}e`),f=i.map(b=>dt(b,a)),h=[];for(let b=0;b<o.values.length;b++)oe(f[b],o.values[b],void 0,o.values),h.push(o.values[b]);let u=[c,...a.childNodes,l];n.parentNode?.insertBefore(bo(u),n);for(let b of f)b.kind==="slot"&&oe(b,void 0,void 0,[]);e.child={strings:o.strings,bound:f,lastValues:h,startNode:c,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function bo(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function Ce(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 tn(e){let{templateEl:t,parts:n}=ft(e),r=t.content.cloneNode(!0),o=document.createComment(`${v}s`),s=document.createComment(`${v}e`),i=n.map(l=>dt(l,r)),a=[];for(let l=0;l<e.values.length;l++)oe(i[l],e.values[l],void 0,e.values),a.push(e.values[l]);let c=document.createDocumentFragment();for(c.appendChild(o);r.firstChild;)c.appendChild(r.firstChild);return c.appendChild(s),{inst:{strings:e.strings,bound:i,lastValues:a,startNode:o,endNode:s},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 go(e,t,n){let{items:r,keyFn:o,templateFn:s}=n,i=e.parentNode;if(!i)return;let a=document.createDocumentFragment();for(let c=0;c<r.length;c++){let l=o(r[c],c),f=s(r[c],c);if(!N(f))continue;let{inst:h,frag:u}=tn(f);t.map.set(l,h),a.appendChild(u)}i.insertBefore(a,e)}function yo(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let o=e.child,{items:s,keyFn:i,templateFn:a}=t,c=new Map;for(let l=0;l<s.length;l++){let f=i(s[l],l),h=a(s[l],l);if(!N(h))continue;let u=o.map.get(f);if(u&&u.strings===h.strings)Ae(u,h.values),en(u.startNode,u.endNode,r,n),c.set(f,u),o.map.delete(f);else{u&&(Be(u),Ce(u.startNode,u.endNode),o.map.delete(f));let{inst:b,frag:g}=tn(h);r.insertBefore(g,n),c.set(f,b)}}for(let l of o.map.values())Be(l),Ce(l.startNode,l.endNode);o.map=c}function ar(e){for(let t of e.map.values())Be(t),Ce(t.startNode,t.endNode);e.map.clear()}function wo(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function ut(e){e.type==="tpl"?(Be(e.inst),Ce(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function cr(e){if(N(e)){let{inst:t,frag:n}=tn(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 _o(e,t,n){let r=e.parentNode;if(!r)return;let o=document.createDocumentFragment(),s=[];for(let i of n){let{item:a,frag:c}=cr(i);c&&o.appendChild(c),s.push(a)}r.insertBefore(o,e),t.items=s}function So(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let o=e.child,s=o.items,i=[];for(let a=0;a<t.length;a++){let c=t[a],l=s[a];if(N(c)){let u=c;if(l&&l.type==="tpl"&&l.inst.strings===u.strings){Ae(l.inst,u.values),i.push(l);continue}}else if(c!=null&&c!==!1&&c!==!0){if(l&&l.type==="text"){let u=String(c);l.node.data!==u&&(l.node.data=u),i.push(l);continue}}else{l&&ut(l),i.push({type:"empty"});continue}let{item:f,frag:h}=cr(c);h&&r.insertBefore(h,Ao(s,a,n)),l&&ut(l),i.push(f)}for(let a=t.length;a<s.length;a++)ut(s[a]);o.items=i}function Ao(e,t,n){for(let r=t;r<e.length;r++){let o=wo(e[r]);if(o&&o.parentNode)return o}return n}function lr(e){for(let t of e.items)ut(t);e.items=[]}function en(e,t,n,r){if(t.nextSibling===r&&e.parentNode===n)return;let o=document.createDocumentFragment(),s=e;for(;s;){let i=s.nextSibling;if(o.appendChild(s),s===t)break;s=i}n.insertBefore(o,r)}function Co(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 V(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&ur(t),!e.child)return;let n=e.child;if(n.kind==="repeat")ar(n);else if(n.kind==="array")lr(n);else if(n.kind==="async-stream")hr(n);else if("strings"in n){let r=e.child;Be(r),Ce(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function vo(e,t){let n=e;n.__untilState&&!te(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!Q(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!ee(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!Z(t)&&(n.__keyedKey=void 0),n.__watchSub&&!ne(t)&&ur(n)}function Eo(e,t){let n=e.marker,r=e,o=r.__cacheMap;o||(o=new Map,r.__cacheMap=o);let s=e.child;if(s&&"strings"in s){let a=s;if(N(t)&&a.strings===t.strings){Ae(a,t.values);return}let c=document.createDocumentFragment();en(a.startNode,a.endNode,c,null),o.set(a.strings,{inst:a,holder:c}),e.child=void 0}if(N(t)){let a=t,c=o.get(a.strings);if(c){o.delete(a.strings),e.child&&V(e),en(c.inst.startNode,c.inst.endNode,n.parentNode,n),Ae(c.inst,a.values),e.child=c.inst;return}}F(e,t)}function ko(e,t){let n=e,r=n.__untilState,o=n.__untilArgs,s=(u,b)=>!!(Object.is(u,b)||N(u)&&N(b)&&u.strings===b.strings),a=o&&o.length===t.length&&o.every((u,b)=>s(u,t[b]))&&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,f;for(let u=0;u<t.length;u++){let b=t[u];if(!b||typeof b.then!="function"){l=u,f=b;break}}l!==-1&&l<=c.highestResolved?(F(e,f),c.highestResolved=l):l===-1&&!n.__untilEverRendered&&F(e,""),n.__untilEverRendered=!0;let h=Math.min(l===-1?t.length:l,c.highestResolved);for(let u=0;u<h;u++){let b=t[u];!b||typeof b.then!="function"||Promise.resolve(b).then(g=>{c.aborted||u>=c.highestResolved||(c.highestResolved=u,F(e,g))},()=>{})}}function xo(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let s;n.__watchSub.observe(()=>{s=t.get()}),F(e,s);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new Ie.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let s;r.observe(()=>{s=t.get()}),F(e,s)})});n.__watchSub=r;let o;r.observe(()=>{o=t.get()}),F(e,o)}function ur(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function To(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;V(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,fr(o,e,t)}function No(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;V(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,fr(o,e,t)}async function fr(e,t,n){let r=t.marker,o=0;try{for(;!e.aborted;){let s=await e.iterator.next();if(e.aborted||s.done)break;let i=n.mapper?n.mapper(s.value,o):s.value,a=dr(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),o++}}catch(s){typeof console<"u"&&console.error("[webjs] asyncStream error:",s)}}function dr(e){if(e==null||e===!1||e===!0)return[];if(N(e)){let t=e,{templateEl:n,parts:r}=ft(t),o=n.content.cloneNode(!0),s=r.map(i=>dt(i,o));for(let i=0;i<t.values.length;i++)oe(s[i],t.values[i],void 0,t.values);return[...o.childNodes]}if(Array.isArray(e)){let t=[];for(let n of e)t.push(...dr(n));return t}return[document.createTextNode(String(e))]}function hr(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 pr=Symbol.for("webjs:registry"),mr=Symbol.for("webjs:classToTag"),ht=globalThis,q=ht[pr]||(ht[pr]=new Map),br=ht[mr]||(ht[mr]=new WeakMap),pt=typeof window<"u"&&typeof customElements<"u";function nn(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=q.get(e);r?(r.cls=t,r.lazy=n):q.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),br.set(t,e)}if(pt){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),nn(t,n)}}if(!pt){let e=globalThis;e.customElements||(e.customElements={define(t,n){nn(t,n)},get(t){return q.get(t)?.cls},upgrade(){},whenDefined(t){let n=q.get(t);return Promise.resolve(n?.cls)}})}function rn(e,t){pt?customElements.define(e,t):nn(e,t)}function jo(e,t){if(pt)return;let n=q.get(e);if(n){n.moduleUrl=t;return}q.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function sn(e){return q.get(e)?.cls}function Ro(e){return q.get(e)?.moduleUrl||null}function Lo(e){return q.get(e)?.lazy===!0}function mt(e){return br.get(e)}function on(){return[...q.keys()]}var k="_$wj";async function Ue(e){return JSON.stringify(await gr(e))}function ae(e){return yr(JSON.parse(e))}async function gr(e){let t=Oo();return await Io(e,t),ie(e,t)}function yr(e){return K(e,Bo())}function Oo(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map}}async function Io(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!qo(r))continue;let o=t.refCount.get(r)||0;if(t.refCount.set(r,o+1),!(o>0)){if(typeof Blob<"u"&&r instanceof Blob){let s=new Uint8Array(await r.arrayBuffer());t.blobBytes.set(r,s);continue}if(typeof FormData<"u"&&r instanceof FormData){for(let[,s]of r.entries())typeof s!="string"&&n.push(s);continue}if(Array.isArray(r))for(let s=0;s<r.length;s++)n.push(r[s]);else if(r instanceof Map)for(let[s,i]of r)n.push(s),n.push(i);else if(r instanceof Set)for(let s of r)n.push(s);else if(Uo(r))for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&n.push(r[s])}}for(let[r,o]of t.refCount)o>1&&t.idOf.set(r,t.nextId++)}function ie(e,t){if(e===null)return null;if(e===void 0)return{[k]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[k]:"NaN"}:e===1/0?{[k]:"Inf"}:e===-1/0?{[k]:"-Inf"}:Object.is(e,-0)?{[k]:"-0"}:e;if(n==="bigint")return{[k]:"BigInt",v:e.toString()};if(n==="symbol"){let s=Symbol.keyFor(e);if(s===void 0)throw new TypeError("Cannot serialize a local Symbol; only Symbol.for() registered symbols are supported.");return{[k]:"Sym",v:s}}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{[k]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let o;if(e instanceof Date)o={[k]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)o={[k]:"Error",v:{name:e.name,message:e.message,stack:e.stack||null}};else if(typeof Blob<"u"&&e instanceof Blob){let s=t.blobBytes.get(e);typeof File<"u"&&e instanceof File?o={[k]:"File",v:qe(s),n:e.name,t:e.type||"",m:e.lastModified}:o={[k]:"Blob",v:qe(s),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let s=[];for(let[i,a]of e.entries())s.push([i,ie(a,t)]);o={[k]:"FD",v:s}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)o=Mo(e);else if(e instanceof Map){let s=[];for(let[i,a]of e)s.push([ie(i,t),ie(a,t)]);o={[k]:"Map",v:s}}else if(e instanceof Set){let s=[];for(let i of e)s.push(ie(i,t));o={[k]:"Set",v:s}}else if(Array.isArray(e))o=e.map(s=>ie(s,t));else{o={};for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let i=Do(s)?"_"+s:s;o[i]=ie(e[s],t)}}if(r!==void 0){if(Array.isArray(o))return{[k]:"Arr",_id:r,v:o};o._id=r}return o}function Mo(e){if(e instanceof ArrayBuffer)return{[k]:"buf",v:qe(new Uint8Array(e))};if(e instanceof DataView)return{[k]:"dv",v:qe(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=$o[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[k]:n,v:qe(r)}}var $o={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 Bo(){return{refs:new Map}}function K(e,t){if(e===null||typeof e!="object")return e;if(Array.isArray(e)){let s=[];for(let i=0;i<e.length;i++)s.push(K(e[i],t));return s}let n=e[k];if(typeof n=="string")return Fo(e,n,t);let r={},o=e._id;typeof o=="number"&&t.refs.set(o,r);for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s)||s==="_id")continue;let i=Ho(s)?s.slice(1):s;r[i]=K(e[s],t)}return r}function Fo(e,t,n){let r=e._id,o=s=>(typeof r=="number"&&n.refs.set(r,s),s);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 o(BigInt(e.v));case"Sym":return o(Symbol.for(e.v));case"Date":return o(e.v==null?new Date(NaN):new Date(e.v));case"Error":{let s=new Error(e.v.message);return s.name=e.v.name,e.v.stack&&(s.stack=e.v.stack),typeof r=="number"&&n.refs.set(r,s),s}case"Map":{let s=new Map;typeof r=="number"&&n.refs.set(r,s);for(let[i,a]of e.v)s.set(K(i,n),K(a,n));return s}case"Set":{let s=new Set;typeof r=="number"&&n.refs.set(r,s);for(let i of e.v)s.add(K(i,n));return s}case"Arr":{let s=[];typeof r=="number"&&n.refs.set(r,s);for(let i of e.v)s.push(K(i,n));return s}case"Ref":{let s=n.refs.get(e.v);if(s===void 0)throw new TypeError(`Dangling reference: id=${e.v}`);return s}case"Blob":{if(typeof Blob>"u")throw new TypeError("Blob is not available in this environment.");let s=Fe(e.v);return o(new Blob([s],{type:e.t||""}))}case"File":{if(typeof File>"u")throw new TypeError("File is not available in this environment.");let s=Fe(e.v);return o(new File([s],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 s=new FormData;o(s);for(let[i,a]of e.v){let c=K(a,n);s.append(i,c)}return s}default:{if(t==="buf"){let i=Fe(e.v);return o(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=Fe(e.v);return o(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let s=Po[t];if(s){let i=Fe(e.v),a=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);return o(new s(a))}throw new TypeError(`Unknown serialization tag: ${t}`)}}}function qo(e){return e!==null&&typeof e=="object"}function Uo(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Do(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function Ho(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}var wr=typeof Buffer<"u"&&typeof Buffer.from=="function";function qe(e){if(wr)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 Fe(e){if(wr){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 Ar=typeof window<"u"&&typeof HTMLElement<"u";function Wo(e,t){return e!==t}function zo(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var bt=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(),o=this.__ssrAttrs.has(r);return(n===void 0?!o: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 o=r.length-1;o>=0;o--)if(r[o]&&r[o].__ssrTag===n)return r[o];return null}get dataset(){if(this.__dataset)return this.__dataset;let t=this,n=r=>"data-"+String(r).replace(/[A-Z]/g,o=>"-"+o.toLowerCase());return this.__dataset=new Proxy({},{get(r,o){if(typeof o!="string")return;let s=t.getAttribute(n(o));return s===null?void 0:s},set(r,o,s){return typeof o=="string"&&t.setAttribute(n(o),s),!0},has(r,o){return typeof o=="string"&&t.hasAttribute(n(o))},deleteProperty(r,o){return typeof o=="string"&&t.removeAttribute(n(o)),!0},ownKeys(){return t.getAttributeNames().filter(r=>r.startsWith("data-")).map(r=>r.slice(5).replace(/-([a-z])/g,(o,s)=>s.toUpperCase()))},getOwnPropertyDescriptor(r,o){if(typeof o=="string"&&t.hasAttribute(n(o)))return{enumerable:!0,configurable:!0,value:t.getAttribute(n(o))}}}),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=zo(),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(bt.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var Ko=Ar?HTMLElement:bt,an=class e extends Ko{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){rn(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(_r)}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,o]of Object.entries(n)){let s=typeof o=="object"?o:{type:o},i=this[r];Object.defineProperty(this,r,{configurable:!0,enumerable:!0,get:()=>this.__propValues[r],set:a=>{let c=this.__propValues[r];(s.hasChanged||Wo)(a,c)&&(this.__propValues[r]=a,s.reflect&&!s.state&&this._connected&&this._reflectAttribute(r,a,s),this.requestUpdate(r,c))}}),i!==void 0&&(this.__propValues[r]=i)}}}_reflectAttribute(t,n,r){let o=_r(t);if(!this.__reflectingAttribute){this.__reflectingAttribute=!0;try{if(r.converter&&r.converter.toAttribute){let s=r.converter.toAttribute(n,r.type);s==null?this.removeAttribute(o):this.setAttribute(o,s)}else r.type===Boolean?n?this.setAttribute(o,""):this.removeAttribute(o):n==null?this.removeAttribute(o):r.type===Object||r.type===Array?this.setAttribute(o,JSON.stringify(n)):this.setAttribute(o,String(n))}finally{this.__reflectingAttribute=!1}}}connectedCallback(){if(!Ar)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 o=n[r].name;o.startsWith("data-webjs-prop-")&&t.push(o)}for(let r of t){let o=this.getAttribute(r);if(this.removeAttribute(r),o==null)continue;let s=Sr(r.slice(16));try{this[s]=ae(o)}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,o=Array.isArray(r)?r:pe(r)?[r]:[];if(o.length){if(n){let s=this.shadowRoot.querySelector("style");s&&s.remove()}Pt(this._renderRoot,o)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${mt(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().`),Zt(this)||(this.__isHydrating()?(z(this),er(this)):Xn(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&&nr(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&&rr(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 o=this.constructor,s=Sr(t),i=o.properties&&(o.properties[s]||o.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[s]!==a&&(this[s]=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 o of this.__controllers)o.hostUpdate&&o.hostUpdate();this.__renderToken=(this.__renderToken||0)+1;try{let o=this.update(t);o&&typeof o.then=="function"&&(r=o)}catch(o){this._handleRenderError(o)}if(!r){for(let o of this.__controllers)o.hostUpdated&&o.hostUpdated();n=!0}}}catch(o){console.error("[webjs] lifecycle hook threw during update phase:",o)}finally{this._isUpdating=!1,(n||r)&&(this._changedProperties=new Map)}if(r){let o=this.__renderToken;this.__pendingAsyncCommits=(this.__pendingAsyncCommits||0)+1,r.then(()=>{if(this.__pendingAsyncCommits--,o===this.__renderToken){for(let s of this.__controllers)s.hostUpdated&&s.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 Ie.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;if(this.__signalWatcher.observe(()=>{n=this.render()}),n&&typeof n.then=="function")return this._commitAsync(n);ve(n,this._renderRoot)}_commitAsync(t){let n=this.__renderToken;if(this.__firstRendered&&this._overridesRenderFallback())try{let r=this.renderFallback();r!==void 0&&ve(r,this._renderRoot)}catch(r){console.error("[webjs] renderFallback() threw:",r)}return Promise.resolve(t).then(r=>{n===this.__renderToken&&ve(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 <${mt(this.constructor)||this.tagName?.toLowerCase()}>:`,t);try{let n=this.renderError(t);n!==void 0&&ve(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 _r(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function Sr(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}var Fa=Symbol.for("webjs.suspense");function Go(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function gt(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}var cn=null;function Yo(e){cn=e}function ln(){if(!cn)return"";try{return cn()||""}catch{return""}}async function Jo(e,t={ssr:!0}){let n=t&&t.suspenseCtx,r=t&&t.dev!==void 0?t.dev:n&&n.dev;n&&n.dev===void 0&&r!==void 0&&(n.dev=r);let o=await x(e,n);return t&&t.ssr===!1?o:await G(o,n,[],r)}async function x(e,t){if(e==null||e===!1||e===!0)return"";if(e&&typeof e.then=="function")return e=await e,x(e,t);if(me(e))return String(e.value??"");if(be(e))return x(e.value,t);if(ne(e))return x(e.signal.get(),t);if(Z(e))return x(e.value,t);if(Q(e))return x(e.fn(),t);if(ge(e)){let n=e.template;return String(n?.innerHTML??"")}if(X(e))return"";if(ee(e))return x(e.value,t);if(te(e)){let n=e.args;for(let r of n)if(!r||typeof r.then!="function")return x(r,t);if(n.length>0)try{let r=await Promise.race(n.map(o=>Promise.resolve(o).catch(()=>{})));return x(r,t)}catch{return""}return""}if(ye(e)||we(e))return"";if(Array.isArray(e))return(await Promise.all(e.map(r=>x(r,t)))).join("");if(J(e)){let n=e;return(await Promise.all(n.items.map((o,s)=>x(n.templateFn(o,s),t)))).join("")}if(gt(e)){let n=e,r=await x(n.fallback,t);if(t){let o=`s${t.nextId++}`;return t.pending.push({id:o,promise:Promise.resolve(n.children)}),`<webjs-boundary id="${o}">${r}</webjs-boundary>`}return r}return N(e)?Zo(e,t):Xe(String(e))}async function Zo(e,t){let{strings:n,values:r}=e,o="",s="text",i="",a=0,c="",l=0,f="",h="";for(let u=0;u<n.length;u++){let b=n[u];for(let g=0;g<b.length;g++){let m=b[g];switch(s){case"text":o+=m,m==="<"&&(s="tag-open");break;case"tag-open":o+=m,m==="!"?s="bang-1":m==="/"?(s="tag-name",f=""):/[a-zA-Z]/.test(m)?(s="tag-name",f=m.toLowerCase()):s="text";break;case"bang-1":o+=m,s=m==="-"?"bang-dash":"tag-name";break;case"bang-dash":o+=m,m==="-"?(s="comment",l=0):s="tag-name";break;case"comment":o+=m,m==="-"?l+=1:(m===">"&&l>=2&&(s="text"),l=0);break;case"tag-name":o+=m,m===">"?(s=yt(f)?"rawtext":"text",s==="rawtext"&&(h="")):/\s/.test(m)?s="in-tag":f+=m.toLowerCase();break;case"in-tag":o+=m,m===">"?(s=yt(f)?"rawtext":"text",s==="rawtext"&&(h="")):!/\s/.test(m)&&m!=="/"&&(s="attr-name",i=m,a=o.length-1);break;case"rawtext":o+=m,h=(h+m.toLowerCase()).slice(-9),(h.endsWith("<\/script>")||h.endsWith("</style>"))&&(s="text",h="",f="");break;case"attr-name":m==="="?(s="after-eq",o+=m):/\s/.test(m)?(s="in-tag",i="",o+=m):m===">"?(s="text",i="",o+=m):(i+=m,o+=m);break;case"after-eq":m==='"'||m==="'"?(s="attr-quoted",c=m,o+=m):/\s/.test(m)?(s="in-tag",i="",o+=m):m===">"?(s="text",i="",o+=m):(s="attr-unquoted",o+=m);break;case"attr-unquoted":/\s/.test(m)?(s="in-tag",i="",o+=m):(m===">"&&(s="text",i=""),o+=m);break;case"attr-quoted":o+=m,m===c&&(s="in-tag",i="");break}}if(u<r.length){let g=r[u];if(g&&typeof g.then=="function"&&(g=await g),s==="comment")o+=String(g??""),l=0;else if(s==="rawtext")o+=String(g??""),h="";else if(s==="text")o+=await x(g,t);else if(s==="after-eq"){let m=i[0],p=i.slice(1);if(m==="@")o=o.slice(0,a),s="in-tag",i="";else if(m==="."){if(o=o.slice(0,a),f==="webjs-suspense"&&p==="fallback"){let d=await x(g,t);o+=`data-webjs-fallback="${P(d)}"`,s="in-tag",i="";continue}if(!f.includes("-")){s="in-tag",i="";continue}if(g===void 0){s="in-tag",i="";continue}try{let d=await Ue(g);o+=`data-webjs-prop-${fi(p)}="${P(d)}"`}catch(d){console.warn(`[webjs] property binding .${p} has an unserializable value during SSR. Dropping. The browser will see the property as undefined. Detail: ${d&&d.message}`)}s="in-tag",i=""}else m==="?"?(o=o.slice(0,a),g&&(o+=`${p}=""`),s="in-tag",i=""):(o+=`"${P(String(g??""))}"`,s="in-tag",i="")}else(s==="attr-quoted"||s==="attr-unquoted")&&(o+=P(String(g??"")))}}return o}var Qo=new Set(["document","window","localStorage","sessionStorage","navigator","matchMedia","requestAnimationFrame","getComputedStyle","IntersectionObserver","MutationObserver","ResizeObserver"]),Xo=new Set(["attachShadow","querySelector","querySelectorAll","getBoundingClientRect","focus","blur","scrollIntoView"]);function ei(e){let t=e&&typeof e.message=="string"?e.message:"",n=/^(\w+) is not defined$/.exec(t);return e instanceof ReferenceError&&n&&Qo.has(n[1])?`\`${n[1]}\` is a browser-only global and is undefined during SSR.`:(n=/\.(\w+) is not a function$/.exec(t),e instanceof TypeError&&n&&Xo.has(n[1])?`\`${n[1]}\` is an HTMLElement method that does not exist on the server-side component instance during SSR.`:null)}function ti(){return typeof process<"u"&&process.env&&!0}function Er(e,t,n){if(!(n===void 0?!ti():!!n))return"";let o=t&&t.message?t.message:String(t);return $t`<div data-webjs-error="${e}" style="border:1px solid #f5c2c7;background:#f8d7da;color:#842029;padding:8px 12px;border-radius:6px;font:13px/1.4 system-ui,sans-serif">
|
|
1
|
+
var Rs=Object.defineProperty;var Z=(e,t)=>()=>(e&&(t=e(e=0)),t);var Dn=(e,t)=>{for(var n in t)Rs(e,n,{get:t[n],enumerable:!0})};async function De(e){return JSON.stringify(await Sr(e))}function D(e){return Ar(JSON.parse(e))}async function Sr(e){let t=Fo();return await Uo(e,t),ce(e,t)}function Ar(e){return G(e,zo())}function Fo(){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(!Ko(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 ce(e,t){if(e===null)return null;if(e===void 0)return{[x]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[x]:"NaN"}:e===1/0?{[x]:"Inf"}:e===-1/0?{[x]:"-Inf"}:Object.is(e,-0)?{[x]:"-0"}:e;if(n==="bigint")return{[x]:"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{[x]:"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{[x]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let s;if(e instanceof Date)s={[x]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)s={[x]:"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={[x]:"File",v:Ue(o),n:e.name,t:e.type||"",m:e.lastModified}:s={[x]:"Blob",v:Ue(o),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let o=[];for(let[i,a]of e.entries())o.push([i,ce(a,t)]);s={[x]:"FD",v:o}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)s=Do(e);else if(e instanceof Map){let o=[];for(let[i,a]of e)o.push([ce(i,t),ce(a,t)]);s={[x]:"Map",v:o}}else if(e instanceof Set){let o=[];for(let i of e)o.push(ce(i,t));s={[x]:"Set",v:o}}else if(Array.isArray(e))s=e.map(o=>ce(o,t));else{s={};for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i=Yo(o)?"_"+o:o;s[i]=ce(e[o],t)}}if(r!==void 0){if(Array.isArray(s))return{[x]:"Arr",_id:r,v:s};s._id=r}return s}function Do(e){if(e instanceof ArrayBuffer)return{[x]:"buf",v:Ue(new Uint8Array(e))};if(e instanceof DataView)return{[x]:"dv",v:Ue(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{[x]:n,v:Ue(r)}}function zo(){return{refs:new Map}}function G(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(G(e[i],t));return o}let n=e[x];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=Jo(o)?o.slice(1):o;r[i]=G(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(G(i,n),G(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(G(i,n));return o}case"Arr":{let o=[];typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.push(G(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=Fe(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=Fe(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=G(a,n);o.append(i,c)}return o}default:{if(t==="buf"){let i=Fe(e.v);return s(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=Fe(e.v);return s(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let o=Wo[t];if(o){let i=Fe(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 Ko(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 Yo(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function Jo(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}function Ue(e){if(Cr)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 Fe(e){if(Cr){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 x,Ho,Wo,Cr,xe=Z(()=>{x="_$wj";Ho={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},Wo={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};Cr=typeof Buffer<"u"&&typeof Buffer.from=="function"});var Ir={};Dn(Ir,{observeLazy:()=>Ii,observeViewportOnce:()=>Pi});function Or(e){let t=mn.get(e);return t||(t=import(e).finally(()=>mn.delete(e)),mn.set(e,t),t)}function Ii(e){for(let[t,n]of Object.entries(e))le.set(t.toLowerCase(),n);if(typeof IntersectionObserver>"u"){for(let t of le.values())Or(t);le.clear();return}Ve||(Ve=new IntersectionObserver(Mi,{rootMargin:"200px"})),Lr(),typeof MutationObserver<"u"&&new MutationObserver(()=>Lr()).observe(document.body,{childList:!0,subtree:!0})}function Lr(){if(!(!Ve||!le.size))for(let e of le.keys())for(let t of document.querySelectorAll(e))Ve.observe(t)}function Mi(e){for(let t of e){if(!t.isIntersecting)continue;let n=t.target.tagName.toLowerCase(),r=le.get(n);r&&(Or(r),le.delete(n),Ve?.unobserve(t.target))}}function $i(e){for(let t of e){if(!t.isIntersecting)continue;let n=At.get(t.target);At.delete(t.target),ze?.unobserve(t.target),n&&n()}}function Pi(e,t){return typeof IntersectionObserver>"u"?(t(),()=>{}):(ze||(ze=new IntersectionObserver($i,{rootMargin:"200px"})),At.set(e,t),ze.observe(e),()=>{At.delete(e),ze?.unobserve(e)})}var le,Ve,mn,ze,At,Mr=Z(()=>{le=new Map,Ve=null,mn=new Map;ze=null,At=new WeakMap});var bn,gn=Z(()=>{bn=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(()=>(Mr(),Ir)).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(()=>(yn(),$r)).then(({loadFrame:n})=>{this._webjsLoadedSrc!==t||!this.isConnected||n(this,t)})}}:null;typeof customElements<"u"&&bn&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",bn)});function qi(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 _n(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 Bi,wn,Ct=Z(()=>{Bi=new Set(["append","prepend","before","after","replace","update"]);wn=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=Bi.has(t)?this.querySelector("template"):null;try{for(let i of r){let a=o?o.content.cloneNode(!0):null;qi(t,i,a)}}finally{this.remove()}}}:null;typeof customElements<"u"&&wn&&!customElements.get("webjs-stream")&&customElements.define("webjs-stream",wn)});var Pr,Br=Z(()=>{Pr=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this.style.display||(this.style.display="contents")}}:null;typeof customElements<"u"&&Pr&&!customElements.get("webjs-suspense")&&customElements.define("webjs-suspense",Pr)});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]'))Fr(n.textContent,n);for(let n of t.querySelectorAll("[data-webjs-seed]"))Fr(n.getAttribute("data-webjs-seed"),n,()=>n.removeAttribute("data-webjs-seed"))}}function Fr(e,t,n){if(e)try{let r=D(e);if(r&&typeof r=="object")for(let s in r)Ke.has(s)||Ke.set(s,r[s])}catch{}n?n():t.remove?.()}function Fi(e,t,n){qr||(qr=!0,Et());let r=`${e}/${t}/${n}`;if(Ke.has(r)){let s=Ke.get(r);return Ke.delete(r),s}return Ur}var Ke,Ur,qr,Sn=Z(()=>{xe();Ke=new Map,Ur=Symbol("webjs.seed.miss"),qr=!1});var $r={};Dn($r,{_FRAME_TOP:()=>ns,_LIVE_ATTRS:()=>xn,_activeFrameId:()=>ts,_addNewHeadElements:()=>kn,_applyStreamedResolve:()=>vs,_blurOutgoingFocus:()=>kt,_buildSubmitFormData:()=>Xr,_bumpNavToken:()=>la,_clearFormBusy:()=>ms,_clearFrameBusy:()=>hs,_collectChildrenSlots:()=>Le,_currentPageUrl:()=>ua,_diffElementInPlace:()=>Ot,_eligibleAnchorHref:()=>Tt,_findAnchorInPath:()=>es,_getSubmitAction:()=>Qr,_getSubmitMethod:()=>Zr,_isNonHtmlPath:()=>da,_keyOf:()=>Re,_longestSharedPath:()=>rs,_markFormBusy:()=>ps,_markFrameBusy:()=>ds,_mergeHead:()=>As,_navToken:()=>ca,_onPopState:()=>Nn,_onSubmit:()=>jn,_prefetch:()=>Ze,_prefetchInflightSize:()=>ia,_prefetchMode:()=>Nt,_prefetchPeek:()=>oa,_prefetchSaysSaveData:()=>On,_prefetchSuppressed:()=>cs,_prefetchTake:()=>ls,_reactivateScripts:()=>It,_readStreamedShell:()=>Cs,_reconcileChildren:()=>Mn,_regraftPermanentElements:()=>gs,_regraftPermanentInSlice:()=>In,_resetPrefetch:()=>aa,_resolveTargetFrameId:()=>Rn,_restoreOptimistic:()=>Ge,_runWithTransition:()=>xt,_setCurrentPageUrl:()=>fa,_snapshotCache:()=>O,_streamBoundariesProgressively:()=>xs,_takeResolveUnit:()=>Es,_viewTransitionsEnabled:()=>bs,collectChildrenSlots:()=>Le,disableClientRouter:()=>Kr,enableClientRouter:()=>Tn,loadFrame:()=>Di,longestSharedPath:()=>rs,navigate:()=>Gr,revalidate:()=>Yr});function Vr(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}function Ui(){An||typeof MutationObserver>"u"||typeof customElements>"u"||(An=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)}}),An.observe(document.body,{childList:!0,subtree:!0}))}function Tn(){de||typeof document>"u"||(de=!0,document.addEventListener("click",Jr,!1),document.addEventListener("submit",jn,!1),window.addEventListener("popstate",Nn),document.addEventListener("pointerover",je,!0),document.addEventListener("focusin",je,!0),document.addEventListener("touchstart",je,{capture:!0,passive:!0}),document.addEventListener("pointerout",us,!0),document.addEventListener("webjs:navigate",vn),Ui(),vn(),typeof history<"u"&&"scrollRestoration"in history&&(vt=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(U=location.href))}function Kr(){de&&(de=!1,document.removeEventListener("click",Jr,!1),document.removeEventListener("submit",jn,!1),window.removeEventListener("popstate",Nn),document.removeEventListener("pointerover",je,!0),document.removeEventListener("focusin",je,!0),document.removeEventListener("touchstart",je,{capture:!0}),document.removeEventListener("pointerout",us,!0),document.removeEventListener("webjs:navigate",vn),$t(),J&&(J.disconnect(),J=null),typeof history<"u"&&vt!==null&&(history.scrollRestoration=vt,vt=null),U=null)}async function Gr(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await Ln(n.href,t?.replace??!1,null)}async function Di(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};I&&I.abort(),I=new AbortController;let s=I.signal,o=++j;return jt(r.href,n,!1,null,"GET",null,s,o)}function Yr(e){if(!e){O.clear(),L.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;O.delete(n),L.delete(n)}function Jr(e){if(!de||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=es(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||Mt.test(r.pathname))return;e.preventDefault();let s=Rn(t);Ln(n,!1,s)}function Nn(e){Ln(location.href,!0,null)}function jn(e){if(!de||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=Zr(t,n);if(s==="dialog")return;let o=Qr(t,n),i;try{i=new URL(o,location.href)}catch{return}if(i.origin!==location.origin||Mt.test(i.pathname))return;let a=Xr(t,n);e.preventDefault();let c=Rn(n||t);Vi(i.href,s,a,c,t)}function Zr(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function Qr(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function Xr(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 es(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function ts(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 Rn(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===ns)return null;let r=typeof document<"u"?document.getElementById(n):null;return r&&r.tagName&&r.tagName.toLowerCase()==="webjs-frame"?n:(Hi(`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 ts(e)}function Hi(e,t){Hr.has(e)||(Hr.add(e),typeof console<"u"&&console.warn&&console.warn(t))}function Le(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 rs(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 ss(e){let t=he(e);O.has(t)&&O.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(O.set(t,n);O.size>Wi;){let r=O.keys().next().value;O.delete(r)}}function zi(e){let t=he(e),n=O.get(t);return n==null?null:(O.delete(t),O.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function he(e){let t=new URL(e,location.href);return t.pathname+t.search}async function Ln(e,t,n){I&&I.abort(),I=new AbortController;let r=I.signal,s=++j;U&&ss(U);let o=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),o=null},150),i=null;t||(i=ws());try{if(t){let a=zi(e);if(a){let c=Vr(a.html);if(c){ys(c,n,!0,null),typeof window<"u"&&window.scrollTo(a.scrollX,a.scrollY),jt(e,n,!1,i,"GET",null,r,s).catch(()=>{});return}}typeof window<"u"&&window.scrollTo(0,0)}await jt(e,n,!t,i,"GET",null,r,s)}finally{o&&clearTimeout(o),s===j&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(U=location.href))}}async function Vi(e,t,n,r,s){I&&I.abort(),I=new AbortController;let o=I.signal,i=++j,a=t==="get"||t==="head",c=new URL(e,location.href);if(a){c.search="";for(let[b,g]of n)c.searchParams.append(b,typeof g=="string"?g:g.name)}U&&ss(U);let l=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),l=null},150),f=ws(),h=s?ps(s,i,c.href):null,u=!1;try{let b=await jt(c.href,r,!0,f,a?"GET":t.toUpperCase(),a?null:n,o,i);u=!!(b&&b.ok),!a&&i===j&&(O.clear(),L.clear())}finally{h&&ms(h,i,c.href,u),l&&clearTimeout(l),i===j&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(U=location.href))}}function os(){return[...Le(document.body).keys()].join(",")}function On(){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 Ji(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||Mt.test(n.pathname)?null:t}function cs(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=Ji(e);return t.includes("external")||t.includes("no-prefetch")}function Nt(e){if(cs(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 Ze(e){if(typeof fetch!="function"||On())return;let t=he(e);if(ue.has(t)||Ye.has(t))return;let n=L.get(t);if(n&&En()-n.at<is)return;if(ue.size>=as){for(Ye.add(t),Te.push(e);Te.length>Gi;){let o=Te.shift();Ye.delete(he(o))}return}ue.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},s=os();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();Qi(t,{html:l,build:a,finalUrl:c,at:En()})}).catch(()=>{}).finally(()=>{ue.delete(t),Zi()})}function Zi(){for(;Te.length&&ue.size<as;){let e=Te.shift();Ye.delete(he(e)),Ze(e)}}function Qi(e,t){for(L.has(e)&&L.delete(e),L.set(e,t);L.size>Ki;){let n=L.keys().next().value;L.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function ls(e){let t=he(e),n=L.get(t);return!n||(L.delete(t),En()-n.at>=is)?null:n}function En(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function je(e){if(!de)return;let t=fs(e.target);if(!t||Nt(t)!=="intent")return;let n=Tt(t);n&&(Je===t&&Ne||($t(),Je=t,Ne=setTimeout(()=>{Ne=null,Je=null,Ze(n)},Yi)))}function us(e){let t=fs(e.target);t&&t===Je&&$t()}function $t(){Ne&&(clearTimeout(Ne),Ne=null),Je=null}function fs(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 vn(){if(typeof document>"u"||On())return;let e=typeof IntersectionObserver<"u";e&&(J?J.disconnect():J=new IntersectionObserver(t=>{for(let n of t){if(!n.isIntersecting)continue;let r=n.target;J.unobserve(r);let s=Tt(r);s&&Nt(r)==="viewport"&&Ze(s)}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=Nt(t);if(n==="render"){let r=Tt(t);r&&Ze(r)}else n==="viewport"&&e&&J.observe(t)}}function Xi(e){if(typeof document>"u"||!document.body)return!1;let t=Le(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 Cn(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||Xi(t)||typeof location<"u"&&(location.href=e)}async function jt(e,t,n,r,s,o,i,a){s=s||"GET";let c=typeof a=="number"?a:j,l,f=null,h=null,u=null,b=!1,g=e,m=t?ds(t,c):null;try{try{let d=s==="GET"&&!o&&!t?ls(e):null;if(d)l=d.html,h=d.build,g=d.finalUrl,u=200,b=!0;else{let y={"x-webjs-router":"1"},w=os();w&&(y["x-webjs-have"]=w),t&&(y["x-webjs-frame"]=t),o!=null&&s!=="GET"&&s!=="HEAD"&&(y.accept=Dr+", text/html");let S={method:s,headers:y,credentials:"same-origin"};i&&(S.signal=i),o!=null&&s!=="GET"&&s!=="HEAD"&&(S.body=o);let A=await fetch(e,S);u=A.status,b=A.ok;let v=A.headers.get("content-type")||"",T=/^text\/html\b/i.test(v);if(v.toLowerCase().indexOf(Dr)===0){let _=await A.text();return c===j&&(Ge(r),_n(_)),{ok:b,status:u,aborted:!1}}if(A.redirected&&A.url&&(g=A.url),A.status===204||A.status===205)return c===j&&n&&history.pushState(null,"",g),{ok:b,status:u,aborted:!1};if(!T)return c===j&&(Ge(r),Cn(e,A.status,null)),{ok:!1,status:u,aborted:!1};h=A.headers.get("x-webjs-build");let C=await Cs(A);l=C.shell,C.streaming&&(f=C)}}catch(d){return d&&d.name==="AbortError"?{ok:!1,status:null,aborted:!0}:c!==j?{ok:!1,status:null,aborted:!0}:(Ge(r),Cn(e,null,d instanceof Error?d:new Error(String(d))),{ok:!1,status:null,aborted:!1})}if(c!==j){if(f&&f.reader)try{f.reader.cancel()}catch{}return{ok:!1,status:u,aborted:!0}}let p=Vr(l);if(!p)return Ge(r),Cn(e,null,new Error("navigation response did not parse as HTML")),{ok:!1,status:u,aborted:!1};if(ys(p,t,!1,g,h),n&&history.pushState(null,"",g),n){let d=new URL(g);if(d.hash){let y=document.getElementById(d.hash.slice(1));y?y.scrollIntoView():window.scrollTo(0,0)}else window.scrollTo(0,0)}return f&&(f.reader||f.rest)&&xs(f.reader,f.dec,f.rest,()=>c===j),document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:g,frameId:t,from:"navigate"}})),{ok:b,status:u,aborted:!1}}finally{m&&hs(m,c)}}function ds(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=Rt.has(n);return Rt.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 hs(e,t){if(Rt.get(e)!==t)return;Rt.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 ps(e,t,n){let r=Lt.has(e);return Lt.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 ms(e,t,n,r){if(Lt.get(e)!==t)return;Lt.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 Wr(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+=fe(r);return n}function bs(){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 xt(e,t){let n=typeof document<"u"?document.startViewTransition:void 0;if(bs()&&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 gs(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 In(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=ea(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 ea(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 ta(e){if(!(!e||!e.start))for(let t=e.start.nextSibling;t&&t!==e.end;t=t.nextSibling)t.nodeType===1&&ke(t)}function ys(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 f=document.querySelector('script[type="importmap"]'),h=f?f.getAttribute("data-webjs-build"):null,u=!1;if(s&&h&&(u=s!==h),!u&&e.head&&e.head.children.length>0){let b=Wr(document),g=Wr(e);b!==g&&(u=!0)}if(u&&typeof location<"u")try{let b="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(b))sessionStorage.removeItem(b);else{sessionStorage&&sessionStorage.setItem(b,"1"),location.href=r;return}}catch{location.href=r;return}else if(!u)try{typeof sessionStorage<"u"&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}}if(t){let f=document.querySelector(`webjs-frame#${CSS.escape(t)}`),h=e.querySelector(`webjs-frame#${CSS.escape(t)}`);if(f&&h){kn(e.head),xt(()=>{sa(f,h),It(f),ke(f),kt()},()=>ke(f)),zr(e.body);return}let u=new CustomEvent("webjs:frame-missing",{bubbles:!0,cancelable:!0,detail:{frameId:t,url:r||(typeof location<"u"?location.href:null),document:e}});(f||document).dispatchEvent(u),u.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=Le(document.body),i=Le(e.body),a=rs(o,i);if(a){kn(e.head),xt(()=>{na(o.get(a),i.get(a),e),kt()},()=>ta(o.get(a))),zr(e.body);return}As(e.head),gs(document.body,e.body);let c=[...e.body.childNodes];xt(()=>{document.body.replaceChildren(...c),It(document.body),ke(document.body),kt()},()=>ke(document.body))}function kt(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function na(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));In(s,o),ra(r,e.start,e.end,s,o);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&(It(i),ke(i))}function ra(e,t,n,r,s){let o=new Map;for(let c of r){if(c.nodeType!==1)continue;let l=Re(c);l&&o.set(l,c)}let i=n,a=[];for(let c of s){if(c.nodeType===1){let l=Re(c);if(l&&o.has(l)){let f=o.get(l);Ot(f,c),a.push(f),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 Ot(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),!xn.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])xn.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);Mn(e,t)}function Mn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(a=>document.importNode(a,!0));In(n,r);let s=new Map;for(let a of n){if(a.nodeType!==1)continue;let c=Re(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=Re(c);if(l&&s.has(l)){let h=s.get(l);Ot(h,c),o.push(h),s.delete(l);continue}let f=n[a];if(f&&f.nodeType===1&&!Re(f)&&f.tagName===c.tagName){Ot(f,c),o.push(f);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 Re(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}function ws(){let e=Le(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:j}}function Ge(e){if(!e||e.token!==j)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 sa(e,t){Mn(e,t)}function _s(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function $n(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=_s();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function Ss(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=_s();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function fe(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function kn(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(fe(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(fe(r))||(r.tagName==="SCRIPT"?document.head.appendChild($n(r)):document.head.appendChild(Ss(r))))}function As(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(fe(o));let s=new Set;for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&s.add(fe(o));for(let o of[...t.children])o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(s.has(fe(o))||o.remove());for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(r.has(fe(o))||(o.tagName==="SCRIPT"?t.appendChild($n(o)):t.appendChild(Ss(o))))}function ke(e){typeof customElements>"u"||Pn(e)}function Pn(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&&Pn(n.shadowRoot))}function zr(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]"))document.body.appendChild(t.cloneNode(!0))}async function Cs(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 f=r.indexOf(s);if(f!==-1)return{shell:r.slice(0,f),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(f)};if(c)return{shell:r,streaming:!1};let h=i.exec(r);if(h){let u=h.index+h[0].length;return{shell:r.slice(0,u),streaming:!0,reader:t,dec:n,rest:r.slice(u)}}}}function Es(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 vs(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&&Pn(o)}async function xs(e,t,n,r){let s=n,o=()=>{let i;for(;i=Es(s);){if(!r())return!1;vs(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 It(e){for(let t of e.querySelectorAll("script"))t.replaceWith($n(t))}function oa(e){return L.get(he(e))||null}function ia(){return ue.size}function aa(){L.clear(),ue.clear(),Te.length=0,Ye.clear(),$t()}function ca(){return j}function la(){return++j}function ua(){return U}function fa(e){U=e}function da(e){return Mt.test(e)}var Dr,de,I,j,An,U,vt,Mt,ns,Hr,Wi,O,Ki,is,as,Gi,Yi,L,ue,Te,Ye,Ne,Je,J,Rt,Lt,xn,yn=Z(()=>{gn();Ct();Ct();Br();Sn();Dr="text/vnd.webjs-stream.html";de=!1,I=null,j=0,An=null;U=null,vt=null;Mt=/\.(?: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;ns="_top";Hr=new Set;Wi=16,O=new Map;Ki=8,is=3e4,as=3,Gi=24,Yi=100,L=new Map,ue=new Set,Te=[],Ye=new Set,Ne=null,Je=null,J=null;Rt=new WeakMap;Lt=new WeakMap;xn=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);Tn()});function qt(e,...t){return{_$webjs:"template",strings:e,values:t}}function N(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var E="w$";function Ls(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 me(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function Ft(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 et(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
|
|
3
|
+
`)}</style>`}function tt(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function P(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}var Hn=Symbol.for("webjs.repeat");function Wn(e,t,n){return{[Hn]:!0,items:[...e],keyFn:t,templateFn:n}}function Q(e){return!!e&&typeof e=="object"&&e[Hn]===!0}function Ut(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function be(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function Os(e){return{_$webjs:"live",value:e}}function ge(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function Is(e,t){return{_$webjs:"keyed",key:e,value:t}}function X(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function Ms(e,t){return{_$webjs:"guard",deps:e,fn:t}}function ee(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function $s(e){return{_$webjs:"template-content",template:e}}function ye(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function Ps(e){return{_$webjs:"ref",target:e}}function te(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function Bs(){return{value:void 0}}function qs(e){return{_$webjs:"cache",value:e}}function ne(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function Fs(...e){return{_$webjs:"until",args:e}}function re(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function Us(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function we(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function Ds(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function _e(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function Hs(e){return{_$webjs:"watch",signal:e}}function se(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var B=null,W=!1,Ae=0,Se=null,Dt=0,zn=(e,t)=>Object.is(e,t),rt=()=>{},Vn=()=>!1;function Kn(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)Kn(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function Oe(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)Oe(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function Gt(e){if(W)throw new Error("Signal read during notification phase");if(B===null)return;let t=B,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&zt(t)&&Oe(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,zt(t)&&Kn(e,t)),t.producerLastReadVersions[n]=e.version}function zt(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function Gn(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=W;W=!0;try{for(let n of e.liveConsumers)n.dirty||Ws(n)}finally{W=t}}function Ws(e){e.dirty=!0,Gn(e),e.consumerMarkedDirty.call(e.wrapper||e)}function st(e){if(!(!e.dirty&&e.lastCleanEpoch===Ae)){if(!e.producerMustRecompute()&&!zs(e)){e.dirty=!1,e.lastCleanEpoch=Ae;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=Ae}}function zs(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(st(n),r!==n.version))return!0}return!1}function Vt(e){e&&(e.nextProducerIndex=0);let t=B;return B=e,t}function Kt(e,t){if(B=t,!!e){if(zt(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)Oe(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var ot=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=Ae,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=Vn,this.producerRecomputeValue=rt,this.consumerMarkedDirty=rt,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||zn,this.watched=n?.[Yt],this.unwatched=n?.[Jt]}get(){return Gt(this),this.__value}peek(){return this.__value}set(t){if(W)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,Ae++,Se!==null?Yn(this):Gn(this))}};function Yn(e){let t=W;W=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?Se.add(n):Yn(n))}finally{W=t}}var Ht=Symbol("unset"),Wt=Symbol("computing"),nt=Symbol("errored"),Ie=class{constructor(t,n){this.__fn=t,this.__value=Ht,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||zn,this.watched=n?.[Yt],this.unwatched=n?.[Jt];let r=this;this.producerMustRecompute=function(){return r.__value===Ht||r.__value===Wt},this.producerRecomputeValue=function(){if(r.__value===Wt)throw new Error("Detected cycle in computations.");let s=r.__value;r.__value=Wt;let o=Vt(r),i,a=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=nt,r.__error=l,a=!0}finally{Kt(r,o)}if(!a&&(s!==Ht&&s!==nt)&&r.__equal.call(r.wrapper,s,i)){r.__value=s;return}r.__value=i,r.version++},this.consumerMarkedDirty=rt}get(){if(st(this),Gt(this),this.__value===nt)throw this.__error;return this.__value}peek(){if(st(this),this.__value===nt)throw this.__error;return this.__value}},it=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=Ae,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=Vn,this.producerRecomputeValue=rt,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)Gt(r),r.__isComputed&&st(r)}finally{Kt(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(Oe(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{Kt(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)Oe(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},Yt=Symbol("watched"),Jt=Symbol("unwatched");function Vs(e){let t=B;B=null;try{return e()}finally{B=t}}function Ks(e){return e.producers.slice()}function Gs(e){return e.liveConsumers?[...e.liveConsumers]:[]}function Ys(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function Js(e){return e.producers.length>0}function Zs(){return B&&B.__isComputed?B:null}function Qs(e){Dt++,Se===null&&(Se=new Set);try{e()}finally{if(Dt--,Dt===0){let t=Se;Se=null;for(let n of t)n.__fire()}}}var Me={State:ot,Computed:Ie,subtle:{Watcher:it,untrack:Vs,introspectSources:Ks,introspectSinks:Gs,hasSinks:Ys,hasSources:Js,currentComputed:Zs,watched:Yt,unwatched:Jt}};function Xs(e,t){return new ot(e,t)}function eo(e,t){return new Ie(e,t)}function to(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function no(e){let t=!1,n=!1,r=new Ie(e),s=new it(()=>{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 ro=`${E}s`,so=`${E}e`;function Jn(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===ro||t===so}function oo(e){for(let t of e.addedNodes)if(Jn(t))return!0;for(let t of e.removedNodes)if(Jn(t))return!0;return!1}function tr(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var Pe=tr(),oe=Symbol("webjs.slot.state"),z="data-webjs-light",ie="data-projection",Be="actual",nr="fallback",ut=Symbol("webjs.slot.fallbackFrag"),io=64,$e=null,Zt=null,at=null,Zn=!1;function ao(){Zn||(Pe=tr(),Pe&&($e=HTMLSlotElement.prototype.assignedNodes,Zt=HTMLSlotElement.prototype.assignedElements,at=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(z)&&!Qn(this)?Qt(this,t):$e?$e.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(z)&&!Qn(this)?Qt(this,t).filter(n=>n.nodeType===1):Zt?Zt.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=at&&at.get?at.get.call(this):null;return t||co(this)}}),Zn=!0))}ao();function Qn(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 Qt(e,t){if(e.getAttribute(ie)===nr)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:Xt(n,new Set,0)}function Xt(e,t,n){if(n>=io)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(z)){let i=Qt(o,{flatten:!1});if(i.length>0)for(let a of Xt(i,t,n+1))r.push(a);else for(let a of Xt(Array.from(o.childNodes),t,n+1))r.push(a)}else if($e){let i=$e.call(o,{flatten:!0});for(let a of i)r.push(a)}else r.push(s)}else r.push(s);return r}function co(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(z))return t.getAttribute(ie)===Be?t:null;t=t.parentElement}return null}function V(e){let t=e,n=t[oe];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[oe]=n),n}function en(e){return!!e[oe]}function rr(e){let t=V(e);for(;e.firstChild;){let n=e.firstChild,r=ct(n);lt(t.assignedByName,r,n),e.removeChild(n)}}function sr(e){let t=V(e),n=e.querySelectorAll(`slot[${z}]`);for(let r of n){let s=r;if(s.getAttribute(ie)!==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 ct(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function lt(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function or(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 ir(e){if(!Pe)return;let t=V(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let s of n)if(!oo(s)){if(s.type==="childList"){for(let o of s.addedNodes)o.parentElement===e&&(lt(t.assignedByName,ct(o),o),r=!0);for(let o of s.removedNodes)e.contains(o)||Xn(t,o)&&(r=!0)}else if(s.type==="attributes"&&s.attributeName==="slot"){let o=s.target;(Xn(t,o)||o.parentElement===e)&&(lt(t.assignedByName,ct(o),o),r=!0)}}r&&ft(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function ar(e){let t=e[oe];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 Xn(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 ft(e){let t=V(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,lo(e)}))}function lo(e){if(!Pe)return;let t=e[oe];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${z}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||uo(t,i);for(let i of r)t.ownedSlots.has(i)||po(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 f of a)l.push(f);for(let f of c)l.indexOf(f)===-1&&l.push(f);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 f=a[l];l===0&&c.length>0?fo(t,f,c)&&o.push(f):ho(t,f)&&o.push(f)}}for(let i of o)mo(i)}function uo(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;or(e.pendingByName,s,r)}e.lastSnapshot.delete(t)}function fo(e,t,n){let r=t.getAttribute(ie)!==Be,s=e.lastSnapshot.get(t)||[];if(!r&&bo(s,n))return!1;let i=t[ut];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(ie,Be),e.lastSnapshot.set(t,n.slice()),!0}function ho(e,t){let n=t.getAttribute(ie)===Be;if(t.setAttribute(ie,nr),!n)return er(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return er(t),!0}function er(e){let t=e[ut];!t||t.childNodes.length===0||e.appendChild(t)}function po(e,t){if(!Pe)return;let n=V(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>ft(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function cr(e,t){if(!en(e))return;let n=V(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);or(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 mo(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function bo(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 lr=new WeakMap,tn=Symbol.for("webjs.instance");function ve(e,t){let n=t,r=n[tn];if(N(e)){let s=e;if(r&&r.strings===s.strings){Ce(r,s.values);return}r&&ur(r,t);let o=t.firstChild;o&&o.nodeType===8&&o.data==="webjs-hydrate"&&o.remove();let i=wo(s,t);n[tn]=i;return}if(r&&ur(r,t),n[tn]=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 ht(e){let{strings:t}=e,n=lr.get(t);if(n)return n;let r=[],s="",o="text",i="",a=0,c="",l=0,f=null,h="",u="";for(let g=0;g<t.length;g++){let m=t[g];for(let p=0;p<m.length;p++){let d=m[p];switch(o){case"text":s+=d,d==="<"&&(o="tag-open");break;case"tag-open":s+=d,d==="!"?o="bang-1":d==="/"?(o="tag-name",h=""):/[a-zA-Z]/.test(d)?(o="tag-name",h=d.toLowerCase()):o="text";break;case"bang-1":s+=d,o=d==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=d,d==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=d,d==="-"?l+=1:(d===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=d,d===">"?(o=h==="script"||h==="style"?"rawtext":"text",o==="rawtext"&&(u="")):/\s/.test(d)?o="in-tag":h+=d.toLowerCase();break;case"in-tag":s+=d,d===">"?(o=h==="script"||h==="style"?"rawtext":"text",o==="rawtext"&&(u="")):!/\s/.test(d)&&d!=="/"&&(o="attr-name",i=d,a=s.length-1);break;case"rawtext":s+=d,u=(u+d.toLowerCase()).slice(-9),(u.endsWith("<\/script>")||u.endsWith("</style>"))&&(o="text",u="",h="");break;case"attr-name":d==="="?(o="after-eq",s+=d):/\s/.test(d)?(o="in-tag",i="",s+=d):d===">"?(o="text",i="",s+=d):(i+=d,s+=d);break;case"after-eq":d==='"'||d==="'"?(o="attr-quoted",c=d,s+=d):/\s/.test(d)?(o="in-tag",i="",s+=d):d===">"?(o="text",i="",s+=d):(o="attr-unquoted",s+=d);break;case"attr-unquoted":/\s/.test(d)?(o="in-tag",i="",s+=d):(d===">"&&(o="text",i=""),s+=d);break;case"attr-quoted":s+=d,d===c&&(o="in-tag",i="");break;case"skip-attr":if(d===c){if(f){let y=f.firstPartIdx,w=[];for(let C=y;C<r.length;C++)(r[C].kind==="noop"||r[C].kind==="attr-mixed")&&w.push(C);let S=[],A=t[w[0]],v=A.lastIndexOf(c);S.push(v>=0?A.slice(v+1):A);for(let C=1;C<w.length;C++)S.push(t[w[C]]);let T=t[w[w.length-1]+1],M=T.indexOf(c);S.push(M>=0?T.slice(0,M):T),r[y]={kind:"attr-mixed",path:[],name:f.name,statics:S,group:w},f=null}o="in-tag",i=""}break}}if(g<t.length-1){let p=r.length;if(o==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(o==="rawtext"){u="",r.push({kind:"noop",path:[]});continue}if(o==="text")s+=`<!--${E}${p}-->`,r.push({kind:"child",path:[]});else if(o==="in-tag"){let d=`data-${E}${p}`;s+=`${d}=""`,r.push({kind:"element",path:[]})}else if(o==="after-eq"){let d=i[0],y=i.slice(1);if(d==="@"||d==="."||d==="?"){s=s.slice(0,a);let w=d==="@"?"event":d==="."?"prop":"bool",S=`data-${E}${p}`;s+=`${S}=""`,r.push({kind:w,path:[],name:y})}else{s=s.slice(0,a);let w=`data-${E}${p}`;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 d=`data-${E}${p}`;s+=`${d}=""`,f={name:i,firstPartIdx:p},r.push({kind:"noop",path:[]}),o="skip-attr"}else o==="skip-attr"&&r.push({kind:"noop",path:[]})}}let b=document.createElement("template");return b.innerHTML=s,go(b.content,r),yo(b.content,r),n={templateEl:b,parts:r},lr.set(t,n),n}function go(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(z,"");let s=t.length;r.setAttribute(`data-${E}${s}`,""),t.push({kind:"slot",path:[]})}}function yo(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(E)){let c=Number(a.slice(E.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-${E}`)){let f=Number(l.name.slice(`data-${E}`.length));t[f]&&t[f].kind!=="child"&&(t[f].path=n.slice()),c.push(l.name)}for(let l of c)a.removeAttribute(l);r(i)}n.pop()}}r(e)}function wo(e,t){let{templateEl:n,parts:r}=ht(e),s=n.content.cloneNode(!0),o=document.createComment(`${E}s`),i=document.createComment(`${E}e`),a=r.map(l=>pt(l,s)),c=[];for(let l=0;l<e.values.length;l++)ae(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"&&ae(l,void 0,void 0,[]);return{strings:e.strings,bound:a,lastValues:c,startNode:o,endNode:i}}function pt(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 Ce(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(ae(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function ur(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=nn(n.slotEl);r&&cr(r,n.slotEl)}}t.replaceChildren()}function ae(e,t,n,r){if(ge(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":Ao(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":So(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=nn(s);if(!a||_o(s))return;let c=document.createDocumentFragment();for(;s.firstChild;)c.appendChild(s.firstChild);s[ut]=c,ft(a)};nn(s)?o():queueMicrotask(o);break}case"noop":break}}function nn(e){let t=e.parentElement;for(;t;){if(t[oe])return t;t=t.parentElement}return null}function _o(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 So(e,t){let n=e,r=te(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 Ao(e,t){return Ro(e,t),q(e,t)}function q(e,t){let n=e.marker;if(be(t)){K(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(X(t)){let s=t,o=e.__keyedKey;o!==void 0&&!Object.is(o,s.key)&&K(e),e.__keyedKey=s.key,q(e,s.value);return}if(ee(t)){let s=t,o=e.__guardDeps,i=s.deps;if(o!==void 0&&(Array.isArray(o)&&Array.isArray(i)?jo(o,i):Object.is(o,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,q(e,s.fn());return}if(ye(t)){K(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(te(t))return;if(ne(t))return Lo(e,t.value);if(re(t))return Oo(e,t.args);if(se(t))return Io(e,t.signal);if(we(t))return Mo(e,t);if(_e(t))return $o(e,t);if(Q(t)){if(e.child&&e.child.kind==="repeat"){vo(e,t);return}K(e);let s={kind:"repeat",map:new Map};e.child=s,Eo(n,s,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){To(e,t);return}K(e);let s={kind:"array",items:[]};e.child=s,ko(n,s,t);return}if(e.child){let s=e.child;if(s.kind==="repeat")fr(s),e.child=void 0;else if(s.kind==="array")hr(s),e.child=void 0;else if(s.kind==="async-stream")gr(s),e.child=void 0;else if("strings"in e.child){let o=e.child;if(N(t)&&o.strings===t.strings){Ce(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(N(t)){let s=t,{templateEl:o,parts:i}=ht(s),a=o.content.cloneNode(!0),c=document.createComment(`${E}s`),l=document.createComment(`${E}e`),f=i.map(b=>pt(b,a)),h=[];for(let b=0;b<s.values.length;b++)ae(f[b],s.values[b],void 0,s.values),h.push(s.values[b]);let u=[c,...a.childNodes,l];n.parentNode?.insertBefore(Co(u),n);for(let b of f)b.kind==="slot"&&ae(b,void 0,void 0,[]);e.child={strings:s.strings,bound:f,lastValues:h,startNode:c,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function Co(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 sn(e){let{templateEl:t,parts:n}=ht(e),r=t.content.cloneNode(!0),s=document.createComment(`${E}s`),o=document.createComment(`${E}e`),i=n.map(l=>pt(l,r)),a=[];for(let l=0;l<e.values.length;l++)ae(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 qe(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 Eo(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),f=o(r[c],c);if(!N(f))continue;let{inst:h,frag:u}=sn(f);t.map.set(l,h),a.appendChild(u)}i.insertBefore(a,e)}function vo(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 f=i(o[l],l),h=a(o[l],l);if(!N(h))continue;let u=s.map.get(f);if(u&&u.strings===h.strings)Ce(u,h.values),rn(u.startNode,u.endNode,r,n),c.set(f,u),s.map.delete(f);else{u&&(qe(u),Ee(u.startNode,u.endNode),s.map.delete(f));let{inst:b,frag:g}=sn(h);r.insertBefore(g,n),c.set(f,b)}}for(let l of s.map.values())qe(l),Ee(l.startNode,l.endNode);s.map=c}function fr(e){for(let t of e.map.values())qe(t),Ee(t.startNode,t.endNode);e.map.clear()}function xo(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function dt(e){e.type==="tpl"?(qe(e.inst),Ee(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function dr(e){if(N(e)){let{inst:t,frag:n}=sn(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 ko(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}=dr(i);c&&s.appendChild(c),o.push(a)}r.insertBefore(s,e),t.items=o}function To(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(N(c)){let u=c;if(l&&l.type==="tpl"&&l.inst.strings===u.strings){Ce(l.inst,u.values),i.push(l);continue}}else if(c!=null&&c!==!1&&c!==!0){if(l&&l.type==="text"){let u=String(c);l.node.data!==u&&(l.node.data=u),i.push(l);continue}}else{l&&dt(l),i.push({type:"empty"});continue}let{item:f,frag:h}=dr(c);h&&r.insertBefore(h,No(o,a,n)),l&&dt(l),i.push(f)}for(let a=t.length;a<o.length;a++)dt(o[a]);s.items=i}function No(e,t,n){for(let r=t;r<e.length;r++){let s=xo(e[r]);if(s&&s.parentNode)return s}return n}function hr(e){for(let t of e.items)dt(t);e.items=[]}function rn(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 jo(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 K(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&pr(t),!e.child)return;let n=e.child;if(n.kind==="repeat")fr(n);else if(n.kind==="array")hr(n);else if(n.kind==="async-stream")gr(n);else if("strings"in n){let r=e.child;qe(r),Ee(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function Ro(e,t){let n=e;n.__untilState&&!re(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!ee(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!ne(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!X(t)&&(n.__keyedKey=void 0),n.__watchSub&&!se(t)&&pr(n)}function Lo(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(N(t)&&a.strings===t.strings){Ce(a,t.values);return}let c=document.createDocumentFragment();rn(a.startNode,a.endNode,c,null),s.set(a.strings,{inst:a,holder:c}),e.child=void 0}if(N(t)){let a=t,c=s.get(a.strings);if(c){s.delete(a.strings),e.child&&K(e),rn(c.inst.startNode,c.inst.endNode,n.parentNode,n),Ce(c.inst,a.values),e.child=c.inst;return}}q(e,t)}function Oo(e,t){let n=e,r=n.__untilState,s=n.__untilArgs,o=(u,b)=>!!(Object.is(u,b)||N(u)&&N(b)&&u.strings===b.strings),a=s&&s.length===t.length&&s.every((u,b)=>o(u,t[b]))&&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,f;for(let u=0;u<t.length;u++){let b=t[u];if(!b||typeof b.then!="function"){l=u,f=b;break}}l!==-1&&l<=c.highestResolved?(q(e,f),c.highestResolved=l):l===-1&&!n.__untilEverRendered&&q(e,""),n.__untilEverRendered=!0;let h=Math.min(l===-1?t.length:l,c.highestResolved);for(let u=0;u<h;u++){let b=t[u];!b||typeof b.then!="function"||Promise.resolve(b).then(g=>{c.aborted||u>=c.highestResolved||(c.highestResolved=u,q(e,g))},()=>{})}}function Io(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let o;n.__watchSub.observe(()=>{o=t.get()}),q(e,o);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new Me.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let o;r.observe(()=>{o=t.get()}),q(e,o)})});n.__watchSub=r;let s;r.observe(()=>{s=t.get()}),q(e,s)}function pr(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function Mo(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;K(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,mr(s,e,t)}function $o(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;K(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,mr(s,e,t)}async function mr(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=br(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 br(e){if(e==null||e===!1||e===!0)return[];if(N(e)){let t=e,{templateEl:n,parts:r}=ht(t),s=n.content.cloneNode(!0),o=r.map(i=>pt(i,s));for(let i=0;i<t.values.length;i++)ae(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(...br(n));return t}return[document.createTextNode(String(e))]}function gr(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 yr=Symbol.for("webjs:registry"),wr=Symbol.for("webjs:classToTag"),mt=globalThis,F=mt[yr]||(mt[yr]=new Map),_r=mt[wr]||(mt[wr]=new WeakMap),bt=typeof window<"u"&&typeof customElements<"u";function on(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=F.get(e);r?(r.cls=t,r.lazy=n):F.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),_r.set(t,e)}if(bt){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),on(t,n)}}if(!bt){let e=globalThis;e.customElements||(e.customElements={define(t,n){on(t,n)},get(t){return F.get(t)?.cls},upgrade(){},whenDefined(t){let n=F.get(t);return Promise.resolve(n?.cls)}})}function an(e,t){bt?customElements.define(e,t):on(e,t)}function Po(e,t){if(bt)return;let n=F.get(e);if(n){n.moduleUrl=t;return}F.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function cn(e){return F.get(e)?.cls}function Bo(e){return F.get(e)?.moduleUrl||null}function qo(e){return F.get(e)?.lazy===!0}function gt(e){return _r.get(e)}function ln(){return[...F.keys()]}xe();var xr=typeof window<"u"&&typeof HTMLElement<"u";function Zo(e,t){return e!==t}function Qo(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var yt=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=Qo(),this.__internals}},Xo=["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 Xo){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(yt.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var ei=xr?HTMLElement:yt,un=class e extends ei{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){an(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(Er)}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||Zo)(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=Er(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(!xr)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=vr(r.slice(16));try{this[o]=D(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:me(r)?[r]:[];if(s.length){if(n){let o=this.shadowRoot.querySelector("style");o&&o.remove()}Ft(this._renderRoot,s)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${gt(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().`),en(this)||(this.__isHydrating()?(V(this),sr(this)):rr(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&&ir(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&&ar(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=vr(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 Me.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;if(this.__signalWatcher.observe(()=>{n=this.render()}),n&&typeof n.then=="function")return this._commitAsync(n);ve(n,this._renderRoot)}_commitAsync(t){let n=this.__renderToken;if(this.__firstRendered&&this._overridesRenderFallback())try{let r=this.renderFallback();r!==void 0&&ve(r,this._renderRoot)}catch(r){console.error("[webjs] renderFallback() threw:",r)}return Promise.resolve(t).then(r=>{n===this.__renderToken&&ve(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 <${gt(this.constructor)||this.tagName?.toLowerCase()}>:`,t);try{let n=this.renderError(t);n!==void 0&&ve(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 Er(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function vr(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}var Ka=Symbol.for("webjs.suspense");function ti(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function wt(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}xe();var fn=null;function ni(e){fn=e}function dn(){if(!fn)return"";try{return fn()||""}catch{return""}}async function ri(e,t={ssr:!0}){let n=t&&t.suspenseCtx,r=t&&t.dev!==void 0?t.dev:n&&n.dev;n&&n.dev===void 0&&r!==void 0&&(n.dev=r);let s=await k(e,n);return t&&t.ssr===!1?s:await Y(s,n,[],r)}async function k(e,t){if(e==null||e===!1||e===!0)return"";if(e&&typeof e.then=="function")return e=await e,k(e,t);if(be(e))return String(e.value??"");if(ge(e))return k(e.value,t);if(se(e))return k(e.signal.get(),t);if(X(e))return k(e.value,t);if(ee(e))return k(e.fn(),t);if(ye(e)){let n=e.template;return String(n?.innerHTML??"")}if(te(e))return"";if(ne(e))return k(e.value,t);if(re(e)){let n=e.args;for(let r of n)if(!r||typeof r.then!="function")return k(r,t);if(n.length>0)try{let r=await Promise.race(n.map(s=>Promise.resolve(s).catch(()=>{})));return k(r,t)}catch{return""}return""}if(we(e)||_e(e))return"";if(Array.isArray(e))return(await Promise.all(e.map(r=>k(r,t)))).join("");if(Q(e)){let n=e;return(await Promise.all(n.items.map((s,o)=>k(n.templateFn(s,o),t)))).join("")}if(wt(e)){let n=e,r=await k(n.fallback,t);if(t){let s=`s${t.nextId++}`;return t.pending.push({id:s,promise:Promise.resolve(n.children)}),`<webjs-boundary id="${s}">${r}</webjs-boundary>`}return r}return N(e)?si(e,t):tt(String(e))}async function si(e,t){let{strings:n,values:r}=e,s="",o="text",i="",a=0,c="",l=0,f="",h="";for(let u=0;u<n.length;u++){let b=n[u];for(let g=0;g<b.length;g++){let m=b[g];switch(o){case"text":s+=m,m==="<"&&(o="tag-open");break;case"tag-open":s+=m,m==="!"?o="bang-1":m==="/"?(o="tag-name",f=""):/[a-zA-Z]/.test(m)?(o="tag-name",f=m.toLowerCase()):o="text";break;case"bang-1":s+=m,o=m==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=m,m==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=m,m==="-"?l+=1:(m===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=m,m===">"?(o=_t(f)?"rawtext":"text",o==="rawtext"&&(h="")):/\s/.test(m)?o="in-tag":f+=m.toLowerCase();break;case"in-tag":s+=m,m===">"?(o=_t(f)?"rawtext":"text",o==="rawtext"&&(h="")):!/\s/.test(m)&&m!=="/"&&(o="attr-name",i=m,a=s.length-1);break;case"rawtext":s+=m,h=(h+m.toLowerCase()).slice(-9),(h.endsWith("<\/script>")||h.endsWith("</style>"))&&(o="text",h="",f="");break;case"attr-name":m==="="?(o="after-eq",s+=m):/\s/.test(m)?(o="in-tag",i="",s+=m):m===">"?(o="text",i="",s+=m):(i+=m,s+=m);break;case"after-eq":m==='"'||m==="'"?(o="attr-quoted",c=m,s+=m):/\s/.test(m)?(o="in-tag",i="",s+=m):m===">"?(o="text",i="",s+=m):(o="attr-unquoted",s+=m);break;case"attr-unquoted":/\s/.test(m)?(o="in-tag",i="",s+=m):(m===">"&&(o="text",i=""),s+=m);break;case"attr-quoted":s+=m,m===c&&(o="in-tag",i="");break}}if(u<r.length){let g=r[u];if(g&&typeof g.then=="function"&&(g=await g),o==="comment")s+=String(g??""),l=0;else if(o==="rawtext")s+=String(g??""),h="";else if(o==="text")s+=await k(g,t);else if(o==="after-eq"){let m=i[0],p=i.slice(1);if(m==="@")s=s.slice(0,a),o="in-tag",i="";else if(m==="."){if(s=s.slice(0,a),f==="webjs-suspense"&&p==="fallback"){let d=await k(g,t);s+=`data-webjs-fallback="${P(d)}"`,o="in-tag",i="";continue}if(!f.includes("-")){o="in-tag",i="";continue}if(g===void 0){o="in-tag",i="";continue}try{let d=await De(g);s+=`data-webjs-prop-${yi(p)}="${P(d)}"`}catch(d){console.warn(`[webjs] property binding .${p} has an unserializable value during SSR. Dropping. The browser will see the property as undefined. Detail: ${d&&d.message}`)}o="in-tag",i=""}else m==="?"?(s=s.slice(0,a),g&&(s+=`${p}=""`),o="in-tag",i=""):(s+=`"${P(String(g??""))}"`,o="in-tag",i="")}else(o==="attr-quoted"||o==="attr-unquoted")&&(s+=P(String(g??"")))}}return s}var oi=new Set(["document","window","localStorage","sessionStorage","navigator","matchMedia","requestAnimationFrame","getComputedStyle","IntersectionObserver","MutationObserver","ResizeObserver"]),ii=new Set(["attachShadow","querySelector","querySelectorAll","getBoundingClientRect","focus","blur","scrollIntoView"]);function ai(e){let t=e&&typeof e.message=="string"?e.message:"",n=/^(\w+) is not defined$/.exec(t);return e instanceof ReferenceError&&n&&oi.has(n[1])?`\`${n[1]}\` is a browser-only global and is undefined during SSR.`:(n=/\.(\w+) is not a function$/.exec(t),e instanceof TypeError&&n&&ii.has(n[1])?`\`${n[1]}\` is an HTMLElement method that does not exist on the server-side component instance during SSR.`:null)}function ci(){return typeof process<"u"&&process.env&&!0}function Nr(e,t,n){if(!(n===void 0?!ci():!!n))return"";let s=t&&t.message?t.message:String(t);return qt`<div data-webjs-error="${e}" style="border:1px solid #f5c2c7;background:#f8d7da;color:#842029;padding:8px 12px;border-radius:6px;font:13px/1.4 system-ui,sans-serif">
|
|
4
4
|
<strong><${e}> failed to render</strong>
|
|
5
|
-
<div style="margin-top:4px;white-space:pre-wrap">${
|
|
6
|
-
</div>`}async function G(e,t,n=[],r){e=await si(e,t,n,r);let o=on();if(!o.length)return e;let s=[...o].sort((h,u)=>u.length-h.length),i=new RegExp(`<(${s.map(De).join("|")})(?=[\\s>/])((?:"[^"]*"|'[^']*'|[^>])*?)(/?)>`,"g"),a=[];for(let h of e.matchAll(i)){let[u,b,g,m]=h,p=sn(b);if(!p)continue;t&&t.usedComponents&&t.usedComponents.add(b);let d=m?`<${b}${g}>`:u,y=null;try{let w=p.shadow===!0;y=new p,y.__ssrTag=b,y.__ssrAncestors=n;let S=vr(g),A=di(S),E=new Set(Object.keys(vr(g)).map(C=>C.toLowerCase()));ci(y,S),ui(y,S,p);for(let[C,_]of Object.entries(A))y[C]=_;typeof y.performServerUpdate=="function"&&y.performServerUpdate();let T=y.render?y.render():"";T&&typeof T.then=="function"&&(T=await T),d=li(d,y,E);let M=await x(T,t);if(w){let C=await G(M,t,[...n,y],r),_=p.styles,$=Array.isArray(_)?_:_&&pe(_)?[_]:[],he=Qe($);a.push({start:h.index,end:h.index+u.length,text:`${d}<template shadowrootmode="open">${he}${C}</template>`})}else{if(M.trim()===""){a.push({start:h.index,end:h.index+u.length,text:`${d}<!--webjs-hydrate-->`});continue}let _="",$=h.index+u.length;if(!m){let Mt=h.index+u.length,Ze=He(e,Mt,b);if(Ze!==-1){_=e.slice(Mt,Ze);let Ss=new RegExp(`</${De(b)}\\s*>`,"i"),As=e.slice(Ze),Pn=Ss.exec(As),Cs=Pn?Pn[0].length:`</${b}>`.length;$=Ze+Cs}else _=e.slice(Mt),$=e.length}let he=ii(_),Je=ai(M,he),_s=await G(Je,t,[...n,y],r);a.push({start:h.index,end:$,text:`${d}<!--webjs-hydrate-->${_s}</${b}>`})}}catch(w){let S=ei(w);console.error(S?`[webjs] SSR failed for <${b}>: ${S} It was touched in the component's constructor or render(), which run during SSR. Move browser-only work to connectedCallback() or a lifecycle hook (firstUpdated/updated), which SSR never calls; seed first-paint defaults in the constructor only from server-known inputs (attributes / props).`:`[webjs] SSR failed for <${b}>:`,w);let A=w instanceof Error?w:new Error(String(w)),E="";try{let _;y&&typeof y.renderError=="function"&&(_=y.renderError(A)),_===void 0&&(_=Er(b,A,r)),E=await x(_,t),E.trim()&&(E=await G(E,t,y?[...n,y]:n,r))}catch(_){console.error(`[webjs] renderError() for <${b}> also threw:`,_),E=""}let T=h.index+u.length;if(!m){let _=h.index+u.length,$=He(e,_,b);if($!==-1){let Je=new RegExp(`</${De(b)}\\s*>`,"i").exec(e.slice($));T=$+(Je?Je[0].length:`</${b}>`.length)}else T=e.length}let M=p.shadow===!0,C;if(M){let _=p.styles,$=Array.isArray(_)?_:_&&pe(_)?[_]:[],he=Qe($);C=`${d}<template shadowrootmode="open">${he}${E}</template>`}else C=`${d}<!--webjs-hydrate-->${E}</${b}>`;a.push({start:h.index,end:T,text:C})}}if(!a.length)return e;a.sort((h,u)=>h.start-u.start);let c=[],l=-1;for(let h of a)h.start>=l&&(c.push(h),l=h.end);let f=e;for(let h=c.length-1;h>=0;h--){let{start:u,end:b,text:g}=c[h];f=f.slice(0,u)+g+f.slice(b)}return f}var ni=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ri(e){return ni.has(e.toLowerCase())}async function si(e,t,n=[],r){if(e.indexOf("<webjs-suspense")===-1)return e;let o=/<webjs-suspense((?:"[^"]*"|'[^']*'|[^>])*?)>/i,s="",i=e;for(let a=0;a<1e4;a++){let c=o.exec(i);if(!c){s+=i;break}let l=c.index,f=c.index+c[0].length;s+=i.slice(0,l);let h=c[1]||"",u=/data-webjs-fallback="([^"]*)"/i.exec(h),b=u?wt(u[1]):"",g=He(i,f,"webjs-suspense"),m,p;if(g===-1)m=i.slice(f),p="";else{m=i.slice(f,g);let d=/<\/webjs-suspense\s*>/i.exec(i.slice(g));p=i.slice(g+(d?d[0].length:17))}if(t){let d=`s${t.nextId++}`;t.pending.push({id:d,promise:Promise.resolve(Bt(m))}),s+=`<webjs-suspense id="${d}">${b}</webjs-suspense>`}else{let d=await G(m,t,n,r);s+=`<webjs-suspense>${d}</webjs-suspense>`}i=p}return s}function He(e,t,n){let r=De(n),o=new RegExp(`<${r}(?:[\\s>/])`,"gi"),s=new RegExp(`</${r}\\s*>`,"gi");o.lastIndex=t,s.lastIndex=t;let i=1;for(;i>0;){let a=o.exec(e),c=s.exec(e);if(!c)return-1;if(a&&a.index<c.index)i++,s.lastIndex=a.index+1;else{if(i--,i===0)return c.index;o.lastIndex=c.index+1}}return-1}function oi(e){let t=/\bslot\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(e);if(!t)return null;let n=t[1]??t[2]??t[3]??"";return n===""?null:n}function ii(e){let t=new Map,n="",r=0;for(;r<e.length;){let o=e.indexOf("<",r);if(o===-1){n+=e.slice(r);break}o>r&&(n+=e.slice(r,o));let s=e.slice(o);if(s.startsWith("<!--")){let p=e.indexOf("-->",o+4);if(p===-1){n+=s,r=e.length;break}n+=e.slice(o,p+3),r=p+3;continue}if(s.startsWith("<!")||s.startsWith("</")){let p=e.indexOf(">",o);if(p===-1){n+=s,r=e.length;break}n+=e.slice(o,p+1),r=p+1;continue}let i=/^<([a-zA-Z][\w-]*)((?:"[^"]*"|'[^']*'|[^>])*?)(\/?)>/.exec(s);if(!i){n+="<",r=o+1;continue}let[a,c,l,f]=i,h=c.toLowerCase(),u=!!f||ri(h),b=oi(l),g;if(u)g=o+a.length;else{let p=o+a.length,d=He(e,p,h);if(d===-1){let E=e.slice(o);b!==null?Cr(t,b,E):n+=E,r=e.length;continue}let y=new RegExp(`</${De(h)}\\s*>`,"i"),w=e.slice(d),S=y.exec(w),A=S?S[0].length:`</${h}>`.length;g=d+A}let m=e.slice(o,g);b!==null?Cr(t,b,m):n+=m,r=g}return n.length>0&&t.set(null,n),t}function Cr(e,t,n){let r=e.get(t);r!==void 0?e.set(t,r+n):e.set(t,n)}function ai(e,t){let n=new Set,r="",o=0,s=/<slot((?:"[^"]*"|'[^']*'|[^>])*?)(\/?)>/gi,i;for(;(i=s.exec(e))!==null;){r+=e.slice(o,i.index);let[a,c,l]=i,f=!!l,h=/\bname\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(c),u=h?h[1]??h[2]??h[3]:null,b=c.replace(/\bname\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i,"").trim(),g="",m;if(f)m=i.index+a.length;else{let w=i.index+a.length,S=He(e,w,"slot");if(S===-1)g=e.slice(w),m=e.length;else{g=e.slice(w,S);let A=/<\/slot\s*>/i,E=e.slice(S),T=A.exec(E),M=T?T[0].length:7;m=S+M}}let p=t.get(u),d=u!==null?` name="${P(u)}"`:"",y=b?` ${b}`:"";p!==void 0&&!n.has(u)?(n.add(u),r+=`<slot data-webjs-light data-projection="actual"${d}${y}>${p}</slot>`):r+=`<slot data-webjs-light data-projection="fallback"${d}${y}>${g}</slot>`,o=m,s.lastIndex=m}return r+=e.slice(o),r}function De(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yt(e){return e==="script"||e==="style"}function vr(e){let t={},n=/([a-zA-Z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2]??r[3]??r[4]??"";return t}function ci(e,t){if(!(!e||typeof e.setAttribute!="function"))for(let[n,r]of Object.entries(t))e.setAttribute(n,wt(r))}function li(e,t,n){if(!t||typeof t.getAttributeNames!="function")return e;let r="";for(let o of t.getAttributeNames()){let s=String(o).toLowerCase();if(n.has(s))continue;let i=t.getAttribute(o);r+=i===""?` ${s}`:` ${s}="${P(String(i))}"`}return r?`${e.slice(0,-1)}${r}>`:e}function ui(e,t,n){let r=n.properties||{};for(let[o,s]of Object.entries(t)){let i=r[o]||r[un(o)],a=r[o]?o:un(o);if(!i){e[a]=s;continue}if(i.type===Number)e[a]=Number(s);else if(i.type===Boolean)e[a]=s!=="false";else if(i.type===Object||i.type===Array)try{e[a]=JSON.parse(wt(s))}catch{e[a]=s}else e[a]=s}}function un(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function fi(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function wt(e){return e.replace(/</g,"<").replace(/"/g,'"').replace(/&/g,"&")}function di(e){let t={};for(let n of Object.keys(e)){if(!n.startsWith("data-webjs-prop-"))continue;let r=un(n.slice(16));try{t[r]=ae(wt(e[n]))}catch{}delete e[n]}return t}function hi(e,t={ssr:!0}){let n=t&&t.suspenseCtx,r=t&&t.dev!==void 0?t.dev:n&&n.dev;return n&&n.dev===void 0&&r!==void 0&&(n.dev=r),new ReadableStream({async start(o){try{if(t&&t.ssr===!1)await R(e,n,o);else{let s=await x(e,n),i=await G(s,n,[],r);o.enqueue(i)}n&&n.pending.length&&await mi(n,o,r),o.close()}catch(s){o.error(s)}}})}async function R(e,t,n){if(!(e==null||e===!1||e===!0)){if(e&&typeof e.then=="function")return e=await e,R(e,t,n);if(me(e)){n.enqueue(String(e.value??""));return}if(be(e))return R(e.value,t,n);if(ne(e))return R(e.signal.get(),t,n);if(Z(e))return R(e.value,t,n);if(Q(e))return R(e.fn(),t,n);if(ge(e)){let r=e.template;n.enqueue(String(r?.innerHTML??""));return}if(!X(e)){if(ee(e))return R(e.value,t,n);if(te(e)){let r=e.args;for(let o of r)if(!o||typeof o.then!="function")return R(o,t,n);if(r.length>0)try{let o=await Promise.race(r.map(s=>Promise.resolve(s).catch(()=>{})));return R(o,t,n)}catch{return}return}if(!(ye(e)||we(e))){if(Array.isArray(e)){for(let r of e)await R(r,t,n);return}if(J(e)){let r=e;for(let o=0;o<r.items.length;o++)await R(r.templateFn(r.items[o],o),t,n);return}if(gt(e)){let r=e;if(t){let o=`s${t.nextId++}`;n.enqueue(`<webjs-boundary id="${o}">`),await R(r.fallback,t,n),n.enqueue("</webjs-boundary>"),t.pending.push({id:o,promise:Promise.resolve(r.children)})}else await R(r.fallback,t,n);return}if(N(e)){await pi(e,t,n);return}n.enqueue(Xe(String(e)))}}}}async function pi(e,t,n){let{strings:r,values:o}=e,s="text",i="",a=0,c="",l=0,f="",h="",u="";for(let b=0;b<r.length;b++){let g=r[b];for(let m=0;m<g.length;m++){let p=g[m];switch(s){case"text":u+=p,p==="<"&&(s="tag-open");break;case"tag-open":u+=p,p==="!"?s="bang-1":p==="/"?(s="tag-name",f=""):/[a-zA-Z]/.test(p)?(s="tag-name",f=p.toLowerCase()):s="text";break;case"bang-1":u+=p,s=p==="-"?"bang-dash":"tag-name";break;case"bang-dash":u+=p,p==="-"?(s="comment",l=0):s="tag-name";break;case"comment":u+=p,p==="-"?l+=1:(p===">"&&l>=2&&(s="text"),l=0);break;case"tag-name":u+=p,p===">"?(s=yt(f)?"rawtext":"text",s==="rawtext"&&(h="")):/\s/.test(p)?s="in-tag":f+=p.toLowerCase();break;case"in-tag":u+=p,p===">"?(s=yt(f)?"rawtext":"text",s==="rawtext"&&(h="")):!/\s/.test(p)&&p!=="/"&&(s="attr-name",i=p,a=u.length-1);break;case"rawtext":u+=p,h=(h+p.toLowerCase()).slice(-9),(h.endsWith("<\/script>")||h.endsWith("</style>"))&&(s="text",h="",f="");break;case"attr-name":p==="="?(s="after-eq",u+=p):/\s/.test(p)?(s="in-tag",i="",u+=p):p===">"?(s="text",i="",u+=p):(i+=p,u+=p);break;case"after-eq":p==='"'||p==="'"?(s="attr-quoted",c=p,u+=p):/\s/.test(p)?(s="in-tag",i="",u+=p):p===">"?(s="text",i="",u+=p):(s="attr-unquoted",u+=p);break;case"attr-unquoted":/\s/.test(p)?(s="in-tag",i="",u+=p):(p===">"&&(s="text",i=""),u+=p);break;case"attr-quoted":u+=p,p===c&&(s="in-tag",i="");break}}if(b<o.length){let m=o[b];if(m&&typeof m.then=="function"&&(m=await m),s==="comment")u+=String(m??""),l=0;else if(s==="rawtext")u+=String(m??""),h="";else if(s==="text")u&&(n.enqueue(u),u=""),await R(m,t,n);else if(s==="after-eq"){let p=i[0],d=i.slice(1);p==="@"||p==="."?(u=u.slice(0,a),s="in-tag",i=""):p==="?"?(u=u.slice(0,a),m&&(u+=`${d}=""`),s="in-tag",i=""):(u+=`"${P(String(m??""))}"`,s="in-tag",i="")}else(s==="attr-quoted"||s==="attr-unquoted")&&(u+=P(String(m??"")))}}u&&n.enqueue(u)}async function mi(e,t,n){let r=ln(),o=r?` nonce="${P(r)}"`:"";for(;e.pending.length;){let s=e.pending.splice(0);await Promise.all(s.map(async({id:i,promise:a})=>{try{let c=await a,l=await x(c,e),f=await G(l,e,[],n);t.enqueue(`<template data-webjs-resolve="${i}">${f}</template><script${o}>(function(){var t=document.currentScript.previousElementSibling;var b=document.getElementById("${i}");if(b&&t){b.replaceWith(t.content.cloneNode(true));t.remove()}document.currentScript.remove()})()<\/script>`)}catch(c){console.error(`[webjs] Suspense boundary "${i}" rejected:`,c);try{let l=c instanceof Error?c:new Error(String(c)),f=await G(await x(Er("webjs-suspense",l,n),e),e,[],n);t.enqueue(`<template data-webjs-resolve="${i}">${f}</template><script${o}>(function(){var t=document.currentScript.previousElementSibling;var b=document.getElementById("${i}");if(b&&t){b.replaceWith(t.content.cloneNode(true));t.remove()}document.currentScript.remove()})()<\/script>`)}catch(l){console.error(`[webjs] Suspense boundary "${i}" error render also threw:`,l)}}}))}}var kr=Symbol.for("webjs.notFound"),xr=Symbol.for("webjs.redirect");function bi(){let e=new Error("webjs: notFound()");throw e.__webjs=kr,e}function gi(e,t){let n=typeof t=="object"&&t!==null?t.status:t,r=new Error(`webjs: redirect(${e})`);throw r.__webjs=xr,r.url=e,r.status=typeof n=="number"?n:void 0,r}function yi(e){return!!e&&e.__webjs===kr}function wi(e){return!!e&&e.__webjs===xr}function _i(e,t,n){let r=/^\s*([A-Z]+)\s+(\/\S*)\s*$/.exec(e);if(!r)throw new Error(`expose(): bad pattern ${JSON.stringify(e)}: expected "METHOD /path"`);let[,o,s]=r;return t.__webjsHttp={method:o,path:s,validate:n&&typeof n.validate=="function"?n.validate:null,cors:n&&"cors"in n?Si(n.cors):null},t}function Si(e){return e?e===!0?{origin:"*",credentials:!1,maxAge:86400,headers:null}:typeof e=="string"?{origin:e,credentials:!0,maxAge:86400,headers:null}:Array.isArray(e)?{origin:e,credentials:!0,maxAge:86400,headers:null}:{origin:e.origin,credentials:!!e.credentials,maxAge:typeof e.maxAge=="number"?e.maxAge:86400,headers:Array.isArray(e.headers)?e.headers:null}:null}function Ai(e,t){if(typeof e!="function")throw new Error("validateInput(): first argument must be the action function");if(typeof t!="function")throw new Error("validateInput(): second argument must be a validator function");let n=e.__webjsHttp||{};return e.__webjsHttp={...n,validate:t},e}function Ci(e){return e&&typeof e=="function"&&e.__webjsHttp||null}function vi(e,t={}){let n=t.reconnect!==!1,r=0,o=!1,s=null,i=[];function a(){o||(s=new WebSocket(Ei(e),t.protocols),s.onopen=c=>{for(r=0;i.length&&s&&s.readyState===WebSocket.OPEN;)s.send(i.shift());t.onOpen?.(c)},s.onmessage=c=>{let l=c.data;if(typeof l=="string")try{l=JSON.parse(l)}catch{}t.onMessage?.(l,c)},s.onerror=c=>{t.onError?.(c)},s.onclose=c=>{if(t.onClose?.(c),!o&&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);s&&s.readyState===WebSocket.OPEN?s.send(l):i.push(l)},close(c,l){o=!0;try{s?.close(c,l)}catch{}},get socket(){return s},get readyState(){return s?.readyState??3}}}function Ei(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 fn="application/vnd.webjs+json";async function ki(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",fn);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 Ue(r),n.has("content-type")||n.set("content-type",fn));let o=await fetch(e,{...t,headers:n,body:r}),s=o.headers.get("content-type")||"",i=await o.text(),a=s.includes(fn)?i?ae(i):null:s.includes("application/json")?i?JSON.parse(i):null:i;if(!o.ok){let c=a&&a.error||`richFetch ${e} -> ${o.status}`,l=new Error(c);throw l.status=o.status,l.body=a,l}return a}mn();pn();St();async function oa(e,t,n){let r=e.get();e.set(t);let o;try{o=await n()}catch(s){throw e.set(r),s}return o&&o.success===!1&&e.set(r),o}var ia=Symbol.for("webjs.context");function aa(e){return{__context__:ia,name:e}}var It=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},In=class{constructor(t,{context:n,initialValue:r}){this._host=t,this._context=n,this._value=r,this._subscriptions=new Set,this._onRequest=o=>{let s=o;if(s.context===this._context)if(o.stopPropagation(),s.subscribe){let i={callback:s.callback},a=()=>{this._subscriptions.delete(i)};this._subscriptions.add(i),s.callback(this._value,a)}else s.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 It(this._context,(n,r)=>{let o=this._value;this._value=n,r&&(this._unsubscribe=r),!Object.is(o,n)&&typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()},this._subscribe);this._host.dispatchEvent(t)}};function ca(){return typeof window<"u"}var D={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},$n=class{constructor(t,{task:n,args:r,autoRun:o=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=o,this._status=D.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=D.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=D.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=D.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 D.INITIAL:return t.initial?.();case D.PENDING:return t.pending?.();case D.COMPLETE:return t.complete?.(this._value);case D.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!ca())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,In as ContextProvider,It as ContextRequestEvent,v as MARKER,Ie as Signal,Go as Suspense,$n as Task,D as TaskStatus,an as WebComponent,hn as WebjsFrame,bn as WebjsStream,Pt as adoptStyles,on as allTags,Is as asyncAppend,Ms as asyncReplace,zs as batch,Ls as cache,Ks as computed,vi as connectWS,aa as createContext,Rs as createRef,ln as cspNonce,Es as css,yr as deserialize,qr as disableClientRouter,Ys as effect,vn as enableClientRouter,P as escapeAttr,Xe as escapeText,_i as expose,Ci as getExposed,Ts as guard,$t as html,ye as isAsyncAppend,we as isAsyncReplace,pe as isCSS,ee as isCache,Q as isGuard,Z as isKeyed,Lo as isLazy,be as isLive,yi as isNotFound,wi as isRedirect,X as isRef,J as isRepeat,Gs as isSignal,gt as isSuspense,N as isTemplate,ge as isTemplateContent,me as isUnsafeHTML,te as isUntil,ne as isWatch,xs as keyed,ks as live,sn as lookup,Ro as lookupModuleUrl,Ur as navigate,bi as notFound,oa as optimistic,ae as parse,jo as primeModuleUrl,gi as redirect,js as ref,rn as register,ve as render,gn as renderStream,hi as renderToStream,Jo as renderToString,qn as repeat,Dr as revalidate,ki as richFetch,gr as serialize,Yo as setCspNonceProvider,Vs as signal,Ue as stringify,Qe as stylesToString,mt as tagOf,Ns as templateContent,Bt as unsafeHTML,Os as until,Ai as validateInput,$s as watch};
|
|
5
|
+
<div style="margin-top:4px;white-space:pre-wrap">${s}</div>
|
|
6
|
+
</div>`}async function Y(e,t,n=[],r){e=await fi(e,t,n,r);let s=ln();if(!s.length)return e;let o=[...s].sort((h,u)=>u.length-h.length),i=new RegExp(`<(${o.map(He).join("|")})(?=[\\s>/])((?:"[^"]*"|'[^']*'|[^>])*?)(/?)>`,"g"),a=[];for(let h of e.matchAll(i)){let[u,b,g,m]=h,p=cn(b);if(!p)continue;t&&t.usedComponents&&t.usedComponents.add(b);let d=m?`<${b}${g}>`:u,y=null;try{let w=p.shadow===!0;y=new p,y.__ssrTag=b,y.__ssrAncestors=n;let S=Tr(g),A=wi(S),v=new Set(Object.keys(Tr(g)).map(C=>C.toLowerCase()));mi(y,S),gi(y,S,p);for(let[C,_]of Object.entries(A))y[C]=_;typeof y.performServerUpdate=="function"&&y.performServerUpdate();let T=y.render?y.render():"";T&&typeof T.then=="function"&&(T=await T),d=bi(d,y,v);let M=await k(T,t);if(w){let C=await Y(M,t,[...n,y],r),_=p.styles,$=Array.isArray(_)?_:_&&me(_)?[_]:[],pe=et($);a.push({start:h.index,end:h.index+u.length,text:`${d}<template shadowrootmode="open">${pe}${C}</template>`})}else{if(M.trim()===""){a.push({start:h.index,end:h.index+u.length,text:`${d}<!--webjs-hydrate-->`});continue}let _="",$=h.index+u.length;if(!m){let Bt=h.index+u.length,Xe=We(e,Bt,b);if(Xe!==-1){_=e.slice(Bt,Xe);let Ts=new RegExp(`</${He(b)}\\s*>`,"i"),Ns=e.slice(Xe),Un=Ts.exec(Ns),js=Un?Un[0].length:`</${b}>`.length;$=Xe+js}else _=e.slice(Bt),$=e.length}let pe=hi(_),Qe=pi(M,pe),ks=await Y(Qe,t,[...n,y],r);a.push({start:h.index,end:$,text:`${d}<!--webjs-hydrate-->${ks}</${b}>`})}}catch(w){let S=ai(w);console.error(S?`[webjs] SSR failed for <${b}>: ${S} It was touched in the component's constructor or render(), which run during SSR. Move browser-only work to connectedCallback() or a lifecycle hook (firstUpdated/updated), which SSR never calls; seed first-paint defaults in the constructor only from server-known inputs (attributes / props).`:`[webjs] SSR failed for <${b}>:`,w);let A=w instanceof Error?w:new Error(String(w)),v="";try{let _;y&&typeof y.renderError=="function"&&(_=y.renderError(A)),_===void 0&&(_=Nr(b,A,r)),v=await k(_,t),v.trim()&&(v=await Y(v,t,y?[...n,y]:n,r))}catch(_){console.error(`[webjs] renderError() for <${b}> also threw:`,_),v=""}let T=h.index+u.length;if(!m){let _=h.index+u.length,$=We(e,_,b);if($!==-1){let Qe=new RegExp(`</${He(b)}\\s*>`,"i").exec(e.slice($));T=$+(Qe?Qe[0].length:`</${b}>`.length)}else T=e.length}let M=p.shadow===!0,C;if(M){let _=p.styles,$=Array.isArray(_)?_:_&&me(_)?[_]:[],pe=et($);C=`${d}<template shadowrootmode="open">${pe}${v}</template>`}else C=`${d}<!--webjs-hydrate-->${v}</${b}>`;a.push({start:h.index,end:T,text:C})}}if(!a.length)return e;a.sort((h,u)=>h.start-u.start);let c=[],l=-1;for(let h of a)h.start>=l&&(c.push(h),l=h.end);let f=e;for(let h=c.length-1;h>=0;h--){let{start:u,end:b,text:g}=c[h];f=f.slice(0,u)+g+f.slice(b)}return f}var li=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ui(e){return li.has(e.toLowerCase())}async function fi(e,t,n=[],r){if(e.indexOf("<webjs-suspense")===-1)return e;let s=/<webjs-suspense((?:"[^"]*"|'[^']*'|[^>])*?)>/i,o="",i=e;for(let a=0;a<1e4;a++){let c=s.exec(i);if(!c){o+=i;break}let l=c.index,f=c.index+c[0].length;o+=i.slice(0,l);let h=c[1]||"",u=/data-webjs-fallback="([^"]*)"/i.exec(h),b=u?St(u[1]):"",g=We(i,f,"webjs-suspense"),m,p;if(g===-1)m=i.slice(f),p="";else{m=i.slice(f,g);let d=/<\/webjs-suspense\s*>/i.exec(i.slice(g));p=i.slice(g+(d?d[0].length:17))}if(t){let d=`s${t.nextId++}`;t.pending.push({id:d,promise:Promise.resolve(Ut(m))}),o+=`<webjs-suspense id="${d}">${b}</webjs-suspense>`}else{let d=await Y(m,t,n,r);o+=`<webjs-suspense>${d}</webjs-suspense>`}i=p}return o}function We(e,t,n){let r=He(n),s=new RegExp(`<${r}(?:[\\s>/])`,"gi"),o=new RegExp(`</${r}\\s*>`,"gi");s.lastIndex=t,o.lastIndex=t;let i=1;for(;i>0;){let a=s.exec(e),c=o.exec(e);if(!c)return-1;if(a&&a.index<c.index)i++,o.lastIndex=a.index+1;else{if(i--,i===0)return c.index;s.lastIndex=c.index+1}}return-1}function di(e){let t=/\bslot\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(e);if(!t)return null;let n=t[1]??t[2]??t[3]??"";return n===""?null:n}function hi(e){let t=new Map,n="",r=0;for(;r<e.length;){let s=e.indexOf("<",r);if(s===-1){n+=e.slice(r);break}s>r&&(n+=e.slice(r,s));let o=e.slice(s);if(o.startsWith("<!--")){let p=e.indexOf("-->",s+4);if(p===-1){n+=o,r=e.length;break}n+=e.slice(s,p+3),r=p+3;continue}if(o.startsWith("<!")||o.startsWith("</")){let p=e.indexOf(">",s);if(p===-1){n+=o,r=e.length;break}n+=e.slice(s,p+1),r=p+1;continue}let i=/^<([a-zA-Z][\w-]*)((?:"[^"]*"|'[^']*'|[^>])*?)(\/?)>/.exec(o);if(!i){n+="<",r=s+1;continue}let[a,c,l,f]=i,h=c.toLowerCase(),u=!!f||ui(h),b=di(l),g;if(u)g=s+a.length;else{let p=s+a.length,d=We(e,p,h);if(d===-1){let v=e.slice(s);b!==null?kr(t,b,v):n+=v,r=e.length;continue}let y=new RegExp(`</${He(h)}\\s*>`,"i"),w=e.slice(d),S=y.exec(w),A=S?S[0].length:`</${h}>`.length;g=d+A}let m=e.slice(s,g);b!==null?kr(t,b,m):n+=m,r=g}return n.length>0&&t.set(null,n),t}function kr(e,t,n){let r=e.get(t);r!==void 0?e.set(t,r+n):e.set(t,n)}function pi(e,t){let n=new Set,r="",s=0,o=/<slot((?:"[^"]*"|'[^']*'|[^>])*?)(\/?)>/gi,i;for(;(i=o.exec(e))!==null;){r+=e.slice(s,i.index);let[a,c,l]=i,f=!!l,h=/\bname\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(c),u=h?h[1]??h[2]??h[3]:null,b=c.replace(/\bname\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i,"").trim(),g="",m;if(f)m=i.index+a.length;else{let w=i.index+a.length,S=We(e,w,"slot");if(S===-1)g=e.slice(w),m=e.length;else{g=e.slice(w,S);let A=/<\/slot\s*>/i,v=e.slice(S),T=A.exec(v),M=T?T[0].length:7;m=S+M}}let p=t.get(u),d=u!==null?` name="${P(u)}"`:"",y=b?` ${b}`:"";p!==void 0&&!n.has(u)?(n.add(u),r+=`<slot data-webjs-light data-projection="actual"${d}${y}>${p}</slot>`):r+=`<slot data-webjs-light data-projection="fallback"${d}${y}>${g}</slot>`,s=m,o.lastIndex=m}return r+=e.slice(s),r}function He(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _t(e){return e==="script"||e==="style"}function Tr(e){let t={},n=/([a-zA-Z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2]??r[3]??r[4]??"";return t}function mi(e,t){if(!(!e||typeof e.setAttribute!="function"))for(let[n,r]of Object.entries(t))e.setAttribute(n,St(r))}function bi(e,t,n){if(!t||typeof t.getAttributeNames!="function")return e;let r="";for(let s of t.getAttributeNames()){let o=String(s).toLowerCase();if(n.has(o))continue;let i=t.getAttribute(s);r+=i===""?` ${o}`:` ${o}="${P(String(i))}"`}return r?`${e.slice(0,-1)}${r}>`:e}function gi(e,t,n){let r=n.properties||{};for(let[s,o]of Object.entries(t)){let i=r[s]||r[hn(s)],a=r[s]?s:hn(s);if(!i){e[a]=o;continue}if(i.type===Number)e[a]=Number(o);else if(i.type===Boolean)e[a]=o!=="false";else if(i.type===Object||i.type===Array)try{e[a]=JSON.parse(St(o))}catch{e[a]=o}else e[a]=o}}function hn(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function yi(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function St(e){return e.replace(/</g,"<").replace(/"/g,'"').replace(/&/g,"&")}function wi(e){let t={};for(let n of Object.keys(e)){if(!n.startsWith("data-webjs-prop-"))continue;let r=hn(n.slice(16));try{t[r]=D(St(e[n]))}catch{}delete e[n]}return t}function _i(e,t={ssr:!0}){let n=t&&t.suspenseCtx,r=t&&t.dev!==void 0?t.dev:n&&n.dev;return n&&n.dev===void 0&&r!==void 0&&(n.dev=r),new ReadableStream({async start(s){try{if(t&&t.ssr===!1)await R(e,n,s);else{let o=await k(e,n),i=await Y(o,n,[],r);s.enqueue(i)}n&&n.pending.length&&await Ai(n,s,r),s.close()}catch(o){s.error(o)}}})}async function R(e,t,n){if(!(e==null||e===!1||e===!0)){if(e&&typeof e.then=="function")return e=await e,R(e,t,n);if(be(e)){n.enqueue(String(e.value??""));return}if(ge(e))return R(e.value,t,n);if(se(e))return R(e.signal.get(),t,n);if(X(e))return R(e.value,t,n);if(ee(e))return R(e.fn(),t,n);if(ye(e)){let r=e.template;n.enqueue(String(r?.innerHTML??""));return}if(!te(e)){if(ne(e))return R(e.value,t,n);if(re(e)){let r=e.args;for(let s of r)if(!s||typeof s.then!="function")return R(s,t,n);if(r.length>0)try{let s=await Promise.race(r.map(o=>Promise.resolve(o).catch(()=>{})));return R(s,t,n)}catch{return}return}if(!(we(e)||_e(e))){if(Array.isArray(e)){for(let r of e)await R(r,t,n);return}if(Q(e)){let r=e;for(let s=0;s<r.items.length;s++)await R(r.templateFn(r.items[s],s),t,n);return}if(wt(e)){let r=e;if(t){let s=`s${t.nextId++}`;n.enqueue(`<webjs-boundary id="${s}">`),await R(r.fallback,t,n),n.enqueue("</webjs-boundary>"),t.pending.push({id:s,promise:Promise.resolve(r.children)})}else await R(r.fallback,t,n);return}if(N(e)){await Si(e,t,n);return}n.enqueue(tt(String(e)))}}}}async function Si(e,t,n){let{strings:r,values:s}=e,o="text",i="",a=0,c="",l=0,f="",h="",u="";for(let b=0;b<r.length;b++){let g=r[b];for(let m=0;m<g.length;m++){let p=g[m];switch(o){case"text":u+=p,p==="<"&&(o="tag-open");break;case"tag-open":u+=p,p==="!"?o="bang-1":p==="/"?(o="tag-name",f=""):/[a-zA-Z]/.test(p)?(o="tag-name",f=p.toLowerCase()):o="text";break;case"bang-1":u+=p,o=p==="-"?"bang-dash":"tag-name";break;case"bang-dash":u+=p,p==="-"?(o="comment",l=0):o="tag-name";break;case"comment":u+=p,p==="-"?l+=1:(p===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":u+=p,p===">"?(o=_t(f)?"rawtext":"text",o==="rawtext"&&(h="")):/\s/.test(p)?o="in-tag":f+=p.toLowerCase();break;case"in-tag":u+=p,p===">"?(o=_t(f)?"rawtext":"text",o==="rawtext"&&(h="")):!/\s/.test(p)&&p!=="/"&&(o="attr-name",i=p,a=u.length-1);break;case"rawtext":u+=p,h=(h+p.toLowerCase()).slice(-9),(h.endsWith("<\/script>")||h.endsWith("</style>"))&&(o="text",h="",f="");break;case"attr-name":p==="="?(o="after-eq",u+=p):/\s/.test(p)?(o="in-tag",i="",u+=p):p===">"?(o="text",i="",u+=p):(i+=p,u+=p);break;case"after-eq":p==='"'||p==="'"?(o="attr-quoted",c=p,u+=p):/\s/.test(p)?(o="in-tag",i="",u+=p):p===">"?(o="text",i="",u+=p):(o="attr-unquoted",u+=p);break;case"attr-unquoted":/\s/.test(p)?(o="in-tag",i="",u+=p):(p===">"&&(o="text",i=""),u+=p);break;case"attr-quoted":u+=p,p===c&&(o="in-tag",i="");break}}if(b<s.length){let m=s[b];if(m&&typeof m.then=="function"&&(m=await m),o==="comment")u+=String(m??""),l=0;else if(o==="rawtext")u+=String(m??""),h="";else if(o==="text")u&&(n.enqueue(u),u=""),await R(m,t,n);else if(o==="after-eq"){let p=i[0],d=i.slice(1);p==="@"||p==="."?(u=u.slice(0,a),o="in-tag",i=""):p==="?"?(u=u.slice(0,a),m&&(u+=`${d}=""`),o="in-tag",i=""):(u+=`"${P(String(m??""))}"`,o="in-tag",i="")}else(o==="attr-quoted"||o==="attr-unquoted")&&(u+=P(String(m??"")))}}u&&n.enqueue(u)}async function Ai(e,t,n){let r=dn(),s=r?` nonce="${P(r)}"`:"";for(;e.pending.length;){let o=e.pending.splice(0);await Promise.all(o.map(async({id:i,promise:a})=>{try{let c=await a,l=await k(c,e),f=await Y(l,e,[],n);t.enqueue(`<template data-webjs-resolve="${i}">${f}</template><script${s}>(function(){var t=document.currentScript.previousElementSibling;var b=document.getElementById("${i}");if(b&&t){b.replaceWith(t.content.cloneNode(true));t.remove()}document.currentScript.remove()})()<\/script>`)}catch(c){console.error(`[webjs] Suspense boundary "${i}" rejected:`,c);try{let l=c instanceof Error?c:new Error(String(c)),f=await Y(await k(Nr("webjs-suspense",l,n),e),e,[],n);t.enqueue(`<template data-webjs-resolve="${i}">${f}</template><script${s}>(function(){var t=document.currentScript.previousElementSibling;var b=document.getElementById("${i}");if(b&&t){b.replaceWith(t.content.cloneNode(true));t.remove()}document.currentScript.remove()})()<\/script>`)}catch(l){console.error(`[webjs] Suspense boundary "${i}" error render also threw:`,l)}}}))}}var jr=Symbol.for("webjs.notFound"),Rr=Symbol.for("webjs.redirect");function Ci(){let e=new Error("webjs: notFound()");throw e.__webjs=jr,e}function Ei(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 vi(e){return!!e&&e.__webjs===jr}function xi(e){return!!e&&e.__webjs===Rr}function ki(e,t,n){let r=/^\s*([A-Z]+)\s+(\/\S*)\s*$/.exec(e);if(!r)throw new Error(`expose(): bad pattern ${JSON.stringify(e)}: expected "METHOD /path"`);let[,s,o]=r;return t.__webjsHttp={method:s,path:o,validate:n&&typeof n.validate=="function"?n.validate:null,cors:n&&"cors"in n?Ti(n.cors):null},t}function Ti(e){return e?e===!0?{origin:"*",credentials:!1,maxAge:86400,headers:null}:typeof e=="string"?{origin:e,credentials:!0,maxAge:86400,headers:null}:Array.isArray(e)?{origin:e,credentials:!0,maxAge:86400,headers:null}:{origin:e.origin,credentials:!!e.credentials,maxAge:typeof e.maxAge=="number"?e.maxAge:86400,headers:Array.isArray(e.headers)?e.headers:null}:null}function Ni(e,t){if(typeof e!="function")throw new Error("validateInput(): first argument must be the action function");if(typeof t!="function")throw new Error("validateInput(): second argument must be a validator function");let n=e.__webjsHttp||{};return e.__webjsHttp={...n,validate:t},e}function ji(e){return e&&typeof e=="function"&&e.__webjsHttp||null}function Ri(e,t={}){let n=t.reconnect!==!1,r=0,s=!1,o=null,i=[];function a(){s||(o=new WebSocket(Li(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 Li(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}`}xe();var pn="application/vnd.webjs+json";async function Oi(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",pn);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 De(r),n.has("content-type")||n.set("content-type",pn));let s=await fetch(e,{...t,headers:n,body:r}),o=s.headers.get("content-type")||"",i=await s.text(),a=o.includes(pn)?i?D(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}xe();yn();gn();Ct();async function ha(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}Sn();var pa=Symbol.for("webjs.context");function ma(e){return{__context__:pa,name:e}}var Pt=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},Bn=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()}},qn=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 Pt(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 ba(){return typeof window<"u"}var H={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},Fn=class{constructor(t,{task:n,args:r,autoRun:s=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=s,this._status=H.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=H.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=H.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=H.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 H.INITIAL:return t.initial?.();case H.PENDING:return t.pending?.();case H.COMPLETE:return t.complete?.(this._value);case H.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!ba())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{qn as ContextConsumer,Bn as ContextProvider,Pt as ContextRequestEvent,E as MARKER,Ur as SEED_MISS,Me as Signal,ti as Suspense,Fn as Task,H as TaskStatus,un as WebComponent,bn as WebjsFrame,wn as WebjsStream,Ft as adoptStyles,ln as allTags,Us as asyncAppend,Ds as asyncReplace,Qs as batch,qs as cache,eo as computed,Ri as connectWS,ma as createContext,Bs as createRef,dn as cspNonce,Ls as css,Ar as deserialize,Kr as disableClientRouter,no as effect,Tn as enableClientRouter,P as escapeAttr,tt as escapeText,ki as expose,ji as getExposed,Ms as guard,qt as html,we as isAsyncAppend,_e as isAsyncReplace,me as isCSS,ne as isCache,ee as isGuard,X as isKeyed,qo as isLazy,ge as isLive,vi as isNotFound,xi as isRedirect,te as isRef,Q as isRepeat,to as isSignal,wt as isSuspense,N as isTemplate,ye as isTemplateContent,be as isUnsafeHTML,re as isUntil,se as isWatch,Is as keyed,Os as live,cn as lookup,Bo as lookupModuleUrl,Gr as navigate,Ci as notFound,ha as optimistic,D as parse,Po as primeModuleUrl,Ei as redirect,Ps as ref,an as register,ve as render,_n as renderStream,_i as renderToStream,ri as renderToString,Wn as repeat,Yr as revalidate,Oi as richFetch,Et as scanSeeds,Sr as serialize,ni as setCspNonceProvider,Xs as signal,De as stringify,et as stylesToString,gt as tagOf,Fi as takeSeed,$s as templateContent,Ut as unsafeHTML,Fs as until,Ni as validateInput,Hs as watch};
|
|
7
7
|
//# sourceMappingURL=webjs-core.js.map
|