@webjsdev/core 0.7.22 → 0.7.24
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/README.md +0 -1
- package/dist/webjs-core-browser.js +3 -3
- package/dist/webjs-core-browser.js.map +2 -2
- package/dist/webjs-core.js +3 -3
- package/dist/webjs-core.js.map +2 -2
- package/index-browser.js +9 -0
- package/package.json +1 -1
- package/src/component.d.ts +14 -13
- package/src/router-client.js +95 -27
- package/src/webjs-config.d.ts +21 -1
package/README.md
CHANGED
|
@@ -41,7 +41,6 @@ Counter)` works identically.
|
|
|
41
41
|
Side-channel imports for optional features:
|
|
42
42
|
|
|
43
43
|
```js
|
|
44
|
-
import '@webjsdev/core/client-router'; // SPA-style link interception
|
|
45
44
|
import { unsafeHTML } from '@webjsdev/core/directives';
|
|
46
45
|
import { createContext } from '@webjsdev/core/context';
|
|
47
46
|
import { Task } from '@webjsdev/core/task';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ms=Object.defineProperty;var $=(e,t)=>()=>(e&&(t=e(e=0)),t);var Cn=(e,t)=>{for(var n in t)ms(e,n,{get:t[n],enumerable:!0})};function sr(e,t,n){Lo.has(t)?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}async function Yt(e){return JSON.stringify(await or(e))}function z(e){return ir(JSON.parse(e))}async function or(e){let t=Oo();return await Mo(e,t),W(e,t)}function ir(e){return U(e,Uo())}function Oo(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map,fdEntries:new Map}}async function Mo(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!Do(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){let o=t.fdEntries.get(r)||[...r.entries()];t.fdEntries.set(r,o);for(let[,i]of o)typeof i!="string"&&n.push(i);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($o(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 W(e,t){if(e===null)return null;if(e===void 0)return{[y]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[y]:"NaN"}:e===1/0?{[y]:"Inf"}:e===-1/0?{[y]:"-Inf"}:Object.is(e,-0)?{[y]:"-0"}:e;if(n==="bigint")return{[y]:"BigInt",v:e.toString()};if(n==="symbol"){let o=Symbol.keyFor(e);if(o===void 0)throw new TypeError("Cannot serialize a local Symbol; only Symbol.for() registered symbols are supported.");return{[y]:"Sym",v:o}}if(n==="function")throw new TypeError("Cannot serialize a function.");let r=t.idOf.get(e);if(r!==void 0&&t.emitted.has(r))return{[y]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let s;if(e instanceof Date)s={[y]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)s={[y]:"Error",v:{name:e.name,message:e.message,stack:e.stack||null}};else if(typeof Blob<"u"&&e instanceof Blob){let o=t.blobBytes.get(e);typeof File<"u"&&e instanceof File?s={[y]:"File",v:ve(o),n:e.name,t:e.type||"",m:e.lastModified}:s={[y]:"Blob",v:ve(o),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let o=t.fdEntries.get(e)||[...e.entries()],i=[];for(let[c,a]of o)i.push([c,W(a,t)]);s={[y]:"FD",v:i}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)s=Po(e);else if(e instanceof Map){let o=[];for(let[i,c]of e)o.push([W(i,t),W(c,t)]);s={[y]:"Map",v:o}}else if(e instanceof Set){let o=[];for(let i of e)o.push(W(i,t));s={[y]:"Set",v:o}}else if(Array.isArray(e))s=e.map(o=>W(o,t));else{s={};for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i=qo(o)?"_"+o:o;sr(s,i,W(e[o],t))}}if(r!==void 0){if(Array.isArray(s))return{[y]:"Arr",_id:r,v:s};s._id=r}return s}function Po(e){if(e instanceof ArrayBuffer)return{[y]:"buf",v:ve(new Uint8Array(e))};if(e instanceof DataView)return{[y]:"dv",v:ve(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=Io[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[y]:n,v:ve(r)}}function Uo(){return{refs:new Map}}function U(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(U(e[i],t));return o}let n=e[y];if(typeof n=="string")return Bo(e,n,t);let r={},s=e._id;typeof s=="number"&&t.refs.set(s,r);for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o)||o==="_id")continue;let i=Ho(o)?o.slice(1):o;sr(r,i,U(e[o],t))}return r}function Bo(e,t,n){let r=e._id,s=o=>(typeof r=="number"&&n.refs.set(r,o),o);switch(t){case"undef":return;case"NaN":return NaN;case"Inf":return 1/0;case"-Inf":return-1/0;case"-0":return-0;case"BigInt":return s(BigInt(e.v));case"Sym":return s(Symbol.for(e.v));case"Date":return s(e.v==null?new Date(NaN):new Date(e.v));case"Error":{let o=new Error(e.v.message);return o.name=e.v.name,e.v.stack&&(o.stack=e.v.stack),typeof r=="number"&&n.refs.set(r,o),o}case"Map":{let o=new Map;typeof r=="number"&&n.refs.set(r,o);for(let[i,c]of e.v)o.set(U(i,n),U(c,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(U(i,n));return o}case"Arr":{let o=[];typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.push(U(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=Ae(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=Ae(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,c]of e.v){let a=U(c,n);o.append(i,a)}return o}default:{if(t==="buf"){let i=Ae(e.v);return s(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=Ae(e.v);return s(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let o=Fo[t];if(o){let i=Ae(e.v),c=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);return s(new o(c))}throw new TypeError(`Unknown serialization tag: ${t}`)}}}function Do(e){return e!==null&&typeof e=="object"}function $o(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function qo(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function Ho(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}function ve(e){if(ar)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 Ae(e){if(ar){let r=Buffer.from(e,"base64");return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}var y,Lo,Io,Fo,ar,Ce=$(()=>{y="_$wj",Lo=new Set(["__proto__","constructor","prototype"]);Io={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},Fo={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};ar=typeof Buffer<"u"&&typeof Buffer.from=="function"});var gr={};Cn(gr,{observeLazy:()=>oi,observeViewportOnce:()=>ci});function yr(e){let t=Jt.get(e);return t||(t=import(e).finally(()=>Jt.delete(e)),Jt.set(e,t),t)}function oi(e){for(let[t,n]of Object.entries(e))K.set(t.toLowerCase(),n);if(typeof IntersectionObserver>"u"){for(let t of K.values())yr(t);K.clear();return}Te||(Te=new IntersectionObserver(ii,{rootMargin:"200px"})),br(),typeof MutationObserver<"u"&&new MutationObserver(()=>br()).observe(document.body,{childList:!0,subtree:!0})}function br(){if(!(!Te||!K.size))for(let e of K.keys())for(let t of document.querySelectorAll(e))Te.observe(t)}function ii(e){for(let t of e){if(!t.isIntersecting)continue;let n=t.target.tagName.toLowerCase(),r=K.get(n);r&&(yr(r),K.delete(n),Te?.unobserve(t.target))}}function ai(e){for(let t of e){if(!t.isIntersecting)continue;let n=st.get(t.target);st.delete(t.target),Ee?.unobserve(t.target),n&&n()}}function ci(e,t){return typeof IntersectionObserver>"u"?(t(),()=>{}):(Ee||(Ee=new IntersectionObserver(ai,{rootMargin:"200px"})),st.set(e,t),Ee.observe(e),()=>{st.delete(e),Ee?.unobserve(e)})}var K,Te,Jt,Ee,st,_r=$(()=>{K=new Map,Te=null,Jt=new Map;Ee=null,st=new WeakMap});var Xt,Qt=$(()=>{Xt=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(()=>(_r(),gr)).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(()=>(Zt(),wr)).then(({loadFrame:n})=>{this._webjsLoadedSrc!==t||!this.isConnected||n(this,t)})}}:null;typeof customElements<"u"&&Xt&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",Xt)});function ui(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 tn(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 li,en,ot=$(()=>{li=new Set(["append","prepend","before","after","replace","update"]);en=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=li.has(t)?this.querySelector("template"):null;try{for(let i of r){let c=o?o.content.cloneNode(!0):null;ui(t,i,c)}}finally{this.remove()}}}:null;typeof customElements<"u"&&en&&!customElements.get("webjs-stream")&&customElements.define("webjs-stream",en)});var Sr,Ar=$(()=>{Sr=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this.style.display||(this.style.display="contents")}}:null;typeof customElements<"u"&&Sr&&!customElements.get("webjs-suspense")&&customElements.define("webjs-suspense",Sr)});function it(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]'))Cr(n.textContent,n);for(let n of t.querySelectorAll("[data-webjs-seed]"))Cr(n.getAttribute("data-webjs-seed"),n,()=>n.removeAttribute("data-webjs-seed"))}}function Cr(e,t,n){if(e)try{let r=z(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){vr||(vr=!0,it());let r=`${e}/${t}/${n}`;if(ke.has(r)){let s=ke.get(r);return ke.delete(r),s}return Er}var ke,Er,vr,nn=$(()=>{Ce();ke=new Map,Er=Symbol("webjs.seed.miss"),vr=!1});var wr={};Cn(wr,{_FRAME_TOP:()=>Dr,_LIVE_ATTRS:()=>cn,_activeFrameId:()=>Br,_addNewHeadElements:()=>ln,_applyStreamedResolve:()=>us,_blurOutgoingFocus:()=>lt,_buildSubmitFormData:()=>Fr,_bumpNavToken:()=>Pi,_clearFormBusy:()=>es,_clearFrameBusy:()=>Qr,_collectChildrenSlots:()=>le,_currentPageUrl:()=>Ii,_diffElementInPlace:()=>mt,_eligibleAnchorHref:()=>ut,_findAnchorInPath:()=>Ur,_getSubmitAction:()=>Ir,_getSubmitMethod:()=>Pr,_isNonHtmlPath:()=>Ui,_keyOf:()=>ce,_longestSharedPath:()=>$r,_markFormBusy:()=>Zr,_markFrameBusy:()=>Xr,_mergeHead:()=>as,_navToken:()=>Mi,_onPopState:()=>fn,_onSubmit:()=>dn,_prefetch:()=>ue,_prefetchHasHoverPointer:()=>zr,_prefetchInflightSize:()=>Li,_prefetchMode:()=>ft,_prefetchPeek:()=>Ri,_prefetchSaysSaveData:()=>mn,_prefetchSuppressed:()=>Kr,_prefetchTake:()=>Yr,_reactivateScripts:()=>bt,_readStreamedShell:()=>cs,_reconcileChildren:()=>gn,_regraftPermanentElements:()=>ns,_regraftPermanentInSlice:()=>yn,_resetPrefetch:()=>Oi,_resolveTargetFrameId:()=>hn,_restoreOptimistic:()=>xe,_runWithTransition:()=>ct,_setCurrentPageUrl:()=>Fi,_snapshotCache:()=>E,_streamBoundariesProgressively:()=>fs,_takeResolveUnit:()=>ls,_viewTransitionsEnabled:()=>ts,collectChildrenSlots:()=>le,disableClientRouter:()=>Rr,enableClientRouter:()=>un,loadFrame:()=>hi,longestSharedPath:()=>$r,navigate:()=>Lr,revalidate:()=>Or});function jr(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}function di(){rn||typeof MutationObserver>"u"||typeof customElements>"u"||(rn=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)}}),rn.observe(document.body,{childList:!0,subtree:!0}))}function un(){D||typeof document>"u"||(D=!0,document.addEventListener("click",Mr,!1),document.addEventListener("submit",dn,!1),window.addEventListener("popstate",fn),document.addEventListener("pointerover",ae,!0),document.addEventListener("focusin",ae,!0),document.addEventListener("touchstart",ae,{capture:!0,passive:!0}),document.addEventListener("pointerout",Gr,!0),document.addEventListener("webjs:navigate",an),di(),an(),typeof history<"u"&&"scrollRestoration"in history&&(at=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(L=location.href))}function Rr(){D&&(D=!1,document.removeEventListener("click",Mr,!1),document.removeEventListener("submit",dn,!1),window.removeEventListener("popstate",fn),document.removeEventListener("pointerover",ae,!0),document.removeEventListener("focusin",ae,!0),document.removeEventListener("touchstart",ae,{capture:!0}),document.removeEventListener("pointerout",Gr,!0),document.removeEventListener("webjs:navigate",an),gt(),bn(),B&&(B.disconnect(),B=null),typeof history<"u"&&at!==null&&(history.scrollRestoration=at,at=null),L=null)}async function Lr(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await pn(n.href,t?.replace??!1,null)}async function hi(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};k&&k.abort(),k=new AbortController;let s=k.signal,o=++g;return dt(r.href,n,!1,null,"GET",null,s,o)}function Or(e){if(!e){E.clear(),A.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;E.delete(n),A.delete(n)}function Mr(e){if(!D||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=Ur(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||yt.test(r.pathname))return;e.preventDefault();let s=hn(t);pn(n,!1,s)}function fn(e){pn(location.href,!0,null)}function dn(e){if(!D||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=Pr(t,n);if(s==="dialog")return;let o=Ir(t,n),i;try{i=new URL(o,location.href)}catch{return}if(i.origin!==location.origin||yt.test(i.pathname))return;let c=Fr(t,n);e.preventDefault();let a=hn(n||t);yi(i.href,s,c,a,t)}function Pr(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function Ir(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function Fr(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 Ur(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function Br(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 hn(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===Dr)return null;let r=typeof document<"u"?document.getElementById(n):null;return r&&r.tagName&&r.tagName.toLowerCase()==="webjs-frame"?n:(pi(`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 Br(e)}function pi(e,t){kr.has(e)||(kr.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,c=/^wj:children:(.+)$/.exec(i);if(c){n.push({path:c[1],start:o});return}if(i.trim()==="/wj:children"){let a=n.pop();a&&!t.has(a.path)&&t.set(a.path,{start:a.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 $r(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 qr(e){let t=J(e);E.has(t)&&E.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(E.set(t,n);E.size>mi;){let r=E.keys().next().value;E.delete(r)}}function bi(e){let t=J(e),n=E.get(t);return n==null?null:(E.delete(t),E.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function J(e){let t=new URL(e,location.href);return t.pathname+t.search}async function pn(e,t,n){k&&k.abort(),k=new AbortController;let r=k.signal,s=++g;L&&qr(L);let o=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),o=null},150),i=null;t||(i=ss());try{if(t){let c=bi(e);if(c){let a=jr(c.html);if(a){rs(a,n,!0,null),typeof window<"u"&&window.scrollTo(c.scrollX,c.scrollY),dt(e,n,!1,i,"GET",null,r,s).catch(()=>{});return}}typeof window<"u"&&window.scrollTo(0,0)}await dt(e,n,!t,i,"GET",null,r,s)}finally{o&&clearTimeout(o),s===g&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(L=location.href))}}async function yi(e,t,n,r,s){k&&k.abort(),k=new AbortController;let o=k.signal,i=++g,c=t==="get"||t==="head",a=new URL(e,location.href);if(c){a.search="";for(let[h,m]of n)a.searchParams.append(h,typeof m=="string"?m:m.name)}L&&qr(L);let l=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),l=null},150),u=ss(),p=s?Zr(s,i,a.href):null,d=!1;try{let h=await dt(a.href,r,!0,u,c?"GET":t.toUpperCase(),c?null:n,o,i);d=!!(h&&h.ok),!c&&i===g&&(E.clear(),A.clear())}finally{p&&es(p,i,a.href,d),l&&clearTimeout(l),i===g&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(L=location.href))}}function Hr(){return[...le(document.body).keys()].join(",")}function mn(){try{let e=typeof navigator<"u"?navigator.connection:null;if(e&&(e.saveData===!0||typeof e.effectiveType=="string"&&/2g$/.test(e.effectiveType))||typeof matchMedia=="function"&&matchMedia("(prefers-reduced-data: reduce)").matches)return!0}catch{}return!1}function zr(){try{if(typeof matchMedia=="function")return matchMedia("(hover: hover) and (pointer: fine)").matches}catch{}return!0}function Ai(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function ut(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||yt.test(n.pathname)?null:t}function Kr(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=Ai(e);return t.includes("external")||t.includes("no-prefetch")}function ft(e){if(Kr(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 zr()?"intent":"viewport"}}function ue(e){if(!D||typeof fetch!="function"||mn())return;let t=J(e);if(Y.has(t)||Ne.has(t))return;let n=A.get(t);if(n&&on()-n.at<Vr)return;if(Y.size>=Wr){for(Ne.add(t),oe.push(e);oe.length>_i;){let o=oe.shift();Ne.delete(J(o))}return}Y.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},s=Hr();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 c=o.headers.get("x-webjs-build"),a=o.redirected&&o.url?o.url:e,l=await o.text();Ci(t,{html:l,build:c,finalUrl:a,at:on()})}).catch(()=>{}).finally(()=>{Y.delete(t),vi()})}function vi(){for(;oe.length&&Y.size<Wr;){let e=oe.shift();Ne.delete(J(e)),ue(e)}}function Ci(e,t){for(A.has(e)&&A.delete(e),A.set(e,t);A.size>gi;){let n=A.keys().next().value;A.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function Yr(e){let t=J(e),n=A.get(t);return!n||(A.delete(t),on()-n.at>=Vr)?null:n}function on(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function ae(e){if(!D)return;let t=Jr(e.target);if(!t)return;let n=ft(t);if(n==="none"||n==="render")return;let r=ut(t);if(r){if(e.type==="touchstart"){ue(r);return}n==="intent"&&(je===t&&ie||(gt(),je=t,ie=setTimeout(()=>{ie=null,je=null,ue(r)},wi)))}}function Gr(e){let t=Jr(e.target);t&&t===je&>()}function gt(){ie&&(clearTimeout(ie),ie=null),je=null}function bn(){for(let e of Re)clearTimeout(e);Re.clear(),re=new WeakMap}function Jr(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 an(){if(typeof document>"u"||mn())return;let e=typeof IntersectionObserver<"u";e&&(B?(B.disconnect(),bn()):B=new IntersectionObserver(t=>{for(let n of t){let r=n.target;if(n.isIntersecting){if(re.has(r))continue;let s=setTimeout(()=>{Re.delete(s),re.delete(r),B.unobserve(r);let o=ut(r);o&&ft(r)==="viewport"&&ue(o)},Si);re.set(r,s),Re.add(s)}else{let s=re.get(r);s&&(clearTimeout(s),Re.delete(s),re.delete(r))}}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=ft(t);if(n==="render"){let r=ut(t);r&&ue(r)}else n==="viewport"&&e&&B.observe(t)}}function Ei(e){if(typeof document>"u"||!document.body)return!1;let t=le(document.body),n,r=-1;for(let[a,l]of t)a.length>r&&(r=a.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 c=document.createRange();return c.setStartAfter(n.start),c.setEndBefore(n.end),c.deleteContents(),s.insertBefore(o,n.end),!0}function sn(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||Ei(t)||typeof location<"u"&&(location.href=e)}async function dt(e,t,n,r,s,o,i,c){s=s||"GET";let a=typeof c=="number"?c:g,l,u=null,p=null,d=null,h=!1,m=e,de=t?Xr(t,a):null;try{try{let f=s==="GET"&&!o&&!t?Yr(e):null;if(f)l=f.html,p=f.build,m=f.finalUrl,d=200,h=!0;else{let T={"x-webjs-router":"1"},w=Hr();w&&(T["x-webjs-have"]=w),t&&(T["x-webjs-frame"]=t),o!=null&&s!=="GET"&&s!=="HEAD"&&(T.accept=Tr+", text/html");let N={method:s,headers:T,credentials:"same-origin"};i&&(N.signal=i),o!=null&&s!=="GET"&&s!=="HEAD"&&(N.body=o);let _=await fetch(e,N);d=_.status,h=_.ok;let he=_.headers.get("content-type")||"",pe=/^text\/html\b/i.test(he);if(he.toLowerCase().indexOf(Tr)===0){let ps=await _.text();return a===g&&(xe(r),tn(ps)),{ok:h,status:d,aborted:!1}}if(_.redirected&&_.url&&(m=_.url),_.status===204||_.status===205)return a===g&&n&&history.pushState(null,"",m),{ok:h,status:d,aborted:!1};if(!pe)return a===g&&(xe(r),sn(e,_.status,null)),{ok:!1,status:d,aborted:!1};p=_.headers.get("x-webjs-build");let C=await cs(_);l=C.shell,C.streaming&&(u=C)}}catch(f){return f&&f.name==="AbortError"?{ok:!1,status:null,aborted:!0}:a!==g?{ok:!1,status:null,aborted:!0}:(xe(r),sn(e,null,f instanceof Error?f:new Error(String(f))),{ok:!1,status:null,aborted:!1})}if(a!==g){if(u&&u.reader)try{u.reader.cancel()}catch{}return{ok:!1,status:d,aborted:!0}}let v=jr(l);if(!v)return xe(r),sn(e,null,new Error("navigation response did not parse as HTML")),{ok:!1,status:d,aborted:!1};if(rs(v,t,!1,m,p),n&&history.pushState(null,"",m),n){let f=new URL(m);if(f.hash){let T=document.getElementById(f.hash.slice(1));T?T.scrollIntoView():window.scrollTo(0,0)}else window.scrollTo(0,0)}return u&&(u.reader||u.rest)&&fs(u.reader,u.dec,u.rest,()=>a===g),document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:m,frameId:t,from:"navigate"}})),{ok:h,status:d,aborted:!1}}finally{de&&Qr(de,a)}}function Xr(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=ht.has(n);return ht.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 Qr(e,t){if(ht.get(e)!==t)return;ht.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 Zr(e,t,n){let r=pt.has(e);return pt.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 es(e,t,n,r){if(pt.get(e)!==t)return;pt.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 xr(e){if(!e||!e.head)return"";let t=e.head.querySelectorAll('[data-webjs-track="reload"]');if(!t.length)return"";let n="";for(let r of t)n+=G(r);return n}function ts(){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(ts()&&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 ns(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 yn(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=Ti(t,s);if(!o||o===r)continue;let i=o.parentNode;if(i)i.replaceChild(r,o);else{let c=t.indexOf(o);c!==-1&&(t[c]=r)}}}function Ti(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 ki(e){if(!(!e||!e.start))for(let t=e.start.nextSibling;t&&t!==e.end;t=t.nextSibling)t.nodeType===1&&se(t)}function rs(e,t,n,r,s){try{it(e)}catch{}try{typeof sessionStorage<"u"&&(!r||t||n)&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}if(r&&!t&&!n){let u=document.querySelector('script[type="importmap"]'),p=u?u.getAttribute("data-webjs-build"):null,d=!1;if(s&&p&&(d=s!==p),!d&&e.head&&e.head.children.length>0){let h=xr(document),m=xr(e);h!==m&&(d=!0)}if(d&&typeof location<"u")try{let h="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(h))sessionStorage.removeItem(h);else{sessionStorage&&sessionStorage.setItem(h,"1"),location.href=r;return}}catch{location.href=r;return}else if(!d)try{typeof sessionStorage<"u"&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}}if(t){let u=document.querySelector(`webjs-frame#${CSS.escape(t)}`),p=e.querySelector(`webjs-frame#${CSS.escape(t)}`);if(u&&p){ln(e.head),ct(()=>{ji(u,p),bt(u),se(u),lt()},()=>se(u)),Nr(e.body);return}let d=new CustomEvent("webjs:frame-missing",{bubbles:!0,cancelable:!0,detail:{frameId:t,url:r||(typeof location<"u"?location.href:null),document:e}});(u||document).dispatchEvent(d),d.defaultPrevented||console.warn(`[webjs] frame "${t}" was not in the navigation response, leaving it unchanged. Handle "webjs:frame-missing" (preventDefault) to override.`);return}let o=le(document.body),i=le(e.body),c=$r(o,i);if(c){ln(e.head),ct(()=>{xi(o.get(c),i.get(c),e),lt()},()=>ki(o.get(c))),Nr(e.body);return}as(e.head),ns(document.body,e.body);let a=[...e.body.childNodes];ct(()=>{document.body.replaceChildren(...a),bt(document.body),se(document.body),lt()},()=>se(document.body))}function lt(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function xi(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));yn(s,o),Ni(r,e.start,e.end,s,o);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&(bt(i),se(i))}function Ni(e,t,n,r,s){let o=new Map;for(let a of r){if(a.nodeType!==1)continue;let l=ce(a);l&&o.set(l,a)}let i=n,c=[];for(let a of s){if(a.nodeType===1){let l=ce(a);if(l&&o.has(l)){let u=o.get(l);mt(u,a),c.push(u),o.delete(l);continue}}c.push(a)}for(let a of r)if(a.parentNode===e){if(a.nodeType===1&&c.includes(a))continue;e.removeChild(a)}for(let a of c)e.insertBefore(a,i)}function mt(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),!cn.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])cn.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);gn(e,t)}function gn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(c=>document.importNode(c,!0));yn(n,r);let s=new Map;for(let c of n){if(c.nodeType!==1)continue;let a=ce(c);a&&s.set(a,c)}let o=[];for(let c=0;c<r.length;c++){let a=r[c];if(a.nodeType===1){let l=ce(a);if(l&&s.has(l)){let p=s.get(l);mt(p,a),o.push(p),s.delete(l);continue}let u=n[c];if(u&&u.nodeType===1&&!ce(u)&&u.tagName===a.tagName){mt(u,a),o.push(u);continue}}else if(a.nodeType===3){let l=n[c];if(l&&l.nodeType===3){l.nodeValue!==a.nodeValue&&(l.nodeValue=a.nodeValue),o.push(l);continue}}else if(a.nodeType===8){let l=n[c];if(l&&l.nodeType===8){l.nodeValue!==a.nodeValue&&(l.nodeValue=a.nodeValue),o.push(l);continue}}o.push(a)}let i=new Set(o);for(let c of n)!i.has(c)&&c.parentNode===e&&e.removeChild(c);for(let c=0;c<o.length;c++){let a=o[c];(a.parentNode!==e||e.childNodes[c]!==a)&&e.insertBefore(a,e.childNodes[c]||null)}}function ce(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}function ss(){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:g}}function xe(e){if(!e||e.token!==g)return;let{slot:t,oldChildren:n}=e;if(t.start.parentNode!==t.end.parentNode)return;let r=document.createRange();r.setStartAfter(t.start),r.setEndBefore(t.end),r.deleteContents();for(let s of n)t.start.parentNode.insertBefore(s,t.end)}function ji(e,t){gn(e,t)}function os(){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=os();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function is(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=os();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function G(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function ln(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(G(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(G(r))||(r.tagName==="SCRIPT"?document.head.appendChild(_n(r)):document.head.appendChild(is(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(G(o));let s=new Set;for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&s.add(G(o));for(let o of[...t.children])o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(s.has(G(o))||o.remove());for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(r.has(G(o))||(o.tagName==="SCRIPT"?t.appendChild(_n(o)):t.appendChild(is(o))))}function se(e){typeof customElements>"u"||wn(e)}function wn(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&&wn(n.shadowRoot))}function Nr(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:c,done:a}=await t.read();c&&(r+=n.decode(c,{stream:!0})),a&&(r+=n.decode());let l=r.indexOf(o);if(l!==-1)return{shell:r.slice(0,l),streaming:!0,reader:a?null:t,dec:n,rest:r.slice(l+o.length)};let u=r.indexOf(s);if(u!==-1)return{shell:r.slice(0,u),streaming:!0,reader:a?null:t,dec:n,rest:r.slice(u)};if(a)return{shell:r,streaming:!1};let p=i.exec(r);if(p){let d=p.index+p[0].length;return{shell:r.slice(0,d),streaming:!0,reader:t,dec:n,rest:r.slice(d)}}}}function ls(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 us(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&&wn(o)}async function fs(e,t,n,r){let s=n,o=()=>{let i;for(;i=ls(s);){if(!r())return!1;us(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:c}=await e.read();if(i&&(s+=t.decode(i,{stream:!0})),c){s+=t.decode(),o();return}}}catch{}}function bt(e){for(let t of e.querySelectorAll("script"))t.replaceWith(_n(t))}function Ri(e){return A.get(J(e))||null}function Li(){return Y.size}function Oi(){A.clear(),Y.clear(),oe.length=0,Ne.clear(),gt(),bn()}function Mi(){return g}function Pi(){return++g}function Ii(){return L}function Fi(e){L=e}function Ui(e){return yt.test(e)}var Tr,D,k,g,rn,L,at,yt,Dr,kr,mi,E,gi,Vr,Wr,_i,wi,Si,A,Y,oe,Ne,ie,je,B,re,Re,ht,pt,cn,Zt=$(()=>{Qt();ot();ot();Ar();nn();Tr="text/vnd.webjs-stream.html";D=!1,k=null,g=0,rn=null;L=null,at=null;yt=/\.(?: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;Dr="_top";kr=new Set;mi=16,E=new Map;gi=8,Vr=3e4,Wr=3,_i=24,wi=100,Si=250,A=new Map,Y=new Set,oe=[],Ne=new Set,ie=null,je=null,B=null,re=new WeakMap,Re=new Set;ht=new WeakMap;pt=new WeakMap;cn=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);un()});function bs(e,...t){return{_$webjs:"template",strings:e,values:t}}function S(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var b="w$";function ys(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 At(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function vt(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
|
|
3
|
-
`)}</style>`}function _s(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ws(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}var En=Symbol.for("webjs.repeat");function Tn(e,t,n){return{[En]:!0,items:[...e],keyFn:t,templateFn:n}}function Le(e){return!!e&&typeof e=="object"&&e[En]===!0}function Ss(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function Ct(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function As(e){return{_$webjs:"live",value:e}}function Et(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function vs(e,t){return{_$webjs:"keyed",key:e,value:t}}function Oe(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function Cs(e,t){return{_$webjs:"guard",deps:e,fn:t}}function Me(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function Es(e){return{_$webjs:"template-content",template:e}}function Tt(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function Ts(e){return{_$webjs:"ref",target:e}}function Pe(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function ks(){return{value:void 0}}function xs(e){return{_$webjs:"cache",value:e}}function Ie(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function Ns(...e){return{_$webjs:"until",args:e}}function Fe(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function js(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function kt(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function Rs(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function xt(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function Ls(e){return{_$webjs:"watch",signal:e}}function Ue(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var x=null,M=!1,Q=0,X=null,Nt=0,kn=(e,t)=>Object.is(e,t),De=()=>{},xn=()=>!1;function Nn(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)Nn(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function me(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)me(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function Pt(e){if(M)throw new Error("Signal read during notification phase");if(x===null)return;let t=x,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&Lt(t)&&me(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,Lt(t)&&Nn(e,t)),t.producerLastReadVersions[n]=e.version}function Lt(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function jn(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=M;M=!0;try{for(let n of e.liveConsumers)n.dirty||Os(n)}finally{M=t}}function Os(e){e.dirty=!0,jn(e),e.consumerMarkedDirty.call(e.wrapper||e)}function $e(e){if(!(!e.dirty&&e.lastCleanEpoch===Q)){if(!e.producerMustRecompute()&&!Ms(e)){e.dirty=!1,e.lastCleanEpoch=Q;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=Q}}function Ms(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||($e(n),r!==n.version))return!0}return!1}function Ot(e){e&&(e.nextProducerIndex=0);let t=x;return x=e,t}function Mt(e,t){if(x=t,!!e){if(Lt(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)me(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var qe=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=Q,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=xn,this.producerRecomputeValue=De,this.consumerMarkedDirty=De,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||kn,this.watched=n?.[It],this.unwatched=n?.[Ft]}get(){return Pt(this),this.__value}peek(){return this.__value}set(t){if(M)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,Q++,X!==null?Rn(this):jn(this))}};function Rn(e){let t=M;M=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?X.add(n):Rn(n))}finally{M=t}}var jt=Symbol("unset"),Rt=Symbol("computing"),Be=Symbol("errored"),be=class{constructor(t,n){this.__fn=t,this.__value=jt,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||kn,this.watched=n?.[It],this.unwatched=n?.[Ft];let r=this;this.producerMustRecompute=function(){return r.__value===jt||r.__value===Rt},this.producerRecomputeValue=function(){if(r.__value===Rt)throw new Error("Detected cycle in computations.");let s=r.__value;r.__value=Rt;let o=Ot(r),i,c=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=Be,r.__error=l,c=!0}finally{Mt(r,o)}if(!c&&(s!==jt&&s!==Be)&&r.__equal.call(r.wrapper,s,i)){r.__value=s;return}r.__value=i,r.version++},this.consumerMarkedDirty=De}get(){if($e(this),Pt(this),this.__value===Be)throw this.__error;return this.__value}peek(){if($e(this),this.__value===Be)throw this.__error;return this.__value}},He=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=Q,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=xn,this.producerRecomputeValue=De,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=Ot(this);try{for(let r of t)Pt(r),r.__isComputed&&$e(r)}finally{Mt(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(me(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=Ot(this),r;try{r=t()}finally{Mt(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)me(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},It=Symbol("watched"),Ft=Symbol("unwatched");function Ps(e){let t=x;x=null;try{return e()}finally{x=t}}function Is(e){return e.producers.slice()}function Fs(e){return e.liveConsumers?[...e.liveConsumers]:[]}function Us(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function Bs(e){return e.producers.length>0}function Ds(){return x&&x.__isComputed?x:null}function $s(e){Nt++,X===null&&(X=new Set);try{e()}finally{if(Nt--,Nt===0){let t=X;X=null;for(let n of t)n.__fire()}}}var ye={State:qe,Computed:be,subtle:{Watcher:He,untrack:Ps,introspectSources:Is,introspectSinks:Fs,hasSinks:Us,hasSources:Bs,currentComputed:Ds,watched:It,unwatched:Ft}};function qs(e,t){return new qe(e,t)}function Hs(e,t){return new be(e,t)}function Vs(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function Ws(e){let t=!1,n=!1,r=new be(e),s=new He(()=>{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 zs=`${b}s`,Ks=`${b}e`;function Ln(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===zs||t===Ks}function Ys(e){for(let t of e.addedNodes)if(Ln(t))return!0;for(let t of e.removedNodes)if(Ln(t))return!0;return!1}function Fn(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var _e=Fn(),q=Symbol("webjs.slot.state"),P="data-webjs-light",H="data-projection",we="actual",Un="fallback",Ke=Symbol("webjs.slot.fallbackFrag"),Gs=64,ge=null,Ut=null,Ve=null,On=!1;function Js(){On||(_e=Fn(),_e&&(ge=HTMLSlotElement.prototype.assignedNodes,Ut=HTMLSlotElement.prototype.assignedElements,Ve=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(P)&&!Mn(this)?Bt(this,t):ge?ge.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(P)&&!Mn(this)?Bt(this,t).filter(n=>n.nodeType===1):Ut?Ut.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=Ve&&Ve.get?Ve.get.call(this):null;return t||Xs(this)}}),On=!0))}Js();function Mn(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 Bt(e,t){if(e.getAttribute(H)===Un)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:Dt(n,new Set,0)}function Dt(e,t,n){if(n>=Gs)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(P)){let i=Bt(o,{flatten:!1});if(i.length>0)for(let c of Dt(i,t,n+1))r.push(c);else for(let c of Dt(Array.from(o.childNodes),t,n+1))r.push(c)}else if(ge){let i=ge.call(o,{flatten:!0});for(let c of i)r.push(c)}else r.push(s)}else r.push(s);return r}function Xs(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(P))return t.getAttribute(H)===we?t:null;t=t.parentElement}return null}function I(e){let t=e,n=t[q];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[q]=n),n}function $t(e){return!!e[q]}function Bn(e){let t=I(e);for(;e.firstChild;){let n=e.firstChild,r=We(n);ze(t.assignedByName,r,n),e.removeChild(n)}}function Dn(e){let t=I(e),n=e.querySelectorAll(`slot[${P}]`);for(let r of n){let s=r;if(s.getAttribute(H)!==we)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 We(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function ze(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function $n(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 qn(e){if(!_e)return;let t=I(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let s of n)if(!Ys(s)){if(s.type==="childList"){for(let o of s.addedNodes)o.parentElement===e&&(ze(t.assignedByName,We(o),o),r=!0);for(let o of s.removedNodes)e.contains(o)||Pn(t,o)&&(r=!0)}else if(s.type==="attributes"&&s.attributeName==="slot"){let o=s.target;(Pn(t,o)||o.parentElement===e)&&(ze(t.assignedByName,We(o),o),r=!0)}}r&&Ye(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function Hn(e){let t=e[q];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 Pn(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 Ye(e){let t=I(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,Qs(e)}))}function Qs(e){if(!_e)return;let t=e[q];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${P}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||Zs(t,i);for(let i of r)t.ownedSlots.has(i)||no(e,i);t.ownedSlots=r;let s=new Map;for(let i of n){let c=i.getAttribute("name")||null,a=s.get(c);a||(a=[],s.set(c,a)),a.push(i)}for(let i of s.keys()){let c=t.pendingByName.get(i);if(c&&c.length){let a=t.assignedByName.get(i)||[],l=[];for(let u of c)l.push(u);for(let u of a)l.indexOf(u)===-1&&l.push(u);t.assignedByName.set(i,l),t.pendingByName.delete(i)}}let o=[];for(let[i,c]of s){let a=t.assignedByName.get(i)||[];for(let l=0;l<c.length;l++){let u=c[l];l===0&&a.length>0?eo(t,u,a)&&o.push(u):to(t,u)&&o.push(u)}}for(let i of o)ro(i)}function Zs(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;$n(e.pendingByName,s,r)}e.lastSnapshot.delete(t)}function eo(e,t,n){let r=t.getAttribute(H)!==we,s=e.lastSnapshot.get(t)||[];if(!r&&so(s,n))return!1;let i=t[Ke];if(r&&i)for(;t.firstChild;)i.appendChild(t.firstChild);else for(;t.firstChild;)t.removeChild(t.firstChild);for(let c of n)t.appendChild(c);return t.setAttribute(H,we),e.lastSnapshot.set(t,n.slice()),!0}function to(e,t){let n=t.getAttribute(H)===we;if(t.setAttribute(H,Un),!n)return In(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return In(t),!0}function In(e){let t=e[Ke];!t||t.childNodes.length===0||e.appendChild(t)}function no(e,t){if(!_e)return;let n=I(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>Ye(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function Vn(e,t){if(!$t(e))return;let n=I(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);$n(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 ro(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function so(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 Wn=new WeakMap,qt=Symbol.for("webjs.instance");function te(e,t){let n=t,r=n[qt];if(S(e)){let s=e;if(r&&r.strings===s.strings){Z(r,s.values);return}r&&zn(r,t);let o=t.firstChild;o&&o.nodeType===8&&o.data==="webjs-hydrate"&&o.remove();let i=ao(s,t);n[qt]=i;return}if(r&&zn(r,t),n[qt]=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 Je(e){let{strings:t}=e,n=Wn.get(t);if(n)return n;let r=[],s="",o="text",i="",c=0,a="",l=0,u=null,p="",d="";for(let m=0;m<t.length;m++){let de=t[m];for(let v=0;v<de.length;v++){let f=de[v];switch(o){case"text":s+=f,f==="<"&&(o="tag-open");break;case"tag-open":s+=f,f==="!"?o="bang-1":f==="/"?(o="tag-name",p=""):/[a-zA-Z]/.test(f)?(o="tag-name",p=f.toLowerCase()):o="text";break;case"bang-1":s+=f,o=f==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=f,f==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=f,f==="-"?l+=1:(f===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=f,f===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(d="")):/\s/.test(f)?o="in-tag":p+=f.toLowerCase();break;case"in-tag":s+=f,f===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(d="")):!/\s/.test(f)&&f!=="/"&&(o="attr-name",i=f,c=s.length-1);break;case"rawtext":s+=f,d=(d+f.toLowerCase()).slice(-9),(d.endsWith("<\/script>")||d.endsWith("</style>"))&&(o="text",d="",p="");break;case"attr-name":f==="="?(o="after-eq",s+=f):/\s/.test(f)?(o="in-tag",i="",s+=f):f===">"?(o="text",i="",s+=f):(i+=f,s+=f);break;case"after-eq":f==='"'||f==="'"?(o="attr-quoted",a=f,s+=f):/\s/.test(f)?(o="in-tag",i="",s+=f):f===">"?(o="text",i="",s+=f):(o="attr-unquoted",s+=f);break;case"attr-unquoted":/\s/.test(f)?(o="in-tag",i="",s+=f):(f===">"&&(o="text",i=""),s+=f);break;case"attr-quoted":s+=f,f===a&&(o="in-tag",i="");break;case"skip-attr":if(f===a){if(u){let T=u.firstPartIdx,w=[];for(let C=T;C<r.length;C++)(r[C].kind==="noop"||r[C].kind==="attr-mixed")&&w.push(C);let N=[],_=t[w[0]],he=_.lastIndexOf(a);N.push(he>=0?_.slice(he+1):_);for(let C=1;C<w.length;C++)N.push(t[w[C]]);let pe=t[w[w.length-1]+1],St=pe.indexOf(a);N.push(St>=0?pe.slice(0,St):pe),r[T]={kind:"attr-mixed",path:[],name:u.name,statics:N,group:w},u=null}o="in-tag",i=""}break}}if(m<t.length-1){let v=r.length;if(o==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(o==="rawtext"){d="",r.push({kind:"noop",path:[]});continue}if(o==="text")s+=`<!--${b}${v}-->`,r.push({kind:"child",path:[]});else if(o==="in-tag"){let f=`data-${b}${v}`;s+=`${f}=""`,r.push({kind:"element",path:[]})}else if(o==="after-eq"){let f=i[0],T=i.slice(1);if(f==="@"||f==="."||f==="?"){s=s.slice(0,c);let w=f==="@"?"event":f==="."?"prop":"bool",N=`data-${b}${v}`;s+=`${N}=""`,r.push({kind:w,path:[],name:T})}else{s=s.slice(0,c);let w=`data-${b}${v}`;s+=`${w}=""`,r.push({kind:"attr",path:[],name:i})}o="in-tag",i=""}else if(o==="attr-quoted"||o==="attr-unquoted"){s=s.slice(0,c);let f=`data-${b}${v}`;s+=`${f}=""`,u={name:i,firstPartIdx:v},r.push({kind:"noop",path:[]}),o="skip-attr"}else o==="skip-attr"&&r.push({kind:"noop",path:[]})}}let h=document.createElement("template");return h.innerHTML=s,oo(h.content,r),io(h.content,r),n={templateEl:h,parts:r},Wn.set(t,n),n}function oo(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(P,"");let s=t.length;r.setAttribute(`data-${b}${s}`,""),t.push({kind:"slot",path:[]})}}function io(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 c=i.data;if(c.startsWith(b)){let a=Number(c.slice(b.length));t[a]&&t[a].kind==="child"&&(t[a].path=n.slice())}}else if(i.nodeType===1){let c=i,a=[];for(let l of c.attributes)if(l.name.startsWith(`data-${b}`)){let u=Number(l.name.slice(`data-${b}`.length));t[u]&&t[u].kind!=="child"&&(t[u].path=n.slice()),a.push(l.name)}for(let l of a)c.removeAttribute(l);r(i)}n.pop()}}r(e)}function ao(e,t){let{templateEl:n,parts:r}=Je(e),s=n.content.cloneNode(!0),o=document.createComment(`${b}s`),i=document.createComment(`${b}e`),c=r.map(l=>Xe(l,s)),a=[];for(let l=0;l<e.values.length;l++)V(c[l],e.values[l],void 0,e.values),a.push(e.values[l]);t.replaceChildren(o,...s.childNodes,i);for(let l of c)l.kind==="slot"&&V(l,void 0,void 0,[]);return{strings:e.strings,bound:c,lastValues:a,startNode:o,endNode:i}}function Xe(e,t){if(e.kind==="noop")return{kind:"noop"};let n=t;for(let s of e.path)n=n.childNodes[s];if(e.kind==="child")return{kind:"child",marker:n};let r=n;if(e.kind==="event"){let s={kind:"event",el:r,name:e.name||"",handler:null,dispatcher(o){s.handler?.(o)}};return r.addEventListener(s.name,s.dispatcher),s}if(e.kind==="attr")return{kind:"attr",el:r,name:e.name||""};if(e.kind==="attr-mixed")return{kind:"attr-mixed",el:r,name:e.name||"",statics:e.statics||[],group:e.group||[]};if(e.kind==="prop")return{kind:"prop",el:r,name:e.name||""};if(e.kind==="bool")return{kind:"bool",el:r,name:e.name||""};if(e.kind==="element")return{kind:"element",el:r};if(e.kind==="slot")return{kind:"slot",slotEl:r,applied:!1};throw new Error(`unknown part kind ${e.kind}`)}function Z(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(V(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function zn(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=Ht(n.slotEl);r&&Vn(r,n.slotEl)}}t.replaceChildren()}function V(e,t,n,r){if(Et(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":uo(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":lo(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 c=Ht(s);if(!c||co(s))return;let a=document.createDocumentFragment();for(;s.firstChild;)a.appendChild(s.firstChild);s[Ke]=a,Ye(c)};Ht(s)?o():queueMicrotask(o);break}case"noop":break}}function Ht(e){let t=e.parentElement;for(;t;){if(t[q])return t;t=t.parentElement}return null}function co(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 lo(e,t){let n=e,r=Pe(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 uo(e,t){return wo(e,t),j(e,t)}function j(e,t){let n=e.marker;if(Ct(t)){F(e);let s=String(t.value??""),o=document.createElement("template");o.innerHTML=s;let i=[...o.content.childNodes],c=document.createDocumentFragment();for(let a of i)c.appendChild(a);n.parentNode?.insertBefore(c,n),e.child=i;return}if(Oe(t)){let s=t,o=e.__keyedKey;o!==void 0&&!Object.is(o,s.key)&&F(e),e.__keyedKey=s.key,j(e,s.value);return}if(Me(t)){let s=t,o=e.__guardDeps,i=s.deps;if(o!==void 0&&(Array.isArray(o)&&Array.isArray(i)?_o(o,i):Object.is(o,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,j(e,s.fn());return}if(Tt(t)){F(e);let s=t.template;if(s&&s.content){let o=s.content.cloneNode(!0),i=[...o.childNodes];n.parentNode?.insertBefore(o,n),e.child=i}return}if(Pe(t))return;if(Ie(t))return So(e,t.value);if(Fe(t))return Ao(e,t.args);if(Ue(t))return vo(e,t.signal);if(kt(t))return Co(e,t);if(xt(t))return Eo(e,t);if(Le(t)){if(e.child&&e.child.kind==="repeat"){po(e,t);return}F(e);let s={kind:"repeat",map:new Map};e.child=s,ho(n,s,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){yo(e,t);return}F(e);let s={kind:"array",items:[]};e.child=s,bo(n,s,t);return}if(e.child){let s=e.child;if(s.kind==="repeat")Kn(s),e.child=void 0;else if(s.kind==="array")Gn(s),e.child=void 0;else if(s.kind==="async-stream")Zn(s),e.child=void 0;else if("strings"in e.child){let o=e.child;if(S(t)&&o.strings===t.strings){Z(o,t.values);return}ee(o.startNode,o.endNode),e.child=void 0}else{for(let o of e.child)o.parentNode&&o.parentNode.removeChild(o);e.child=void 0}}if(t==null||t===!1||t===!0)return;if(S(t)){let s=t,{templateEl:o,parts:i}=Je(s),c=o.content.cloneNode(!0),a=document.createComment(`${b}s`),l=document.createComment(`${b}e`),u=i.map(h=>Xe(h,c)),p=[];for(let h=0;h<s.values.length;h++)V(u[h],s.values[h],void 0,s.values),p.push(s.values[h]);let d=[a,...c.childNodes,l];n.parentNode?.insertBefore(fo(d),n);for(let h of u)h.kind==="slot"&&V(h,void 0,void 0,[]);e.child={strings:s.strings,bound:u,lastValues:p,startNode:a,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function fo(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 Wt(e){let{templateEl:t,parts:n}=Je(e),r=t.content.cloneNode(!0),s=document.createComment(`${b}s`),o=document.createComment(`${b}e`),i=n.map(l=>Xe(l,r)),c=[];for(let l=0;l<e.values.length;l++)V(i[l],e.values[l],void 0,e.values),c.push(e.values[l]);let a=document.createDocumentFragment();for(a.appendChild(s);r.firstChild;)a.appendChild(r.firstChild);return a.appendChild(o),{inst:{strings:e.strings,bound:i,lastValues:c,startNode:s,endNode:o},frag:a}}function Se(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 ho(e,t,n){let{items:r,keyFn:s,templateFn:o}=n,i=e.parentNode;if(!i)return;let c=document.createDocumentFragment();for(let a=0;a<r.length;a++){let l=s(r[a],a),u=o(r[a],a);if(!S(u))continue;let{inst:p,frag:d}=Wt(u);t.map.set(l,p),c.appendChild(d)}i.insertBefore(c,e)}function po(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,{items:o,keyFn:i,templateFn:c}=t,a=new Map;for(let l=0;l<o.length;l++){let u=i(o[l],l),p=c(o[l],l);if(!S(p))continue;let d=s.map.get(u);if(d&&d.strings===p.strings)Z(d,p.values),Vt(d.startNode,d.endNode,r,n),a.set(u,d),s.map.delete(u);else{d&&(Se(d),ee(d.startNode,d.endNode),s.map.delete(u));let{inst:h,frag:m}=Wt(p);r.insertBefore(m,n),a.set(u,h)}}for(let l of s.map.values())Se(l),ee(l.startNode,l.endNode);s.map=a}function Kn(e){for(let t of e.map.values())Se(t),ee(t.startNode,t.endNode);e.map.clear()}function mo(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function Ge(e){e.type==="tpl"?(Se(e.inst),ee(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function Yn(e){if(S(e)){let{inst:t,frag:n}=Wt(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 bo(e,t,n){let r=e.parentNode;if(!r)return;let s=document.createDocumentFragment(),o=[];for(let i of n){let{item:c,frag:a}=Yn(i);a&&s.appendChild(a),o.push(c)}r.insertBefore(s,e),t.items=o}function yo(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,o=s.items,i=[];for(let c=0;c<t.length;c++){let a=t[c],l=o[c];if(S(a)){let d=a;if(l&&l.type==="tpl"&&l.inst.strings===d.strings){Z(l.inst,d.values),i.push(l);continue}}else if(a!=null&&a!==!1&&a!==!0){if(l&&l.type==="text"){let d=String(a);l.node.data!==d&&(l.node.data=d),i.push(l);continue}}else{l&&Ge(l),i.push({type:"empty"});continue}let{item:u,frag:p}=Yn(a);p&&r.insertBefore(p,go(o,c,n)),l&&Ge(l),i.push(u)}for(let c=t.length;c<o.length;c++)Ge(o[c]);s.items=i}function go(e,t,n){for(let r=t;r<e.length;r++){let s=mo(e[r]);if(s&&s.parentNode)return s}return n}function Gn(e){for(let t of e.items)Ge(t);e.items=[]}function Vt(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 _o(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function F(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&Jn(t),!e.child)return;let n=e.child;if(n.kind==="repeat")Kn(n);else if(n.kind==="array")Gn(n);else if(n.kind==="async-stream")Zn(n);else if("strings"in n){let r=e.child;Se(r),ee(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function wo(e,t){let n=e;n.__untilState&&!Fe(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!Me(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!Ie(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!Oe(t)&&(n.__keyedKey=void 0),n.__watchSub&&!Ue(t)&&Jn(n)}function So(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 c=o;if(S(t)&&c.strings===t.strings){Z(c,t.values);return}let a=document.createDocumentFragment();Vt(c.startNode,c.endNode,a,null),s.set(c.strings,{inst:c,holder:a}),e.child=void 0}if(S(t)){let c=t,a=s.get(c.strings);if(a){s.delete(c.strings),e.child&&F(e),Vt(a.inst.startNode,a.inst.endNode,n.parentNode,n),Z(a.inst,c.values),e.child=a.inst;return}}j(e,t)}function Ao(e,t){let n=e,r=n.__untilState,s=n.__untilArgs,o=(d,h)=>!!(Object.is(d,h)||S(d)&&S(h)&&d.strings===h.strings),c=s&&s.length===t.length&&s.every((d,h)=>o(d,t[h]))&&r?r.highestResolved:1/0;r&&(r.aborted=!0),n.__untilArgs=t.slice();let a={aborted:!1,highestResolved:c};n.__untilState=a;let l=-1,u;for(let d=0;d<t.length;d++){let h=t[d];if(!h||typeof h.then!="function"){l=d,u=h;break}}l!==-1&&l<=a.highestResolved?(j(e,u),a.highestResolved=l):l===-1&&!n.__untilEverRendered&&j(e,""),n.__untilEverRendered=!0;let p=Math.min(l===-1?t.length:l,a.highestResolved);for(let d=0;d<p;d++){let h=t[d];!h||typeof h.then!="function"||Promise.resolve(h).then(m=>{a.aborted||d>=a.highestResolved||(a.highestResolved=d,j(e,m))},()=>{})}}function vo(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let o;n.__watchSub.observe(()=>{o=t.get()}),j(e,o);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new ye.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let o;r.observe(()=>{o=t.get()}),j(e,o)})});n.__watchSub=r;let s;r.observe(()=>{s=t.get()}),j(e,s)}function Jn(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function Co(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;F(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,Xn(s,e,t)}function Eo(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;F(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,Xn(s,e,t)}async function Xn(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,c=Qn(i);if(e.mode==="replace"){for(let l of e.nodes)l.parentNode&&l.parentNode.removeChild(l);e.nodes=[]}let a=document.createDocumentFragment();for(let l of c)a.appendChild(l);r.parentNode?.insertBefore(a,r),e.nodes.push(...c),s++}}catch(o){typeof console<"u"&&console.error("[webjs] asyncStream error:",o)}}function Qn(e){if(e==null||e===!1||e===!0)return[];if(S(e)){let t=e,{templateEl:n,parts:r}=Je(t),s=n.content.cloneNode(!0),o=r.map(i=>Xe(i,s));for(let i=0;i<t.values.length;i++)V(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(...Qn(n));return t}return[document.createTextNode(String(e))]}function Zn(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 er=null;function Qe(e){er=e||null}function To(){return er||void 0}var tr=Symbol.for("webjs:registry"),nr=Symbol.for("webjs:classToTag"),Ze=globalThis,R=Ze[tr]||(Ze[tr]=new Map),rr=Ze[nr]||(Ze[nr]=new WeakMap),et=typeof window<"u"&&typeof customElements<"u";function zt(e,t){if(!e||typeof e!="string"||!e.includes("-"))throw new Error(`customElements.define: tag "${e}" must contain a hyphen (HTML spec)`);let n=t.lazy===!0,r=R.get(e);r?(r.cls=t,r.lazy=n):R.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),rr.set(t,e)}if(et){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),zt(t,n)}}if(!et){let e=globalThis;e.customElements||(e.customElements={define(t,n){zt(t,n)},get(t){return R.get(t)?.cls},upgrade(){},whenDefined(t){let n=R.get(t);return Promise.resolve(n?.cls)}})}function Kt(e,t){et?customElements.define(e,t):zt(e,t)}function ko(e,t){if(et)return;let n=R.get(e);if(n){n.moduleUrl=t;return}R.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function xo(e){return R.get(e)?.cls}function No(e){return R.get(e)?.moduleUrl||null}function jo(e){return R.get(e)?.lazy===!0}function tt(e){return rr.get(e)}function Ro(){return[...R.keys()]}Ce();var fr=typeof window<"u"&&typeof HTMLElement<"u";function Vo(e,t){return e!==t}function Wo(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var nt=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=Wo(),this.__internals}},zo=["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 zo){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(nt.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var Ko=fr?HTMLElement:nt,dr=Symbol("webjs.factoryProps"),cr=new WeakSet,ne=class e extends Ko{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){Kt(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(lr)}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._assertFactoryProperties(),this._initializeProperties()}_assertFactoryProperties(){let t=this.constructor;if(cr.has(t))return;let n=t;for(;n&&n!==e;){if(Object.hasOwn(n,"properties")&&!Object.hasOwn(n,dr)){let r=n.name||"a component";throw new Error(`${r}: \`static properties\` is no longer supported. Declare reactive properties via the factory instead: \`class ${r} extends WebComponent({ count: Number })\`. Use the \`prop()\` helper for options (\`prop(Number, { reflect: true })\`) and set defaults via the \`default\` option or in the constructor. See https://docs.webjs.com/docs/components.`)}n=Object.getPrototypeOf(n)}cr.add(t)}_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:c=>{let a=this.__propValues[r];(o.hasChanged||Vo)(c,a)&&(this.__propValues[r]=c,o.reflect&&!o.state&&this._connected&&this._reflectAttribute(r,c,o),this.requestUpdate(r,a))}}),i!==void 0&&(this.__propValues[r]=i)}}}_reflectAttribute(t,n,r){let s=lr(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(!fr)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=ur(r.slice(16));try{this[o]=z(s)}catch(i){console.warn(`[webjs] failed to decode ${r} on <${this.tagName.toLowerCase()}>: ${i&&i.message}`)}}}_activate(){this._connected=!0,this._reflectDeclaredAttributes();let t=this.constructor;if(t.shadow===!0){let n=!!this.shadowRoot;this.shadowRoot||this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot;let r=t.styles,s=Array.isArray(r)?r:At(r)?[r]:[];if(s.length){if(n){let o=this.shadowRoot.querySelector("style");o&&o.remove()}vt(this._renderRoot,s)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${tt(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().`),$t(this)||(this.__isHydrating()?(I(this),Dn(this)):Bn(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&&qn(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&&Hn(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=ur(t),i=s.properties&&(s.properties[o]||s.properties[t]);if(!i)return;let c=typeof i=="object"?i:{type:i},a;if(c.converter&&c.converter.fromAttribute)a=c.converter.fromAttribute(r,c.type);else if(c.type===Number)a=r==null?null:Number(r);else if(c.type===Boolean)a=r!=null&&r!=="false";else if(c.type===Object||c.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,this.__renderAbort&&this.__renderAbort.abort(),this.__renderAbort=typeof AbortController<"u"?new AbortController:null,Qe(this.__renderAbort?this.__renderAbort.signal:null);try{let s=this.update(t);s&&typeof s.then=="function"&&(r=s)}catch(s){this._handleRenderError(s)}finally{Qe(null)}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 ye.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;if(this.__signalWatcher.observe(()=>{n=this.render()}),n&&typeof n.then=="function")return this._commitAsync(n);te(n,this._renderRoot)}_commitAsync(t){let n=this.__renderToken;if(this.__firstRendered&&this._overridesRenderFallback())try{let r=this.renderFallback();r!==void 0&&te(r,this._renderRoot)}catch(r){console.error("[webjs] renderFallback() threw:",r)}return Promise.resolve(t).then(r=>{n===this.__renderToken&&te(r,this._renderRoot)},r=>{n===this.__renderToken&&this._handleRenderError(r instanceof Error?r:new Error(String(r)))})}_overridesRenderFallback(){return this.renderFallback!==rt.prototype.renderFallback}_handleRenderError(t){console.error(`[webjs] render error in <${tt(this.constructor)||this.tagName?.toLowerCase()}>:`,t);try{let n=this.renderError(t);n!==void 0&&te(n,this._renderRoot)}catch(n){console.error("[webjs] renderError() also threw:",n)}}_postCommit(t){try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(n){console.error("[webjs] lifecycle hook threw during post-commit phase:",n)}finally{this._resolveUpdate()}}updated(t){}firstUpdated(t){}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}addController(t){this.__controllers.add(t),this._connected&&t.hostConnected&&t.hostConnected()}removeController(t){this.__controllers.delete(t)}render(){return""}renderError(t){}renderFallback(){}};function lr(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function ur(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function rt(e){return new.target?Reflect.construct(ne,arguments,new.target):class extends ne{static properties=e;static[dr]=!0}}Object.setPrototypeOf(rt,ne);rt.prototype=ne.prototype;function Yo(e,t={}){return e&&typeof e=="object"&&!("call"in e)&&(t=e,e=void 0),{...e?{type:e}:{},...t}}var hr=Symbol.for("webjs.notFound"),pr=Symbol.for("webjs.redirect");function Go(){let e=new Error("webjs: notFound()");throw e.__webjs=hr,e}function Jo(e,t){let n=typeof t=="object"&&t!==null?t.status:t,r=new Error(`webjs: redirect(${e})`);throw r.__webjs=pr,r.url=e,r.status=typeof n=="number"?n:void 0,r}function Xo(e){return!!e&&e.__webjs===hr}function Qo(e){return!!e&&e.__webjs===pr}var mr=null;function Zo(){if(!mr)return"";try{return mr()||""}catch{return""}}var Ia=Symbol.for("webjs.suspense");function ei(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function ti(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}function ni(e,t={}){let n=t.reconnect!==!1,r=0,s=!1,o=null,i=[];function c(){s||(o=new WebSocket(ri(e),t.protocols),o.onopen=a=>{for(r=0;i.length&&o&&o.readyState===WebSocket.OPEN;)o.send(i.shift());t.onOpen?.(a)},o.onmessage=a=>{let l=a.data;if(typeof l=="string")try{l=JSON.parse(l)}catch{}t.onMessage?.(l,a)},o.onerror=a=>{t.onError?.(a)},o.onclose=a=>{if(t.onClose?.(a),!s&&n){let l=Math.min(1e3*2**r++,3e4);setTimeout(c,l)}})}return c(),{send(a){let l=typeof a=="string"||a instanceof ArrayBuffer||ArrayBuffer.isView(a)?a:JSON.stringify(a);o&&o.readyState===WebSocket.OPEN?o.send(l):i.push(l)},close(a,l){s=!0;try{o?.close(a,l)}catch{}},get socket(){return o},get readyState(){return o?.readyState??3}}}function ri(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}`}Ce();var Gt="application/vnd.webjs+json";async function si(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",Gt);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 Yt(r),n.has("content-type")||n.set("content-type",Gt));let s=await fetch(e,{...t,headers:n,body:r}),o=s.headers.get("content-type")||"",i=await s.text(),c=o.includes(Gt)?i?z(i):null:o.includes("application/json")?i?JSON.parse(i):null:i;if(!s.ok){let a=c&&c.error||`richFetch ${e} -> ${s.status}`,l=new Error(a);throw l.status=s.status,l.body=c,l}return c}Ce();Zt();Qt();ot();async function Bi(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}nn();var _t=0,ds=new Map,fe=new Map,Di=1e3;function $i(e){if(!(!Array.isArray(e)||!e.length)){_t+=1;for(let t of e)t&&ds.set(t,_t)}}function qi(){return _t}function Hi(e,t,n){if(!(!Array.isArray(t)||!t.length)&&(fe.delete(e),fe.set(e,{tags:t.slice(),since:typeof n=="number"?n:_t}),fe.size>Di)){let r=fe.keys().next().value;r!==void 0&&fe.delete(r)}}function Vi(e){let t=fe.get(e);if(!t)return!1;for(let n of t.tags)if((ds.get(n)||0)>t.since)return!0;return!1}function Wi(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}var zi="application/vnd.webjs+stream",Ki=1,Yi=2,Gi=3,hs=new Uint8Array(0);function Ji(e,t){let n=t||hs,r=n.length,s=new Uint8Array(5+r);return s[0]=e&255,s[1]=r>>>24&255,s[2]=r>>>16&255,s[3]=r>>>8&255,s[4]=r&255,r&&s.set(n,5),s}function Xi(){let e=hs;return{push(t){if(t&&t.length){let r=new Uint8Array(e.length+t.length);r.set(e,0),r.set(t,e.length),e=r}let n=[];for(;e.length>=5;){let r=e[0],s=(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0;if(e.length<5+s)break;let o=e.slice(5,5+s);n.push({type:r,payload:o}),e=e.slice(5+s)}return n}}}var Qi=Symbol.for("webjs.context");function Zi(e){return{__context__:Qi,name:e}}var wt=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},Sn=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},c=()=>{this._subscriptions.delete(i)};this._subscriptions.add(i),o.callback(this._value,c)}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()}},An=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 wt(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 ea(){return typeof window<"u"}var O={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},vn=class{constructor(t,{task:n,args:r,autoRun:s=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=s,this._status=O.INITIAL,this._value=void 0,this._error=void 0,this._abortController=null,this._prevArgs=null,typeof t.addController=="function"&&t.addController(this)}get status(){return this._status}get value(){return this._value}get error(){return this._error}async run(){this.abort();let t=new AbortController;this._abortController=t;let n=this._argsFn();this._prevArgs=n,this._status=O.PENDING,this._error=void 0,this._requestHostUpdate();try{let r=await this._taskFn(...n,{signal:t.signal});if(t.signal.aborted)return;this._value=r,this._status=O.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=O.ERROR,this._value=void 0}finally{this._abortController===t&&(this._abortController=null)}this._requestHostUpdate()}abort(){this._abortController&&(this._abortController.abort(),this._abortController=null)}render(t={}){switch(this._status){case O.INITIAL:return t.initial?.();case O.PENDING:return t.pending?.();case O.COMPLETE:return t.complete?.(this._value);case O.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!ea())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{An as ContextConsumer,Sn as ContextProvider,wt as ContextRequestEvent,Ki as FRAME_CHUNK,Yi as FRAME_END,Gi as FRAME_ERROR,b as MARKER,Er as SEED_MISS,zi as STREAM_CONTENT_TYPE,ye as Signal,ei as Suspense,vn as Task,O as TaskStatus,rt as WebComponent,Xt as WebjsFrame,en as WebjsStream,To as activeActionSignal,vt as adoptStyles,Ro as allTags,js as asyncAppend,Rs as asyncReplace,$s as batch,xs as cache,Hs as computed,ni as connectWS,Vi as consumeStale,Zi as createContext,Xi as createFrameDecoder,ks as createRef,Zo as cspNonce,ys as css,ir as deserialize,Rr as disableClientRouter,Ws as effect,un as enableClientRouter,Ji as encodeFrame,ws as escapeAttr,_s as escapeText,qi as fetchMark,Cs as guard,bs as html,kt as isAsyncAppend,xt as isAsyncReplace,At as isCSS,Ie as isCache,Me as isGuard,Oe as isKeyed,jo as isLazy,Et as isLive,Xo as isNotFound,Qo as isRedirect,Pe as isRef,Le as isRepeat,Vs as isSignal,ti as isSuspense,S as isTemplate,Tt as isTemplateContent,Ct as isUnsafeHTML,Fe as isUntil,Ue as isWatch,vs as keyed,As as live,xo as lookup,No as lookupModuleUrl,$i as markStale,Lr as navigate,Go as notFound,Bi as optimistic,z as parse,Wi as parseTagHeader,ko as primeModuleUrl,Yo as prop,Jo as redirect,Ts as ref,Kt as register,Hi as registerKeyTags,te as render,tn as renderStream,Tn as repeat,Or as revalidate,si as richFetch,it as scanSeeds,or as serialize,Qe as setActiveActionSignal,qs as signal,Yt as stringify,gs as stylesToString,tt as tagOf,fi as takeSeed,Es as templateContent,Ss as unsafeHTML,Ns as until,Ls as watch};
|
|
1
|
+
var _s=Object.defineProperty;var $=(e,t)=>()=>(e&&(t=e(e=0)),t);var kn=(e,t)=>{for(var n in t)_s(e,n,{get:t[n],enumerable:!0})};function ar(e,t,n){Io.has(t)?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}async function Jt(e){return JSON.stringify(await cr(e))}function z(e){return lr(JSON.parse(e))}async function cr(e){let t=Fo();return await Bo(e,t),W(e,t)}function lr(e){return B(e,qo())}function Fo(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map,fdEntries:new Map}}async function Bo(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!Vo(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){let o=t.fdEntries.get(r)||[...r.entries()];t.fdEntries.set(r,o);for(let[,i]of o)typeof i!="string"&&n.push(i);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(Wo(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 W(e,t){if(e===null)return null;if(e===void 0)return{[y]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[y]:"NaN"}:e===1/0?{[y]:"Inf"}:e===-1/0?{[y]:"-Inf"}:Object.is(e,-0)?{[y]:"-0"}:e;if(n==="bigint")return{[y]:"BigInt",v:e.toString()};if(n==="symbol"){let o=Symbol.keyFor(e);if(o===void 0)throw new TypeError("Cannot serialize a local Symbol; only Symbol.for() registered symbols are supported.");return{[y]:"Sym",v:o}}if(n==="function")throw new TypeError("Cannot serialize a function.");let r=t.idOf.get(e);if(r!==void 0&&t.emitted.has(r))return{[y]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let s;if(e instanceof Date)s={[y]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)s={[y]:"Error",v:{name:e.name,message:e.message,stack:e.stack||null}};else if(typeof Blob<"u"&&e instanceof Blob){let o=t.blobBytes.get(e);typeof File<"u"&&e instanceof File?s={[y]:"File",v:ve(o),n:e.name,t:e.type||"",m:e.lastModified}:s={[y]:"Blob",v:ve(o),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let o=t.fdEntries.get(e)||[...e.entries()],i=[];for(let[c,a]of o)i.push([c,W(a,t)]);s={[y]:"FD",v:i}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)s=Uo(e);else if(e instanceof Map){let o=[];for(let[i,c]of e)o.push([W(i,t),W(c,t)]);s={[y]:"Map",v:o}}else if(e instanceof Set){let o=[];for(let i of e)o.push(W(i,t));s={[y]:"Set",v:o}}else if(Array.isArray(e))s=e.map(o=>W(o,t));else{s={};for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i=zo(o)?"_"+o:o;ar(s,i,W(e[o],t))}}if(r!==void 0){if(Array.isArray(s))return{[y]:"Arr",_id:r,v:s};s._id=r}return s}function Uo(e){if(e instanceof ArrayBuffer)return{[y]:"buf",v:ve(new Uint8Array(e))};if(e instanceof DataView)return{[y]:"dv",v:ve(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=Do[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[y]:n,v:ve(r)}}function qo(){return{refs:new Map}}function B(e,t){if(e===null||typeof e!="object")return e;if(Array.isArray(e)){let o=[];for(let i=0;i<e.length;i++)o.push(B(e[i],t));return o}let n=e[y];if(typeof n=="string")return Ho(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=Ko(o)?o.slice(1):o;ar(r,i,B(e[o],t))}return r}function Ho(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,c]of e.v)o.set(B(i,n),B(c,n));return o}case"Set":{let o=new Set;typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.add(B(i,n));return o}case"Arr":{let o=[];typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.push(B(i,n));return o}case"Ref":{let o=n.refs.get(e.v);if(o===void 0)throw new TypeError(`Dangling reference: id=${e.v}`);return o}case"Blob":{if(typeof Blob>"u")throw new TypeError("Blob is not available in this environment.");let o=Ae(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=Ae(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,c]of e.v){let a=B(c,n);o.append(i,a)}return o}default:{if(t==="buf"){let i=Ae(e.v);return s(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=Ae(e.v);return s(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let o=$o[t];if(o){let i=Ae(e.v),c=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);return s(new o(c))}throw new TypeError(`Unknown serialization tag: ${t}`)}}}function Vo(e){return e!==null&&typeof e=="object"}function Wo(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function zo(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function Ko(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}function ve(e){if(ur)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 Ae(e){if(ur){let r=Buffer.from(e,"base64");return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}var y,Io,Do,$o,ur,Ce=$(()=>{y="_$wj",Io=new Set(["__proto__","constructor","prototype"]);Do={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},$o={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};ur=typeof Buffer<"u"&&typeof Buffer.from=="function"});var Sr={};kn(Sr,{observeLazy:()=>li,observeViewportOnce:()=>di});function wr(e){let t=Qt.get(e);return t||(t=import(e).finally(()=>Qt.delete(e)),Qt.set(e,t),t)}function li(e){for(let[t,n]of Object.entries(e))K.set(t.toLowerCase(),n);if(typeof IntersectionObserver>"u"){for(let t of K.values())wr(t);K.clear();return}Te||(Te=new IntersectionObserver(ui,{rootMargin:"200px"})),_r(),typeof MutationObserver<"u"&&new MutationObserver(()=>_r()).observe(document.body,{childList:!0,subtree:!0})}function _r(){if(!(!Te||!K.size))for(let e of K.keys())for(let t of document.querySelectorAll(e))Te.observe(t)}function ui(e){for(let t of e){if(!t.isIntersecting)continue;let n=t.target.tagName.toLowerCase(),r=K.get(n);r&&(wr(r),K.delete(n),Te?.unobserve(t.target))}}function fi(e){for(let t of e){if(!t.isIntersecting)continue;let n=st.get(t.target);st.delete(t.target),Ee?.unobserve(t.target),n&&n()}}function di(e,t){return typeof IntersectionObserver>"u"?(t(),()=>{}):(Ee||(Ee=new IntersectionObserver(fi,{rootMargin:"200px"})),st.set(e,t),Ee.observe(e),()=>{st.delete(e),Ee?.unobserve(e)})}var K,Te,Qt,Ee,st,Ar=$(()=>{K=new Map,Te=null,Qt=new Map;Ee=null,st=new WeakMap});var Zt,en=$(()=>{Zt=typeof HTMLElement<"u"?class extends HTMLElement{constructor(){super(),this._webjsLoadedSrc=null,this._webjsLazyTeardown=null}static get observedAttributes(){return["src"]}connectedCallback(){this._webjsScheduleLoad()}disconnectedCallback(){this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null)}attributeChangedCallback(t,n,r){t==="src"&&this.isConnected&&this._webjsScheduleLoad()}_webjsScheduleLoad(){let t=this.getAttribute("src");if(!t){this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null),this._webjsLoadedSrc=null;return}let n=t;try{n=new URL(t,location.href).href}catch{}if(n===this._webjsLoadedSrc)return;this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null),(this.getAttribute("loading")||"eager").toLowerCase()==="lazy"?(this._webjsLoadedSrc=n,Promise.resolve().then(()=>(Ar(),Sr)).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(()=>(ot(),vr)).then(({loadFrame:n})=>{this._webjsLoadedSrc!==t||!this.isConnected||n(this,t)})}}:null;typeof customElements<"u"&&Zt&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",Zt)});function pi(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 nn(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 hi,tn,it=$(()=>{hi=new Set(["append","prepend","before","after","replace","update"]);tn=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=hi.has(t)?this.querySelector("template"):null;try{for(let i of r){let c=o?o.content.cloneNode(!0):null;pi(t,i,c)}}finally{this.remove()}}}:null;typeof customElements<"u"&&tn&&!customElements.get("webjs-stream")&&customElements.define("webjs-stream",tn)});var Cr,Er=$(()=>{Cr=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this.style.display||(this.style.display="contents")}}:null;typeof customElements<"u"&&Cr&&!customElements.get("webjs-suspense")&&customElements.define("webjs-suspense",Cr)});function at(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]'))kr(n.textContent,n);for(let n of t.querySelectorAll("[data-webjs-seed]"))kr(n.getAttribute("data-webjs-seed"),n,()=>n.removeAttribute("data-webjs-seed"))}}function kr(e,t,n){if(e)try{let r=z(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 mi(e,t,n){Tr||(Tr=!0,at());let r=`${e}/${t}/${n}`;if(ke.has(r)){let s=ke.get(r);return ke.delete(r),s}return Nr}var ke,Nr,Tr,rn=$(()=>{Ce();ke=new Map,Nr=Symbol("webjs.seed.miss"),Tr=!1});var vr={};kn(vr,{_FRAME_TOP:()=>Hr,_LIVE_ATTRS:()=>fn,_activeFrameId:()=>qr,_addNewHeadElements:()=>dn,_applyStreamedResolve:()=>ps,_blurOutgoingFocus:()=>ut,_buildSubmitFormData:()=>Dr,_bumpNavToken:()=>Bi,_clearFormBusy:()=>ss,_clearFrameBusy:()=>ns,_collectChildrenSlots:()=>le,_currentPageUrl:()=>Ui,_diffElementInPlace:()=>yt,_eligibleAnchorHref:()=>dt,_findAnchorInPath:()=>$r,_getSubmitAction:()=>Ur,_getSubmitMethod:()=>Br,_isNonHtmlPath:()=>qi,_keyOf:()=>ce,_longestSharedPath:()=>Wr,_markFormBusy:()=>rs,_markFrameBusy:()=>ts,_mergeHead:()=>fs,_navToken:()=>Fi,_onPopState:()=>pn,_onSubmit:()=>mn,_prefetch:()=>ue,_prefetchHasHoverPointer:()=>Jr,_prefetchInflightSize:()=>Pi,_prefetchMode:()=>ht,_prefetchPeek:()=>Mi,_prefetchSaysSaveData:()=>gn,_prefetchSuppressed:()=>Xr,_prefetchTake:()=>Qr,_reactivateScripts:()=>gt,_readStreamedShell:()=>ds,_reconcileChildren:()=>Sn,_regraftPermanentElements:()=>is,_regraftPermanentInSlice:()=>wn,_resetPrefetch:()=>Ii,_resetWarnOnce:()=>$i,_resolveTargetFrameId:()=>bn,_restoreOptimistic:()=>Ne,_runWithTransition:()=>lt,_setCurrentPageUrl:()=>Di,_snapshotCache:()=>E,_streamBoundariesProgressively:()=>ms,_takeResolveUnit:()=>hs,_viewTransitionsEnabled:()=>os,collectChildrenSlots:()=>le,disableClientRouter:()=>Mr,enableClientRouter:()=>hn,loadFrame:()=>yi,longestSharedPath:()=>Wr,navigate:()=>Pr,revalidate:()=>Ir});function Or(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}function bi(){sn||typeof MutationObserver>"u"||typeof customElements>"u"||(sn=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)}}),sn.observe(document.body,{childList:!0,subtree:!0}))}function hn(){D||typeof document>"u"||(D=!0,document.addEventListener("click",Fr,!1),document.addEventListener("submit",mn,!1),window.addEventListener("popstate",pn),document.addEventListener("pointerover",ae,!0),document.addEventListener("focusin",ae,!0),document.addEventListener("touchstart",ae,{capture:!0,passive:!0}),document.addEventListener("pointerout",Zr,!0),document.addEventListener("webjs:navigate",un),bi(),un(),typeof history<"u"&&"scrollRestoration"in history&&(ct=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(L=location.href))}function Mr(){D&&(D=!1,document.removeEventListener("click",Fr,!1),document.removeEventListener("submit",mn,!1),window.removeEventListener("popstate",pn),document.removeEventListener("pointerover",ae,!0),document.removeEventListener("focusin",ae,!0),document.removeEventListener("touchstart",ae,{capture:!0}),document.removeEventListener("pointerout",Zr,!0),document.removeEventListener("webjs:navigate",un),wt(),_n(),U&&(U.disconnect(),U=null),typeof history<"u"&&ct!==null&&(history.scrollRestoration=ct,ct=null),L=null)}async function Pr(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await yn(n.href,t?.replace??!1,null)}async function yi(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};k&&k.abort(),k=new AbortController;let s=k.signal,o=++g;return pt(r.href,n,!1,null,"GET",null,s,o)}function Ir(e){if(!e){E.clear(),A.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;E.delete(n),A.delete(n)}function Fr(e){if(!D||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=$r(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||_t.test(r.pathname))return;e.preventDefault();let s=bn(t);yn(n,!1,s)}function pn(e){yn(location.href,!0,null)}function mn(e){if(!D||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=Br(t,n);if(s==="dialog")return;let o=Ur(t,n),i;try{i=new URL(o,location.href)}catch{return}if(i.origin!==location.origin||_t.test(i.pathname))return;let c=Dr(t,n);e.preventDefault();let a=bn(n||t);wi(i.href,s,c,a,t)}function Br(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function Ur(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function Dr(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 $r(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function qr(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 bn(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===Hr)return null;let r=typeof document<"u"?document.getElementById(n):null;return r&&r.tagName&&r.tagName.toLowerCase()==="webjs-frame"?n:(Vr(`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 qr(e)}function Vr(e,t){an.has(e)||(an.add(e),typeof console<"u"&&console.warn&&console.warn(t))}function jr(){if(typeof process<"u"&&process.env||cn||typeof document>"u"||typeof getComputedStyle!="function")return;let e=document.documentElement;if(!e)return;cn=!0;let t;try{t=getComputedStyle(e).scrollBehavior}catch{return}t==="smooth"&&Vr("scroll-behavior-smooth-html","[webjs] Detected `scroll-behavior: smooth` on <html>. The client router scrolls to the top instantly on navigation (like a native page load), so route transitions are not affected by it. It still applies to in-page #anchor links. Pairing it with a sticky `backdrop-filter` header can also flash on iOS during navigation.")}function ft(e){if(typeof document>"u")return;let t=document.documentElement;if(!(!t||!t.hasAttribute("data-webjs-nav-progress")))try{e?t.setAttribute("data-navigating",""):t.removeAttribute("data-navigating")}catch{}}function le(e){let t=new Map,n=[];function r(s){if(s.nodeType===8){let o=s,i=o.data,c=/^wj:children:(.+)$/.exec(i);if(c){n.push({path:c[1],start:o});return}if(i.trim()==="/wj:children"){let a=n.pop();a&&!t.has(a.path)&&t.set(a.path,{start:a.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 Wr(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=J(e);E.has(t)&&E.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(E.set(t,n);E.size>gi;){let r=E.keys().next().value;E.delete(r)}}function _i(e){let t=J(e),n=E.get(t);return n==null?null:(E.delete(t),E.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function J(e){let t=new URL(e,location.href);return t.pathname+t.search}async function yn(e,t,n){k&&k.abort(),k=new AbortController;let r=k.signal,s=++g;L&&zr(L);let o=setTimeout(()=>{ft(!0),o=null},150),i=null;t||(i=cs());try{if(t){let c=_i(e);if(c){let a=Or(c.html);if(a){as(a,n,!0,null),typeof window<"u"&&window.scrollTo({left:c.scrollX,top:c.scrollY,behavior:"instant"}),pt(e,n,!1,i,"GET",null,r,s).catch(()=>{});return}}typeof window<"u"&&window.scrollTo({left:0,top:0,behavior:"instant"})}await pt(e,n,!t,i,"GET",null,r,s)}finally{o&&clearTimeout(o),s===g&&(ft(!1),typeof location<"u"&&(L=location.href))}}async function wi(e,t,n,r,s){k&&k.abort(),k=new AbortController;let o=k.signal,i=++g,c=t==="get"||t==="head",a=new URL(e,location.href);if(c){a.search="";for(let[h,m]of n)a.searchParams.append(h,typeof m=="string"?m:m.name)}L&&zr(L);let l=setTimeout(()=>{ft(!0),l=null},150),u=cs(),p=s?rs(s,i,a.href):null,d=!1;try{let h=await pt(a.href,r,!0,u,c?"GET":t.toUpperCase(),c?null:n,o,i);d=!!(h&&h.ok),!c&&i===g&&(E.clear(),A.clear())}finally{p&&ss(p,i,a.href,d),l&&clearTimeout(l),i===g&&(ft(!1),typeof location<"u"&&(L=location.href))}}function Kr(){return[...le(document.body).keys()].join(",")}function gn(){try{let e=typeof navigator<"u"?navigator.connection:null;if(e&&(e.saveData===!0||typeof e.effectiveType=="string"&&/2g$/.test(e.effectiveType))||typeof matchMedia=="function"&&matchMedia("(prefers-reduced-data: reduce)").matches)return!0}catch{}return!1}function Jr(){try{if(typeof matchMedia=="function")return matchMedia("(hover: hover) and (pointer: fine)").matches}catch{}return!0}function Ei(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function dt(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||_t.test(n.pathname)?null:t}function Xr(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=Ei(e);return t.includes("external")||t.includes("no-prefetch")}function ht(e){if(Xr(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 Jr()?"intent":"viewport"}}function ue(e){if(!D||typeof fetch!="function"||gn())return;let t=J(e);if(Y.has(t)||xe.has(t))return;let n=A.get(t);if(n&&ln()-n.at<Yr)return;if(Y.size>=Gr){for(xe.add(t),oe.push(e);oe.length>Ai;){let o=oe.shift();xe.delete(J(o))}return}Y.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},s=Kr();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 c=o.headers.get("x-webjs-build"),a=o.redirected&&o.url?o.url:e,l=await o.text();ki(t,{html:l,build:c,finalUrl:a,at:ln()})}).catch(()=>{}).finally(()=>{Y.delete(t),Ti()})}function Ti(){for(;oe.length&&Y.size<Gr;){let e=oe.shift();xe.delete(J(e)),ue(e)}}function ki(e,t){for(A.has(e)&&A.delete(e),A.set(e,t);A.size>Si;){let n=A.keys().next().value;A.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function Qr(e){let t=J(e),n=A.get(t);return!n||(A.delete(t),ln()-n.at>=Yr)?null:n}function ln(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function ae(e){if(!D)return;let t=es(e.target);if(!t)return;let n=ht(t);if(n==="none"||n==="render")return;let r=dt(t);if(r){if(e.type==="touchstart"){ue(r);return}n==="intent"&&(je===t&&ie||(wt(),je=t,ie=setTimeout(()=>{ie=null,je=null,ue(r)},vi)))}}function Zr(e){let t=es(e.target);t&&t===je&&wt()}function wt(){ie&&(clearTimeout(ie),ie=null),je=null}function _n(){for(let e of Re)clearTimeout(e);Re.clear(),re=new WeakMap}function es(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 un(){if(typeof document>"u"||gn())return;let e=typeof IntersectionObserver<"u";e&&(U?(U.disconnect(),_n()):U=new IntersectionObserver(t=>{for(let n of t){let r=n.target;if(n.isIntersecting){if(re.has(r))continue;let s=setTimeout(()=>{Re.delete(s),re.delete(r),U.unobserve(r);let o=dt(r);o&&ht(r)==="viewport"&&ue(o)},Ci);re.set(r,s),Re.add(s)}else{let s=re.get(r);s&&(clearTimeout(s),Re.delete(s),re.delete(r))}}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=ht(t);if(n==="render"){let r=dt(t);r&&ue(r)}else n==="viewport"&&e&&U.observe(t)}}function Ni(e){if(typeof document>"u"||!document.body)return!1;let t=le(document.body),n,r=-1;for(let[a,l]of t)a.length>r&&(r=a.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 c=document.createRange();return c.setStartAfter(n.start),c.setEndBefore(n.end),c.deleteContents(),s.insertBefore(o,n.end),!0}function on(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||Ni(t)||typeof location<"u"&&(location.href=e)}async function pt(e,t,n,r,s,o,i,c){s=s||"GET";let a=typeof c=="number"?c:g,l,u=null,p=null,d=null,h=!1,m=e,de=t?ts(t,a):null;try{try{let f=s==="GET"&&!o&&!t?Qr(e):null;if(f)l=f.html,p=f.build,m=f.finalUrl,d=200,h=!0;else{let T={"x-webjs-router":"1"},w=Kr();w&&(T["x-webjs-have"]=w),t&&(T["x-webjs-frame"]=t),o!=null&&s!=="GET"&&s!=="HEAD"&&(T.accept=xr+", text/html");let x={method:s,headers:T,credentials:"same-origin"};i&&(x.signal=i),o!=null&&s!=="GET"&&s!=="HEAD"&&(x.body=o);let _=await fetch(e,x);d=_.status,h=_.ok;let he=_.headers.get("content-type")||"",pe=/^text\/html\b/i.test(he);if(he.toLowerCase().indexOf(xr)===0){let gs=await _.text();return a===g&&(Ne(r),nn(gs)),{ok:h,status:d,aborted:!1}}if(_.redirected&&_.url&&(m=_.url),_.status===204||_.status===205)return a===g&&n&&history.pushState(null,"",m),{ok:h,status:d,aborted:!1};if(!pe)return a===g&&(Ne(r),on(e,_.status,null)),{ok:!1,status:d,aborted:!1};p=_.headers.get("x-webjs-build");let C=await ds(_);l=C.shell,C.streaming&&(u=C)}}catch(f){return f&&f.name==="AbortError"?{ok:!1,status:null,aborted:!0}:a!==g?{ok:!1,status:null,aborted:!0}:(Ne(r),on(e,null,f instanceof Error?f:new Error(String(f))),{ok:!1,status:null,aborted:!1})}if(a!==g){if(u&&u.reader)try{u.reader.cancel()}catch{}return{ok:!1,status:d,aborted:!0}}let v=Or(l);if(!v)return Ne(r),on(e,null,new Error("navigation response did not parse as HTML")),{ok:!1,status:d,aborted:!1};if(as(v,t,!1,m,p),n&&history.pushState(null,"",m),n){let f=new URL(m);if(f.hash){let T=document.getElementById(f.hash.slice(1));T?T.scrollIntoView():(jr(),window.scrollTo({left:0,top:0,behavior:"instant"}))}else jr(),window.scrollTo({left:0,top:0,behavior:"instant"})}return u&&(u.reader||u.rest)&&ms(u.reader,u.dec,u.rest,()=>a===g),document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:m,frameId:t,from:"navigate"}})),{ok:h,status:d,aborted:!1}}finally{de&&ns(de,a)}}function ts(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=mt.has(n);return mt.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 ns(e,t){if(mt.get(e)!==t)return;mt.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 rs(e,t,n){let r=bt.has(e);return bt.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 ss(e,t,n,r){if(bt.get(e)!==t)return;bt.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 Rr(e){if(!e||!e.head)return"";let t=e.head.querySelectorAll('[data-webjs-track="reload"]');if(!t.length)return"";let n="";for(let r of t)n+=G(r);return n}function os(){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 lt(e,t){let n=typeof document<"u"?document.startViewTransition:void 0;if(os()&&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 is(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 wn(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=xi(t,s);if(!o||o===r)continue;let i=o.parentNode;if(i)i.replaceChild(r,o);else{let c=t.indexOf(o);c!==-1&&(t[c]=r)}}}function xi(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 ji(e){if(!(!e||!e.start))for(let t=e.start.nextSibling;t&&t!==e.end;t=t.nextSibling)t.nodeType===1&&se(t)}function as(e,t,n,r,s){try{at(e)}catch{}try{typeof sessionStorage<"u"&&(!r||t||n)&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}if(r&&!t&&!n){let u=document.querySelector('script[type="importmap"]'),p=u?u.getAttribute("data-webjs-build"):null,d=!1;if(s&&p&&(d=s!==p),!d&&e.head&&e.head.children.length>0){let h=Rr(document),m=Rr(e);h!==m&&(d=!0)}if(d&&typeof location<"u")try{let h="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(h))sessionStorage.removeItem(h);else{sessionStorage&&sessionStorage.setItem(h,"1"),location.href=r;return}}catch{location.href=r;return}else if(!d)try{typeof sessionStorage<"u"&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}}if(t){let u=document.querySelector(`webjs-frame#${CSS.escape(t)}`),p=e.querySelector(`webjs-frame#${CSS.escape(t)}`);if(u&&p){dn(e.head),lt(()=>{Oi(u,p),gt(u),se(u),ut()},()=>se(u)),Lr(e.body);return}let d=new CustomEvent("webjs:frame-missing",{bubbles:!0,cancelable:!0,detail:{frameId:t,url:r||(typeof location<"u"?location.href:null),document:e}});(u||document).dispatchEvent(d),d.defaultPrevented||console.warn(`[webjs] frame "${t}" was not in the navigation response, leaving it unchanged. Handle "webjs:frame-missing" (preventDefault) to override.`);return}let o=le(document.body),i=le(e.body),c=Wr(o,i);if(c){dn(e.head),lt(()=>{Ri(o.get(c),i.get(c),e),ut()},()=>ji(o.get(c))),Lr(e.body);return}fs(e.head),is(document.body,e.body);let a=[...e.body.childNodes];lt(()=>{document.body.replaceChildren(...a),gt(document.body),se(document.body),ut()},()=>se(document.body))}function ut(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function Ri(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));wn(s,o),Li(r,e.start,e.end,s,o);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&(gt(i),se(i))}function Li(e,t,n,r,s){let o=new Map;for(let a of r){if(a.nodeType!==1)continue;let l=ce(a);l&&o.set(l,a)}let i=n,c=[];for(let a of s){if(a.nodeType===1){let l=ce(a);if(l&&o.has(l)){let u=o.get(l);yt(u,a),c.push(u),o.delete(l);continue}}c.push(a)}for(let a of r)if(a.parentNode===e){if(a.nodeType===1&&c.includes(a))continue;e.removeChild(a)}for(let a of c)e.insertBefore(a,i)}function yt(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),!fn.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])fn.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);Sn(e,t)}function Sn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(c=>document.importNode(c,!0));wn(n,r);let s=new Map;for(let c of n){if(c.nodeType!==1)continue;let a=ce(c);a&&s.set(a,c)}let o=[];for(let c=0;c<r.length;c++){let a=r[c];if(a.nodeType===1){let l=ce(a);if(l&&s.has(l)){let p=s.get(l);yt(p,a),o.push(p),s.delete(l);continue}let u=n[c];if(u&&u.nodeType===1&&!ce(u)&&u.tagName===a.tagName){yt(u,a),o.push(u);continue}}else if(a.nodeType===3){let l=n[c];if(l&&l.nodeType===3){l.nodeValue!==a.nodeValue&&(l.nodeValue=a.nodeValue),o.push(l);continue}}else if(a.nodeType===8){let l=n[c];if(l&&l.nodeType===8){l.nodeValue!==a.nodeValue&&(l.nodeValue=a.nodeValue),o.push(l);continue}}o.push(a)}let i=new Set(o);for(let c of n)!i.has(c)&&c.parentNode===e&&e.removeChild(c);for(let c=0;c<o.length;c++){let a=o[c];(a.parentNode!==e||e.childNodes[c]!==a)&&e.insertBefore(a,e.childNodes[c]||null)}}function ce(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}function cs(){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:g}}function Ne(e){if(!e||e.token!==g)return;let{slot:t,oldChildren:n}=e;if(t.start.parentNode!==t.end.parentNode)return;let r=document.createRange();r.setStartAfter(t.start),r.setEndBefore(t.end),r.deleteContents();for(let s of n)t.start.parentNode.insertBefore(s,t.end)}function Oi(e,t){Sn(e,t)}function ls(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function An(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=ls();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function us(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=ls();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function G(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function dn(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(G(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(G(r))||(r.tagName==="SCRIPT"?document.head.appendChild(An(r)):document.head.appendChild(us(r))))}function fs(e){let t=document.head,n=e.querySelector("title");n&&(document.title=n.textContent||"");let r=new Set;for(let o of t.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&r.add(G(o));let s=new Set;for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&s.add(G(o));for(let o of[...t.children])o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(s.has(G(o))||o.remove());for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(r.has(G(o))||(o.tagName==="SCRIPT"?t.appendChild(An(o)):t.appendChild(us(o))))}function se(e){typeof customElements>"u"||vn(e)}function vn(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&&vn(n.shadowRoot))}function Lr(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]"))document.body.appendChild(t.cloneNode(!0))}async function ds(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:c,done:a}=await t.read();c&&(r+=n.decode(c,{stream:!0})),a&&(r+=n.decode());let l=r.indexOf(o);if(l!==-1)return{shell:r.slice(0,l),streaming:!0,reader:a?null:t,dec:n,rest:r.slice(l+o.length)};let u=r.indexOf(s);if(u!==-1)return{shell:r.slice(0,u),streaming:!0,reader:a?null:t,dec:n,rest:r.slice(u)};if(a)return{shell:r,streaming:!1};let p=i.exec(r);if(p){let d=p.index+p[0].length;return{shell:r.slice(0,d),streaming:!0,reader:t,dec:n,rest:r.slice(d)}}}}function hs(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 ps(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&&vn(o)}async function ms(e,t,n,r){let s=n,o=()=>{let i;for(;i=hs(s);){if(!r())return!1;ps(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:c}=await e.read();if(i&&(s+=t.decode(i,{stream:!0})),c){s+=t.decode(),o();return}}}catch{}}function gt(e){for(let t of e.querySelectorAll("script"))t.replaceWith(An(t))}function Mi(e){return A.get(J(e))||null}function Pi(){return Y.size}function Ii(){A.clear(),Y.clear(),oe.length=0,xe.clear(),wt(),_n()}function Fi(){return g}function Bi(){return++g}function Ui(){return L}function Di(e){L=e}function $i(){an.clear(),cn=!1}function qi(e){return _t.test(e)}var xr,D,k,g,sn,L,ct,_t,Hr,an,cn,gi,E,Si,Yr,Gr,Ai,vi,Ci,A,Y,oe,xe,ie,je,U,re,Re,mt,bt,fn,ot=$(()=>{en();it();it();Er();rn();xr="text/vnd.webjs-stream.html";D=!1,k=null,g=0,sn=null;L=null,ct=null;_t=/\.(?: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;Hr="_top";an=new Set;cn=!1;gi=16,E=new Map;Si=8,Yr=3e4,Gr=3,Ai=24,vi=100,Ci=250,A=new Map,Y=new Set,oe=[],xe=new Set,ie=null,je=null,U=null,re=new WeakMap,Re=new Set;mt=new WeakMap;bt=new WeakMap;fn=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);(typeof window>"u"||window.__WEBJS_CLIENT_ROUTER__!==!1)&&hn()});function ws(e,...t){return{_$webjs:"template",strings:e,values:t}}function S(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var b="w$";function Ss(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 Ct(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function Et(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 As(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
|
|
3
|
+
`)}</style>`}function vs(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Cs(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}var Nn=Symbol.for("webjs.repeat");function xn(e,t,n){return{[Nn]:!0,items:[...e],keyFn:t,templateFn:n}}function Le(e){return!!e&&typeof e=="object"&&e[Nn]===!0}function Es(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function Tt(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function Ts(e){return{_$webjs:"live",value:e}}function kt(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function ks(e,t){return{_$webjs:"keyed",key:e,value:t}}function Oe(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function Ns(e,t){return{_$webjs:"guard",deps:e,fn:t}}function Me(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function xs(e){return{_$webjs:"template-content",template:e}}function Nt(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function js(e){return{_$webjs:"ref",target:e}}function Pe(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function Rs(){return{value:void 0}}function Ls(e){return{_$webjs:"cache",value:e}}function Ie(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function Os(...e){return{_$webjs:"until",args:e}}function Fe(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function Ms(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function xt(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function Ps(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function jt(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function Is(e){return{_$webjs:"watch",signal:e}}function Be(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var N=null,M=!1,Q=0,X=null,Rt=0,jn=(e,t)=>Object.is(e,t),De=()=>{},Rn=()=>!1;function Ln(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)Ln(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function me(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)me(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function Ft(e){if(M)throw new Error("Signal read during notification phase");if(N===null)return;let t=N,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&Mt(t)&&me(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,Mt(t)&&Ln(e,t)),t.producerLastReadVersions[n]=e.version}function Mt(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function On(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=M;M=!0;try{for(let n of e.liveConsumers)n.dirty||Fs(n)}finally{M=t}}function Fs(e){e.dirty=!0,On(e),e.consumerMarkedDirty.call(e.wrapper||e)}function $e(e){if(!(!e.dirty&&e.lastCleanEpoch===Q)){if(!e.producerMustRecompute()&&!Bs(e)){e.dirty=!1,e.lastCleanEpoch=Q;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=Q}}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||($e(n),r!==n.version))return!0}return!1}function Pt(e){e&&(e.nextProducerIndex=0);let t=N;return N=e,t}function It(e,t){if(N=t,!!e){if(Mt(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)me(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var qe=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=Q,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=Rn,this.producerRecomputeValue=De,this.consumerMarkedDirty=De,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||jn,this.watched=n?.[Bt],this.unwatched=n?.[Ut]}get(){return Ft(this),this.__value}peek(){return this.__value}set(t){if(M)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,Q++,X!==null?Mn(this):On(this))}};function Mn(e){let t=M;M=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?X.add(n):Mn(n))}finally{M=t}}var Lt=Symbol("unset"),Ot=Symbol("computing"),Ue=Symbol("errored"),be=class{constructor(t,n){this.__fn=t,this.__value=Lt,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||jn,this.watched=n?.[Bt],this.unwatched=n?.[Ut];let r=this;this.producerMustRecompute=function(){return r.__value===Lt||r.__value===Ot},this.producerRecomputeValue=function(){if(r.__value===Ot)throw new Error("Detected cycle in computations.");let s=r.__value;r.__value=Ot;let o=Pt(r),i,c=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=Ue,r.__error=l,c=!0}finally{It(r,o)}if(!c&&(s!==Lt&&s!==Ue)&&r.__equal.call(r.wrapper,s,i)){r.__value=s;return}r.__value=i,r.version++},this.consumerMarkedDirty=De}get(){if($e(this),Ft(this),this.__value===Ue)throw this.__error;return this.__value}peek(){if($e(this),this.__value===Ue)throw this.__error;return this.__value}},He=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=Q,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=Rn,this.producerRecomputeValue=De,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=Pt(this);try{for(let r of t)Ft(r),r.__isComputed&&$e(r)}finally{It(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(me(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=Pt(this),r;try{r=t()}finally{It(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)me(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},Bt=Symbol("watched"),Ut=Symbol("unwatched");function Us(e){let t=N;N=null;try{return e()}finally{N=t}}function Ds(e){return e.producers.slice()}function $s(e){return e.liveConsumers?[...e.liveConsumers]:[]}function qs(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function Hs(e){return e.producers.length>0}function Vs(){return N&&N.__isComputed?N:null}function Ws(e){Rt++,X===null&&(X=new Set);try{e()}finally{if(Rt--,Rt===0){let t=X;X=null;for(let n of t)n.__fire()}}}var ye={State:qe,Computed:be,subtle:{Watcher:He,untrack:Us,introspectSources:Ds,introspectSinks:$s,hasSinks:qs,hasSources:Hs,currentComputed:Vs,watched:Bt,unwatched:Ut}};function zs(e,t){return new qe(e,t)}function Ks(e,t){return new be(e,t)}function Ys(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function Gs(e){let t=!1,n=!1,r=new be(e),s=new He(()=>{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 Js=`${b}s`,Xs=`${b}e`;function Pn(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===Js||t===Xs}function Qs(e){for(let t of e.addedNodes)if(Pn(t))return!0;for(let t of e.removedNodes)if(Pn(t))return!0;return!1}function Dn(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var _e=Dn(),q=Symbol("webjs.slot.state"),P="data-webjs-light",H="data-projection",we="actual",$n="fallback",Ke=Symbol("webjs.slot.fallbackFrag"),Zs=64,ge=null,Dt=null,Ve=null,In=!1;function eo(){In||(_e=Dn(),_e&&(ge=HTMLSlotElement.prototype.assignedNodes,Dt=HTMLSlotElement.prototype.assignedElements,Ve=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(P)&&!Fn(this)?$t(this,t):ge?ge.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(P)&&!Fn(this)?$t(this,t).filter(n=>n.nodeType===1):Dt?Dt.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=Ve&&Ve.get?Ve.get.call(this):null;return t||to(this)}}),In=!0))}eo();function Fn(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 $t(e,t){if(e.getAttribute(H)===$n)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:qt(n,new Set,0)}function qt(e,t,n){if(n>=Zs)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(P)){let i=$t(o,{flatten:!1});if(i.length>0)for(let c of qt(i,t,n+1))r.push(c);else for(let c of qt(Array.from(o.childNodes),t,n+1))r.push(c)}else if(ge){let i=ge.call(o,{flatten:!0});for(let c of i)r.push(c)}else r.push(s)}else r.push(s);return r}function to(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(P))return t.getAttribute(H)===we?t:null;t=t.parentElement}return null}function I(e){let t=e,n=t[q];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[q]=n),n}function Ht(e){return!!e[q]}function qn(e){let t=I(e);for(;e.firstChild;){let n=e.firstChild,r=We(n);ze(t.assignedByName,r,n),e.removeChild(n)}}function Hn(e){let t=I(e),n=e.querySelectorAll(`slot[${P}]`);for(let r of n){let s=r;if(s.getAttribute(H)!==we)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 We(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function ze(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function Vn(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 Wn(e){if(!_e)return;let t=I(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let s of n)if(!Qs(s)){if(s.type==="childList"){for(let o of s.addedNodes)o.parentElement===e&&(ze(t.assignedByName,We(o),o),r=!0);for(let o of s.removedNodes)e.contains(o)||Bn(t,o)&&(r=!0)}else if(s.type==="attributes"&&s.attributeName==="slot"){let o=s.target;(Bn(t,o)||o.parentElement===e)&&(ze(t.assignedByName,We(o),o),r=!0)}}r&&Ye(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function zn(e){let t=e[q];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 Bn(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 Ye(e){let t=I(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,no(e)}))}function no(e){if(!_e)return;let t=e[q];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${P}]`)),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 s=new Map;for(let i of n){let c=i.getAttribute("name")||null,a=s.get(c);a||(a=[],s.set(c,a)),a.push(i)}for(let i of s.keys()){let c=t.pendingByName.get(i);if(c&&c.length){let a=t.assignedByName.get(i)||[],l=[];for(let u of c)l.push(u);for(let u of a)l.indexOf(u)===-1&&l.push(u);t.assignedByName.set(i,l),t.pendingByName.delete(i)}}let o=[];for(let[i,c]of s){let a=t.assignedByName.get(i)||[];for(let l=0;l<c.length;l++){let u=c[l];l===0&&a.length>0?so(t,u,a)&&o.push(u):oo(t,u)&&o.push(u)}}for(let i of o)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 s=t.getAttribute("name")||null;Vn(e.pendingByName,s,r)}e.lastSnapshot.delete(t)}function so(e,t,n){let r=t.getAttribute(H)!==we,s=e.lastSnapshot.get(t)||[];if(!r&&co(s,n))return!1;let i=t[Ke];if(r&&i)for(;t.firstChild;)i.appendChild(t.firstChild);else for(;t.firstChild;)t.removeChild(t.firstChild);for(let c of n)t.appendChild(c);return t.setAttribute(H,we),e.lastSnapshot.set(t,n.slice()),!0}function oo(e,t){let n=t.getAttribute(H)===we;if(t.setAttribute(H,$n),!n)return Un(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return Un(t),!0}function Un(e){let t=e[Ke];!t||t.childNodes.length===0||e.appendChild(t)}function io(e,t){if(!_e)return;let n=I(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>Ye(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function Kn(e,t){if(!Ht(e))return;let n=I(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);Vn(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 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 Yn=new WeakMap,Vt=Symbol.for("webjs.instance");function te(e,t){let n=t,r=n[Vt];if(S(e)){let s=e;if(r&&r.strings===s.strings){Z(r,s.values);return}r&&Gn(r,t);let o=t.firstChild;o&&o.nodeType===8&&o.data==="webjs-hydrate"&&o.remove();let i=fo(s,t);n[Vt]=i;return}if(r&&Gn(r,t),n[Vt]=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 Je(e){let{strings:t}=e,n=Yn.get(t);if(n)return n;let r=[],s="",o="text",i="",c=0,a="",l=0,u=null,p="",d="";for(let m=0;m<t.length;m++){let de=t[m];for(let v=0;v<de.length;v++){let f=de[v];switch(o){case"text":s+=f,f==="<"&&(o="tag-open");break;case"tag-open":s+=f,f==="!"?o="bang-1":f==="/"?(o="tag-name",p=""):/[a-zA-Z]/.test(f)?(o="tag-name",p=f.toLowerCase()):o="text";break;case"bang-1":s+=f,o=f==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=f,f==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=f,f==="-"?l+=1:(f===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=f,f===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(d="")):/\s/.test(f)?o="in-tag":p+=f.toLowerCase();break;case"in-tag":s+=f,f===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(d="")):!/\s/.test(f)&&f!=="/"&&(o="attr-name",i=f,c=s.length-1);break;case"rawtext":s+=f,d=(d+f.toLowerCase()).slice(-9),(d.endsWith("<\/script>")||d.endsWith("</style>"))&&(o="text",d="",p="");break;case"attr-name":f==="="?(o="after-eq",s+=f):/\s/.test(f)?(o="in-tag",i="",s+=f):f===">"?(o="text",i="",s+=f):(i+=f,s+=f);break;case"after-eq":f==='"'||f==="'"?(o="attr-quoted",a=f,s+=f):/\s/.test(f)?(o="in-tag",i="",s+=f):f===">"?(o="text",i="",s+=f):(o="attr-unquoted",s+=f);break;case"attr-unquoted":/\s/.test(f)?(o="in-tag",i="",s+=f):(f===">"&&(o="text",i=""),s+=f);break;case"attr-quoted":s+=f,f===a&&(o="in-tag",i="");break;case"skip-attr":if(f===a){if(u){let T=u.firstPartIdx,w=[];for(let C=T;C<r.length;C++)(r[C].kind==="noop"||r[C].kind==="attr-mixed")&&w.push(C);let x=[],_=t[w[0]],he=_.lastIndexOf(a);x.push(he>=0?_.slice(he+1):_);for(let C=1;C<w.length;C++)x.push(t[w[C]]);let pe=t[w[w.length-1]+1],vt=pe.indexOf(a);x.push(vt>=0?pe.slice(0,vt):pe),r[T]={kind:"attr-mixed",path:[],name:u.name,statics:x,group:w},u=null}o="in-tag",i=""}break}}if(m<t.length-1){let v=r.length;if(o==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(o==="rawtext"){d="",r.push({kind:"noop",path:[]});continue}if(o==="text")s+=`<!--${b}${v}-->`,r.push({kind:"child",path:[]});else if(o==="in-tag"){let f=`data-${b}${v}`;s+=`${f}=""`,r.push({kind:"element",path:[]})}else if(o==="after-eq"){let f=i[0],T=i.slice(1);if(f==="@"||f==="."||f==="?"){s=s.slice(0,c);let w=f==="@"?"event":f==="."?"prop":"bool",x=`data-${b}${v}`;s+=`${x}=""`,r.push({kind:w,path:[],name:T})}else{s=s.slice(0,c);let w=`data-${b}${v}`;s+=`${w}=""`,r.push({kind:"attr",path:[],name:i})}o="in-tag",i=""}else if(o==="attr-quoted"||o==="attr-unquoted"){s=s.slice(0,c);let f=`data-${b}${v}`;s+=`${f}=""`,u={name:i,firstPartIdx:v},r.push({kind:"noop",path:[]}),o="skip-attr"}else o==="skip-attr"&&r.push({kind:"noop",path:[]})}}let h=document.createElement("template");return h.innerHTML=s,lo(h.content,r),uo(h.content,r),n={templateEl:h,parts:r},Yn.set(t,n),n}function lo(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(P,"");let s=t.length;r.setAttribute(`data-${b}${s}`,""),t.push({kind:"slot",path:[]})}}function uo(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 c=i.data;if(c.startsWith(b)){let a=Number(c.slice(b.length));t[a]&&t[a].kind==="child"&&(t[a].path=n.slice())}}else if(i.nodeType===1){let c=i,a=[];for(let l of c.attributes)if(l.name.startsWith(`data-${b}`)){let u=Number(l.name.slice(`data-${b}`.length));t[u]&&t[u].kind!=="child"&&(t[u].path=n.slice()),a.push(l.name)}for(let l of a)c.removeAttribute(l);r(i)}n.pop()}}r(e)}function fo(e,t){let{templateEl:n,parts:r}=Je(e),s=n.content.cloneNode(!0),o=document.createComment(`${b}s`),i=document.createComment(`${b}e`),c=r.map(l=>Xe(l,s)),a=[];for(let l=0;l<e.values.length;l++)V(c[l],e.values[l],void 0,e.values),a.push(e.values[l]);t.replaceChildren(o,...s.childNodes,i);for(let l of c)l.kind==="slot"&&V(l,void 0,void 0,[]);return{strings:e.strings,bound:c,lastValues:a,startNode:o,endNode:i}}function Xe(e,t){if(e.kind==="noop")return{kind:"noop"};let n=t;for(let s of e.path)n=n.childNodes[s];if(e.kind==="child")return{kind:"child",marker:n};let r=n;if(e.kind==="event"){let s={kind:"event",el:r,name:e.name||"",handler:null,dispatcher(o){s.handler?.(o)}};return r.addEventListener(s.name,s.dispatcher),s}if(e.kind==="attr")return{kind:"attr",el:r,name:e.name||""};if(e.kind==="attr-mixed")return{kind:"attr-mixed",el:r,name:e.name||"",statics:e.statics||[],group:e.group||[]};if(e.kind==="prop")return{kind:"prop",el:r,name:e.name||""};if(e.kind==="bool")return{kind:"bool",el:r,name:e.name||""};if(e.kind==="element")return{kind:"element",el:r};if(e.kind==="slot")return{kind:"slot",slotEl:r,applied:!1};throw new Error(`unknown part kind ${e.kind}`)}function Z(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(V(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function Gn(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=Wt(n.slotEl);r&&Kn(r,n.slotEl)}}t.replaceChildren()}function V(e,t,n,r){if(kt(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":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 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 c=Wt(s);if(!c||ho(s))return;let a=document.createDocumentFragment();for(;s.firstChild;)a.appendChild(s.firstChild);s[Ke]=a,Ye(c)};Wt(s)?o():queueMicrotask(o);break}case"noop":break}}function Wt(e){let t=e.parentElement;for(;t;){if(t[q])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=Pe(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 mo(e,t){return Co(e,t),j(e,t)}function j(e,t){let n=e.marker;if(Tt(t)){F(e);let s=String(t.value??""),o=document.createElement("template");o.innerHTML=s;let i=[...o.content.childNodes],c=document.createDocumentFragment();for(let a of i)c.appendChild(a);n.parentNode?.insertBefore(c,n),e.child=i;return}if(Oe(t)){let s=t,o=e.__keyedKey;o!==void 0&&!Object.is(o,s.key)&&F(e),e.__keyedKey=s.key,j(e,s.value);return}if(Me(t)){let s=t,o=e.__guardDeps,i=s.deps;if(o!==void 0&&(Array.isArray(o)&&Array.isArray(i)?vo(o,i):Object.is(o,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,j(e,s.fn());return}if(Nt(t)){F(e);let s=t.template;if(s&&s.content){let o=s.content.cloneNode(!0),i=[...o.childNodes];n.parentNode?.insertBefore(o,n),e.child=i}return}if(Pe(t))return;if(Ie(t))return Eo(e,t.value);if(Fe(t))return To(e,t.args);if(Be(t))return ko(e,t.signal);if(xt(t))return No(e,t);if(jt(t))return xo(e,t);if(Le(t)){if(e.child&&e.child.kind==="repeat"){go(e,t);return}F(e);let s={kind:"repeat",map:new Map};e.child=s,yo(n,s,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){So(e,t);return}F(e);let s={kind:"array",items:[]};e.child=s,wo(n,s,t);return}if(e.child){let s=e.child;if(s.kind==="repeat")Jn(s),e.child=void 0;else if(s.kind==="array")Qn(s),e.child=void 0;else if(s.kind==="async-stream")nr(s),e.child=void 0;else if("strings"in e.child){let o=e.child;if(S(t)&&o.strings===t.strings){Z(o,t.values);return}ee(o.startNode,o.endNode),e.child=void 0}else{for(let o of e.child)o.parentNode&&o.parentNode.removeChild(o);e.child=void 0}}if(t==null||t===!1||t===!0)return;if(S(t)){let s=t,{templateEl:o,parts:i}=Je(s),c=o.content.cloneNode(!0),a=document.createComment(`${b}s`),l=document.createComment(`${b}e`),u=i.map(h=>Xe(h,c)),p=[];for(let h=0;h<s.values.length;h++)V(u[h],s.values[h],void 0,s.values),p.push(s.values[h]);let d=[a,...c.childNodes,l];n.parentNode?.insertBefore(bo(d),n);for(let h of u)h.kind==="slot"&&V(h,void 0,void 0,[]);e.child={strings:s.strings,bound:u,lastValues:p,startNode:a,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 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 Kt(e){let{templateEl:t,parts:n}=Je(e),r=t.content.cloneNode(!0),s=document.createComment(`${b}s`),o=document.createComment(`${b}e`),i=n.map(l=>Xe(l,r)),c=[];for(let l=0;l<e.values.length;l++)V(i[l],e.values[l],void 0,e.values),c.push(e.values[l]);let a=document.createDocumentFragment();for(a.appendChild(s);r.firstChild;)a.appendChild(r.firstChild);return a.appendChild(o),{inst:{strings:e.strings,bound:i,lastValues:c,startNode:s,endNode:o},frag:a}}function Se(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 yo(e,t,n){let{items:r,keyFn:s,templateFn:o}=n,i=e.parentNode;if(!i)return;let c=document.createDocumentFragment();for(let a=0;a<r.length;a++){let l=s(r[a],a),u=o(r[a],a);if(!S(u))continue;let{inst:p,frag:d}=Kt(u);t.map.set(l,p),c.appendChild(d)}i.insertBefore(c,e)}function go(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,{items:o,keyFn:i,templateFn:c}=t,a=new Map;for(let l=0;l<o.length;l++){let u=i(o[l],l),p=c(o[l],l);if(!S(p))continue;let d=s.map.get(u);if(d&&d.strings===p.strings)Z(d,p.values),zt(d.startNode,d.endNode,r,n),a.set(u,d),s.map.delete(u);else{d&&(Se(d),ee(d.startNode,d.endNode),s.map.delete(u));let{inst:h,frag:m}=Kt(p);r.insertBefore(m,n),a.set(u,h)}}for(let l of s.map.values())Se(l),ee(l.startNode,l.endNode);s.map=a}function Jn(e){for(let t of e.map.values())Se(t),ee(t.startNode,t.endNode);e.map.clear()}function _o(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function Ge(e){e.type==="tpl"?(Se(e.inst),ee(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function Xn(e){if(S(e)){let{inst:t,frag:n}=Kt(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 wo(e,t,n){let r=e.parentNode;if(!r)return;let s=document.createDocumentFragment(),o=[];for(let i of n){let{item:c,frag:a}=Xn(i);a&&s.appendChild(a),o.push(c)}r.insertBefore(s,e),t.items=o}function So(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,o=s.items,i=[];for(let c=0;c<t.length;c++){let a=t[c],l=o[c];if(S(a)){let d=a;if(l&&l.type==="tpl"&&l.inst.strings===d.strings){Z(l.inst,d.values),i.push(l);continue}}else if(a!=null&&a!==!1&&a!==!0){if(l&&l.type==="text"){let d=String(a);l.node.data!==d&&(l.node.data=d),i.push(l);continue}}else{l&&Ge(l),i.push({type:"empty"});continue}let{item:u,frag:p}=Xn(a);p&&r.insertBefore(p,Ao(o,c,n)),l&&Ge(l),i.push(u)}for(let c=t.length;c<o.length;c++)Ge(o[c]);s.items=i}function Ao(e,t,n){for(let r=t;r<e.length;r++){let s=_o(e[r]);if(s&&s.parentNode)return s}return n}function Qn(e){for(let t of e.items)Ge(t);e.items=[]}function zt(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 vo(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function F(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&Zn(t),!e.child)return;let n=e.child;if(n.kind==="repeat")Jn(n);else if(n.kind==="array")Qn(n);else if(n.kind==="async-stream")nr(n);else if("strings"in n){let r=e.child;Se(r),ee(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function Co(e,t){let n=e;n.__untilState&&!Fe(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!Me(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!Ie(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!Oe(t)&&(n.__keyedKey=void 0),n.__watchSub&&!Be(t)&&Zn(n)}function Eo(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 c=o;if(S(t)&&c.strings===t.strings){Z(c,t.values);return}let a=document.createDocumentFragment();zt(c.startNode,c.endNode,a,null),s.set(c.strings,{inst:c,holder:a}),e.child=void 0}if(S(t)){let c=t,a=s.get(c.strings);if(a){s.delete(c.strings),e.child&&F(e),zt(a.inst.startNode,a.inst.endNode,n.parentNode,n),Z(a.inst,c.values),e.child=a.inst;return}}j(e,t)}function To(e,t){let n=e,r=n.__untilState,s=n.__untilArgs,o=(d,h)=>!!(Object.is(d,h)||S(d)&&S(h)&&d.strings===h.strings),c=s&&s.length===t.length&&s.every((d,h)=>o(d,t[h]))&&r?r.highestResolved:1/0;r&&(r.aborted=!0),n.__untilArgs=t.slice();let a={aborted:!1,highestResolved:c};n.__untilState=a;let l=-1,u;for(let d=0;d<t.length;d++){let h=t[d];if(!h||typeof h.then!="function"){l=d,u=h;break}}l!==-1&&l<=a.highestResolved?(j(e,u),a.highestResolved=l):l===-1&&!n.__untilEverRendered&&j(e,""),n.__untilEverRendered=!0;let p=Math.min(l===-1?t.length:l,a.highestResolved);for(let d=0;d<p;d++){let h=t[d];!h||typeof h.then!="function"||Promise.resolve(h).then(m=>{a.aborted||d>=a.highestResolved||(a.highestResolved=d,j(e,m))},()=>{})}}function ko(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let o;n.__watchSub.observe(()=>{o=t.get()}),j(e,o);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new ye.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let o;r.observe(()=>{o=t.get()}),j(e,o)})});n.__watchSub=r;let s;r.observe(()=>{s=t.get()}),j(e,s)}function Zn(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function No(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;F(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,er(s,e,t)}function xo(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;F(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,er(s,e,t)}async function er(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,c=tr(i);if(e.mode==="replace"){for(let l of e.nodes)l.parentNode&&l.parentNode.removeChild(l);e.nodes=[]}let a=document.createDocumentFragment();for(let l of c)a.appendChild(l);r.parentNode?.insertBefore(a,r),e.nodes.push(...c),s++}}catch(o){typeof console<"u"&&console.error("[webjs] asyncStream error:",o)}}function tr(e){if(e==null||e===!1||e===!0)return[];if(S(e)){let t=e,{templateEl:n,parts:r}=Je(t),s=n.content.cloneNode(!0),o=r.map(i=>Xe(i,s));for(let i=0;i<t.values.length;i++)V(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(...tr(n));return t}return[document.createTextNode(String(e))]}function nr(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 rr=null;function Qe(e){rr=e||null}function jo(){return rr||void 0}var sr=Symbol.for("webjs:registry"),or=Symbol.for("webjs:classToTag"),Ze=globalThis,R=Ze[sr]||(Ze[sr]=new Map),ir=Ze[or]||(Ze[or]=new WeakMap),et=typeof window<"u"&&typeof customElements<"u";function Yt(e,t){if(!e||typeof e!="string"||!e.includes("-"))throw new Error(`customElements.define: tag "${e}" must contain a hyphen (HTML spec)`);let n=t.lazy===!0,r=R.get(e);r?(r.cls=t,r.lazy=n):R.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),ir.set(t,e)}if(et){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),Yt(t,n)}}if(!et){let e=globalThis;e.customElements||(e.customElements={define(t,n){Yt(t,n)},get(t){return R.get(t)?.cls},upgrade(){},whenDefined(t){let n=R.get(t);return Promise.resolve(n?.cls)}})}function Gt(e,t){et?customElements.define(e,t):Yt(e,t)}function Ro(e,t){if(et)return;let n=R.get(e);if(n){n.moduleUrl=t;return}R.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function Lo(e){return R.get(e)?.cls}function Oo(e){return R.get(e)?.moduleUrl||null}function Mo(e){return R.get(e)?.lazy===!0}function tt(e){return ir.get(e)}function Po(){return[...R.keys()]}Ce();var pr=typeof window<"u"&&typeof HTMLElement<"u";function Yo(e,t){return e!==t}function Go(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var nt=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=Go(),this.__internals}},Jo=["ariaAtomic","ariaAutoComplete","ariaBusy","ariaChecked","ariaColCount","ariaColIndex","ariaColSpan","ariaCurrent","ariaDescription","ariaDisabled","ariaExpanded","ariaHasPopup","ariaHidden","ariaInvalid","ariaKeyShortcuts","ariaLabel","ariaLevel","ariaLive","ariaModal","ariaMultiLine","ariaMultiSelectable","ariaOrientation","ariaPlaceholder","ariaPosInSet","ariaPressed","ariaReadOnly","ariaRequired","ariaRoleDescription","ariaRowCount","ariaRowIndex","ariaRowSpan","ariaSelected","ariaSetSize","ariaSort","ariaValueMax","ariaValueMin","ariaValueNow","ariaValueText"];for(let e of Jo){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(nt.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var Xo=pr?HTMLElement:nt,mr=Symbol("webjs.factoryProps"),fr=new WeakSet,ne=class e extends Xo{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){Gt(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(dr)}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._assertFactoryProperties(),this._initializeProperties()}_assertFactoryProperties(){let t=this.constructor;if(fr.has(t))return;let n=t;for(;n&&n!==e;){if(Object.hasOwn(n,"properties")&&!Object.hasOwn(n,mr)){let r=n.name||"a component";throw new Error(`${r}: \`static properties\` is no longer supported. Declare reactive properties via the factory instead: \`class ${r} extends WebComponent({ count: Number })\`. Use the \`prop()\` helper for options (\`prop(Number, { reflect: true })\`) and set defaults via the \`default\` option or in the constructor. See https://docs.webjs.com/docs/components.`)}n=Object.getPrototypeOf(n)}fr.add(t)}_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:c=>{let a=this.__propValues[r];(o.hasChanged||Yo)(c,a)&&(this.__propValues[r]=c,o.reflect&&!o.state&&this._connected&&this._reflectAttribute(r,c,o),this.requestUpdate(r,a))}}),i!==void 0&&(this.__propValues[r]=i)}}}_reflectAttribute(t,n,r){let s=dr(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(!pr)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=hr(r.slice(16));try{this[o]=z(s)}catch(i){console.warn(`[webjs] failed to decode ${r} on <${this.tagName.toLowerCase()}>: ${i&&i.message}`)}}}_activate(){this._connected=!0,this._reflectDeclaredAttributes();let t=this.constructor;if(t.shadow===!0){let n=!!this.shadowRoot;this.shadowRoot||this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot;let r=t.styles,s=Array.isArray(r)?r:Ct(r)?[r]:[];if(s.length){if(n){let o=this.shadowRoot.querySelector("style");o&&o.remove()}Et(this._renderRoot,s)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${tt(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().`),Ht(this)||(this.__isHydrating()?(I(this),Hn(this)):qn(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&&Wn(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&&zn(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=hr(t),i=s.properties&&(s.properties[o]||s.properties[t]);if(!i)return;let c=typeof i=="object"?i:{type:i},a;if(c.converter&&c.converter.fromAttribute)a=c.converter.fromAttribute(r,c.type);else if(c.type===Number)a=r==null?null:Number(r);else if(c.type===Boolean)a=r!=null&&r!=="false";else if(c.type===Object||c.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,this.__renderAbort&&this.__renderAbort.abort(),this.__renderAbort=typeof AbortController<"u"?new AbortController:null,Qe(this.__renderAbort?this.__renderAbort.signal:null);try{let s=this.update(t);s&&typeof s.then=="function"&&(r=s)}catch(s){this._handleRenderError(s)}finally{Qe(null)}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 ye.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;if(this.__signalWatcher.observe(()=>{n=this.render()}),n&&typeof n.then=="function")return this._commitAsync(n);te(n,this._renderRoot)}_commitAsync(t){let n=this.__renderToken;if(this.__firstRendered&&this._overridesRenderFallback())try{let r=this.renderFallback();r!==void 0&&te(r,this._renderRoot)}catch(r){console.error("[webjs] renderFallback() threw:",r)}return Promise.resolve(t).then(r=>{n===this.__renderToken&&te(r,this._renderRoot)},r=>{n===this.__renderToken&&this._handleRenderError(r instanceof Error?r:new Error(String(r)))})}_overridesRenderFallback(){return this.renderFallback!==rt.prototype.renderFallback}_handleRenderError(t){console.error(`[webjs] render error in <${tt(this.constructor)||this.tagName?.toLowerCase()}>:`,t);try{let n=this.renderError(t);n!==void 0&&te(n,this._renderRoot)}catch(n){console.error("[webjs] renderError() also threw:",n)}}_postCommit(t){try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(n){console.error("[webjs] lifecycle hook threw during post-commit phase:",n)}finally{this._resolveUpdate()}}updated(t){}firstUpdated(t){}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}addController(t){this.__controllers.add(t),this._connected&&t.hostConnected&&t.hostConnected()}removeController(t){this.__controllers.delete(t)}render(){return""}renderError(t){}renderFallback(){}};function dr(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function hr(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function rt(e){return new.target?Reflect.construct(ne,arguments,new.target):class extends ne{static properties=e;static[mr]=!0}}Object.setPrototypeOf(rt,ne);rt.prototype=ne.prototype;function Qo(e,t={}){return e&&typeof e=="object"&&!("call"in e)&&(t=e,e=void 0),{...e?{type:e}:{},...t}}var br=Symbol.for("webjs.notFound"),yr=Symbol.for("webjs.redirect");function Zo(){let e=new Error("webjs: notFound()");throw e.__webjs=br,e}function ei(e,t){let n=typeof t=="object"&&t!==null?t.status:t,r=new Error(`webjs: redirect(${e})`);throw r.__webjs=yr,r.url=e,r.status=typeof n=="number"?n:void 0,r}function ti(e){return!!e&&e.__webjs===br}function ni(e){return!!e&&e.__webjs===yr}var gr=null;function ri(){if(!gr)return"";try{return gr()||""}catch{return""}}var Da=Symbol.for("webjs.suspense");function si(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function oi(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}function ii(e,t={}){let n=t.reconnect!==!1,r=0,s=!1,o=null,i=[];function c(){s||(o=new WebSocket(ai(e),t.protocols),o.onopen=a=>{for(r=0;i.length&&o&&o.readyState===WebSocket.OPEN;)o.send(i.shift());t.onOpen?.(a)},o.onmessage=a=>{let l=a.data;if(typeof l=="string")try{l=JSON.parse(l)}catch{}t.onMessage?.(l,a)},o.onerror=a=>{t.onError?.(a)},o.onclose=a=>{if(t.onClose?.(a),!s&&n){let l=Math.min(1e3*2**r++,3e4);setTimeout(c,l)}})}return c(),{send(a){let l=typeof a=="string"||a instanceof ArrayBuffer||ArrayBuffer.isView(a)?a:JSON.stringify(a);o&&o.readyState===WebSocket.OPEN?o.send(l):i.push(l)},close(a,l){s=!0;try{o?.close(a,l)}catch{}},get socket(){return o},get readyState(){return o?.readyState??3}}}function ai(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}`}Ce();var Xt="application/vnd.webjs+json";async function ci(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",Xt);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 Jt(r),n.has("content-type")||n.set("content-type",Xt));let s=await fetch(e,{...t,headers:n,body:r}),o=s.headers.get("content-type")||"",i=await s.text(),c=o.includes(Xt)?i?z(i):null:o.includes("application/json")?i?JSON.parse(i):null:i;if(!s.ok){let a=c&&c.error||`richFetch ${e} -> ${s.status}`,l=new Error(a);throw l.status=s.status,l.body=c,l}return c}Ce();ot();ot();en();it();async function Hi(e,t,n){let r=e.get();e.set(t);let s;try{s=await n()}catch(o){throw e.set(r),o}return s&&s.success===!1&&e.set(r),s}rn();var St=0,bs=new Map,fe=new Map,Vi=1e3;function Wi(e){if(!(!Array.isArray(e)||!e.length)){St+=1;for(let t of e)t&&bs.set(t,St)}}function zi(){return St}function Ki(e,t,n){if(!(!Array.isArray(t)||!t.length)&&(fe.delete(e),fe.set(e,{tags:t.slice(),since:typeof n=="number"?n:St}),fe.size>Vi)){let r=fe.keys().next().value;r!==void 0&&fe.delete(r)}}function Yi(e){let t=fe.get(e);if(!t)return!1;for(let n of t.tags)if((bs.get(n)||0)>t.since)return!0;return!1}function Gi(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}var Ji="application/vnd.webjs+stream",Xi=1,Qi=2,Zi=3,ys=new Uint8Array(0);function ea(e,t){let n=t||ys,r=n.length,s=new Uint8Array(5+r);return s[0]=e&255,s[1]=r>>>24&255,s[2]=r>>>16&255,s[3]=r>>>8&255,s[4]=r&255,r&&s.set(n,5),s}function ta(){let e=ys;return{push(t){if(t&&t.length){let r=new Uint8Array(e.length+t.length);r.set(e,0),r.set(t,e.length),e=r}let n=[];for(;e.length>=5;){let r=e[0],s=(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0;if(e.length<5+s)break;let o=e.slice(5,5+s);n.push({type:r,payload:o}),e=e.slice(5+s)}return n}}}var na=Symbol.for("webjs.context");function ra(e){return{__context__:na,name:e}}var At=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},Cn=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},c=()=>{this._subscriptions.delete(i)};this._subscriptions.add(i),o.callback(this._value,c)}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()}},En=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 At(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 sa(){return typeof window<"u"}var O={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},Tn=class{constructor(t,{task:n,args:r,autoRun:s=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=s,this._status=O.INITIAL,this._value=void 0,this._error=void 0,this._abortController=null,this._prevArgs=null,typeof t.addController=="function"&&t.addController(this)}get status(){return this._status}get value(){return this._value}get error(){return this._error}async run(){this.abort();let t=new AbortController;this._abortController=t;let n=this._argsFn();this._prevArgs=n,this._status=O.PENDING,this._error=void 0,this._requestHostUpdate();try{let r=await this._taskFn(...n,{signal:t.signal});if(t.signal.aborted)return;this._value=r,this._status=O.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=O.ERROR,this._value=void 0}finally{this._abortController===t&&(this._abortController=null)}this._requestHostUpdate()}abort(){this._abortController&&(this._abortController.abort(),this._abortController=null)}render(t={}){switch(this._status){case O.INITIAL:return t.initial?.();case O.PENDING:return t.pending?.();case O.COMPLETE:return t.complete?.(this._value);case O.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!sa())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{En as ContextConsumer,Cn as ContextProvider,At as ContextRequestEvent,Xi as FRAME_CHUNK,Qi as FRAME_END,Zi as FRAME_ERROR,b as MARKER,Nr as SEED_MISS,Ji as STREAM_CONTENT_TYPE,ye as Signal,si as Suspense,Tn as Task,O as TaskStatus,rt as WebComponent,Zt as WebjsFrame,tn as WebjsStream,jo as activeActionSignal,Et as adoptStyles,Po as allTags,Ms as asyncAppend,Ps as asyncReplace,Ws as batch,Ls as cache,Ks as computed,ii as connectWS,Yi as consumeStale,ra as createContext,ta as createFrameDecoder,Rs as createRef,ri as cspNonce,Ss as css,lr as deserialize,Mr as disableClientRouter,Gs as effect,hn as enableClientRouter,ea as encodeFrame,Cs as escapeAttr,vs as escapeText,zi as fetchMark,Ns as guard,ws as html,xt as isAsyncAppend,jt as isAsyncReplace,Ct as isCSS,Ie as isCache,Me as isGuard,Oe as isKeyed,Mo as isLazy,kt as isLive,ti as isNotFound,ni as isRedirect,Pe as isRef,Le as isRepeat,Ys as isSignal,oi as isSuspense,S as isTemplate,Nt as isTemplateContent,Tt as isUnsafeHTML,Fe as isUntil,Be as isWatch,ks as keyed,Ts as live,Lo as lookup,Oo as lookupModuleUrl,Wi as markStale,Pr as navigate,Zo as notFound,Hi as optimistic,z as parse,Gi as parseTagHeader,Ro as primeModuleUrl,Qo as prop,ei as redirect,js as ref,Gt as register,Ki as registerKeyTags,te as render,nn as renderStream,xn as repeat,Ir as revalidate,ci as richFetch,at as scanSeeds,cr as serialize,Qe as setActiveActionSignal,zs as signal,Jt as stringify,As as stylesToString,tt as tagOf,mi as takeSeed,xs as templateContent,Es as unsafeHTML,Os as until,Is as watch};
|
|
4
4
|
//# sourceMappingURL=webjs-core-browser.js.map
|