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