@estjs/template 0.0.16-beta.9 → 0.0.16

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/template.js CHANGED
@@ -1,2 +1,2 @@
1
- import {d,g,i,b,f,h,a,c}from'./chunk-GXUTKBCN.js';import {normalizeClassName,SPREAD_NAME,isObject,startsWith,isSpecialBooleanAttr,isBooleanAttr,includeBooleanAttr,isSymbol,isString,isArray,kebabCase,camelCase,capitalize,HYDRATION_ANCHOR_ATTR,isBrowser,warn,isPromise,isFunction,isOn,coerceArray}from'@estjs/shared';import {effect,shallowReactive,isSignal,isComputed,isReactive,signal}from'@estjs/signals';var dn="ref",mn="key",pn="http://www.w3.org/2000/svg",He="http://www.w3.org/2000/xlink",Ve="http://www.w3.org/2000/xmlns/";var je=Symbol(""),de=Symbol(""),$e=Symbol(""),yn=Symbol(""),Ke=Symbol(""),Be=Symbol("");function ee(e,n,t,o){if(n===mn){o==null?e.removeAttribute(n):e.setAttribute(n,String(o));return}if(n===SPREAD_NAME){let y=isObject(t)?t:null,h=isObject(o)?o:null;if(y)for(let N in y)N!==SPREAD_NAME&&(!h||!(N in h))&&ee(e,N,y[N],null);if(h)for(let N in h)N!==SPREAD_NAME&&ee(e,N,y==null?void 0:y[N],h[N]);return}let r=(e==null?void 0:e.namespaceURI)===pn,a=r&&startsWith(n,"xlink:"),l=r&&startsWith(n,"xmlns:"),s=isSpecialBooleanAttr(n)||isBooleanAttr(n);if(t===o||n.length>2&&n.charCodeAt(0)===111&&n.charCodeAt(1)===110)return;let c=n.toLowerCase();if(c==="innerhtml"||c==="srcdoc")return;if(o==null){if(a)e.removeAttributeNS(He,n.slice(6));else if(l){let y=n.slice(6);e.removeAttributeNS(Ve,y);}else e.removeAttribute(n);return}if(s){includeBooleanAttr(o)?e.setAttribute(n,""):e.removeAttribute(n);return}let d=isSymbol(o)?String(o):o;if((c==="href"||c==="src"||c==="xlink:href"||c==="action"||c==="formaction"||c==="poster")&&isString(d)){let y=d.trim().toLowerCase();if(startsWith(y,"javascript:")||startsWith(y,"data:"))return}if(a){e.setAttributeNS(He,n,String(d));return}if(l){e.setAttributeNS(Ve,n,String(d));return}if(r)e.setAttribute(n,String(d));else if(n in e)try{e[n]=d;}catch(y){e.setAttribute(n,String(d));}else e.setAttribute(n,String(d));}function Te(e,n,t,o=false){if(n===t)return;let r=Ne(t);if(!r){e.removeAttribute("class");return}(isString(n)?n:Ne(n))!==r&&(o?e.setAttribute("class",r):e.className=r);}var Ne=normalizeClassName;var gn=/\s*!important$/,dt=["Webkit","Moz","ms"],Ge={};function Ae(e,n,t){let o=e.style;if(t&&isString(t)){n!==t&&(o.cssText=t);return}if(!t){n&&e.removeAttribute("style");return}if(n&&!isString(n)){let r=n;for(let a in r)(!t||t[a]==null)&&te(o,a,"");}else if(n&&isString(n)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,a;for(;(a=r.exec(n))!==null;){let l=a[1].trim();l&&t&&isObject(t)&&t[l]==null&&te(o,l,"");}}if(t&&!isString(t)){let r=t;for(let a in r){let l=r[a];(!n||isString(n)||n[a]!==l)&&l!=null&&te(o,a,l);}}}function te(e,n,t){if(isArray(t)){for(let a of t)te(e,n,a);return}(t==null||t==="")&&(t="");let o=isString(t)&&gn.test(t)?"important":"";if(o&&(t=t.replace(gn,"")),startsWith(n,"--")){o?e.setProperty(n,t,o):e.setProperty(n,t);return}let r=pt(e,n);o?e.setProperty(mt(r),t,o):e[r]=t;}function mt(e){let n=kebabCase(e);return startsWith(e,"Webkit")||startsWith(e,"Moz")||startsWith(e,"ms")?`-${n}`:n}function pt(e,n){let t=Ge[n];if(t)return t;let o=camelCase(n);if(o!=="filter"&&o in e)return Ge[n]=o;o=capitalize(o);for(let r of dt){let a=r+o;if(a in e)return Ge[n]=a}return n}var Ue=0;function vn(){return String(Ue++)}function vt(){Ue=0;}var q=false;function re(){return q}var oe=new Map;function Et(e){let n=e.querySelectorAll("[data-hk]");for(let t of n){let o=t.dataset.hk;o!=null&&!oe.has(o)&&oe.set(o,t);}}var we=[],me=new Map;function Ct(){if(typeof document=="undefined")return;let e=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),n;for(;n=e.nextNode();){let t=n.data;if(t==="teleport-anchor")we.push(n);else if(t==="teleport-start"){let o=n.parentElement;if(!o)continue;let r=me.get(o);r||(r=[],me.set(o,r)),r.push(n);}}}function ze(){var e;return (e=we.shift())!=null?e:null}function We(e){let n=me.get(e),t=n==null?void 0:n.shift();if(!t)return null;let o=[],r=t.nextSibling;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data==="teleport-end")return {start:t,end:r,nodes:o};o.push(r),r=r.nextSibling;}return null}function qe(e){q=true,Ue=0,oe.clear(),we.length=0,me.clear(),Et(e),Ct();}function Xe(){q=false,oe.clear(),we.length=0,me.clear();}function En(e,n,t){var a,l;if(!q||t&&t.parentNode!==e)return null;if(n.length===0)return [];let o=new Array(n.length),r=t?t.previousSibling:e.lastChild;for(let s=n.length-1;s>=0;s--){if(!r)return null;let c=n[s],d=c.nodeType;if(d===Node.TEXT_NODE){let u=(a=c.textContent)!=null?a:"";if(!u||r.nodeType!==Node.TEXT_NODE)return null;let y=(l=r.textContent)!=null?l:"";if(y===u){o[s]=r,r=r.previousSibling;continue}if(!y.endsWith(u))return null;let h=y.slice(0,y.length-u.length);if(!h)return null;let N=document.createTextNode(h);e.insertBefore(N,r),r.textContent=u,o[s]=r,r=N;continue}if(r.nodeType!==d)return null;if(d===Node.ELEMENT_NODE){if(r.tagName!==c.tagName)return null}else if(d===Node.COMMENT_NODE&&r.data!==c.data)return null;o[s]=r,r=r.previousSibling;}return o}function Cn(e){var t,o,r;return (r=(o=e.dataset.hk)!=null?o:(t=e.closest("[data-hk]"))==null?void 0:t.dataset.hk)!=null?r:null}function Nt(e,n){if(!q||!e||n<0)return null;let t=e instanceof Element?Cn(e):null,o=t?`${t}-${n}`:String(n),r=e.firstChild;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data===o)return r;r=r.nextSibling;}return null}function Tt(e,n){if(!q||!(e instanceof Element)||n<0)return null;let t=Cn(e),o=t?`${t}-${n}`:String(n),r=e.firstChild;for(;r;){if(r instanceof Element&&r.getAttribute(HYDRATION_ANCHOR_ATTR)===o)return r;r=r.nextSibling;}return null}function St(e){if(!isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let n=null;return ()=>{if(!q)return n||(n=be(e)),n();let t=vn(),o=oe.get(t);return o?(oe.delete(t),o):(warn(`[essor] hydration mismatch: no SSR element for key "${t}"`),n||(n=be(e)),n())}}function At(e,n,t,o){q||Te(e,n,t,o);}function bt(e,n,t,o){q||ee(e,n,t,o);}function wt(e,n,t){q||Ae(e,n,t);}function Ye(e,n){return n&&n.parentNode===e?n:null}function Nn(e,n,t,o){let r=Ye(e,o),a=n.length,l=t.length;if(a===0&&l===0)return t;if(a===0){for(let u=0;u<l;u++)G(e,t[u],r);return t}if(l===0){for(let u=0;u<a;u++)Y(n[u]);return []}let s=0,c=a-1,d=l-1;for(;s<=c&&s<=d&&n[s]===t[s];)s++;for(;c>=s&&d>=s&&n[c]===t[d];)c--,d--;if(s>c){if(s<=d){let u=d+1,y=Ye(e,u<l?t[u]:r);for(let h=s;h<=d;h++)G(e,t[h],y);}}else if(s>d)for(let u=s;u<=c;u++)Y(n[u]);else _t(e,n,t,s,c,d,r);return t}function _t(e,n,t,o,r,a,l){let s=a-o+1,c=s<=4?T=>{for(let E=o;E<=a;E++)if(t[E]===T)return E}:(()=>{let T=new Map;for(let E=o;E<=a;E++)T.set(t[E],E);return E=>T.get(E)})(),d=new Int32Array(s),u=0,y=false,h=0;for(let T=o;T<=r;T++){let E=n[T];if(u>=s){Y(E);continue}let p=c(E);p===void 0?Y(E):(d[p-o]=T+1,p>=h?h=p:y=true,u++);}let N=y?Je(d):[],w=N.length-1;for(let T=s-1;T>=0;T--){let E=o+T,p=t[E],S=Ye(e,E+1<t.length?t[E+1]:l);d[T]===0?G(e,p,S):y&&(w<0||T!==N[w]?G(e,p,S):w--);}}function Je(e){let n=new Int32Array(e.length),t=[0],o=e.length,r,a,l,s,c;for(r=0;r<o;r++){let d=e[r];if(d!==0){if(a=t[t.length-1],e[a]<d){n[r]=a,t.push(r);continue}for(l=0,s=t.length-1;l<s;)c=l+s>>1,e[t[c]]<d?l=c+1:s=c;d<e[t[l]]&&(l>0&&(n[r]=t[l-1]),t[l]=r);}}for(l=t.length,s=t[l-1];l-- >0;)t[l]=s,s=n[s];return t}function Y(e){if(e)if(B(e))e.destroy();else {let n=e;n.parentNode&&n.remove();}}function G(e,n,t){if(!e||!n)return;let o=B(t)?t.firstChild:t;if(B(n)){n.mount(e,o);return}o?e.insertBefore(n,o):e.appendChild(n);}function ie(e){if(e instanceof Node||B(e))return e;let n=typeof e;return e==null||n==="string"||n==="number"||n==="boolean"||n==="symbol"?document.createTextNode(e===false||e==null?"":String(e)):document.createTextNode(String(e))}function J(e,n,t){if(!e)return;let o=d(),r=[],a=true,l=c=>{if(c instanceof Node)return [c];if(B(c))return [c];let d=typeof c;return c==null||d==="string"||d==="number"||d==="boolean"?[ie(c)]:coerceArray(c).map(u=>isFunction(u)?u():u).flatMap(u=>u).map(ie)},s=effect(()=>{let c=()=>{let d=isFunction(n)?n():n,u=l(d);if(a&&re()&&u.every(y=>y instanceof Node&&y.parentNode===e)){r=u,a=false;return}if(a&&re()){let y=En(e,u,t);if(y){r=y,a=false;return}}r=Nn(e,r,u,t),a=false;};o&&!o.isDestroyed?g(o,c):c();});return i(()=>{s.stop();for(let c of r)Y(c);r=[];}),r}function kt(e){return (e==null?void 0:e.firstChild)||null}function Rt(e,n=1){for(;e&&n>0;)e=e.nextSibling,n--;return e||null}function Lt(e,n){if(!e||n<0)return null;let t=e.firstChild;for(;t&&n>0;)t=t.nextSibling,n--;return t||null}function se(e,n,t,o){if(!(o!=null&&o.delegate))return e.addEventListener(n,t,o),()=>e.removeEventListener(n,t,o);let r=o.delegate,a=d=>{let u=d.target;(u.matches(r)||u.closest(r))&&t.call(e,d);},c=o,{delegate:l}=c,s=b(c,["delegate"]);return e.addEventListener(n,a,s),()=>{e.removeEventListener(n,a,s);}}function Qe(e,n,t){let o=e[n];o||(o=[],e[n]=o),o.push(t);}function An(e,n,t){let o=e.length;if(o===0)return;let r;for(let a=0;a<o;a++)try{let l=e[a]();if(isPromise(l)){let s=l.catch(c=>{});(r||(r=[])).push(s);}}catch(l){}if(r)return Promise.all(r).then(()=>{})}function Q(e){let n=d();if(n){if(n.isMounted){try{let t=e();isPromise(t)&&t.catch(o=>{});}catch(t){}return}Qe(n,"onMount",e);}}function Ft(e){let n=d();n&&Qe(n,"onUpdate",e);}function le(e){let n=d();n&&Qe(n,"onDestroy",e);}function bn(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let n=e.onMount,t=g(e,()=>An(n,e.id));return n.length=0,e.isMounted=true,t}function wn(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return g(e,()=>An(e.onUpdate,e.id))}function xn(e,n,t=false){for(let o of Object.getOwnPropertyNames(n))Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o));if(t){let o=Object.getOwnPropertyNames(n);for(let r of Object.getOwnPropertyNames(e))o.includes(r)||delete e[r];}}function Pn(e,n){let t=Object.getOwnPropertyDescriptor(e,n);return t.get?t.get.call(e):t.value}var kn;kn="normal";var ae=class{constructor(n,t={}){this.component=n;this.props=t;this[kn]=true;this.scope=null;this.state=0;this.beforeNode=void 0;this.renderedNodes=[];this.firstChild=void 0;this.parentNode=void 0;this.rootEventCleanups=[];this.parentScope=d();let o={};xn(o,t),this.reactiveProps=shallowReactive(o);}mount(n,t){var a;if(this.parentNode=n,this.beforeNode=t,this.state=1,this.renderedNodes.length>0){for(let l of this.renderedNodes)G(n,l,t);return this.state=2,this.renderedNodes}let o=f((a=this.parentScope)!=null?a:d());this.scope=o;let r=g(o,()=>{var s;let l=this.component(this.reactiveProps);return isFunction(l)&&(l=l(this.reactiveProps)),(isSignal(l)||isComputed(l))&&(l=l.value),(s=J(n,l,t))!=null?s:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,bn(o),this.renderedNodes}update(n){this.props=n;let t=this.scope;!t||t.isDestroyed||(xn(this.reactiveProps,n!=null?n:{},true),this.syncSpecialProps(n),wn(t));}forceUpdate(){if(!this.parentNode)return;let n=this.parentNode,t=this.beforeNode;this.destroy(),this.mount(n,t);}destroy(){let n=this.scope;if(!(!n||n.isDestroyed)){this.scope=null,this.releaseSpecialProps(),h(n);for(let t of this.renderedNodes)Y(t);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;for(let t of Object.getOwnPropertyNames(this.reactiveProps))delete this.reactiveProps[t];}}syncSpecialProps(n){if(!n)return;let t=this.firstChild;if(!(!t||!(t instanceof Element))){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(n)){if(o===dn){let r=Pn(n,o);this.rootRefCleanup=this.bindRootRef(r,t);continue}if(isOn(o)){let r=Pn(n,o);if(!isFunction(r))continue;let a=o.slice(2).toLowerCase(),l=t,s=`_$${a}`,c=l[s];if(isFunction(c)){l[s]=r,this.rootEventCleanups.push(()=>{l[s]===r&&(l[s]=c);});continue}let d=r,u=y=>{l.disabled||d.call(l,y);};this.rootEventCleanups.push(se(l,a,u));}}}}releaseSpecialProps(){for(let n of this.rootEventCleanups)n();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(n,t){if(isFunction(n))return n(t),()=>n(null);if(isSignal(n)){let o=n,r=o.value;return o.value=t,()=>{o.value===t&&(o.value=r);}}}};function B(e){return !!e&&!!e.normal}function Ze(e,n){return B(e)?e:new ae(e,n)}function pe(e,n){let t=d();t&&(t.provides||(t.provides=new Map),t.provides.set(e,n));}function Z(e,n){let t=d();if(!t)return n;let o=t;for(;o;){if(o.provides&&o.provides.has(e))return o.provides.get(e);o=o.parent;}return n}var Ot=typeof __VERSION__=="string"?__VERSION__:"",Rn={pre:0,default:1,post:2};function be(e){let n,t=()=>{let o=document.createElement("template");o.innerHTML=e;let r=o.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(n||(n=t())).cloneNode(true)}function Ht(e,n){return isString(n)||n instanceof Element?en(e).mount(n):en(e,n)}function Vt(e,n){return en(e).hydrate(n)}function jt(e){return e}function en(e,n){var s,c;let t=(s=n==null?void 0:n.plugins)!=null?s:[],o=a({},(c=n==null?void 0:n.config)!=null?c:{}),r=false;function a$1(d,u){if(r)return;r=true;let y=isString(d)?document.querySelector(d):d;if(!y)return;!u&&y.innerHTML&&(y.innerHTML="");let h$1=f(),N=[],w=new Set,T=new Set,E,p;function S(v,F){if(o.errorHandler)o.errorHandler(F,v);else throw v}let f$1=t.map((v,F)=>({entry:v,index:F})).sort((v,F)=>{var m,k;let i=Rn[(m=Ln(v.entry).enforce)!=null?m:"default"],g=Rn[(k=Ln(F.entry).enforce)!=null?k:"default"];return i-g||v.index-F.index}).map(v=>v.entry);function b(v,F){if(!(T.has(v)||w.has(v.name))){T.add(v),w.add(v.name),E=v.name;try{let i=v.setup(R,F);if(i instanceof Promise){let g=v.name;return i.catch(m=>S(m,{phase:"install",plugin:g})).finally(()=>{E===g&&(E=void 0);})}return E=void 0,i}catch(i){E=void 0,S(i,{phase:"install",plugin:v.name});}}}let R={provide:pe,inject:Z,onMount:v=>{N.push(v);},onCleanup:i,warn(v){let F={plugin:E};o.warnHandler&&o.warnHandler(F,v);},error(v){throw new Error(v)},config:o,version:Ot};function A(){u&&qe(y);try{let v=Ze(e);B(v)&&(p=v,(u?J:G)(y,v));}finally{u&&Xe();}for(let v of N)try{v();}catch(F){S(F,{phase:"mount"});}return {root:p,unmount(){h(h$1),p==null||p.destroy();}}}let P;try{g(h$1,()=>{for(let v of f$1){let[F,i]=$t(v);if(P){P=P.then(()=>g(h$1,()=>{let m=b(F,i);return m instanceof Promise?m:void 0}));continue}let g$1=b(F,i);g$1 instanceof Promise&&(P=g$1);}});}catch(v){throw h(h$1),v}if(P)return P.then(()=>g(h$1,A)).catch(v=>{throw h(h$1),v});try{return g(h$1,A)}catch(v){throw h(h$1),v}}return {config:o,mount:d=>a$1(d,false),hydrate:d=>a$1(d,true)}}function Ln(e){return Array.isArray(e)?e[0]:e}function $t(e){return Array.isArray(e)?[e[0],e[1]]:[e,void 0]}function nn(e,n){Object.defineProperty(e,"target",{configurable:true,value:n});}function In(e){let n=e.target,t=e.type,o=e.target,r=e.currentTarget,a=()=>{let s=n[`_$${t}`];if(s&&isFunction(s)&&!n.disabled){let c=n[`${t}Data`];if(c?s.call(n,c,e):s.call(n,e),e.cancelBubble)return false}return n.host&&!isString(n.host)&&!n.host._$host&&isFunction(n.contains)&&n.contains(e.target)&&nn(e,n.host),true},l=()=>{for(;a()&&(n=n._$host||n.parentNode||n.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return n||document}}),e.composedPath){let s=e.composedPath();nn(e,s[0]);for(let c=0;c<s.length-2&&(n=s[c],!!a());c++){if(n._$host){n=n._$host,l();break}if(n.parentNode===r)break}}else l();nn(e,o);}var xe=Symbol("_$EVENTS");function Bt(e,n=globalThis.document){let t=n,o=t[xe]||(t[xe]=new Set);for(let r of e)o.has(r)||(o.add(r),n.addEventListener(r,In));}function Gt(e=globalThis.document){let n=e,t=n[xe];if(t){for(let o of t.keys())e.removeEventListener(o,In);delete n[xe];}}function ce(e,n,t,o){let r=se(e,n,t,o);d()&&i(r);}var qt=e=>e,Xt=typeof DataTransfer!="undefined"?new DataTransfer().files:[];function Hn(e,n){let t=e,o=n==null?"":String(n);t.value!==o&&(t.value=o);}var Yt={event:"change",forceChange:true,checkboxArray:true,read:e=>e.checked,write(e,n){let t=e,o=isArray(n)?n.map(String).includes(t.value):!!n;t.checked!==o&&(t.checked=o);}},Jt={event:"change",forceChange:true,read(e){let n=e;return n.checked?n.value:""},write(e,n){let t=e,o=String(n)===t.value;t.checked!==o&&(t.checked=o);}},Qt={event:"change",forceChange:true,read:e=>e.files,write(e,n){if(n==null)try{e.files=Xt;}catch(t){}}},Mn={event:"input",ime:true,read:e=>e.value,write:Hn},Zt={event:"change",forceChange:true,read(e){let n=e;return n.multiple?Array.from(n.selectedOptions,t=>t.value):n.value},write(e,n){let t=e;if(!t.multiple)return Hn(e,n);let o=new Set((isArray(n)?n:[]).map(String));for(let r of Array.from(t.options))r.selected=o.has(r.value);}};function On(e){return {event:"input",read:n=>n[e],write(n,t){n[e]=t;}}}function eo(e,n){switch(e.nodeName){case "INPUT":return n==="checked"?e.type==="radio"?Jt:Yt:n==="files"?Qt:n==="value"?Mn:On(n);case "SELECT":return Zt;case "TEXTAREA":return Mn;default:return On(n)}}function no(e,n,t){if(!isString(e))return e;let o=n?e.trim():e;if(t){let r=n?o:o.trim();if(r!==""){let a=Number(r);if(!Number.isNaN(a))return a}}return o}function to(e){let n=e.getRootNode();return (n instanceof Document||n instanceof ShadowRoot)&&n.activeElement===e}function oo(e,n){if(n!=="value"||e.nodeName!=="INPUT")return false;let t=e.type;return t==="number"||t==="range"}function ro(e,n,t,o,r={}){if(!e)return;let{event:a,read:l,write:s,forceChange:c,ime:d$1,checkboxArray:u}=eo(e,n),y=r.trim===true,h=r.number===true||oo(e,n),N=r.lazy===true,w=(y||h)&&n!=="files",T=isFunction(t)?t:()=>t,E=w?A=>no(A,y,h):qt,p=u?A=>{let P=T();if(!isArray(P))return E(A);let v=e.value,F=P.filter(i=>String(i)!==v);return A&&F.push(v),F}:E,S=false,f=N||c?"change":a,b=()=>{if(S)return;let A=l(e);if(A===void 0)return;let P=p(A);Object.is(T(),P)||o(P);};ce(e,f,b),!N&&w&&f!=="change"&&ce(e,"change",()=>s(e,E(l(e)))),d$1&&(ce(e,"compositionstart",()=>{S=true;}),ce(e,"compositionend",()=>{S=false,N||b();}));let R=effect(()=>{let A=T();d$1&&S||d$1&&!N&&to(e)&&Object.is(E(l(e)),A)||s(e,A);});d()&&i(()=>R.stop());}function Vn(e){let n=e;return Array.isArray(n)&&n.length===1&&(n=n[0]),typeof n=="function"?n():n}function jn(e){let n=Object.getOwnPropertyDescriptor(e,"children");return n!=null&&n.get?()=>Vn(n.get.call(e)):()=>Vn(e.children)}function io(e,n){let t=new Set(n);return new Proxy(e,{get(o,r){if(!t.has(r))return Reflect.get(o,r)},ownKeys(o){return Reflect.ownKeys(o).filter(r=>!t.has(r))},getOwnPropertyDescriptor(o,r){if(!t.has(r))return Reflect.getOwnPropertyDescriptor(o,r)},has(o,r){return t.has(r)?false:Reflect.has(o,r)}})}function $n(e){var t;if(e&&((t=Object.getOwnPropertyDescriptor(e,"children"))!=null&&t.get||isReactive(e)))return [()=>e.children];let n=e==null?void 0:e.children;return n==null?null:n}$n[je]=true;function lo(e){return !!e&&!!e[je]}function Pe(e){let n=isFunction(e.target)?e.target():e.target;return n==null?null:isString(n)?document.querySelector(n):n}function ke(e){return isFunction(e.disabled)?!!e.disabled():!!e.disabled}function Bn(e){if(re()){let u=uo(e);if(u)return u}let n=document.createComment("portal");n[de]=true;let{children:t}=e;if(t==null)return n;let o=d(),r=null,a=(u,y)=>{r=f(o),g(r,()=>{J(u,()=>t,y);});},l=()=>{r&&(h(r),r=null);},s=(u,y)=>{if(l(),u){let h=n.parentNode;if(!h)return;a(h,n);return}y&&a(y);},c=false,d$1=effect(()=>{let u=ke(e),y=u?null:Pe(e);c&&s(u,y);});return Q(()=>{c=!0;let u=ke(e),y=u?null:Pe(e);if(u||y){s(u,y);return}queueMicrotask(()=>{n.parentNode&&s(ke(e),Pe(e));});}),i(()=>{d$1.stop(),l();}),n}Bn[de]=true;function uo(e){if(ke(e))return null;let n=ze();if(!n)return null;let t=Pe(e);return !t||!We(t)?null:(n[de]=true,n)}function fo(e){return !!e&&!!e[de]}function Le(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function Gn(e){let n=e;for(;isFunction(n);)n=n();return isSignal(n)||isComputed(n)?Gn(n.value):n}var ye=Symbol("SuspenseContext");function Un(e){var w;if(!isBrowser())return (w=e.fallback)!=null?w:"";let n=document.createElement("div");n.style.display="contents";let t=true,o=0,r=false,a=null,l=T=>{let E=Gn(T);if(isArray(E)){let p=[];for(let S of E){let f=l(S);isArray(f)?p.push(...f):p.push(f);}return p}return ie(E)},s=T=>{let E=l(T),p=isArray(E)?E:[E];for(let S of p)S!=null&&G(n,S);},c=()=>{Le(n),e.fallback!=null&&s(e.fallback);},d=()=>{r||(r=true,c());},u=()=>{!r||!(a||e.children!=null&&!isPromise(e.children))||(r=false,Le(n),a?y(a):e.children!=null&&!isPromise(e.children)&&y(e.children));},y=T=>{if(r||(Le(n),T==null))return;let E=isArray(T)?T:[T];for(let p of E)p!=null&&s(p);r&&c();},h={register:T=>{o++,d(),T.then(()=>{t&&(o--,o===0&&u());}).catch(E=>{t&&(o--,o===0&&u());});},increment:()=>{o++,d();},decrement:()=>{o=Math.max(0,o-1),o===0&&u();}};pe(ye,h);let N=e.children;return isPromise(N)?(N.then(T=>{a=T;}).catch(()=>{}),h.register(N)):N!=null?y(N):d(),le(()=>{t=false,o=0,a=null,Le(n),n.remove();}),n}Un[$e]=true;function go(e){return !!e&&!!e[$e]}function vo(e,n){let t=signal(n==null?void 0:n.initialValue),o=signal(true),r=signal(null),a=signal("pending"),l=0,s=null,c$1=false,d=Z(ye,null),u=()=>c(null,null,function*(){let N=++l;o.value=true,a.value="pending",r.value=null,c$1=false,d&&d.increment();try{let w=e();s=w,w.catch(()=>{});let T=yield w;N===l&&(t.value=T,a.value="ready",o.value=!1);}catch(w){N===l&&(r.value=w instanceof Error?w:new Error(String(w)),a.value="errored",o.value=false);}finally{d&&d.decrement();}});u();let y=(()=>(!c$1&&o.value&&s&&d&&(c$1=true,d.register(s)),t.value));return y.loading=o,y.error=r,y.state=a,[y,{mutate:N=>{t.value=N,a.value="ready",o.value=false,r.value=null;},refetch:()=>c(null,null,function*(){yield u();})}]}function zn(e){return isFunction(e)?e:e.default}function rn(e,n,t){let o=new ae(n,t);return o.mount(e),o}function Co(e,n={}){let{delay:t=200,timeout:o,ssr:r="blocking",onError:a}=n;if(typeof window=="undefined"){if(r==="client-only"){let E=()=>"";return E.__asyncLoader=e,E.__asyncResolved=()=>null,E}let h=null,N=null,w=()=>N||(N=e().then(E=>{h=zn(E);}).catch(()=>{}),N);w();let T=E=>h?h(E):"";return T.__asyncLoader=w,T.__asyncResolved=()=>h,T}let l=null,s=null,c="pending",d=null;function u(){return d||(d=e().then(h=>{l=zn(h),c="resolved";}).catch(h=>{s=h instanceof Error?h:new Error(String(h)),c="errored",d=null;}),d)}u();function y(h){var F;if(c==="resolved"&&l){let i$1=document.createElement("div");i$1.style.display="contents";let g=rn(i$1,l,h);return i(()=>g.destroy()),i$1}if(c==="errored"&&s){let i=document.createElement("div");if(i.style.display="contents",n.error){let g=true,m=null,k=(x,C)=>{g&&(m==null||m.destroy(),m=rn(i,x,C));},_=()=>{d=null,c="pending",s=null,n.loading&&k(n.loading),u().then(()=>{g&&(c==="resolved"&&l?k(l,h):c==="errored"&&s&&n.error&&k(n.error,{error:s,retry:_}));});};k(n.error,{error:s,retry:_}),le(()=>{g=false,m==null||m.destroy(),m=null;});}return i}let N=document.createElement("div");N.style.display="contents";let w=true,T=null,E=null,p=null,S=(i,g)=>{w&&(T==null||T.destroy(),T=rn(N,i,g));},f=i=>()=>{d=null,c="pending",s=null,n.loading&&S(n.loading),u().then(()=>{c==="resolved"&&l?S(l,i):c==="errored"&&s&&n.error&&S(n.error,{error:s,retry:f(i)});});};le(()=>{w=false,T==null||T.destroy(),T=null,E!=null&&clearTimeout(E),p!=null&&clearTimeout(p);});let b=(F=Z(ye))!=null?F:null,R=i=>S(i,h),A=i=>{n.error&&S(n.error,{error:i,retry:f(h)});},P=()=>{n.loading&&S(n.loading);},v=u().then(()=>{w&&(c==="resolved"&&l?R(l):c==="errored"&&s&&(A(s),a&&a(s,f(h))),E!=null&&clearTimeout(E),p!=null&&clearTimeout(p));});return b&&b.register(v),t>0?E=setTimeout(()=>{w&&c==="pending"&&P();},t):n.loading&&P(),o!=null&&(p=setTimeout(()=>{if(w&&c==="pending"){let i=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);s=i,c="errored",A(i),a&&a(i,f(h));}},o)),N}return y.__asyncLoader=u,y.__asyncResolved=()=>l,y}function Wn(e){let n=document.createDocumentFragment(),t=document.createComment("");n.appendChild(t);let o=[],r=[],a=e.key,l=e.children,s=Array.isArray(l)&&l.length===1&&isFunction(l[0])?l[0]:e.children;if(!isFunction(s))throw new TypeError("<For> requires `children` to be a function (item, index) => Node");let c=()=>{var S,f;let p=e.each;return isSignal(p)?(S=p.value)!=null?S:[]:isFunction(p)?(f=p())!=null?f:[]:p!=null?p:[]},d$1=(p,S)=>a?a(p,S):p,u=(p,S,f)=>{if(p==null||p===false)return [];if(Array.isArray(p)){let R=[];for(let A of p)R.push(...u(A,S,f));return R}if(B(p))return G(S,p,f!=null?f:void 0),p.renderedNodes;let b=ie(p);return G(S,b,f!=null?f:void 0),[b]},y=(p,S)=>{if(!e.fallback)return;r=u(e.fallback(),p,S);},h$1=()=>{for(let p of r)p.parentNode&&p.parentNode.removeChild(p);r=[];},N=(p,S,f$1,b,R=d$1(p,S))=>{let A=d(),P=f(A),v=[];return g(P,()=>{v=u(s(p,S),f$1,b);}),{key:R,item:p,nodes:v,scope:P}},w=p=>{h(p.scope);for(let S of p.nodes)S.parentNode&&S.parentNode.removeChild(S);},T=effect(()=>{let p=c(),S=t.parentNode;if(!S){if(p.length===0)y(n,t);else {o=new Array(p.length);let f=0;for(let b of p)o[f]=N(b,f,n,t),f++;}return}E(S,p);});function E(p,S){let f=o.length,b=S.length;if(b===0){for(let C=0;C<f;C++)w(o[C]);o=[],e.fallback&&r.length===0&&y(p,t);return}if(f===0||r.length>0){r.length>0&&h$1(),o=new Array(b);let C=document.createDocumentFragment();for(let L=0;L<b;L++)o[L]=N(S[L],L,C,null);p.insertBefore(C,t);return}let R=new Map;for(let C=0;C<f;C++){let L=o[C],D=R.get(L.key),$=[L,C];D?D.push($):R.set(L.key,[$]);}let A=new Array(b),P=[],v=null,F=new Int32Array(b),i=false,g=0,m=new Array(b);for(let C=0;C<b;C++)m[C]=d$1(S[C],C);for(let C=0;C<b;C++){let L=S[C],D=m[C],$=R.get(D);if($&&$.length>0){let[X,z]=$.shift();Object.is(X.item,L)?(X.item=L,A[C]=X,F[C]=z+1,z<g?i=true:g=z):(v||(v=document.createDocumentFragment()),w(X),A[C]=N(L,C,v,null,D));}else v||(v=document.createDocumentFragment()),A[C]=N(L,C,v,null,D);}for(let C of R.values())for(let[L]of C)P.push(L);for(let C of P)w(C);let k=i?Je(F):[],_=k.length-1,x=t;for(let C=b-1;C>=0;C--){let D=A[C].nodes;if(!(F[C]===0)&&i&&_>=0&&C===k[_]){_--;for(let z=D.length-1;z>=0;z--)x=D[z];continue}for(let z=D.length-1;z>=0;z--){let Me=D[z];Me.nextSibling!==x&&p.insertBefore(Me,x),x=Me;}}o=A;}return i(()=>{T.stop();for(let p of o)w(p);o=[],h$1(),t.parentNode&&t.parentNode.removeChild(t);}),n}Wn[yn]=true;function ln(e){var a,l,s,c,d,u,y,h,N,w;let n=(a=e.name)!=null?a:"v",t=(l=e.enterFromClass)!=null?l:`${n}-enter-from`,o=(s=e.enterActiveClass)!=null?s:`${n}-enter-active`,r=(c=e.enterToClass)!=null?c:`${n}-enter-to`;return {enterFrom:t,enterActive:o,enterTo:r,leaveFrom:(d=e.leaveFromClass)!=null?d:`${n}-leave-from`,leaveActive:(u=e.leaveActiveClass)!=null?u:`${n}-leave-active`,leaveTo:(y=e.leaveToClass)!=null?y:`${n}-leave-to`,appearFrom:(h=e.appearFromClass)!=null?h:t,appearActive:(N=e.appearActiveClass)!=null?N:o,appearTo:(w=e.appearToClass)!=null?w:r}}var qn=e=>e?e.endsWith("ms")?Number(e.slice(0,-2).replace(",",".")):Number(e.slice(0,-1).replace(",","."))*1e3:0;function Xn(e,n){let t=e.split(", "),o=n.split(", "),r=0;for(let[a,l]of o.entries()){let s=qn(l)+qn(t[a%t.length]||"0s");s>r&&(r=s);}return r}function Jn(e,n){let t=getComputedStyle(e),o=n!=="animation"?Xn(t.transitionDelay,t.transitionDuration):0,r=n!=="transition"?Xn(t.animationDelay,t.animationDuration):0;return o===0&&r===0?null:o>=r?{event:"transitionend",timeout:o}:{event:"animationend",timeout:r}}function U(e,n){for(let t of n.split(/\s+/))t&&e.classList.add(t);}function j(e,n){for(let t of n.split(/\s+/))t&&e.classList.remove(t);}function ge(e){requestAnimationFrame(()=>requestAnimationFrame(e));}function Ie(e){e.offsetHeight;}function ue(e,n,t,o){if(t!=null){setTimeout(o,t);return}let r=Jn(e,n);if(!r){o();return}let a=false,l=()=>{a||(a=true,e.removeEventListener(r.event,s),o());},s=()=>l();e.addEventListener(r.event,s),setTimeout(l,r.timeout+1);}function fe(e,n){return e==null?null:typeof e=="number"?e:e[n]}function Yn(e){if(e==null||e===false)return null;if(Array.isArray(e))return e[0]instanceof Element?e[0]:null;if(e instanceof Element)return e;if(B(e)){let n=e;if(n.scope==null){let o=document.createDocumentFragment();n.mount(o);}let t=n.firstChild;return t instanceof Element?t:null}return null}var De=Symbol("enter_cb"),he=Symbol("leave_cb");function Qn(e){let n=document.createComment(""),t=ln(e),o=e.css!==false,r=jn(e),a="idle",l=null,s=null,c=false,d,u=false,y=false,h=false,N=(f,b)=>{var g;let R=f[he];R&&R(true),a="entering";let A=b==="appear"?t.appearFrom:t.enterFrom,P=b==="appear"?t.appearActive:t.enterActive,v=b==="appear"?t.appearTo:t.enterTo;(g=e.onBeforeEnter)==null||g.call(e,f),o&&(U(f,A),U(f,P));let F=false,i=m=>{var k,_;F||(F=true,f[De]=void 0,o&&(j(f,A),j(f,P),j(f,v)),m?(k=e.onEnterCancelled)==null||k.call(e,f):(a="entered",(_=e.onAfterEnter)==null||_.call(e,f)));};f[De]=i,ge(()=>{if(!F)if(o&&(j(f,A),U(f,v)),e.onEnter)e.onEnter(f,()=>i(false));else if(o){let m=fe(e.duration,"enter");ue(f,e.type,m,()=>i(false));}else i(false);});},w=(f,b)=>{var i;let R=f[De];R&&(R(true),Ie(f)),a="leaving",(i=e.onBeforeLeave)==null||i.call(e,f),o&&(U(f,t.leaveFrom),U(f,t.leaveActive));let A=false,P=g=>{var m,k;A||(A=true,f[he]=void 0,o&&(j(f,t.leaveFrom),j(f,t.leaveActive),j(f,t.leaveTo)),g?(m=e.onLeaveCancelled)==null||m.call(e,f):(a="idle",b(),(k=e.onAfterLeave)==null||k.call(e,f)));};f[he]=P;let v=fe(e.duration,"leave"),F=o&&!e.onLeave&&v==null?!!Jn(f,e.type):false;if(!e.onLeave&&v==null&&!F){P(false);return}ge(()=>{A||(o&&(j(f,t.leaveFrom),U(f,t.leaveTo)),e.onLeave?e.onLeave(f,()=>P(false)):o?ue(f,e.type,v,()=>P(false)):P(false));});},T=(f,b)=>{if(f&&a==="leaving"&&s){let A=s,P=A[he];P&&P(true),s=null,l=A,N(A,"enter");return}if(f===l)return;let R=l;if(l=f,R){s=R;let A=R;w(A,()=>{A.parentNode&&A.parentNode.removeChild(A),s===A&&(s=null);});}f&&n.parentNode?(n.parentNode.insertBefore(f,n),b&&!e.appear?a="entered":N(f,b&&e.appear?"appear":"enter")):!R&&!f&&(a="idle");},E=()=>{if(y=false,h||!u)return;let f=d;u=false,d=void 0;try{T(Yn(f),!1);}catch(b){}},p=f=>{d=f,u=true,!y&&(y=true,queueMicrotask(E));},S=effect(()=>{let f=r();c?p(f):(d=f,u=true);});return Q(()=>{c=!0;let f=u?Yn(d):null;u=!1,d=void 0,T(f,!0);}),i(()=>{h=true,S.stop();for(let f of [l,s]){if(!f)continue;let b=f[De],R=f[he];b==null||b(true),R==null||R(true),f.parentNode&&f.parentNode.removeChild(f);}l=null,s=null,a="idle";}),n}Qn[Ke]=true;function Ao(e){return !!e&&!!e[Ke]}function cn(e,n){if(e==null||e===false)return {el:null,comp:null};if(Array.isArray(e)&&e.length===1)return cn(e[0],n);if(isFunction(e))return cn(e(),n);if(e instanceof HTMLElement)return {el:e,comp:null};if(B(e)){let t=e;t.scope==null&&t.mount(n);let o=t.firstChild;return o instanceof HTMLElement?{el:o,comp:t}:{el:null,comp:t}}return {el:null,comp:null}}function _o(e){return {position:e.style.position,top:e.style.top,left:e.style.left,width:e.style.width,height:e.style.height}}function an(e,n){e.style.position=n.position,e.style.top=n.top,e.style.left=n.left,e.style.width=n.width,e.style.height=n.height;}function Zn(e){var P,v,F;let n=(P=e.tag)!=null?P:"div",t=document.createElement(n),o=ln(e),r=e.css!==false,a=(F=e.moveClass)!=null?F:`${(v=e.name)!=null?v:"v"}-move`,l=e.key,s=e.children,c=Array.isArray(s)&&s.length===1&&isFunction(s[0])?s[0]:e.children;if(!isFunction(c)||!isFunction(l))throw new TypeError("<TransitionGroup> requires `children: (item, index) => Node` and `key: (item, index) => unknown`");let d$1=()=>{var g,m;let i=e.each;return isSignal(i)?(g=i.value)!=null?g:[]:isFunction(i)?(m=i())!=null?m:[]:i!=null?i:[]},u=[],y=false,h$1=(i,g$1)=>{let m=d(),k=f(m),_;g(k,()=>{_=c(i,g$1);});let{el:x,comp:C}=cn(_,t);return x?{key:l(i,g$1),item:i,el:x,comp:C,scope:k,state:"entering"}:(h(k),null)},N=i=>{if(i.comp){for(let g of i.comp.renderedNodes)g.parentNode===t&&t.removeChild(g);return}i.el.parentNode===t&&t.removeChild(i.el);},w=i=>{var g,m;(g=i.cancelEnter)==null||g.call(i,true),(m=i.cancelLeave)==null||m.call(i,true),i.comp&&i.comp.destroy(),N(i),h(i.scope);},T=i=>{var _,x,C;let g=i.el;if((_=i.cancelLeave)==null||_.call(i,true),!r){i.state="present",(x=e.onAfterEnter)==null||x.call(e,g);return}(C=e.onBeforeEnter)==null||C.call(e,g),U(g,o.enterFrom),U(g,o.enterActive);let m=false,k=L=>{var D,$;m||(m=true,i.cancelEnter=void 0,j(g,o.enterFrom),j(g,o.enterActive),j(g,o.enterTo),L?(D=e.onEnterCancelled)==null||D.call(e,g):(i.state="present",($=e.onAfterEnter)==null||$.call(e,g)));};i.cancelEnter=k,i.state="entering",ge(()=>{if(!m)if(j(g,o.enterFrom),U(g,o.enterTo),e.onEnter)e.onEnter(g,()=>k(false));else {let L=fe(e.duration,"enter");ue(g,e.type,L,()=>k(false));}});},E=(i,g)=>{var C,L;let m=i.el;i.cancelEnter&&(i.cancelEnter(true),Ie(m)),i.state="leaving",i.savedStyles=_o(m);let k=t.getBoundingClientRect();if(m.style.position="absolute",m.style.top=`${g.top-k.top}px`,m.style.left=`${g.left-k.left}px`,m.style.width=`${g.width}px`,m.style.height=`${g.height}px`,!r){i.savedStyles&&an(m,i.savedStyles),N(i),h(i.scope),i.comp&&i.comp.destroy(),(C=e.onAfterLeave)==null||C.call(e,m);return}(L=e.onBeforeLeave)==null||L.call(e,m),U(m,o.leaveFrom),U(m,o.leaveActive);let _=false,x=D=>{var $,X;if(!_){if(_=true,i.cancelLeave=void 0,j(m,o.leaveFrom),j(m,o.leaveActive),j(m,o.leaveTo),D){i.savedStyles&&an(m,i.savedStyles),i.savedStyles=void 0,($=e.onLeaveCancelled)==null||$.call(e,m);return}i.savedStyles&&an(m,i.savedStyles),i.savedStyles=void 0,N(i),h(i.scope),i.comp&&i.comp.destroy(),(X=e.onAfterLeave)==null||X.call(e,m);}};i.cancelLeave=x,ge(()=>{if(!_)if(j(m,o.leaveFrom),U(m,o.leaveTo),e.onLeave)e.onLeave(m,()=>x(false));else {let D=fe(e.duration,"leave");ue(m,e.type,D,()=>x(false));}});},p=(i,g)=>{if(!r||i.state!=="present")return;let m=i.el,k=m.getBoundingClientRect(),_=g.left-k.left,x=g.top-k.top;if(!_&&!x)return;let C=m.style.transform,L=m.style.transitionDuration;m.style.transform=`translate(${_}px, ${x}px)`,m.style.transitionDuration="0s",U(m,a),Ie(m),m.style.transform=C,m.style.transitionDuration=L;let D=fe(e.duration,"enter");ue(m,e.type,D,()=>{j(m,a);});},S=()=>{for(let i of u)i.state!=="leaving"&&(i.prevRect=i.el.getBoundingClientRect());},f$1=i=>{let g=new Map;for(let x of u)g.set(x.key,x);let m=[];for(let[x,C]of i.entries()){let L=l(C,x),D=g.get(L);if(D)g.delete(L),D.item=C,m.push(D);else {let $=h$1(C,x);$&&m.push($);}}let k=[];for(let x of g.values())x.state!=="leaving"&&k.push(x);let _=null;for(let x=m.length-1;x>=0;x--){let C=m[x].el;(C.parentNode!==t||C.nextSibling!==_)&&t.insertBefore(C,_),_=C;}return {next:m,leaving:k}},b=(i,g)=>{if(g){let _=[];for(let[x,C]of i.entries()){let L=h$1(C,x);L&&(L.el.parentNode!==t&&t.appendChild(L.el),L.state="present",_.push(L));}u=_;return}S();let{next:m,leaving:k}=f$1(i);for(let _ of m)_.state!=="present"&&T(_);for(let _ of k){let x=_.prevRect;x&&E(_,x);}for(let _ of m)_.state!=="present"||!_.prevRect||(p(_,_.prevRect),_.prevRect=void 0);u=m.concat(k);},R=null,A=effect(()=>{let i=d$1();if(!y){R=i;return}b(i,false);});return Q(()=>{y=!0,R&&(b(R,!0),R=null);}),i(()=>{A.stop();for(let i of u)w(i);u=[],t.parentNode&&t.parentNode.removeChild(t);}),t}Zn[Be]=true;function xo(e){return !!e&&!!e[Be]}
2
- export{ae as Component,Wn as For,$n as Fragment,Bn as Portal,Un as Suspense,Qn as Transition,Zn as TransitionGroup,se as addEvent,ce as addEventListener,qe as beginHydration,ro as bindElement,kt as child,Gt as clearDelegatedEvents,ze as consumeTeleportAnchor,We as consumeTeleportBlock,Ht as createApp,Ze as createComponent,vo as createResource,Co as defineAsyncComponent,jt as definePlugin,Bt as delegateEvents,Xe as endHydration,vn as getHydrationKey,St as getRenderedElement,Vt as hydrate,Tt as hydrationAnchor,Nt as hydrationMarker,Z as inject,J as insert,B as isComponent,lo as isFragment,re as isHydrating,fo as isPortal,go as isSuspense,Ao as isTransition,xo as isTransitionGroup,Rt as next,Ne as normalizeClass,Lt as nthChild,io as omitProps,le as onDestroy,Q as onMount,Ft as onUpdate,ee as patchAttr,bt as patchAttrHydrate,Te as patchClass,At as patchClassHydrate,Ae as patchStyle,wt as patchStyleHydrate,pe as provide,vt as resetHydrationKey,te as setStyle,be as template};
1
+ import {c,f,h,a,e,g,b}from'./chunk-3SR36LGP.js';import {normalizeClassName,SPREAD_NAME,isObject,startsWith,isSpecialBooleanAttr,isBooleanAttr,includeBooleanAttr,isSymbol,isString,isArray,kebabCase,camelCase,capitalize,HYDRATION_ANCHOR_ATTR,isBrowser,warn,isPromise,isFunction,isOn,coerceArray}from'@estjs/shared';import {effect,shallowReactive,isSignal,isComputed,isReactive,signal}from'@estjs/signals';var un="ref",fn="key",dn="http://www.w3.org/2000/svg",He="http://www.w3.org/2000/xlink",Ve="http://www.w3.org/2000/xmlns/";var je=Symbol(""),fe=Symbol(""),$e=Symbol(""),mn=Symbol(""),Ke=Symbol(""),Be=Symbol("");function Z(e,n,t,o){if(n===fn){o==null?e.removeAttribute(n):e.setAttribute(n,String(o));return}if(n===SPREAD_NAME){let y=isObject(t)?t:null,v=isObject(o)?o:null;if(y)for(let E in y)E!==SPREAD_NAME&&(!v||!(E in v))&&Z(e,E,y[E],null);if(v)for(let E in v)E!==SPREAD_NAME&&Z(e,E,y==null?void 0:y[E],v[E]);return}let r=(e==null?void 0:e.namespaceURI)===dn,s=r&&startsWith(n,"xlink:"),i=r&&startsWith(n,"xmlns:"),l=isSpecialBooleanAttr(n)||isBooleanAttr(n);if(t===o||n.length>2&&n.charCodeAt(0)===111&&n.charCodeAt(1)===110)return;let c=n.toLowerCase();if(c==="innerhtml"||c==="srcdoc")return;if(o==null){if(s)e.removeAttributeNS(He,n.slice(6));else if(i){let y=n.slice(6);e.removeAttributeNS(Ve,y);}else e.removeAttribute(n);return}if(l){includeBooleanAttr(o)?e.setAttribute(n,""):e.removeAttribute(n);return}let d=isSymbol(o)?String(o):o;if((c==="href"||c==="src"||c==="xlink:href"||c==="action"||c==="formaction"||c==="poster")&&isString(d)){let y=d.trim().toLowerCase();if(startsWith(y,"javascript:")||startsWith(y,"data:"))return}if(s){e.setAttributeNS(He,n,String(d));return}if(i){e.setAttributeNS(Ve,n,String(d));return}if(r)e.setAttribute(n,String(d));else if(n in e)try{e[n]=d;}catch(y){e.setAttribute(n,String(d));}else e.setAttribute(n,String(d));}function Ne(e,n,t,o=false){if(n===t)return;let r=Ce(t);if(!r){e.removeAttribute("class");return}(isString(n)?n:Ce(n))!==r&&(o?e.setAttribute("class",r):e.className=r);}var Ce=normalizeClassName;var yn=/\s*!important$/,at=["Webkit","Moz","ms"],Ge={};function Se(e,n,t){let o=e.style;if(t&&isString(t)){n!==t&&(o.cssText=t);return}if(!t){n&&e.removeAttribute("style");return}if(n&&!isString(n)){let r=n;for(let s in r)(!t||t[s]==null)&&ne(o,s,"");}else if(n&&isString(n)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,s;for(;(s=r.exec(n))!==null;){let i=s[1].trim();i&&t&&isObject(t)&&t[i]==null&&ne(o,i,"");}}if(t&&!isString(t)){let r=t;for(let s in r){let i=r[s];(!n||isString(n)||n[s]!==i)&&i!=null&&ne(o,s,i);}}}function ne(e,n,t){if(isArray(t)){for(let s of t)ne(e,n,s);return}(t==null||t==="")&&(t="");let o=isString(t)&&yn.test(t)?"important":"";if(o&&(t=t.replace(yn,"")),startsWith(n,"--")){o?e.setProperty(n,t,o):e.setProperty(n,t);return}let r=ut(e,n);o?e.setProperty(ct(r),t,o):e[r]=t;}function ct(e){let n=kebabCase(e);return startsWith(e,"Webkit")||startsWith(e,"Moz")||startsWith(e,"ms")?`-${n}`:n}function ut(e,n){let t=Ge[n];if(t)return t;let o=camelCase(n);if(o!=="filter"&&o in e)return Ge[n]=o;o=capitalize(o);for(let r of at){let s=r+o;if(s in e)return Ge[n]=s}return n}var Ue=0;function hn(){return String(Ue++)}function pt(){Ue=0;}var q=false;function oe(){return q}var te=new Map;function yt(e){let n=e.querySelectorAll("[data-hk]");for(let t of n){let o=t.dataset.hk;o!=null&&!te.has(o)&&te.set(o,t);}}var we=[],de=new Map;function ht(){if(typeof document=="undefined")return;let e=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),n;for(;n=e.nextNode();){let t=n.data;if(t==="teleport-anchor")we.push(n);else if(t==="teleport-start"){let o=n.parentElement;if(!o)continue;let r=de.get(o);r||(r=[],de.set(o,r)),r.push(n);}}}function ze(){var e;return (e=we.shift())!=null?e:null}function We(e){let n=de.get(e),t=n==null?void 0:n.shift();if(!t)return null;let o=[],r=t.nextSibling;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data==="teleport-end")return {start:t,end:r,nodes:o};o.push(r),r=r.nextSibling;}return null}function qe(e){q=true,Ue=0,te.clear(),we.length=0,de.clear(),yt(e),ht();}function Xe(){q=false,te.clear(),we.length=0,de.clear();}function gn(e,n,t){var s,i;if(!q||t&&t.parentNode!==e)return null;if(n.length===0)return [];let o=new Array(n.length),r=t?t.previousSibling:e.lastChild;for(let l=n.length-1;l>=0;l--){if(!r)return null;let c=n[l],d=c.nodeType;if(d===Node.TEXT_NODE){let f=(s=c.textContent)!=null?s:"";if(!f||r.nodeType!==Node.TEXT_NODE)return null;let y=(i=r.textContent)!=null?i:"";if(y===f){o[l]=r,r=r.previousSibling;continue}if(!y.endsWith(f))return null;let v=y.slice(0,y.length-f.length);if(!v)return null;let E=document.createTextNode(v);e.insertBefore(E,r),r.textContent=f,o[l]=r,r=E;continue}if(r.nodeType!==d)return null;if(d===Node.ELEMENT_NODE){if(r.tagName!==c.tagName)return null}else if(d===Node.COMMENT_NODE&&r.data!==c.data)return null;o[l]=r,r=r.previousSibling;}return o}function vn(e){var t,o,r;return (r=(o=e.dataset.hk)!=null?o:(t=e.closest("[data-hk]"))==null?void 0:t.dataset.hk)!=null?r:null}function gt(e,n){if(!q||!e||n<0)return null;let t=e instanceof Element?vn(e):null,o=t?`${t}-${n}`:String(n),r=e.firstChild;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data===o)return r;r=r.nextSibling;}return null}function vt(e,n){if(!q||!(e instanceof Element)||n<0)return null;let t=vn(e),o=t?`${t}-${n}`:String(n),r=e.firstChild;for(;r;){if(r instanceof Element&&r.getAttribute(HYDRATION_ANCHOR_ATTR)===o)return r;r=r.nextSibling;}return null}function Et(e){if(!isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let n=null;return ()=>{if(!q)return n||(n=be(e)),n();let t=hn(),o=te.get(t);return o?(te.delete(t),o):(warn(`[essor] hydration mismatch: no SSR element for key "${t}"`),n||(n=be(e)),n())}}function Ct(e,n,t,o){q||Ne(e,n,t,o);}function Nt(e,n,t,o){q||Z(e,n,t,o);}function Tt(e,n,t){q||Se(e,n,t);}function Ye(e,n){return n&&n.parentNode===e?n:null}function En(e,n,t,o){let r=Ye(e,o),s=n.length,i=t.length;if(s===0&&i===0)return t;if(s===0){for(let f=0;f<i;f++)G(e,t[f],r);return t}if(i===0){for(let f=0;f<s;f++)Y(n[f]);return []}let l=0,c=s-1,d=i-1;for(;l<=c&&l<=d&&n[l]===t[l];)l++;for(;c>=l&&d>=l&&n[c]===t[d];)c--,d--;if(l>c){if(l<=d){let f=d+1,y=Ye(e,f<i?t[f]:r);for(let v=l;v<=d;v++)G(e,t[v],y);}}else if(l>d)for(let f=l;f<=c;f++)Y(n[f]);else St(e,n,t,l,c,d,r);return t}function St(e,n,t,o,r,s,i){let l=s-o+1,c=l<=4?C=>{for(let N=o;N<=s;N++)if(t[N]===C)return N}:(()=>{let C=new Map;for(let N=o;N<=s;N++)C.set(t[N],N);return N=>C.get(N)})(),d=new Int32Array(l),f=0,y=false,v=0;for(let C=o;C<=r;C++){let N=n[C];if(f>=l){Y(N);continue}let p=c(N);p===void 0?Y(N):(d[p-o]=C+1,p>=v?v=p:y=true,f++);}let E=y?Je(d):[],_=E.length-1;for(let C=l-1;C>=0;C--){let N=o+C,p=t[N],T=Ye(e,N+1<t.length?t[N+1]:i);d[C]===0?G(e,p,T):y&&(_<0||C!==E[_]?G(e,p,T):_--);}}function Je(e){let n=new Int32Array(e.length),t=[0],o=e.length,r,s,i,l,c;for(r=0;r<o;r++){let d=e[r];if(d!==0){if(s=t[t.length-1],e[s]<d){n[r]=s,t.push(r);continue}for(i=0,l=t.length-1;i<l;)c=i+l>>1,e[t[c]]<d?i=c+1:l=c;d<e[t[i]]&&(i>0&&(n[r]=t[i-1]),t[i]=r);}}for(i=t.length,l=t[i-1];i-- >0;)t[i]=l,l=n[l];return t}function Y(e){if(e)if(V(e))e.destroy();else {let n=e;n.parentNode&&n.remove();}}function G(e,n,t){if(!e||!n)return;let o=V(t)?t.firstChild:t;if(V(n)){n.mount(e,o);return}o?e.insertBefore(n,o):e.appendChild(n);}function re(e){if(e instanceof Node||V(e))return e;let n=typeof e;return e==null||n==="string"||n==="number"||n==="boolean"||n==="symbol"?document.createTextNode(e===false||e==null?"":String(e)):document.createTextNode(String(e))}function J(e,n,t){if(!e)return;let o=c(),r=[],s=true,i=c=>{if(c instanceof Node)return [c];if(V(c))return [c];let d=typeof c;return c==null||d==="string"||d==="number"||d==="boolean"?[re(c)]:coerceArray(c).map(f=>isFunction(f)?f():f).flatMap(f=>f).map(re)},l=effect(()=>{let c=()=>{let d=isFunction(n)?n():n,f=i(d);if(s&&oe()&&f.every(y=>y instanceof Node&&y.parentNode===e)){r=f,s=false;return}if(s&&oe()){let y=gn(e,f,t);if(y){r=y,s=false;return}}r=En(e,r,f,t),s=false;};o&&!o.isDestroyed?f(o,c):c();});return h(()=>{l.stop();for(let c of r)Y(c);r=[];}),r}function _t(e){return (e==null?void 0:e.firstChild)||null}function At(e,n=1){for(;e&&n>0;)e=e.nextSibling,n--;return e||null}function xt(e,n){if(!e||n<0)return null;let t=e.firstChild;for(;t&&n>0;)t=t.nextSibling,n--;return t||null}function ie(e,n,t,o){if(!(o!=null&&o.delegate))return e.addEventListener(n,t,o),()=>e.removeEventListener(n,t,o);let r=o.delegate,s=d=>{let f=d.target;(f.matches(r)||f.closest(r))&&t.call(e,d);},c=o,{delegate:i}=c,l=a(c,["delegate"]);return e.addEventListener(n,s,l),()=>{e.removeEventListener(n,s,l);}}function Qe(e,n,t){let o=e[n];o||(o=[],e[n]=o),o.push(t);}function Tn(e,n,t){let o=e.length;if(o===0)return;let r;for(let s=0;s<o;s++)try{let i=e[s]();if(isPromise(i)){let l=i.catch(c=>{});(r||(r=[])).push(l);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function Q(e){let n=c();if(n){if(n.isMounted){try{let t=e();isPromise(t)&&t.catch(o=>{});}catch(t){}return}Qe(n,"onMount",e);}}function kt(e){let n=c();n&&Qe(n,"onUpdate",e);}function se(e){let n=c();n&&Qe(n,"onDestroy",e);}function Sn(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let n=e.onMount,t=f(e,()=>Tn(n,e.id));return n.length=0,e.isMounted=true,t}function bn(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return f(e,()=>Tn(e.onUpdate,e.id))}function _n(e,n,t=false){for(let o of Object.getOwnPropertyNames(n))Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o));if(t){let o=Object.getOwnPropertyNames(n);for(let r of Object.getOwnPropertyNames(e))o.includes(r)||delete e[r];}}function An(e,n){let t=Object.getOwnPropertyDescriptor(e,n);return t.get?t.get.call(e):t.value}var xn;xn="normal";var le=class{constructor(n,t={}){this.component=n;this.props=t;this[xn]=true;this.scope=null;this.state=0;this.beforeNode=void 0;this.renderedNodes=[];this.firstChild=void 0;this.parentNode=void 0;this.rootEventCleanups=[];this.parentScope=c();let o={};_n(o,t),this.reactiveProps=shallowReactive(o);}mount(n,t){var s;if(this.parentNode=n,this.beforeNode=t,this.state=1,this.renderedNodes.length>0){for(let i of this.renderedNodes)G(n,i,t);return this.state=2,this.renderedNodes}let o=e((s=this.parentScope)!=null?s:c());this.scope=o;let r=f(o,()=>{var l;let i=this.component(this.reactiveProps);return isFunction(i)&&(i=i(this.reactiveProps)),(isSignal(i)||isComputed(i))&&(i=i.value),(l=J(n,i,t))!=null?l:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,Sn(o),this.renderedNodes}update(n){this.props=n;let t=this.scope;!t||t.isDestroyed||(_n(this.reactiveProps,n!=null?n:{},true),this.syncSpecialProps(n),bn(t));}forceUpdate(){if(!this.parentNode)return;let n=this.parentNode,t=this.beforeNode;this.destroy(),this.mount(n,t);}destroy(){let n=this.scope;if(!(!n||n.isDestroyed)){this.scope=null,this.releaseSpecialProps(),g(n);for(let t of this.renderedNodes)Y(t);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;for(let t of Object.getOwnPropertyNames(this.reactiveProps))delete this.reactiveProps[t];}}syncSpecialProps(n){if(!n)return;let t=this.firstChild;if(!(!t||!(t instanceof Element))){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(n)){if(o===un){let r=An(n,o);this.rootRefCleanup=this.bindRootRef(r,t);continue}if(isOn(o)){let r=An(n,o);if(!isFunction(r))continue;let s=o.slice(2).toLowerCase(),i=t,l=`_$${s}`,c=i[l];if(isFunction(c)){i[l]=r,this.rootEventCleanups.push(()=>{i[l]===r&&(i[l]=c);});continue}let d=r,f=y=>{i.disabled||d.call(i,y);};this.rootEventCleanups.push(ie(i,s,f));}}}}releaseSpecialProps(){for(let n of this.rootEventCleanups)n();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(n,t){if(isFunction(n))return n(t),()=>n(null);if(isSignal(n)){let o=n,r=o.value;return o.value=t,()=>{o.value===t&&(o.value=r);}}}};function V(e){return !!e&&!!e.normal}function Ae(e,n){return V(e)?e:new le(e,n)}function be(e){let n,t=()=>{let o=document.createElement("template");o.innerHTML=e;let r=o.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(n||(n=t())).cloneNode(true)}function Ft(e$1,n){let t=isString(n)?document.querySelector(n):n;if(!t)return;t.innerHTML&&(t.innerHTML="");let r=e(),s;try{f(r,()=>{let i=Ae(e$1);V(i)&&(s=i,G(t,i));});}catch(i){throw g(r),i}return {root:s,unmount:()=>{g(r),s==null||s.destroy();}}}function Dt(e$1,n){let t=isString(n)?document.querySelector(n):n;if(!t)return;qe(t);let o=e(),r;try{f(o,()=>{let s=Ae(e$1);V(s)&&(r=s,J(t,s));});}catch(s){throw g(o),s}finally{Xe();}return {root:r,unmount:()=>{g(o),r==null||r.destroy();}}}function Ze(e,n){let t=c();t&&(t.provides||(t.provides=new Map),t.provides.set(e,n));}function me(e,n){let t=c();if(!t)return n;let o=t;for(;o;){if(o.provides&&o.provides.has(e))return o.provides.get(e);o=o.parent;}return n}function en(e,n){Object.defineProperty(e,"target",{configurable:true,value:n});}function Rn(e){let n=e.target,t=e.type,o=e.target,r=e.currentTarget,s=()=>{let l=n[`_$${t}`];if(l&&isFunction(l)&&!n.disabled){let c=n[`${t}Data`];if(c?l.call(n,c,e):l.call(n,e),e.cancelBubble)return false}return n.host&&!isString(n.host)&&!n.host._$host&&isFunction(n.contains)&&n.contains(e.target)&&en(e,n.host),true},i=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return n||document}}),e.composedPath){let l=e.composedPath();en(e,l[0]);for(let c=0;c<l.length-2&&(n=l[c],!!s());c++){if(n._$host){n=n._$host,i();break}if(n.parentNode===r)break}}else i();en(e,o);}var xe=Symbol("_$EVENTS");function It(e,n=globalThis.document){let t=n,o=t[xe]||(t[xe]=new Set);for(let r of e)o.has(r)||(o.add(r),n.addEventListener(r,Rn));}function Ot(e=globalThis.document){let n=e,t=n[xe];if(t){for(let o of t.keys())e.removeEventListener(o,Rn);delete n[xe];}}function ae(e,n,t,o){let r=ie(e,n,t,o);c()&&h(r);}var $t=e=>e,Kt=typeof DataTransfer!="undefined"?new DataTransfer().files:[];function Dn(e,n){let t=e,o=n==null?"":String(n);t.value!==o&&(t.value=o);}var Bt={event:"change",forceChange:true,checkboxArray:true,read:e=>e.checked,write(e,n){let t=e,o=isArray(n)?n.map(String).includes(t.value):!!n;t.checked!==o&&(t.checked=o);}},Gt={event:"change",forceChange:true,read(e){let n=e;return n.checked?n.value:""},write(e,n){let t=e,o=String(n)===t.value;t.checked!==o&&(t.checked=o);}},Ut={event:"change",forceChange:true,read:e=>e.files,write(e,n){if(n==null)try{e.files=Kt;}catch(t){}}},Ln={event:"input",ime:true,read:e=>e.value,write:Dn},zt={event:"change",forceChange:true,read(e){let n=e;return n.multiple?Array.from(n.selectedOptions,t=>t.value):n.value},write(e,n){let t=e;if(!t.multiple)return Dn(e,n);let o=new Set((isArray(n)?n:[]).map(String));for(let r of Array.from(t.options))r.selected=o.has(r.value);}};function Fn(e){return {event:"input",read:n=>n[e],write(n,t){n[e]=t;}}}function Wt(e,n){switch(e.nodeName){case "INPUT":return n==="checked"?e.type==="radio"?Gt:Bt:n==="files"?Ut:n==="value"?Ln:Fn(n);case "SELECT":return zt;case "TEXTAREA":return Ln;default:return Fn(n)}}function qt(e,n,t){if(!isString(e))return e;let o=n?e.trim():e;if(t){let r=n?o:o.trim();if(r!==""){let s=Number(r);if(!Number.isNaN(s))return s}}return o}function Xt(e){let n=e.getRootNode();return (n instanceof Document||n instanceof ShadowRoot)&&n.activeElement===e}function Yt(e,n){if(n!=="value"||e.nodeName!=="INPUT")return false;let t=e.type;return t==="number"||t==="range"}function Jt(e,n,t,o,r={}){if(!e)return;let{event:s,read:i,write:l,forceChange:c$1,ime:d,checkboxArray:f}=Wt(e,n),y=r.trim===true,v=r.number===true||Yt(e,n),E=r.lazy===true,_=(y||v)&&n!=="files",C=isFunction(t)?t:()=>t,N=_?S=>qt(S,y,v):$t,p=f?S=>{let R=C();if(!isArray(R))return N(S);let L=e.value,O=R.filter(a=>String(a)!==L);return S&&O.push(L),O}:N,T=false,u=E||c$1?"change":s,w=()=>{if(T)return;let S=i(e);if(S===void 0)return;let R=p(S);Object.is(C(),R)||o(R);};ae(e,u,w),!E&&_&&u!=="change"&&ae(e,"change",()=>l(e,N(i(e)))),d&&(ae(e,"compositionstart",()=>{T=true;}),ae(e,"compositionend",()=>{T=false,E||w();}));let k=effect(()=>{let S=C();d&&T||d&&!E&&Xt(e)&&Object.is(N(i(e)),S)||l(e,S);});c()&&h(()=>k.stop());}function Mn(e){let n=e;return Array.isArray(n)&&n.length===1&&(n=n[0]),typeof n=="function"?n():n}function In(e){let n=Object.getOwnPropertyDescriptor(e,"children");return n!=null&&n.get?()=>Mn(n.get.call(e)):()=>Mn(e.children)}function Qt(e,n){let t=new Set(n);return new Proxy(e,{get(o,r){if(!t.has(r))return Reflect.get(o,r)},ownKeys(o){return Reflect.ownKeys(o).filter(r=>!t.has(r))},getOwnPropertyDescriptor(o,r){if(!t.has(r))return Reflect.getOwnPropertyDescriptor(o,r)},has(o,r){return t.has(r)?false:Reflect.has(o,r)}})}function On(e){var t;if(e&&((t=Object.getOwnPropertyDescriptor(e,"children"))!=null&&t.get||isReactive(e)))return [()=>e.children];let n=e==null?void 0:e.children;return n==null?null:n}On[je]=true;function eo(e){return !!e&&!!e[je]}function ke(e){let n=isFunction(e.target)?e.target():e.target;return n==null?null:isString(n)?document.querySelector(n):n}function Pe(e){return isFunction(e.disabled)?!!e.disabled():!!e.disabled}function Vn(e$1){if(oe()){let f=oo(e$1);if(f)return f}let n=document.createComment("portal");n[fe]=true;let{children:t}=e$1;if(t==null)return n;let o=c(),r=null,s=(f$1,y)=>{r=e(o),f(r,()=>{J(f$1,()=>t,y);});},i=()=>{r&&(g(r),r=null);},l=(f,y)=>{if(i(),f){let v=n.parentNode;if(!v)return;s(v,n);return}y&&s(y);},c$1=false,d=effect(()=>{let f=Pe(e$1),y=f?null:ke(e$1);c$1&&l(f,y);});return Q(()=>{c$1=!0;let f=Pe(e$1),y=f?null:ke(e$1);if(f||y){l(f,y);return}queueMicrotask(()=>{n.parentNode&&l(Pe(e$1),ke(e$1));});}),h(()=>{d.stop(),i();}),n}Vn[fe]=true;function oo(e){if(Pe(e))return null;let n=ze();if(!n)return null;let t=ke(e);return !t||!We(t)?null:(n[fe]=true,n)}function ro(e){return !!e&&!!e[fe]}function Le(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function jn(e){let n=e;for(;isFunction(n);)n=n();return isSignal(n)||isComputed(n)?jn(n.value):n}var pe=Symbol("SuspenseContext");function $n(e){var _;if(!isBrowser())return (_=e.fallback)!=null?_:"";let n=document.createElement("div");n.style.display="contents";let t=true,o=0,r=false,s=null,i=C=>{let N=jn(C);if(isArray(N)){let p=[];for(let T of N){let u=i(T);isArray(u)?p.push(...u):p.push(u);}return p}return re(N)},l=C=>{let N=i(C),p=isArray(N)?N:[N];for(let T of p)T!=null&&G(n,T);},c=()=>{Le(n),e.fallback!=null&&l(e.fallback);},d=()=>{r||(r=true,c());},f=()=>{!r||!(s||e.children!=null&&!isPromise(e.children))||(r=false,Le(n),s?y(s):e.children!=null&&!isPromise(e.children)&&y(e.children));},y=C=>{if(r||(Le(n),C==null))return;let N=isArray(C)?C:[C];for(let p of N)p!=null&&l(p);r&&c();},v={register:C=>{o++,d(),C.then(()=>{t&&(o--,o===0&&f());}).catch(N=>{t&&(o--,o===0&&f());});},increment:()=>{o++,d();},decrement:()=>{o=Math.max(0,o-1),o===0&&f();}};Ze(pe,v);let E=e.children;return isPromise(E)?(E.then(C=>{s=C;}).catch(()=>{}),v.register(E)):E!=null?y(E):d(),se(()=>{t=false,o=0,s=null,Le(n),n.remove();}),n}$n[$e]=true;function co(e){return !!e&&!!e[$e]}function uo(e,n){let t=signal(n==null?void 0:n.initialValue),o=signal(true),r=signal(null),s=signal("pending"),i=0,l=null,c=false,d=me(pe,null),f=()=>b(null,null,function*(){let E=++i;o.value=true,s.value="pending",r.value=null,c=false,d&&d.increment();try{let _=e();l=_,_.catch(()=>{});let C=yield _;E===i&&(t.value=C,s.value="ready",o.value=!1);}catch(_){E===i&&(r.value=_ instanceof Error?_:new Error(String(_)),s.value="errored",o.value=false);}finally{d&&d.decrement();}});f();let y=(()=>(!c&&o.value&&l&&d&&(c=true,d.register(l)),t.value));return y.loading=o,y.error=r,y.state=s,[y,{mutate:E=>{t.value=E,s.value="ready",o.value=false,r.value=null;},refetch:()=>b(null,null,function*(){yield f();})}]}function Kn(e){return isFunction(e)?e:e.default}function on(e,n,t){let o=new le(n,t);return o.mount(e),o}function mo(e,n={}){let{delay:t=200,timeout:o,ssr:r="blocking",onError:s}=n;if(typeof window=="undefined"){if(r==="client-only"){let N=()=>"";return N.__asyncLoader=e,N.__asyncResolved=()=>null,N}let v=null,E=null,_=()=>E||(E=e().then(N=>{v=Kn(N);}).catch(()=>{}),E);_();let C=N=>v?v(N):"";return C.__asyncLoader=_,C.__asyncResolved=()=>v,C}let i=null,l=null,c="pending",d=null;function f(){return d||(d=e().then(v=>{i=Kn(v),c="resolved";}).catch(v=>{l=v instanceof Error?v:new Error(String(v)),c="errored",d=null;}),d)}f();function y(v){var O;if(c==="resolved"&&i){let a=document.createElement("div");a.style.display="contents";let g=on(a,i,v);return h(()=>g.destroy()),a}if(c==="errored"&&l){let a=document.createElement("div");if(a.style.display="contents",n.error){let g=true,m=null,P=(A,h)=>{g&&(m==null||m.destroy(),m=on(a,A,h));},b=()=>{d=null,c="pending",l=null,n.loading&&P(n.loading),f().then(()=>{g&&(c==="resolved"&&i?P(i,v):c==="errored"&&l&&n.error&&P(n.error,{error:l,retry:b}));});};P(n.error,{error:l,retry:b}),se(()=>{g=false,m==null||m.destroy(),m=null;});}return a}let E=document.createElement("div");E.style.display="contents";let _=true,C=null,N=null,p=null,T=(a,g)=>{_&&(C==null||C.destroy(),C=on(E,a,g));},u=a=>()=>{d=null,c="pending",l=null,n.loading&&T(n.loading),f().then(()=>{c==="resolved"&&i?T(i,a):c==="errored"&&l&&n.error&&T(n.error,{error:l,retry:u(a)});});};se(()=>{_=false,C==null||C.destroy(),C=null,N!=null&&clearTimeout(N),p!=null&&clearTimeout(p);});let w=(O=me(pe))!=null?O:null,k=a=>T(a,v),S=a=>{n.error&&T(n.error,{error:a,retry:u(v)});},R=()=>{n.loading&&T(n.loading);},L=f().then(()=>{_&&(c==="resolved"&&i?k(i):c==="errored"&&l&&(S(l),s&&s(l,u(v))),N!=null&&clearTimeout(N),p!=null&&clearTimeout(p));});return w&&w.register(L),t>0?N=setTimeout(()=>{_&&c==="pending"&&R();},t):n.loading&&R(),o!=null&&(p=setTimeout(()=>{if(_&&c==="pending"){let a=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);l=a,c="errored",S(a),s&&s(a,u(v));}},o)),E}return y.__asyncLoader=f,y.__asyncResolved=()=>i,y}function Bn(e$1){let n=document.createDocumentFragment(),t=document.createComment("");n.appendChild(t);let o=[],r=[],s=e$1.key,i=e$1.children,l=Array.isArray(i)&&i.length===1&&isFunction(i[0])?i[0]:e$1.children;if(!isFunction(l))throw new TypeError("<For> requires `children` to be a function (item, index) => Node");let c$1=()=>{var T,u;let p=e$1.each;return isSignal(p)?(T=p.value)!=null?T:[]:isFunction(p)?(u=p())!=null?u:[]:p!=null?p:[]},d=(p,T)=>s?s(p,T):p,f$1=(p,T,u)=>{if(p==null||p===false)return [];if(Array.isArray(p)){let k=[];for(let S of p)k.push(...f$1(S,T,u));return k}if(V(p))return G(T,p,u!=null?u:void 0),p.renderedNodes;let w=re(p);return G(T,w,u!=null?u:void 0),[w]},y=(p,T)=>{if(!e$1.fallback)return;r=f$1(e$1.fallback(),p,T);},v=()=>{for(let p of r)p.parentNode&&p.parentNode.removeChild(p);r=[];},E=(p,T,u,w,k=d(p,T))=>{let S=c(),R=e(S),L=[];return f(R,()=>{L=f$1(l(p,T),u,w);}),{key:k,item:p,nodes:L,scope:R}},_=p=>{g(p.scope);for(let T of p.nodes)T.parentNode&&T.parentNode.removeChild(T);},C=effect(()=>{let p=c$1(),T=t.parentNode;if(!T){if(p.length===0)y(n,t);else {o=new Array(p.length);let u=0;for(let w of p)o[u]=E(w,u,n,t),u++;}return}N(T,p);});function N(p,T){let u=o.length,w=T.length;if(w===0){for(let h=0;h<u;h++)_(o[h]);o=[],e$1.fallback&&r.length===0&&y(p,t);return}if(u===0||r.length>0){r.length>0&&v(),o=new Array(w);let h=document.createDocumentFragment();for(let x=0;x<w;x++)o[x]=E(T[x],x,h,null);p.insertBefore(h,t);return}let k=new Map;for(let h=0;h<u;h++){let x=o[h],F=k.get(x.key),j=[x,h];F?F.push(j):k.set(x.key,[j]);}let S=new Array(w),R=[],L=null,O=new Int32Array(w),a=false,g=0,m=new Array(w);for(let h=0;h<w;h++)m[h]=d(T[h],h);for(let h=0;h<w;h++){let x=T[h],F=m[h],j=k.get(F);if(j&&j.length>0){let[X,z]=j.shift();Object.is(X.item,x)?(X.item=x,S[h]=X,O[h]=z+1,z<g?a=true:g=z):(L||(L=document.createDocumentFragment()),_(X),S[h]=E(x,h,L,null,F));}else L||(L=document.createDocumentFragment()),S[h]=E(x,h,L,null,F);}for(let h of k.values())for(let[x]of h)R.push(x);for(let h of R)_(h);let P=a?Je(O):[],b=P.length-1,A=t;for(let h=w-1;h>=0;h--){let F=S[h].nodes;if(!(O[h]===0)&&a&&b>=0&&h===P[b]){b--;for(let z=F.length-1;z>=0;z--)A=F[z];continue}for(let z=F.length-1;z>=0;z--){let Ie=F[z];Ie.nextSibling!==A&&p.insertBefore(Ie,A),A=Ie;}}o=S;}return h(()=>{C.stop();for(let p of o)_(p);o=[],v(),t.parentNode&&t.parentNode.removeChild(t);}),n}Bn[mn]=true;function sn(e){var s,i,l,c,d,f,y,v,E,_;let n=(s=e.name)!=null?s:"v",t=(i=e.enterFromClass)!=null?i:`${n}-enter-from`,o=(l=e.enterActiveClass)!=null?l:`${n}-enter-active`,r=(c=e.enterToClass)!=null?c:`${n}-enter-to`;return {enterFrom:t,enterActive:o,enterTo:r,leaveFrom:(d=e.leaveFromClass)!=null?d:`${n}-leave-from`,leaveActive:(f=e.leaveActiveClass)!=null?f:`${n}-leave-active`,leaveTo:(y=e.leaveToClass)!=null?y:`${n}-leave-to`,appearFrom:(v=e.appearFromClass)!=null?v:t,appearActive:(E=e.appearActiveClass)!=null?E:o,appearTo:(_=e.appearToClass)!=null?_:r}}var Gn=e=>e?e.endsWith("ms")?Number(e.slice(0,-2).replace(",",".")):Number(e.slice(0,-1).replace(",","."))*1e3:0;function Un(e,n){let t=e.split(", "),o=n.split(", "),r=0;for(let[s,i]of o.entries()){let l=Gn(i)+Gn(t[s%t.length]||"0s");l>r&&(r=l);}return r}function Wn(e,n){let t=getComputedStyle(e),o=n!=="animation"?Un(t.transitionDelay,t.transitionDuration):0,r=n!=="transition"?Un(t.animationDelay,t.animationDuration):0;return o===0&&r===0?null:o>=r?{event:"transitionend",timeout:o}:{event:"animationend",timeout:r}}function U(e,n){for(let t of n.split(/\s+/))t&&e.classList.add(t);}function H(e,n){for(let t of n.split(/\s+/))t&&e.classList.remove(t);}function he(e){requestAnimationFrame(()=>requestAnimationFrame(e));}function Me(e){e.offsetHeight;}function ce(e,n,t,o){if(t!=null){setTimeout(o,t);return}let r=Wn(e,n);if(!r){o();return}let s=false,i=()=>{s||(s=true,e.removeEventListener(r.event,l),o());},l=()=>i();e.addEventListener(r.event,l),setTimeout(i,r.timeout+1);}function ue(e,n){return e==null?null:typeof e=="number"?e:e[n]}function zn(e){if(e==null||e===false)return null;if(Array.isArray(e))return e[0]instanceof Element?e[0]:null;if(e instanceof Element)return e;if(V(e)){let n=e;if(n.scope==null){let o=document.createDocumentFragment();n.mount(o);}let t=n.firstChild;return t instanceof Element?t:null}return null}var De=Symbol("enter_cb"),ye=Symbol("leave_cb");function qn(e){let n=document.createComment(""),t=sn(e),o=e.css!==false,r=In(e),s="idle",i=null,l=null,c=false,d,f=false,y=false,v=false,E=(u,w)=>{var g;let k=u[ye];k&&k(true),s="entering";let S=w==="appear"?t.appearFrom:t.enterFrom,R=w==="appear"?t.appearActive:t.enterActive,L=w==="appear"?t.appearTo:t.enterTo;(g=e.onBeforeEnter)==null||g.call(e,u),o&&(U(u,S),U(u,R));let O=false,a=m=>{var P,b;O||(O=true,u[De]=void 0,o&&(H(u,S),H(u,R),H(u,L)),m?(P=e.onEnterCancelled)==null||P.call(e,u):(s="entered",(b=e.onAfterEnter)==null||b.call(e,u)));};u[De]=a,he(()=>{if(!O)if(o&&(H(u,S),U(u,L)),e.onEnter)e.onEnter(u,()=>a(false));else if(o){let m=ue(e.duration,"enter");ce(u,e.type,m,()=>a(false));}else a(false);});},_=(u,w)=>{var a;let k=u[De];k&&(k(true),Me(u)),s="leaving",(a=e.onBeforeLeave)==null||a.call(e,u),o&&(U(u,t.leaveFrom),U(u,t.leaveActive));let S=false,R=g=>{var m,P;S||(S=true,u[ye]=void 0,o&&(H(u,t.leaveFrom),H(u,t.leaveActive),H(u,t.leaveTo)),g?(m=e.onLeaveCancelled)==null||m.call(e,u):(s="idle",w(),(P=e.onAfterLeave)==null||P.call(e,u)));};u[ye]=R;let L=ue(e.duration,"leave"),O=o&&!e.onLeave&&L==null?!!Wn(u,e.type):false;if(!e.onLeave&&L==null&&!O){R(false);return}he(()=>{S||(o&&(H(u,t.leaveFrom),U(u,t.leaveTo)),e.onLeave?e.onLeave(u,()=>R(false)):o?ce(u,e.type,L,()=>R(false)):R(false));});},C=(u,w)=>{if(u&&s==="leaving"&&l){let S=l,R=S[ye];R&&R(true),l=null,i=S,E(S,"enter");return}if(u===i)return;let k=i;if(i=u,k){l=k;let S=k;_(S,()=>{S.parentNode&&S.parentNode.removeChild(S),l===S&&(l=null);});}u&&n.parentNode?(n.parentNode.insertBefore(u,n),w&&!e.appear?s="entered":E(u,w&&e.appear?"appear":"enter")):!k&&!u&&(s="idle");},N=()=>{if(y=false,v||!f)return;let u=d;f=false,d=void 0;try{C(zn(u),!1);}catch(w){}},p=u=>{d=u,f=true,!y&&(y=true,queueMicrotask(N));},T=effect(()=>{let u=r();c?p(u):(d=u,f=true);});return Q(()=>{c=!0;let u=f?zn(d):null;f=!1,d=void 0,C(u,!0);}),h(()=>{v=true,T.stop();for(let u of [i,l]){if(!u)continue;let w=u[De],k=u[ye];w==null||w(true),k==null||k(true),u.parentNode&&u.parentNode.removeChild(u);}i=null,l=null,s="idle";}),n}qn[Ke]=true;function go(e){return !!e&&!!e[Ke]}function an(e,n){if(e==null||e===false)return {el:null,comp:null};if(Array.isArray(e)&&e.length===1)return an(e[0],n);if(isFunction(e))return an(e(),n);if(e instanceof HTMLElement)return {el:e,comp:null};if(V(e)){let t=e;t.scope==null&&t.mount(n);let o=t.firstChild;return o instanceof HTMLElement?{el:o,comp:t}:{el:null,comp:t}}return {el:null,comp:null}}function Co(e){return {position:e.style.position,top:e.style.top,left:e.style.left,width:e.style.width,height:e.style.height}}function ln(e,n){e.style.position=n.position,e.style.top=n.top,e.style.left=n.left,e.style.width=n.width,e.style.height=n.height;}function Xn(e$1){var R,L,O;let n=(R=e$1.tag)!=null?R:"div",t=document.createElement(n),o=sn(e$1),r=e$1.css!==false,s=(O=e$1.moveClass)!=null?O:`${(L=e$1.name)!=null?L:"v"}-move`,i=e$1.key,l=e$1.children,c$1=Array.isArray(l)&&l.length===1&&isFunction(l[0])?l[0]:e$1.children;if(!isFunction(c$1)||!isFunction(i))throw new TypeError("<TransitionGroup> requires `children: (item, index) => Node` and `key: (item, index) => unknown`");let d=()=>{var g,m;let a=e$1.each;return isSignal(a)?(g=a.value)!=null?g:[]:isFunction(a)?(m=a())!=null?m:[]:a!=null?a:[]},f$1=[],y=false,v=(a,g$1)=>{let m=c(),P=e(m),b;f(P,()=>{b=c$1(a,g$1);});let{el:A,comp:h}=an(b,t);return A?{key:i(a,g$1),item:a,el:A,comp:h,scope:P,state:"entering"}:(g(P),null)},E=a=>{if(a.comp){for(let g of a.comp.renderedNodes)g.parentNode===t&&t.removeChild(g);return}a.el.parentNode===t&&t.removeChild(a.el);},_=a=>{var g$1,m;(g$1=a.cancelEnter)==null||g$1.call(a,true),(m=a.cancelLeave)==null||m.call(a,true),a.comp&&a.comp.destroy(),E(a),g(a.scope);},C=a=>{var b,A,h;let g=a.el;if((b=a.cancelLeave)==null||b.call(a,true),!r){a.state="present",(A=e$1.onAfterEnter)==null||A.call(e$1,g);return}(h=e$1.onBeforeEnter)==null||h.call(e$1,g),U(g,o.enterFrom),U(g,o.enterActive);let m=false,P=x=>{var F,j;m||(m=true,a.cancelEnter=void 0,H(g,o.enterFrom),H(g,o.enterActive),H(g,o.enterTo),x?(F=e$1.onEnterCancelled)==null||F.call(e$1,g):(a.state="present",(j=e$1.onAfterEnter)==null||j.call(e$1,g)));};a.cancelEnter=P,a.state="entering",he(()=>{if(!m)if(H(g,o.enterFrom),U(g,o.enterTo),e$1.onEnter)e$1.onEnter(g,()=>P(false));else {let x=ue(e$1.duration,"enter");ce(g,e$1.type,x,()=>P(false));}});},N=(a,g$1)=>{var h,x;let m=a.el;a.cancelEnter&&(a.cancelEnter(true),Me(m)),a.state="leaving",a.savedStyles=Co(m);let P=t.getBoundingClientRect();if(m.style.position="absolute",m.style.top=`${g$1.top-P.top}px`,m.style.left=`${g$1.left-P.left}px`,m.style.width=`${g$1.width}px`,m.style.height=`${g$1.height}px`,!r){a.savedStyles&&ln(m,a.savedStyles),E(a),g(a.scope),a.comp&&a.comp.destroy(),(h=e$1.onAfterLeave)==null||h.call(e$1,m);return}(x=e$1.onBeforeLeave)==null||x.call(e$1,m),U(m,o.leaveFrom),U(m,o.leaveActive);let b=false,A=F=>{var j,X;if(!b){if(b=true,a.cancelLeave=void 0,H(m,o.leaveFrom),H(m,o.leaveActive),H(m,o.leaveTo),F){a.savedStyles&&ln(m,a.savedStyles),a.savedStyles=void 0,(j=e$1.onLeaveCancelled)==null||j.call(e$1,m);return}a.savedStyles&&ln(m,a.savedStyles),a.savedStyles=void 0,E(a),g(a.scope),a.comp&&a.comp.destroy(),(X=e$1.onAfterLeave)==null||X.call(e$1,m);}};a.cancelLeave=A,he(()=>{if(!b)if(H(m,o.leaveFrom),U(m,o.leaveTo),e$1.onLeave)e$1.onLeave(m,()=>A(false));else {let F=ue(e$1.duration,"leave");ce(m,e$1.type,F,()=>A(false));}});},p=(a,g)=>{if(!r||a.state!=="present")return;let m=a.el,P=m.getBoundingClientRect(),b=g.left-P.left,A=g.top-P.top;if(!b&&!A)return;let h=m.style.transform,x=m.style.transitionDuration;m.style.transform=`translate(${b}px, ${A}px)`,m.style.transitionDuration="0s",U(m,s),Me(m),m.style.transform=h,m.style.transitionDuration=x;let F=ue(e$1.duration,"enter");ce(m,e$1.type,F,()=>{H(m,s);});},T=()=>{for(let a of f$1)a.state!=="leaving"&&(a.prevRect=a.el.getBoundingClientRect());},u=a=>{let g=new Map;for(let A of f$1)g.set(A.key,A);let m=[];for(let[A,h]of a.entries()){let x=i(h,A),F=g.get(x);if(F)g.delete(x),F.item=h,m.push(F);else {let j=v(h,A);j&&m.push(j);}}let P=[];for(let A of g.values())A.state!=="leaving"&&P.push(A);let b=null;for(let A=m.length-1;A>=0;A--){let h=m[A].el;(h.parentNode!==t||h.nextSibling!==b)&&t.insertBefore(h,b),b=h;}return {next:m,leaving:P}},w=(a,g)=>{if(g){let b=[];for(let[A,h]of a.entries()){let x=v(h,A);x&&(x.el.parentNode!==t&&t.appendChild(x.el),x.state="present",b.push(x));}f$1=b;return}T();let{next:m,leaving:P}=u(a);for(let b of m)b.state!=="present"&&C(b);for(let b of P){let A=b.prevRect;A&&N(b,A);}for(let b of m)b.state!=="present"||!b.prevRect||(p(b,b.prevRect),b.prevRect=void 0);f$1=m.concat(P);},k=null,S=effect(()=>{let a=d();if(!y){k=a;return}w(a,false);});return Q(()=>{y=!0,k&&(w(k,!0),k=null);}),h(()=>{S.stop();for(let a of f$1)_(a);f$1=[],t.parentNode&&t.parentNode.removeChild(t);}),t}Xn[Be]=true;function No(e){return !!e&&!!e[Be]}
2
+ export{le as Component,Bn as For,On as Fragment,Vn as Portal,$n as Suspense,qn as Transition,Xn as TransitionGroup,ie as addEvent,ae as addEventListener,qe as beginHydration,Jt as bindElement,_t as child,Ot as clearDelegatedEvents,ze as consumeTeleportAnchor,We as consumeTeleportBlock,Ft as createApp,Ae as createComponent,uo as createResource,mo as defineAsyncComponent,It as delegateEvents,Xe as endHydration,hn as getHydrationKey,Et as getRenderedElement,Dt as hydrate,vt as hydrationAnchor,gt as hydrationMarker,me as inject,J as insert,V as isComponent,eo as isFragment,oe as isHydrating,ro as isPortal,co as isSuspense,go as isTransition,No as isTransitionGroup,At as next,Ce as normalizeClass,xt as nthChild,Qt as omitProps,se as onDestroy,Q as onMount,kt as onUpdate,Z as patchAttr,Nt as patchAttrHydrate,Ne as patchClass,Ct as patchClassHydrate,Se as patchStyle,Tt as patchStyleHydrate,Ze as provide,pt as resetHydrationKey,ne as setStyle,be as template};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estjs/template",
3
- "version": "0.0.16-beta.9",
3
+ "version": "0.0.16",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -63,12 +63,12 @@
63
63
  "unpkg": "dist/template.js",
64
64
  "jsdelivr": "dist/template.js",
65
65
  "dependencies": {
66
- "@estjs/shared": "0.0.16-beta.9",
67
- "@estjs/signals": "0.0.16-beta.9"
66
+ "@estjs/shared": "0.0.16",
67
+ "@estjs/signals": "0.0.16"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@babel/core": "^7.29.7",
71
- "babel-plugin-essor": "0.0.16-beta.9"
71
+ "babel-plugin-essor": "0.0.16"
72
72
  },
73
73
  "scripts": {
74
74
  "build": "tsup && cross-env NODE_ENV=production tsup --clean=false",
@@ -1 +0,0 @@
1
- import'@estjs/shared';import {setCurrentScope,effectScope}from'@estjs/signals';var s=Object.defineProperty;var u=Object.getOwnPropertySymbols;var a=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var p=(e,r,n)=>r in e?s(e,r,{enumerable:true,configurable:true,writable:true,value:n}):e[r]=n,x=(e,r)=>{for(var n in r||(r={}))a.call(r,n)&&p(e,n,r[n]);if(u)for(var n of u(r))S.call(r,n)&&p(e,n,r[n]);return e};var E=(e,r)=>{var n={};for(var o in e)a.call(e,o)&&r.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&u)for(var o of u(e))r.indexOf(o)<0&&S.call(e,o)&&(n[o]=e[o]);return n};var b=(e,r,n)=>new Promise((o,i)=>{var v=l=>{try{d(n.next(l));}catch(f){i(f);}},h=l=>{try{d(n.throw(l));}catch(f){i(f);}},d=l=>l.done?o(l.value):Promise.resolve(l.value).then(v,h);d((n=n.apply(e,r)).next());});var t=null,m=0;function C(){return t}function c(e){t=e,setCurrentScope(e==null?void 0:e.effectScope);}function I(e=t){let r=e?e.effectScope.run(()=>effectScope()):effectScope(true),n={id:++m,effectScope:r,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=new Set),e.children.add(n)),n}function P(e,r){let n=t;c(e);try{return e.effectScope.run(r)}finally{c(n);}}function D(e){var n;if(!e||e.isDestroyed)return;if(e.isDestroyed=true,e.children&&e.children.size>0){for(let o of e.children)o&&(o.parent=null,D(o));e.children.clear();}let r=t;if(c(e),e.onDestroy){for(let o=0;o<e.onDestroy.length;o++)try{e.onDestroy[o]();}catch(i){}e.onDestroy=null;}if(e.cleanup){for(let o=0;o<e.cleanup.length;o++)try{e.cleanup[o]();}catch(i){}e.cleanup=null;}c(r),e.effectScope.stop(),(n=e.parent)!=null&&n.children&&e.parent.children.delete(e),e.provides&&(e.provides.clear(),e.provides=null),e.onMount=null,e.onUpdate=null,e.children=null,e.parent=null;}function U(e){let r=t;r&&(r.cleanup||(r.cleanup=[]),r.cleanup.push(e));}export{x as a,E as b,b as c,C as d,c as e,I as f,P as g,D as h,U as i};
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/scope.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAI,WAAA,GAA4B,IAAA;AAGhC,IAAI,OAAA,GAAU,CAAA;AAOP,SAAS,cAAA,GAA+B;AAC7C,EAAA,OAAO,WAAA;AACT;AAQO,SAAS,eAAe,KAAA,EAA2B;AACxD,EAAA,WAAA,GAAc,KAAA;AACd,EAAA,eAAA,CAAgB,+BAAO,WAAW,CAAA;AACpC;AASO,SAAS,WAAA,CAAY,SAAuB,WAAA,EAAoB;AACrE,EAAA,MAAM,aAAA,GAAgB,MAAA,GAAS,MAAA,CAAO,WAAA,CAAY,GAAA,CAAI,MAAM,WAAA,EAAa,CAAA,GAAK,WAAA,CAAY,IAAI,CAAA;AAC9F,EAAA,MAAM,KAAA,GAAe;AAAA,IACnB,IAAI,EAAE,OAAA;AAAA,IACN,WAAA,EAAa,aAAA;AAAA,IACb,MAAA;AAAA,IACA,QAAA,EAAU,IAAA;AAAA;AAAA,IACV,QAAA,EAAU,IAAA;AAAA;AAAA,IACV,OAAA,EAAS,IAAA;AAAA;AAAA,IACT,OAAA,EAAS,IAAA;AAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA;AAAA,IACV,SAAA,EAAW,IAAA;AAAA;AAAA,IACX,SAAA,EAAW,KAAA;AAAA,IACX,WAAA,EAAa;AAAA,GACf;AAGA,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,IAAI,CAAC,OAAO,QAAA,EAAU;AACpB,MAAA,MAAA,CAAO,QAAA,uBAAe,GAAA,EAAI;AAAA,IAC5B;AACA,IAAA,MAAA,CAAO,QAAA,CAAS,IAAI,KAAK,CAAA;AAAA,EAC3B;AAEA,EAAA,OAAO,KAAA;AACT;AAUO,SAAS,YAAA,CAAgB,OAAc,EAAA,EAAgB;AAC5D,EAAA,MAAM,SAAA,GAAY,WAAA;AAClB,EAAA,cAAA,CAAe,KAAK,CAAA;AACpB,EAAA,IAAI;AACF,IAAA,OAAO,KAAA,CAAM,WAAA,CAAY,GAAA,CAAI,EAAE,CAAA;AAAA,EACjC,CAAA,SAAE;AACA,IAAA,cAAA,CAAe,SAAS,CAAA;AAAA,EAC1B;AACF;AASO,SAAS,aAAa,KAAA,EAAoB;AAhIjD,EAAA,IAAA,EAAA;AAkIE,EAAA,IAAI,CAAC,KAAA,IAAS,KAAA,CAAM,WAAA,EAAa;AAC/B,IAAA;AAAA,EACF;AAIA,EAAA,KAAA,CAAM,WAAA,GAAc,IAAA;AAIpB,EAAA,IAAI,KAAA,CAAM,QAAA,IAAY,KAAA,CAAM,QAAA,CAAS,OAAO,CAAA,EAAG;AAC7C,IAAA,KAAA,MAAW,KAAA,IAAS,MAAM,QAAA,EAAU;AAClC,MAAA,IAAI,KAAA,EAAO;AACT,QAAA,KAAA,CAAM,MAAA,GAAS,IAAA;AACf,QAAA,YAAA,CAAa,KAAK,CAAA;AAAA,MACpB;AAAA,IACF;AACA,IAAA,KAAA,CAAM,SAAS,KAAA,EAAM;AAAA,EACvB;AAGA,EAAA,MAAM,SAAA,GAAY,WAAA;AAClB,EAAA,cAAA,CAAe,KAAK,CAAA;AACpB,EAAA,IAAI,MAAM,SAAA,EAAW;AACnB,IAAA,KAAA,IAAS,IAAI,CAAA,EAAG,CAAA,GAAI,KAAA,CAAM,SAAA,CAAU,QAAQ,CAAA,EAAA,EAAK;AAC/C,MAAA,IAAI;AACF,QAAA,KAAA,CAAM,SAAA,CAAU,CAAC,CAAA,EAAE;AAAA,MACrB,SAAS,MAAA,EAAQ;AACf,QAAa,KAAA,CAAM,CAAA,MAAA,EAAS,KAAA,CAAM,EAAE,6BAA6B,MAAM,CAAA;AAAA,MACzE;AAAA,IACF;AACA,IAAA,KAAA,CAAM,SAAA,GAAY,IAAA;AAAA,EACpB;AACA,EAAA,IAAI,MAAM,OAAA,EAAS;AACjB,IAAA,KAAA,IAAS,IAAI,CAAA,EAAG,CAAA,GAAI,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAA,EAAK;AAC7C,MAAA,IAAI;AACF,QAAA,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA,EAAE;AAAA,MACnB,SAAS,MAAA,EAAQ;AACf,QAAa,KAAA,CAAM,CAAA,MAAA,EAAS,KAAA,CAAM,EAAE,wBAAwB,MAAM,CAAA;AAAA,MACpE;AAAA,IACF;AACA,IAAA,KAAA,CAAM,OAAA,GAAU,IAAA;AAAA,EAClB;AACA,EAAA,cAAA,CAAe,SAAS,CAAA;AAExB,EAAA,KAAA,CAAM,YAAY,IAAA,EAAK;AAGvB,EAAA,IAAA,CAAI,EAAA,GAAA,KAAA,CAAM,MAAA,KAAN,IAAA,GAAA,MAAA,GAAA,EAAA,CAAc,QAAA,EAAU;AAC1B,IAAA,KAAA,CAAM,MAAA,CAAO,QAAA,CAAS,MAAA,CAAO,KAAK,CAAA;AAAA,EACpC;AAGA,EAAA,IAAI,MAAM,QAAA,EAAU;AAClB,IAAA,KAAA,CAAM,SAAS,KAAA,EAAM;AACrB,IAAA,KAAA,CAAM,QAAA,GAAW,IAAA;AAAA,EACnB;AACA,EAAA,KAAA,CAAM,OAAA,GAAU,IAAA;AAChB,EAAA,KAAA,CAAM,QAAA,GAAW,IAAA;AACjB,EAAA,KAAA,CAAM,QAAA,GAAW,IAAA;AAGjB,EAAA,KAAA,CAAM,MAAA,GAAS,IAAA;AACjB;AAQO,SAAS,UAAU,EAAA,EAAsB;AAC9C,EAAA,MAAM,KAAA,GAAQ,WAAA;AAEd,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAa;AACX,MAAA,KAAA,CAAM,2CAA2C,CAAA;AAAA,IACnD;AACA,IAAA;AAAA,EACF;AAGA,EAAA,IAAI,CAAC,MAAM,OAAA,EAAS;AAClB,IAAA,KAAA,CAAM,UAAU,EAAC;AAAA,EACnB;AAEA,EAAA,KAAA,CAAM,OAAA,CAAQ,KAAK,EAAE,CAAA;AACvB","file":"chunk-W5LMSADN.dev.js","sourcesContent":["import { error } from '@estjs/shared';\nimport { type EffectScope, effectScope, setCurrentScope } from '@estjs/signals';\nimport type { InjectionKey } from './provide';\n\n/**\n * Scope represents an execution context in the component tree.\n * It manages provides, cleanup functions, and lifecycle hooks.\n */\nexport interface Scope {\n /** Unique identifier for debugging */\n readonly id: number;\n\n /** Reactive effect scope tied to this template scope */\n readonly effectScope: EffectScope;\n\n /** Parent scope in the hierarchy */\n parent: Scope | null;\n\n /** Child scopes (lazy initialized) */\n children: Set<Scope> | null;\n\n /** Provided values (lazy initialized) */\n provides: Map<InjectionKey<unknown> | string | number | symbol, unknown> | null;\n\n /** Cleanup functions (lazy initialized) */\n cleanup: Array<() => void> | null;\n\n /** Mount lifecycle hooks (lazy initialized) */\n onMount: Array<() => void | Promise<void>> | null;\n\n /** Update lifecycle hooks (lazy initialized) */\n onUpdate: Array<() => void | Promise<void>> | null;\n\n /** Destroy lifecycle hooks (lazy initialized) */\n onDestroy: Array<() => void | Promise<void>> | null;\n\n /** Whether the scope has been mounted */\n isMounted: boolean;\n\n /** Whether the scope has been destroyed */\n isDestroyed: boolean;\n}\n\n/** Currently active scope */\nlet activeScope: Scope | null = null;\n\n/** Scope ID counter for unique identification */\nlet scopeId = 0;\n\n/**\n * Get the currently active scope.\n *\n * @returns The active scope or null if none is active.\n */\nexport function getActiveScope(): Scope | null {\n return activeScope;\n}\n\n/**\n * Set the active scope (internal use).\n *\n * @param scope - The scope to set as active.\n * @returns {void}\n */\nexport function setActiveScope(scope: Scope | null): void {\n activeScope = scope;\n setCurrentScope(scope?.effectScope);\n}\n\n/**\n * Create a new scope with optional parent.\n * If no parent is provided, uses the current active scope as parent.\n *\n * @param parent - Optional parent scope (defaults to active scope).\n * @returns A new scope instance.\n */\nexport function createScope(parent: Scope | null = activeScope): Scope {\n const reactiveScope = parent ? parent.effectScope.run(() => effectScope())! : effectScope(true);\n const scope: Scope = {\n id: ++scopeId,\n effectScope: reactiveScope,\n parent,\n children: null, // Lazy initialized\n provides: null, // Lazy initialized\n cleanup: null, // Lazy initialized\n onMount: null, // Lazy initialized\n onUpdate: null, // Lazy initialized\n onDestroy: null, // Lazy initialized\n isMounted: false,\n isDestroyed: false,\n };\n\n // Establish parent-child relationship\n if (parent) {\n if (!parent.children) {\n parent.children = new Set();\n }\n parent.children.add(scope);\n }\n\n return scope;\n}\n\n/**\n * Run a function within a scope, ensuring proper cleanup.\n * The previous active scope is restored even if the function throws.\n *\n * @param scope - The scope to run within.\n * @param fn - The function to execute.\n * @returns The return value of the function.\n */\nexport function runWithScope<T>(scope: Scope, fn: () => T): T {\n const prevScope = activeScope;\n setActiveScope(scope);\n try {\n return scope.effectScope.run(fn) as T;\n } finally {\n setActiveScope(prevScope);\n }\n}\n\n/**\n * Dispose a scope and all its children.\n * Children are disposed first (depth-first), then the scope itself.\n *\n * @param scope - The scope to dispose.\n * @returns {void}\n */\nexport function disposeScope(scope: Scope): void {\n // Idempotent: already destroyed\n if (!scope || scope.isDestroyed) {\n return;\n }\n\n // Mark destroyed immediately to block re-entrant disposeScope calls\n // (e.g. an onDestroy hook that accidentally disposes the same scope again).\n scope.isDestroyed = true;\n\n // Dispose children first (depth-first)\n // Iterate directly safely by unlinking parent reference to prevent mutation during iteration\n if (scope.children && scope.children.size > 0) {\n for (const child of scope.children) {\n if (child) {\n child.parent = null;\n disposeScope(child);\n }\n }\n scope.children.clear();\n }\n\n // Execute destroy hooks with this scope active so inject/provide work in callbacks.\n const prevScope = activeScope;\n setActiveScope(scope);\n if (scope.onDestroy) {\n for (let i = 0; i < scope.onDestroy.length; i++) {\n try {\n scope.onDestroy[i]();\n } catch (error_) {\n if (__DEV__) error(`Scope(${scope.id}): Error in destroy hook:`, error_);\n }\n }\n scope.onDestroy = null;\n }\n if (scope.cleanup) {\n for (let i = 0; i < scope.cleanup.length; i++) {\n try {\n scope.cleanup[i]();\n } catch (error_) {\n if (__DEV__) error(`Scope(${scope.id}): Error in cleanup:`, error_);\n }\n }\n scope.cleanup = null;\n }\n setActiveScope(prevScope);\n\n scope.effectScope.stop();\n\n // Remove from parent's children\n if (scope.parent?.children) {\n scope.parent.children.delete(scope);\n }\n\n // Clear all internal collections to prevent memory leaks\n if (scope.provides) {\n scope.provides.clear();\n scope.provides = null;\n }\n scope.onMount = null;\n scope.onUpdate = null;\n scope.children = null;\n\n // Break parent reference to prevent memory leaks\n scope.parent = null;\n}\n\n/**\n * Register a cleanup function in the current scope.\n * The function will be called when the scope is disposed.\n *\n * @param fn - The cleanup function.\n */\nexport function onCleanup(fn: () => void): void {\n const scope = activeScope;\n\n if (!scope) {\n if (__DEV__) {\n error('onCleanup() must be called within a scope');\n }\n return;\n }\n\n // Lazy initialize cleanup array\n if (!scope.cleanup) {\n scope.cleanup = [];\n }\n\n scope.cleanup.push(fn);\n}\n"]}