@estjs/template 0.0.16-beta.6 → 0.0.16-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- 'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var We=Object.getOwnPropertySymbols;var St=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable;var Be=(e,t)=>{var n={};for(var o in e)St.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&We)for(var o of We(e))t.indexOf(o)<0&&vt.call(e,o)&&(n[o]=e[o]);return n};var _e=(e,t,n)=>new Promise((o,r)=>{var s=l=>{try{c(n.next(l));}catch(a){r(a);}},i=l=>{try{c(n.throw(l));}catch(a){r(a);}},c=l=>l.done?o(l.value):Promise.resolve(l.value).then(s,i);c((n=n.apply(e,t)).next());});var ue="_$spread$";var Xe="http://www.w3.org/2000/svg",we="http://www.w3.org/2000/xlink",xe="http://www.w3.org/2000/xmlns/";var Ae=Symbol(""),ie=Symbol(""),Pe=Symbol(""),qe=Symbol("");var q=null,Et=0;function _(){return q}function H(e=q){let t=e?e.effectScope.run(()=>signals.effectScope()):signals.effectScope(true),n={id:++Et,effectScope:t,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 x(e,t){let n=q;q=e;try{return e.effectScope.run(t)}finally{q=n;}}function P(e){var t;if(!(!e||e.isDestroyed)){if(e.isDestroyed=true,e.children&&e.children.size>0){for(let n of e.children)n&&(n.parent=null,P(n));e.children.clear();}x(e,()=>{if(e.onDestroy){for(let n=0;n<e.onDestroy.length;n++)try{e.onDestroy[n]();}catch(o){}e.onDestroy=null;}if(e.cleanup){for(let n=0;n<e.cleanup.length;n++)try{e.cleanup[n]();}catch(o){}e.cleanup=null;}}),e.effectScope.stop(),(t=e.parent)!=null&&t.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 k(e){let t=q;t&&(t.cleanup||(t.cleanup=[]),t.cleanup.push(e));}function G(e,t,n,o){if(t==="key"){o==null?e.removeAttribute(t):e.setAttribute(t,String(o));return}if(t===ue){let d=shared.isObject(n)?n:null,m=shared.isObject(o)?o:null;if(d)for(let h in d)h!==ue&&(!m||!(h in m))&&G(e,h,d[h],null);if(m)for(let h in m)h!==ue&&G(e,h,d==null?void 0:d[h],m[h]);return}let r=(e==null?void 0:e.namespaceURI)===Xe,s=r&&t.startsWith("xlink:"),i=r&&t.startsWith("xmlns:"),c=shared.isSpecialBooleanAttr(t)||shared.isBooleanAttr(t);if(n===o||t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110)return;let l=t.toLowerCase();if(l==="innerhtml"||l==="srcdoc")return;if(o==null){if(s)e.removeAttributeNS(we,t.slice(6));else if(i){let d=t.slice(6);e.removeAttributeNS(xe,d);}else e.removeAttribute(t);return}if(c){shared.includeBooleanAttr(o)?e.setAttribute(t,""):e.removeAttribute(t);return}let a=shared.isSymbol(o)?String(o):o;if((l==="href"||l==="src"||l==="xlink:href"||l==="action"||l==="formaction"||l==="poster")&&shared.isString(a)){let d=a.trim().toLowerCase();if(d.startsWith("javascript:")||d.startsWith("data:"))return}if(s){e.setAttributeNS(we,t,String(a));return}if(i){e.setAttributeNS(xe,t,String(a));return}if(r)e.setAttribute(t,String(a));else if(t in e)try{e[t]=a;}catch(d){e.setAttribute(t,String(a));}else e.setAttribute(t,String(a));}function de(e,t,n,o=false){if(t===n)return;let r=fe(n);if(!r){e.removeAttribute("class");return}(shared.isString(t)?t:fe(t))!==r&&(o?e.setAttribute("class",r):e.className=r);}var fe=shared.normalizeClassName;var Je=/\s*!important$/,Lt=["Webkit","Moz","ms"],ke={};function pe(e,t,n){let o=e.style;if(n&&shared.isString(n)){t!==n&&(o.cssText=n);return}if(!n){t&&e.removeAttribute("style");return}if(t&&!shared.isString(t)){let r=t;for(let s in r)(!n||n[s]==null)&&J(o,s,"");}else if(t&&shared.isString(t)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,s;for(;(s=r.exec(t))!==null;){let i=s[1].trim();i&&n&&shared.isObject(n)&&n[i]==null&&J(o,i,"");}}if(n&&!shared.isString(n)){let r=n;for(let s in r){let i=r[s];(!t||shared.isString(t)||t[s]!==i)&&i!=null&&J(o,s,i);}}}function J(e,t,n){if(shared.isArray(n)){for(let s of n)J(e,t,s);return}(n==null||n==="")&&(n="");let o=shared.isString(n)&&Je.test(n)?"important":"";if(o&&(n=n.replace(Je,"")),t.startsWith("--")){o?e.setProperty(t,n,o):e.setProperty(t,n);return}let r=It(e,t);o?e.setProperty(Ft(r),n,o):e[r]=n;}function Ft(e){let t=shared.kebabCase(e);return e.startsWith("Webkit")||e.startsWith("Moz")||e.startsWith("ms")?`-${t}`:t}function It(e,t){let n=ke[t];if(n)return n;let o=shared.camelCase(t);if(o!=="filter"&&o in e)return ke[t]=o;o=shared.capitalize(o);for(let r of Lt){let s=r+o;if(s in e)return ke[t]=s}return t}var Te=0;function Qe(){return String(Te++)}function Vt(){Te=0;}var U=false;function le(){return U}var Q=new Map;function jt(e){let t=e.querySelectorAll("[data-hk]");for(let n of t){let o=n.dataset.hk;o!=null&&!Q.has(o)&&Q.set(o,n);}}var ye=[],se=new Map;function Kt(){if(typeof document=="undefined")return;let e=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),t;for(;t=e.nextNode();){let n=t.data;if(n==="teleport-anchor")ye.push(t);else if(n==="teleport-start"){let o=t.parentElement;if(!o)continue;let r=se.get(o);r||(r=[],se.set(o,r)),r.push(t);}}}function Re(){var e;return (e=ye.shift())!=null?e:null}function De(e){let t=se.get(e),n=t==null?void 0:t.shift();if(!n)return null;let o=[],r=n.nextSibling;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data==="teleport-end")return {start:n,end:r,nodes:o};o.push(r),r=r.nextSibling;}return null}function Me(e){U=true,Te=0,Q.clear(),ye.length=0,se.clear(),jt(e),Kt();}function Le(){U=false,Q.clear(),ye.length=0,se.clear();}function $t(e){if(!shared.isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let t=null;return ()=>{if(!U)return t||(t=me(e)),t();let n=Qe(),o=Q.get(n);return o?(Q.delete(n),o):(shared.warn(`[essor] hydration mismatch: no SSR element for key "${n}"`),t||(t=me(e)),t())}}function Ut(e,t,n,o){U||de(e,t,n,o);}function zt(e,t,n,o){U||G(e,t,n,o);}function Wt(e,t,n){U||pe(e,t,n);}function Fe(e,t){return t&&t.parentNode===e?t:null}function Ze(e,t,n,o){let r=Fe(e,o),s=t.length,i=n.length;if(s===0&&i===0)return n;if(s===0){for(let f=0;f<i;f++)M(e,n[f],r);return n}if(i===0){for(let f=0;f<s;f++)j(t[f]);return []}let c=0,l=s-1,a=i-1;for(;c<=l&&c<=a&&t[c]===n[c];)c++;for(;l>=c&&a>=c&&t[l]===n[a];)l--,a--;if(c>l){if(c<=a){let f=a+1,d=Fe(e,f<i?n[f]:r);for(let m=c;m<=a;m++)M(e,n[m],d);}}else if(c>a)for(let f=c;f<=l;f++)j(t[f]);else Bt(e,t,n,c,l,a,r);return n}function Bt(e,t,n,o,r,s,i){let c=s-o+1,l=new Map;for(let p=o;p<=s;p++)l.set(n[p],p);let a=new Int32Array(c);a.fill(0);let f=0,d=false,m=0;for(let p=o;p<=r;p++){let g=t[p];if(f>=c){j(g);continue}let u=l.get(g);u===void 0?j(g):(a[u-o]=p+1,u>=m?m=u:d=true,f++);}let h=d?Ie(a):[],v=h.length-1;for(let p=c-1;p>=0;p--){let g=o+p,u=n[g],y=Fe(e,g+1<n.length?n[g+1]:i);a[p]===0?M(e,u,y):d&&(v<0||p!==h[v]?M(e,u,y):v--);}}function Ie(e){let t=new Int32Array(e.length),n=[0],o=e.length,r,s,i,c,l;for(r=0;r<o;r++){let a=e[r];if(a!==0){if(s=n[n.length-1],e[s]<a){t[r]=s,n.push(r);continue}for(i=0,c=n.length-1;i<c;)l=i+c>>1,e[n[l]]<a?i=l+1:c=l;a<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r);}}for(i=n.length,c=n[i-1];i-- >0;)n[i]=c,c=t[c];return n}function j(e){if(e)if(L(e))e.destroy();else {let t=e;t.parentNode&&t.remove();}}function M(e,t,n){if(!e||!t)return;let o=L(n)?n.firstChild:n;if(L(t)){t.mount(e,o);return}o?e.insertBefore(t,o):e.appendChild(t);}function Z(e){if(e instanceof Node||L(e))return e;let t=typeof e;return e==null||t==="string"||t==="number"||t==="boolean"||t==="symbol"?document.createTextNode(e===false||e==null?"":String(e)):document.createTextNode(String(e))}function z(e,t,n){if(!e)return;let o=_(),r=[],s=true,i=l=>{if(l instanceof Node)return [l];if(L(l))return [l];let a=typeof l;return l==null||a==="string"||a==="number"||a==="boolean"?[Z(l)]:shared.coerceArray(l).map(f=>shared.isFunction(f)?f():f).flatMap(f=>f).map(Z)},c=signals.effect(()=>{let l=()=>{let a=shared.isFunction(t)?t():t,f=i(a);if(s&&le()&&f.every(d=>d instanceof Node&&d.parentNode===e)){r=f,s=false;return}r=Ze(e,r,f,n),s=false;};o&&!o.isDestroyed?x(o,l):l();});return k(()=>{c.stop();for(let l of r)j(l);r=[];}),r}function Gt(e){return (e==null?void 0:e.firstChild)||null}function Yt(e,t=1){for(;e&&t>0;)e=e.nextSibling,t--;return e||null}function Jt(e,t){if(!e||t<0)return null;let n=e.firstChild;for(;n&&t>0;)n=n.nextSibling,t--;return n||null}function ee(e,t,n,o){if(!(o!=null&&o.delegate))return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o);let r=o.delegate,s=a=>{let f=a.target;(f.matches(r)||f.closest(r))&&n.call(e,a);},l=o,{delegate:i}=l,c=Be(l,["delegate"]);return e.addEventListener(t,s,c),()=>{e.removeEventListener(t,s,c);}}function He(e,t,n){let o=e[t];o||(o=[],e[t]=o),o.push(n);}function nt(e,t,n){let o=e.length;if(o===0)return;let r;for(let s=0;s<o;s++)try{let i=e[s]();if(shared.isPromise(i)){let c=i.catch(l=>{});(r||(r=[])).push(c);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function Oe(e){let t=_();if(t){if(t.isMounted){try{let n=e();shared.isPromise(n)&&n.catch(o=>{});}catch(n){}return}He(t,"onMount",e);}}function Qt(e){let t=_();t&&He(t,"onUpdate",e);}function te(e){let t=_();t&&He(t,"onDestroy",e);}function ot(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let t=e.onMount,n=x(e,()=>nt(t,e.id));return t.length=0,e.isMounted=true,n}function rt(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return x(e,()=>nt(e.onUpdate,e.id))}function st(e,t,n=false){let o=n?new Set:null;for(let r of Object.getOwnPropertyNames(t))o==null||o.add(r),Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));if(o)for(let r of Object.getOwnPropertyNames(e))o.has(r)||delete e[r];}function nn(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return n.get?n.get.call(e):n.value}var lt;lt="normal";var ne=class{constructor(t,n={}){this.component=t;this.props=n;this[lt]=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=_();let o={};st(o,n),this.reactiveProps=signals.shallowReactive(o);}mount(t,n){var s;if(this.parentNode=t,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let i of this.renderedNodes)M(t,i,n);return this.state=2,this.renderedNodes}let o=H((s=this.parentScope)!=null?s:_());this.scope=o;let r=x(o,()=>{var c;let i=this.component(this.reactiveProps);return shared.isFunction(i)&&(i=i(this.reactiveProps)),(signals.isSignal(i)||signals.isComputed(i))&&(i=i.value),(c=z(t,i,n))!=null?c:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,ot(o),this.renderedNodes}update(t){this.props=t;let n=this.scope;!n||n.isDestroyed||(st(this.reactiveProps,t!=null?t:{},true),this.syncSpecialProps(t),rt(n));}forceUpdate(){if(!this.parentNode)return;let t=this.parentNode,n=this.beforeNode;this.destroy(),this.mount(t,n);}destroy(){let t=this.scope;if(!(!t||t.isDestroyed)){this.scope=null,this.releaseSpecialProps(),P(t);for(let n of this.renderedNodes)j(n);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;}}syncSpecialProps(t){if(!t)return;let n=this.firstChild;if(n){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(t)){let r=nn(t,o);if(o==="ref"){this.rootRefCleanup=this.bindRootRef(r,n);continue}if(shared.isOn(o)&&shared.isFunction(r)){let s=o.slice(2).toLowerCase();this.rootEventCleanups.push(ee(n,s,r));}}}}releaseSpecialProps(){for(let t of this.rootEventCleanups)t();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(t,n){if(shared.isFunction(t))return t(n),()=>t(null);if(signals.isSignal(t)){let o=t,r=o.value;return o.value=n,()=>{o.value===n&&(o.value=r);}}}};function L(e){return !!e&&!!e.normal}function he(e,t){return L(e)?e:new ne(e,t)}function me(e){let t,n=()=>{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 ()=>(t||(t=n())).cloneNode(true)}function on(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;n.innerHTML&&(n.innerHTML="");let r=H(),s;try{x(r,()=>{let i=he(e);L(i)&&(s=i,M(n,i));});}catch(i){throw P(r),i}return {root:s,unmount:()=>{P(r),s==null||s.destroy();}}}function rn(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;Me(n);let o=H(),r;try{x(o,()=>{let s=he(e);L(s)&&(r=s,z(n,s));});}catch(s){throw P(o),s}finally{Le();}return {root:r,unmount:()=>{P(o),r==null||r.destroy();}}}function je(e,t){let n=_();n&&(n.provides||(n.provides=new Map),n.provides.set(e,t));}function ce(e,t){let n=_();if(!n)return t;let o=n;for(;o;){if(o.provides&&o.provides.has(e))return o.provides.get(e);o=o.parent;}return t}function Ke(e,t){Object.defineProperty(e,"target",{configurable:true,value:t});}function ut(e){let t=e.target,n=e.type,o=e.target,r=e.currentTarget,s=()=>{let c=t[`_$${n}`];if(c&&shared.isFunction(c)&&!t.disabled){let l=t[`${n}Data`];if(l?c.call(t,l,e):c.call(t,e),e.cancelBubble)return false}return t.host&&!shared.isString(t.host)&&!t.host._$host&&shared.isFunction(t.contains)&&t.contains(e.target)&&Ke(e,t.host),true},i=()=>{for(;s()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return t||document}}),e.composedPath){let c=e.composedPath();Ke(e,c[0]);for(let l=0;l<c.length-2&&(t=c[l],!!s());l++){if(t._$host){t=t._$host,i();break}if(t.parentNode===r)break}}else i();Ke(e,o);}var ge=Symbol("_$EVENTS");function ln(e,t=window.document){let n=t,o=n[ge]||(n[ge]=new Set);for(let r of e)o.has(r)||(o.add(r),t.addEventListener(r,ut));}function cn(e=window.document){let t=e,n=t[ge];if(n){for(let o of n.keys())e.removeEventListener(o,ut);delete t[ge];}}function oe(e,t,n,o){let r=ee(e,t,n,o);_()&&k(r);}function $e(e,t){let n=e,o=t==null?"":String(t);n.value!==o&&(n.value=o);}var dn={event:"change",forceChange:true,read:e=>e.checked,write(e,t){let n=e,o=!!t;n.checked!==o&&(n.checked=o);}},pn={event:"change",forceChange:true,read(e){let t=e;return t.checked?t.value:""},write(e,t){let n=e,o=String(t)===n.value;n.checked!==o&&(n.checked=o);}},mn={event:"change",forceChange:true,read:e=>e.files,write(){}},yn={event:"input",ime:true,read:e=>e.value,write:$e},hn={event:"input",ime:true,read:e=>e.value,write:$e},gn={event:"change",forceChange:true,read(e){let t=e;return t.multiple?Array.from(t.selectedOptions,n=>n.value):t.value},write(e,t){let n=e;if(n.multiple){let o=new Set((Array.isArray(t)?t:[]).map(String));for(let r of Array.from(n.options))r.selected=o.has(r.value);}else $e(e,t);}};function Sn(e,t){switch(e.nodeName){case "INPUT":return t==="checked"?e.type==="radio"?pn:dn:t==="files"?mn:yn;case "SELECT":return gn;case "TEXTAREA":return hn;default:return {event:"input",read:n=>n[t],write(n,o){n[t]=o;}}}}function vn(e,t,n){if(!shared.isString(e))return e;let o=e;if(t&&(o=o.trim()),n&&o!==""){let r=Number(o);if(!Number.isNaN(r))return r}return o}function En(e){let t=e.getRootNode();return (t instanceof Document||t instanceof ShadowRoot)&&t.activeElement===e}function Nn(e,t,n,o,r={}){if(!e)return;let{event:s,read:i,write:c,forceChange:l,ime:a}=Sn(e,t),f=r.trim===true,d=r.number===true,m=r.lazy===true,h=(f||d)&&t!=="files",v=shared.isFunction(n)?n:()=>n,p=h?N=>vn(N,f,d):N=>N,g=false,u=m||l?"change":s,y=()=>{if(g)return;let N=i(e);if(N===void 0)return;let A=p(N);Object.is(v(),A)||o(A);};oe(e,u,y),!m&&h&&u!=="change"&&oe(e,"change",()=>c(e,p(i(e)))),a&&!m&&(oe(e,"compositionstart",()=>{g=true;}),oe(e,"compositionend",()=>{g&&(g=false,y());}));let E=signals.effect(()=>{let N=v();a&&!m&&En(e)&&(g||Object.is(p(i(e)),N))||c(e,N);});_()&&k(()=>E.stop());}function bn(e,t){let n=new Set(t);return new Proxy(e,{get(o,r){if(!n.has(r))return Reflect.get(o,r)},ownKeys(o){return Reflect.ownKeys(o).filter(r=>!n.has(r))},getOwnPropertyDescriptor(o,r){if(!n.has(r))return Reflect.getOwnPropertyDescriptor(o,r)},has(o,r){return n.has(r)?false:Reflect.has(o,r)}})}function ft(e){return !e||e.children==null?null:e.children}ft[Ae]=true;function Cn(e){return !!e&&!!e[Ae]}function Se(e){let t=shared.isFunction(e.target)?e.target():e.target;return t==null?null:shared.isString(t)?document.querySelector(t):t}function ve(e){return shared.isFunction(e.disabled)?!!e.disabled():!!e.disabled}function pt(e){if(le()){let f=xn(e);if(f)return f}let t=document.createComment("portal");t[ie]=true;let{children:n}=e;if(n==null)return t;let o=_(),r=null,s=(f,d)=>{r=H(o),x(r,()=>{z(f,()=>n,d);});},i=()=>{r&&(P(r),r=null);},c=(f,d)=>{if(i(),f){let m=t.parentNode;if(!m)return;s(m,t);return}d&&s(d);},l=false,a=signals.effect(()=>{let f=ve(e),d=f?null:Se(e);l&&c(f,d);});return Oe(()=>{l=!0;let f=ve(e),d=f?null:Se(e);if(f||d){c(f,d);return}queueMicrotask(()=>{t.parentNode&&c(ve(e),Se(e));});}),k(()=>{a.stop(),i();}),t}pt[ie]=true;function xn(e){if(ve(e))return null;let t=Re();if(!t)return null;let n=Se(e);return !n||!De(n)?null:(t[ie]=true,t)}function An(e){return !!e&&!!e[ie]}function Ne(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function mt(e){let t=e;for(;shared.isFunction(t);)t=t();return signals.isSignal(t)||signals.isComputed(t)?mt(t.value):t}var ae=Symbol("SuspenseContext");function yt(e){var v;if(!shared.isBrowser())return (v=e.fallback)!=null?v:"";let t=document.createElement("div");t.style.display="contents";let n=true,o=0,r=false,s=null,i=p=>{let g=mt(p);if(shared.isArray(g)){let u=[];for(let y of g){let E=i(y);shared.isArray(E)?u.push(...E):u.push(E);}return u}return Z(g)},c=p=>{let g=i(p),u=shared.isArray(g)?g:[g];for(let y of u)y!=null&&M(t,y);},l=()=>{Ne(t),e.fallback!=null&&c(e.fallback);},a=()=>{r||(r=true,l());},f=()=>{!r||!(s||e.children!=null&&!shared.isPromise(e.children))||(r=false,Ne(t),s?d(s):e.children!=null&&!shared.isPromise(e.children)&&d(e.children));},d=p=>{if(r||(Ne(t),p==null))return;let g=shared.isArray(p)?p:[p];for(let u of g)u!=null&&c(u);r&&l();},m={register:p=>{o++,a(),p.then(()=>{n&&(o--,o===0&&f());}).catch(g=>{n&&(o--,o===0&&f());});},increment:()=>{o++,a();},decrement:()=>{o=Math.max(0,o-1),o===0&&f();}};je(ae,m);let h=e.children;return shared.isPromise(h)?(h.then(p=>{s=p;}).catch(()=>{}),m.register(h)):h!=null?d(h):a(),te(()=>{n=false,o=0,s=null,Ne(t),t.remove();}),t}yt[Pe]=true;function Dn(e){return !!e&&!!e[Pe]}function Mn(e,t){let n=signals.signal(t==null?void 0:t.initialValue),o=signals.signal(true),r=signals.signal(null),s=signals.signal("pending"),i=0,c=null,l=false,a=ce(ae,null),f=()=>_e(null,null,function*(){let h=++i;o.value=true,s.value="pending",r.value=null,l=false,a&&a.increment();try{let v=e();c=v,v.catch(()=>{});let p=yield v;h===i&&(n.value=p,s.value="ready",o.value=!1);}catch(v){h===i&&(r.value=v instanceof Error?v:new Error(String(v)),s.value="errored",o.value=false);}finally{a&&a.decrement();}});f();let d=(()=>(!l&&o.value&&c&&a&&(l=true,a.register(c)),n.value));return d.loading=o,d.error=r,d.state=s,[d,{mutate:h=>{n.value=h,s.value="ready",o.value=false,r.value=null;},refetch:()=>_e(null,null,function*(){yield f();})}]}function ht(e){return shared.isFunction(e)?e:e.default}function ze(e,t,n){let o=new ne(t,n);return o.mount(e),o}function Fn(e,t={}){let{delay:n=200,timeout:o,ssr:r="blocking",onError:s}=t;if(typeof window=="undefined"){if(r==="client-only"){let g=()=>"";return g.__asyncLoader=e,g.__asyncResolved=()=>null,g}let m=null,h=null,v=()=>h||(h=e().then(g=>{m=ht(g);}).catch(()=>{}),h);v();let p=g=>m?m(g):"";return p.__asyncLoader=v,p.__asyncResolved=()=>m,p}let i=null,c=null,l="pending",a=null;function f(){return a||(a=e().then(m=>{i=ht(m),l="resolved";}).catch(m=>{c=m instanceof Error?m:new Error(String(m)),l="errored",a=null;}),a)}f();function d(m){var W;if(l==="resolved"&&i){let b=document.createElement("div");b.style.display="contents";let F=ze(b,i,m);return k(()=>F.destroy()),b}if(l==="errored"&&c){let b=document.createElement("div");if(b.style.display="contents",t.error){let F=true,R=null,K=(X,S)=>{F&&(R==null||R.destroy(),R=ze(b,X,S));},B=()=>{a=null,l="pending",c=null,t.loading&&K(t.loading),f().then(()=>{F&&(l==="resolved"&&i?K(i,m):l==="errored"&&c&&t.error&&K(t.error,{error:c,retry:B}));});};K(t.error,{error:c,retry:B}),te(()=>{F=false,R==null||R.destroy(),R=null;});}return b}let h=document.createElement("div");h.style.display="contents";let v=true,p=null,g=null,u=null,y=(b,F)=>{v&&(p==null||p.destroy(),p=ze(h,b,F));},E=b=>()=>{a=null,l="pending",c=null,t.loading&&y(t.loading),f().then(()=>{l==="resolved"&&i?y(i,b):l==="errored"&&c&&t.error&&y(t.error,{error:c,retry:E(b)});});};te(()=>{v=false,p==null||p.destroy(),p=null,g!=null&&clearTimeout(g),u!=null&&clearTimeout(u);});let N=(W=ce(ae))!=null?W:null,A=b=>y(b,m),T=b=>{t.error&&y(t.error,{error:b,retry:E(m)});},O=()=>{t.loading&&y(t.loading);},V=f().then(()=>{v&&(l==="resolved"&&i?A(i):l==="errored"&&c&&(T(c),s&&s(c,E(m))),g!=null&&clearTimeout(g),u!=null&&clearTimeout(u));});return N&&N.register(V),n>0?g=setTimeout(()=>{v&&l==="pending"&&O();},n):t.loading&&O(),o!=null&&(u=setTimeout(()=>{if(v&&l==="pending"){let b=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);c=b,l="errored",T(b),s&&s(b,E(m));}},o)),h}return d.__asyncLoader=f,d.__asyncResolved=()=>i,d}function gt(e){let t=document.createDocumentFragment(),n=document.createComment("");t.appendChild(n);let o=[],r=[],s=e.key,i=e.children,c=()=>{var y,E;let u=e.each;return signals.isSignal(u)?(y=u.value)!=null?y:[]:shared.isFunction(u)?(E=u())!=null?E:[]:u!=null?u:[]},l=u=>s?s(u):u,a=u=>{if(Array.isArray(u)){let y=[];for(let E of u)y.push(...a(E));return y}return [Z(u)]},f=(u,y,E)=>{let N=a(u);for(let A of N)E?y.insertBefore(A,E):y.appendChild(A);return N},d=(u,y)=>{if(!e.fallback)return;r=f(e.fallback(),u,y);},m=()=>{for(let u of r)u.parentNode&&u.parentNode.removeChild(u);r=[];},h=(u,y,E,N)=>{let A=_(),T=H(A),O=[];return x(T,()=>{O=f(i(u,y),E,N);}),{key:l(u),item:u,nodes:O,scope:T}},v=u=>{P(u.scope);for(let y of u.nodes)y.parentNode&&y.parentNode.removeChild(y);},p=signals.effect(()=>{let u=c(),y=n.parentNode;if(!y){if(u.length===0)d(t,n);else {o=new Array(u.length);let E=0;for(let N of u)o[E]=h(N,E,t,n),E++;}return}g(y,u);});function g(u,y){let E=o.length,N=y.length;if(N===0){for(let S=0;S<E;S++)v(o[S]);o=[],e.fallback&&r.length===0&&d(u,n);return}if(E===0||r.length>0){r.length>0&&m(),o=new Array(N);let S=document.createDocumentFragment();for(let w=0;w<N;w++)o[w]=h(y[w],w,S,null);u.insertBefore(S,n);return}let A=new Map;for(let S=0;S<E;S++){let w=o[S],I=A.get(w.key),$=[w,S];I?I.push($):A.set(w.key,[$]);}let T=new Array(N),O=[],V=null,W=new Int32Array(N),b=false,F=0,R=new Array(N);for(let S=0;S<N;S++)R[S]=l(y[S]);for(let S=0;S<N;S++){let w=y[S],I=R[S],$=A.get(I);if($&&$.length>0){let[re,D]=$.shift();Object.is(re.item,w)?(re.item=w,T[S]=re,W[S]=D+1,D<F?b=true:F=D):(V||(V=document.createDocumentFragment()),v(re),T[S]=h(w,S,V,null));}else V||(V=document.createDocumentFragment()),T[S]=h(w,S,V,null);}for(let S of A.values())for(let[w]of S)O.push(w);for(let S of O)v(S);let K=b?Ie(W):[],B=K.length-1,X=n;for(let S=N-1;S>=0;S--){let I=T[S].nodes;if(!(W[S]===0)&&b&&B>=0&&S===K[B]){B--;for(let D=I.length-1;D>=0;D--)X=I[D];continue}for(let D=I.length-1;D>=0;D--){let Ce=I[D];Ce.nextSibling!==X&&u.insertBefore(Ce,X),X=Ce;}}o=T;}return k(()=>{p.stop();for(let u of o)v(u);o=[],m(),n.parentNode&&n.parentNode.removeChild(n);}),t}gt[qe]=true;
2
- exports.Component=ne;exports.For=gt;exports.Fragment=ft;exports.Portal=pt;exports.Suspense=yt;exports.addEvent=ee;exports.addEventListener=oe;exports.beginHydration=Me;exports.bindElement=Nn;exports.child=Gt;exports.clearDelegatedEvents=cn;exports.consumeTeleportAnchor=Re;exports.consumeTeleportBlock=De;exports.createApp=on;exports.createComponent=he;exports.createResource=Mn;exports.defineAsyncComponent=Fn;exports.delegateEvents=ln;exports.endHydration=Le;exports.getHydrationKey=Qe;exports.getRenderedElement=$t;exports.hydrate=rn;exports.inject=ce;exports.insert=z;exports.isComponent=L;exports.isFragment=Cn;exports.isHydrating=le;exports.isPortal=An;exports.isSuspense=Dn;exports.next=Yt;exports.normalizeClass=fe;exports.nthChild=Jt;exports.omitProps=bn;exports.onDestroy=te;exports.onMount=Oe;exports.onUpdate=Qt;exports.patchAttr=G;exports.patchAttrHydrate=zt;exports.patchClass=de;exports.patchClassHydrate=Ut;exports.patchStyle=pe;exports.patchStyleHydrate=Wt;exports.provide=je;exports.resetHydrationKey=Vt;exports.setStyle=J;exports.template=me;
1
+ 'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var We=Object.getOwnPropertySymbols;var vt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var Be=(e,t)=>{var n={};for(var o in e)vt.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&We)for(var o of We(e))t.indexOf(o)<0&&Et.call(e,o)&&(n[o]=e[o]);return n};var _e=(e,t,n)=>new Promise((o,r)=>{var s=l=>{try{c(n.next(l));}catch(a){r(a);}},i=l=>{try{c(n.throw(l));}catch(a){r(a);}},c=l=>l.done?o(l.value):Promise.resolve(l.value).then(s,i);c((n=n.apply(e,t)).next());});var ue="_$spread$";var Xe="http://www.w3.org/2000/svg",we="http://www.w3.org/2000/xlink",xe="http://www.w3.org/2000/xmlns/";var Ae=Symbol(""),ie=Symbol(""),Pe=Symbol(""),qe=Symbol("");var q=null,Nt=0;function _(){return q}function O(e=q){let t=e?e.effectScope.run(()=>signals.effectScope()):signals.effectScope(true),n={id:++Nt,effectScope:t,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 x(e,t){let n=q;q=e;try{return e.effectScope.run(t)}finally{q=n;}}function P(e){var t;if(!(!e||e.isDestroyed)){if(e.isDestroyed=true,e.children&&e.children.size>0){for(let n of e.children)n&&(n.parent=null,P(n));e.children.clear();}x(e,()=>{if(e.onDestroy){for(let n=0;n<e.onDestroy.length;n++)try{e.onDestroy[n]();}catch(o){}e.onDestroy=null;}if(e.cleanup){for(let n=0;n<e.cleanup.length;n++)try{e.cleanup[n]();}catch(o){}e.cleanup=null;}}),e.effectScope.stop(),(t=e.parent)!=null&&t.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 k(e){let t=q;t&&(t.cleanup||(t.cleanup=[]),t.cleanup.push(e));}function G(e,t,n,o){if(t==="key"){o==null?e.removeAttribute(t):e.setAttribute(t,String(o));return}if(t===ue){let d=shared.isObject(n)?n:null,p=shared.isObject(o)?o:null;if(d)for(let h in d)h!==ue&&(!p||!(h in p))&&G(e,h,d[h],null);if(p)for(let h in p)h!==ue&&G(e,h,d==null?void 0:d[h],p[h]);return}let r=(e==null?void 0:e.namespaceURI)===Xe,s=r&&t.startsWith("xlink:"),i=r&&t.startsWith("xmlns:"),c=shared.isSpecialBooleanAttr(t)||shared.isBooleanAttr(t);if(n===o||t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110)return;let l=t.toLowerCase();if(l==="innerhtml"||l==="srcdoc")return;if(o==null){if(s)e.removeAttributeNS(we,t.slice(6));else if(i){let d=t.slice(6);e.removeAttributeNS(xe,d);}else e.removeAttribute(t);return}if(c){shared.includeBooleanAttr(o)?e.setAttribute(t,""):e.removeAttribute(t);return}let a=shared.isSymbol(o)?String(o):o;if((l==="href"||l==="src"||l==="xlink:href"||l==="action"||l==="formaction"||l==="poster")&&shared.isString(a)){let d=a.trim().toLowerCase();if(d.startsWith("javascript:")||d.startsWith("data:"))return}if(s){e.setAttributeNS(we,t,String(a));return}if(i){e.setAttributeNS(xe,t,String(a));return}if(r)e.setAttribute(t,String(a));else if(t in e)try{e[t]=a;}catch(d){e.setAttribute(t,String(a));}else e.setAttribute(t,String(a));}function de(e,t,n,o=false){if(t===n)return;let r=fe(n);if(!r){e.removeAttribute("class");return}(shared.isString(t)?t:fe(t))!==r&&(o?e.setAttribute("class",r):e.className=r);}var fe=shared.normalizeClassName;var Je=/\s*!important$/,Ft=["Webkit","Moz","ms"],ke={};function me(e,t,n){let o=e.style;if(n&&shared.isString(n)){t!==n&&(o.cssText=n);return}if(!n){t&&e.removeAttribute("style");return}if(t&&!shared.isString(t)){let r=t;for(let s in r)(!n||n[s]==null)&&J(o,s,"");}else if(t&&shared.isString(t)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,s;for(;(s=r.exec(t))!==null;){let i=s[1].trim();i&&n&&shared.isObject(n)&&n[i]==null&&J(o,i,"");}}if(n&&!shared.isString(n)){let r=n;for(let s in r){let i=r[s];(!t||shared.isString(t)||t[s]!==i)&&i!=null&&J(o,s,i);}}}function J(e,t,n){if(shared.isArray(n)){for(let s of n)J(e,t,s);return}(n==null||n==="")&&(n="");let o=shared.isString(n)&&Je.test(n)?"important":"";if(o&&(n=n.replace(Je,"")),t.startsWith("--")){o?e.setProperty(t,n,o):e.setProperty(t,n);return}let r=Ht(e,t);o?e.setProperty(It(r),n,o):e[r]=n;}function It(e){let t=shared.kebabCase(e);return e.startsWith("Webkit")||e.startsWith("Moz")||e.startsWith("ms")?`-${t}`:t}function Ht(e,t){let n=ke[t];if(n)return n;let o=shared.camelCase(t);if(o!=="filter"&&o in e)return ke[t]=o;o=shared.capitalize(o);for(let r of Ft){let s=r+o;if(s in e)return ke[t]=s}return t}var Te=0;function Qe(){return String(Te++)}function jt(){Te=0;}var U=false;function le(){return U}var Q=new Map;function Kt(e){let t=e.querySelectorAll("[data-hk]");for(let n of t){let o=n.dataset.hk;o!=null&&!Q.has(o)&&Q.set(o,n);}}var ye=[],se=new Map;function $t(){if(typeof document=="undefined")return;let e=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),t;for(;t=e.nextNode();){let n=t.data;if(n==="teleport-anchor")ye.push(t);else if(n==="teleport-start"){let o=t.parentElement;if(!o)continue;let r=se.get(o);r||(r=[],se.set(o,r)),r.push(t);}}}function Re(){var e;return (e=ye.shift())!=null?e:null}function De(e){let t=se.get(e),n=t==null?void 0:t.shift();if(!n)return null;let o=[],r=n.nextSibling;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data==="teleport-end")return {start:n,end:r,nodes:o};o.push(r),r=r.nextSibling;}return null}function Me(e){U=true,Te=0,Q.clear(),ye.length=0,se.clear(),Kt(e),$t();}function Le(){U=false,Q.clear(),ye.length=0,se.clear();}function Ut(e){if(!shared.isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let t=null;return ()=>{if(!U)return t||(t=pe(e)),t();let n=Qe(),o=Q.get(n);return o?(Q.delete(n),o):(shared.warn(`[essor] hydration mismatch: no SSR element for key "${n}"`),t||(t=pe(e)),t())}}function zt(e,t,n,o){U||de(e,t,n,o);}function Wt(e,t,n,o){U||G(e,t,n,o);}function Bt(e,t,n){U||me(e,t,n);}function Fe(e,t){return t&&t.parentNode===e?t:null}function Ze(e,t,n,o){let r=Fe(e,o),s=t.length,i=n.length;if(s===0&&i===0)return n;if(s===0){for(let f=0;f<i;f++)L(e,n[f],r);return n}if(i===0){for(let f=0;f<s;f++)j(t[f]);return []}let c=0,l=s-1,a=i-1;for(;c<=l&&c<=a&&t[c]===n[c];)c++;for(;l>=c&&a>=c&&t[l]===n[a];)l--,a--;if(c>l){if(c<=a){let f=a+1,d=Fe(e,f<i?n[f]:r);for(let p=c;p<=a;p++)L(e,n[p],d);}}else if(c>a)for(let f=c;f<=l;f++)j(t[f]);else Xt(e,t,n,c,l,a,r);return n}function Xt(e,t,n,o,r,s,i){let c=s-o+1,l=new Map;for(let m=o;m<=s;m++)l.set(n[m],m);let a=new Int32Array(c);a.fill(0);let f=0,d=false,p=0;for(let m=o;m<=r;m++){let g=t[m];if(f>=c){j(g);continue}let u=l.get(g);u===void 0?j(g):(a[u-o]=m+1,u>=p?p=u:d=true,f++);}let h=d?Ie(a):[],v=h.length-1;for(let m=c-1;m>=0;m--){let g=o+m,u=n[g],y=Fe(e,g+1<n.length?n[g+1]:i);a[m]===0?L(e,u,y):d&&(v<0||m!==h[v]?L(e,u,y):v--);}}function Ie(e){let t=new Int32Array(e.length),n=[0],o=e.length,r,s,i,c,l;for(r=0;r<o;r++){let a=e[r];if(a!==0){if(s=n[n.length-1],e[s]<a){t[r]=s,n.push(r);continue}for(i=0,c=n.length-1;i<c;)l=i+c>>1,e[n[l]]<a?i=l+1:c=l;a<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r);}}for(i=n.length,c=n[i-1];i-- >0;)n[i]=c,c=t[c];return n}function j(e){if(e)if(F(e))e.destroy();else {let t=e;t.parentNode&&t.remove();}}function L(e,t,n){if(!e||!t)return;let o=F(n)?n.firstChild:n;if(F(t)){t.mount(e,o);return}o?e.insertBefore(t,o):e.appendChild(t);}function Z(e){if(e instanceof Node||F(e))return e;let t=typeof e;return e==null||t==="string"||t==="number"||t==="boolean"||t==="symbol"?document.createTextNode(e===false||e==null?"":String(e)):document.createTextNode(String(e))}function z(e,t,n){if(!e)return;let o=_(),r=[],s=true,i=l=>{if(l instanceof Node)return [l];if(F(l))return [l];let a=typeof l;return l==null||a==="string"||a==="number"||a==="boolean"?[Z(l)]:shared.coerceArray(l).map(f=>shared.isFunction(f)?f():f).flatMap(f=>f).map(Z)},c=signals.effect(()=>{let l=()=>{let a=shared.isFunction(t)?t():t,f=i(a);if(s&&le()&&f.every(d=>d instanceof Node&&d.parentNode===e)){r=f,s=false;return}r=Ze(e,r,f,n),s=false;};o&&!o.isDestroyed?x(o,l):l();});return k(()=>{c.stop();for(let l of r)j(l);r=[];}),r}function Yt(e){return (e==null?void 0:e.firstChild)||null}function Jt(e,t=1){for(;e&&t>0;)e=e.nextSibling,t--;return e||null}function Qt(e,t){if(!e||t<0)return null;let n=e.firstChild;for(;n&&t>0;)n=n.nextSibling,t--;return n||null}function ee(e,t,n,o){if(!(o!=null&&o.delegate))return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o);let r=o.delegate,s=a=>{let f=a.target;(f.matches(r)||f.closest(r))&&n.call(e,a);},l=o,{delegate:i}=l,c=Be(l,["delegate"]);return e.addEventListener(t,s,c),()=>{e.removeEventListener(t,s,c);}}function He(e,t,n){let o=e[t];o||(o=[],e[t]=o),o.push(n);}function nt(e,t,n){let o=e.length;if(o===0)return;let r;for(let s=0;s<o;s++)try{let i=e[s]();if(shared.isPromise(i)){let c=i.catch(l=>{});(r||(r=[])).push(c);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function Oe(e){let t=_();if(t){if(t.isMounted){try{let n=e();shared.isPromise(n)&&n.catch(o=>{});}catch(n){}return}He(t,"onMount",e);}}function Zt(e){let t=_();t&&He(t,"onUpdate",e);}function te(e){let t=_();t&&He(t,"onDestroy",e);}function ot(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let t=e.onMount,n=x(e,()=>nt(t,e.id));return t.length=0,e.isMounted=true,n}function rt(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return x(e,()=>nt(e.onUpdate,e.id))}function st(e,t,n=false){let o=n?new Set:null;for(let r of Object.getOwnPropertyNames(t))o==null||o.add(r),Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));if(o)for(let r of Object.getOwnPropertyNames(e))o.has(r)||delete e[r];}function lt(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return n.get?n.get.call(e):n.value}var ct;ct="normal";var ne=class{constructor(t,n={}){this.component=t;this.props=n;this[ct]=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=_();let o={};st(o,n),this.reactiveProps=signals.shallowReactive(o);}mount(t,n){var s;if(this.parentNode=t,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let i of this.renderedNodes)L(t,i,n);return this.state=2,this.renderedNodes}let o=O((s=this.parentScope)!=null?s:_());this.scope=o;let r=x(o,()=>{var c;let i=this.component(this.reactiveProps);return shared.isFunction(i)&&(i=i(this.reactiveProps)),(signals.isSignal(i)||signals.isComputed(i))&&(i=i.value),(c=z(t,i,n))!=null?c:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,ot(o),this.renderedNodes}update(t){this.props=t;let n=this.scope;!n||n.isDestroyed||(st(this.reactiveProps,t!=null?t:{},true),this.syncSpecialProps(t),rt(n));}forceUpdate(){if(!this.parentNode)return;let t=this.parentNode,n=this.beforeNode;this.destroy(),this.mount(t,n);}destroy(){let t=this.scope;if(!(!t||t.isDestroyed)){this.scope=null,this.releaseSpecialProps(),P(t);for(let n of this.renderedNodes)j(n);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;}}syncSpecialProps(t){if(!t)return;let n=this.firstChild;if(n){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(t)){if(o==="ref"){let r=lt(t,o);this.rootRefCleanup=this.bindRootRef(r,n);continue}if(shared.isOn(o)){let r=lt(t,o);if(!shared.isFunction(r))continue;let s=o.slice(2).toLowerCase();this.rootEventCleanups.push(ee(n,s,r));}}}}releaseSpecialProps(){for(let t of this.rootEventCleanups)t();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(t,n){if(shared.isFunction(t))return t(n),()=>t(null);if(signals.isSignal(t)){let o=t,r=o.value;return o.value=n,()=>{o.value===n&&(o.value=r);}}}};function F(e){return !!e&&!!e.normal}function he(e,t){return F(e)?e:new ne(e,t)}function pe(e){let t,n=()=>{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 ()=>(t||(t=n())).cloneNode(true)}function on(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;n.innerHTML&&(n.innerHTML="");let r=O(),s;try{x(r,()=>{let i=he(e);F(i)&&(s=i,L(n,i));});}catch(i){throw P(r),i}return {root:s,unmount:()=>{P(r),s==null||s.destroy();}}}function rn(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;Me(n);let o=O(),r;try{x(o,()=>{let s=he(e);F(s)&&(r=s,z(n,s));});}catch(s){throw P(o),s}finally{Le();}return {root:r,unmount:()=>{P(o),r==null||r.destroy();}}}function je(e,t){let n=_();n&&(n.provides||(n.provides=new Map),n.provides.set(e,t));}function ce(e,t){let n=_();if(!n)return t;let o=n;for(;o;){if(o.provides&&o.provides.has(e))return o.provides.get(e);o=o.parent;}return t}function Ke(e,t){Object.defineProperty(e,"target",{configurable:true,value:t});}function ft(e){let t=e.target,n=e.type,o=e.target,r=e.currentTarget,s=()=>{let c=t[`_$${n}`];if(c&&shared.isFunction(c)&&!t.disabled){let l=t[`${n}Data`];if(l?c.call(t,l,e):c.call(t,e),e.cancelBubble)return false}return t.host&&!shared.isString(t.host)&&!t.host._$host&&shared.isFunction(t.contains)&&t.contains(e.target)&&Ke(e,t.host),true},i=()=>{for(;s()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return t||document}}),e.composedPath){let c=e.composedPath();Ke(e,c[0]);for(let l=0;l<c.length-2&&(t=c[l],!!s());l++){if(t._$host){t=t._$host,i();break}if(t.parentNode===r)break}}else i();Ke(e,o);}var ge=Symbol("_$EVENTS");function ln(e,t=window.document){let n=t,o=n[ge]||(n[ge]=new Set);for(let r of e)o.has(r)||(o.add(r),t.addEventListener(r,ft));}function cn(e=window.document){let t=e,n=t[ge];if(n){for(let o of n.keys())e.removeEventListener(o,ft);delete t[ge];}}function oe(e,t,n,o){let r=ee(e,t,n,o);_()&&k(r);}function $e(e,t){let n=e,o=t==null?"":String(t);n.value!==o&&(n.value=o);}var dn={event:"change",forceChange:true,read:e=>e.checked,write(e,t){let n=e,o=!!t;n.checked!==o&&(n.checked=o);}},mn={event:"change",forceChange:true,read(e){let t=e;return t.checked?t.value:""},write(e,t){let n=e,o=String(t)===n.value;n.checked!==o&&(n.checked=o);}},pn={event:"change",forceChange:true,read:e=>e.files,write(){}},yn={event:"input",ime:true,read:e=>e.value,write:$e},hn={event:"input",ime:true,read:e=>e.value,write:$e},gn={event:"change",forceChange:true,read(e){let t=e;return t.multiple?Array.from(t.selectedOptions,n=>n.value):t.value},write(e,t){let n=e;if(n.multiple){let o=new Set((Array.isArray(t)?t:[]).map(String));for(let r of Array.from(n.options))r.selected=o.has(r.value);}else $e(e,t);}};function Sn(e,t){switch(e.nodeName){case "INPUT":return t==="checked"?e.type==="radio"?mn:dn:t==="files"?pn:yn;case "SELECT":return gn;case "TEXTAREA":return hn;default:return {event:"input",read:n=>n[t],write(n,o){n[t]=o;}}}}function vn(e,t,n){if(!shared.isString(e))return e;let o=e;if(t&&(o=o.trim()),n&&o!==""){let r=Number(o);if(!Number.isNaN(r))return r}return o}function En(e){let t=e.getRootNode();return (t instanceof Document||t instanceof ShadowRoot)&&t.activeElement===e}function Nn(e,t,n,o,r={}){if(!e)return;let{event:s,read:i,write:c,forceChange:l,ime:a}=Sn(e,t),f=r.trim===true,d=r.number===true,p=r.lazy===true,h=(f||d)&&t!=="files",v=shared.isFunction(n)?n:()=>n,m=h?N=>vn(N,f,d):N=>N,g=false,u=p||l?"change":s,y=()=>{if(g)return;let N=i(e);if(N===void 0)return;let A=m(N);Object.is(v(),A)||o(A);};oe(e,u,y),!p&&h&&u!=="change"&&oe(e,"change",()=>c(e,m(i(e)))),a&&!p&&(oe(e,"compositionstart",()=>{g=true;}),oe(e,"compositionend",()=>{g&&(g=false,y());}));let E=signals.effect(()=>{let N=v();a&&!p&&En(e)&&(g||Object.is(m(i(e)),N))||c(e,N);});_()&&k(()=>E.stop());}function bn(e,t){let n=new Set(t);return new Proxy(e,{get(o,r){if(!n.has(r))return Reflect.get(o,r)},ownKeys(o){return Reflect.ownKeys(o).filter(r=>!n.has(r))},getOwnPropertyDescriptor(o,r){if(!n.has(r))return Reflect.getOwnPropertyDescriptor(o,r)},has(o,r){return n.has(r)?false:Reflect.has(o,r)}})}function dt(e){let t=e==null?void 0:e.children;return t==null?null:t}dt[Ae]=true;function Cn(e){return !!e&&!!e[Ae]}function Se(e){let t=shared.isFunction(e.target)?e.target():e.target;return t==null?null:shared.isString(t)?document.querySelector(t):t}function ve(e){return shared.isFunction(e.disabled)?!!e.disabled():!!e.disabled}function pt(e){if(le()){let f=xn(e);if(f)return f}let t=document.createComment("portal");t[ie]=true;let{children:n}=e;if(n==null)return t;let o=_(),r=null,s=(f,d)=>{r=O(o),x(r,()=>{z(f,()=>n,d);});},i=()=>{r&&(P(r),r=null);},c=(f,d)=>{if(i(),f){let p=t.parentNode;if(!p)return;s(p,t);return}d&&s(d);},l=false,a=signals.effect(()=>{let f=ve(e),d=f?null:Se(e);l&&c(f,d);});return Oe(()=>{l=!0;let f=ve(e),d=f?null:Se(e);if(f||d){c(f,d);return}queueMicrotask(()=>{t.parentNode&&c(ve(e),Se(e));});}),k(()=>{a.stop(),i();}),t}pt[ie]=true;function xn(e){if(ve(e))return null;let t=Re();if(!t)return null;let n=Se(e);return !n||!De(n)?null:(t[ie]=true,t)}function An(e){return !!e&&!!e[ie]}function Ne(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function yt(e){let t=e;for(;shared.isFunction(t);)t=t();return signals.isSignal(t)||signals.isComputed(t)?yt(t.value):t}var ae=Symbol("SuspenseContext");function ht(e){var v;if(!shared.isBrowser())return (v=e.fallback)!=null?v:"";let t=document.createElement("div");t.style.display="contents";let n=true,o=0,r=false,s=null,i=m=>{let g=yt(m);if(shared.isArray(g)){let u=[];for(let y of g){let E=i(y);shared.isArray(E)?u.push(...E):u.push(E);}return u}return Z(g)},c=m=>{let g=i(m),u=shared.isArray(g)?g:[g];for(let y of u)y!=null&&L(t,y);},l=()=>{Ne(t),e.fallback!=null&&c(e.fallback);},a=()=>{r||(r=true,l());},f=()=>{!r||!(s||e.children!=null&&!shared.isPromise(e.children))||(r=false,Ne(t),s?d(s):e.children!=null&&!shared.isPromise(e.children)&&d(e.children));},d=m=>{if(r||(Ne(t),m==null))return;let g=shared.isArray(m)?m:[m];for(let u of g)u!=null&&c(u);r&&l();},p={register:m=>{o++,a(),m.then(()=>{n&&(o--,o===0&&f());}).catch(g=>{n&&(o--,o===0&&f());});},increment:()=>{o++,a();},decrement:()=>{o=Math.max(0,o-1),o===0&&f();}};je(ae,p);let h=e.children;return shared.isPromise(h)?(h.then(m=>{s=m;}).catch(()=>{}),p.register(h)):h!=null?d(h):a(),te(()=>{n=false,o=0,s=null,Ne(t),t.remove();}),t}ht[Pe]=true;function Dn(e){return !!e&&!!e[Pe]}function Mn(e,t){let n=signals.signal(t==null?void 0:t.initialValue),o=signals.signal(true),r=signals.signal(null),s=signals.signal("pending"),i=0,c=null,l=false,a=ce(ae,null),f=()=>_e(null,null,function*(){let h=++i;o.value=true,s.value="pending",r.value=null,l=false,a&&a.increment();try{let v=e();c=v,v.catch(()=>{});let m=yield v;h===i&&(n.value=m,s.value="ready",o.value=!1);}catch(v){h===i&&(r.value=v instanceof Error?v:new Error(String(v)),s.value="errored",o.value=false);}finally{a&&a.decrement();}});f();let d=(()=>(!l&&o.value&&c&&a&&(l=true,a.register(c)),n.value));return d.loading=o,d.error=r,d.state=s,[d,{mutate:h=>{n.value=h,s.value="ready",o.value=false,r.value=null;},refetch:()=>_e(null,null,function*(){yield f();})}]}function gt(e){return shared.isFunction(e)?e:e.default}function ze(e,t,n){let o=new ne(t,n);return o.mount(e),o}function Fn(e,t={}){let{delay:n=200,timeout:o,ssr:r="blocking",onError:s}=t;if(typeof window=="undefined"){if(r==="client-only"){let g=()=>"";return g.__asyncLoader=e,g.__asyncResolved=()=>null,g}let p=null,h=null,v=()=>h||(h=e().then(g=>{p=gt(g);}).catch(()=>{}),h);v();let m=g=>p?p(g):"";return m.__asyncLoader=v,m.__asyncResolved=()=>p,m}let i=null,c=null,l="pending",a=null;function f(){return a||(a=e().then(p=>{i=gt(p),l="resolved";}).catch(p=>{c=p instanceof Error?p:new Error(String(p)),l="errored",a=null;}),a)}f();function d(p){var W;if(l==="resolved"&&i){let b=document.createElement("div");b.style.display="contents";let H=ze(b,i,p);return k(()=>H.destroy()),b}if(l==="errored"&&c){let b=document.createElement("div");if(b.style.display="contents",t.error){let H=true,R=null,K=(X,S)=>{H&&(R==null||R.destroy(),R=ze(b,X,S));},B=()=>{a=null,l="pending",c=null,t.loading&&K(t.loading),f().then(()=>{H&&(l==="resolved"&&i?K(i,p):l==="errored"&&c&&t.error&&K(t.error,{error:c,retry:B}));});};K(t.error,{error:c,retry:B}),te(()=>{H=false,R==null||R.destroy(),R=null;});}return b}let h=document.createElement("div");h.style.display="contents";let v=true,m=null,g=null,u=null,y=(b,H)=>{v&&(m==null||m.destroy(),m=ze(h,b,H));},E=b=>()=>{a=null,l="pending",c=null,t.loading&&y(t.loading),f().then(()=>{l==="resolved"&&i?y(i,b):l==="errored"&&c&&t.error&&y(t.error,{error:c,retry:E(b)});});};te(()=>{v=false,m==null||m.destroy(),m=null,g!=null&&clearTimeout(g),u!=null&&clearTimeout(u);});let N=(W=ce(ae))!=null?W:null,A=b=>y(b,p),I=b=>{t.error&&y(t.error,{error:b,retry:E(p)});},V=()=>{t.loading&&y(t.loading);},T=f().then(()=>{v&&(l==="resolved"&&i?A(i):l==="errored"&&c&&(I(c),s&&s(c,E(p))),g!=null&&clearTimeout(g),u!=null&&clearTimeout(u));});return N&&N.register(T),n>0?g=setTimeout(()=>{v&&l==="pending"&&V();},n):t.loading&&V(),o!=null&&(u=setTimeout(()=>{if(v&&l==="pending"){let b=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);c=b,l="errored",I(b),s&&s(b,E(p));}},o)),h}return d.__asyncLoader=f,d.__asyncResolved=()=>i,d}function St(e){let t=document.createDocumentFragment(),n=document.createComment("");t.appendChild(n);let o=[],r=[],s=e.key,i=e.children,c=()=>{var y,E;let u=e.each;return signals.isSignal(u)?(y=u.value)!=null?y:[]:shared.isFunction(u)?(E=u())!=null?E:[]:u!=null?u:[]},l=(u,y)=>s?s(u,y):u,a=u=>{if(Array.isArray(u)){let y=[];for(let E of u)y.push(...a(E));return y}return [Z(u)]},f=(u,y,E)=>{let N=a(u);for(let A of N)E?y.insertBefore(A,E):y.appendChild(A);return N},d=(u,y)=>{if(!e.fallback)return;r=f(e.fallback(),u,y);},p=()=>{for(let u of r)u.parentNode&&u.parentNode.removeChild(u);r=[];},h=(u,y,E,N,A=l(u,y))=>{let I=_(),V=O(I),T=[];return x(V,()=>{T=f(i(u,y),E,N);}),{key:A,item:u,nodes:T,scope:V}},v=u=>{P(u.scope);for(let y of u.nodes)y.parentNode&&y.parentNode.removeChild(y);},m=signals.effect(()=>{let u=c(),y=n.parentNode;if(!y){if(u.length===0)d(t,n);else {o=new Array(u.length);let E=0;for(let N of u)o[E]=h(N,E,t,n),E++;}return}g(y,u);});function g(u,y){let E=o.length,N=y.length;if(N===0){for(let S=0;S<E;S++)v(o[S]);o=[],e.fallback&&r.length===0&&d(u,n);return}if(E===0||r.length>0){r.length>0&&p(),o=new Array(N);let S=document.createDocumentFragment();for(let w=0;w<N;w++)o[w]=h(y[w],w,S,null);u.insertBefore(S,n);return}let A=new Map;for(let S=0;S<E;S++){let w=o[S],D=A.get(w.key),$=[w,S];D?D.push($):A.set(w.key,[$]);}let I=new Array(N),V=[],T=null,W=new Int32Array(N),b=false,H=0,R=new Array(N);for(let S=0;S<N;S++)R[S]=l(y[S],S);for(let S=0;S<N;S++){let w=y[S],D=R[S],$=A.get(D);if($&&$.length>0){let[re,M]=$.shift();Object.is(re.item,w)?(re.item=w,I[S]=re,W[S]=M+1,M<H?b=true:H=M):(T||(T=document.createDocumentFragment()),v(re),I[S]=h(w,S,T,null,D));}else T||(T=document.createDocumentFragment()),I[S]=h(w,S,T,null,D);}for(let S of A.values())for(let[w]of S)V.push(w);for(let S of V)v(S);let K=b?Ie(W):[],B=K.length-1,X=n;for(let S=N-1;S>=0;S--){let D=I[S].nodes;if(!(W[S]===0)&&b&&B>=0&&S===K[B]){B--;for(let M=D.length-1;M>=0;M--)X=D[M];continue}for(let M=D.length-1;M>=0;M--){let Ce=D[M];Ce.nextSibling!==X&&u.insertBefore(Ce,X),X=Ce;}}o=I;}return k(()=>{m.stop();for(let u of o)v(u);o=[],p(),n.parentNode&&n.parentNode.removeChild(n);}),t}St[qe]=true;
2
+ exports.Component=ne;exports.For=St;exports.Fragment=dt;exports.Portal=pt;exports.Suspense=ht;exports.addEvent=ee;exports.addEventListener=oe;exports.beginHydration=Me;exports.bindElement=Nn;exports.child=Yt;exports.clearDelegatedEvents=cn;exports.consumeTeleportAnchor=Re;exports.consumeTeleportBlock=De;exports.createApp=on;exports.createComponent=he;exports.createResource=Mn;exports.defineAsyncComponent=Fn;exports.delegateEvents=ln;exports.endHydration=Le;exports.getHydrationKey=Qe;exports.getRenderedElement=Ut;exports.hydrate=rn;exports.inject=ce;exports.insert=z;exports.isComponent=F;exports.isFragment=Cn;exports.isHydrating=le;exports.isPortal=An;exports.isSuspense=Dn;exports.next=Jt;exports.normalizeClass=fe;exports.nthChild=Qt;exports.omitProps=bn;exports.onDestroy=te;exports.onMount=Oe;exports.onUpdate=Zt;exports.patchAttr=G;exports.patchAttrHydrate=Wt;exports.patchClass=de;exports.patchClassHydrate=zt;exports.patchStyle=me;exports.patchStyleHydrate=Bt;exports.provide=je;exports.resetHydrationKey=jt;exports.setStyle=J;exports.template=pe;
@@ -666,7 +666,7 @@ declare function defineAsyncComponent<P extends ComponentProps = ComponentProps>
666
666
  interface ForProps<T> {
667
667
  each: T[] | Signal<T[]> | (() => T[]);
668
668
  children: (item: T, index: number) => AnyNode;
669
- key?: (item: T) => unknown;
669
+ key?: (item: T, index: number) => unknown;
670
670
  fallback?: () => AnyNode;
671
671
  }
672
672
  /**
@@ -666,7 +666,7 @@ declare function defineAsyncComponent<P extends ComponentProps = ComponentProps>
666
666
  interface ForProps<T> {
667
667
  each: T[] | Signal<T[]> | (() => T[]);
668
668
  children: (item: T, index: number) => AnyNode;
669
- key?: (item: T) => unknown;
669
+ key?: (item: T, index: number) => unknown;
670
670
  fallback?: () => AnyNode;
671
671
  }
672
672
  /**
@@ -999,12 +999,14 @@ var Component = class {
999
999
  if (!root) return;
1000
1000
  this.releaseSpecialProps();
1001
1001
  for (const key of Object.getOwnPropertyNames(props)) {
1002
- const value = readProp(props, key);
1003
1002
  if (key === REF_KEY) {
1003
+ const value = readProp(props, key);
1004
1004
  this.rootRefCleanup = this.bindRootRef(value, root);
1005
1005
  continue;
1006
1006
  }
1007
- if (shared.isOn(key) && shared.isFunction(value)) {
1007
+ if (shared.isOn(key)) {
1008
+ const value = readProp(props, key);
1009
+ if (!shared.isFunction(value)) continue;
1008
1010
  const eventName = key.slice(2).toLowerCase();
1009
1011
  this.rootEventCleanups.push(addEvent(root, eventName, value));
1010
1012
  }
@@ -1438,8 +1440,9 @@ function omitProps(target, keys) {
1438
1440
 
1439
1441
  // src/components/Fragment.ts
1440
1442
  function Fragment(props) {
1441
- if (!props || props.children == null) return null;
1442
- return props.children;
1443
+ const children = props == null ? void 0 : props.children;
1444
+ if (children == null) return null;
1445
+ return children;
1443
1446
  }
1444
1447
  Fragment[FRAGMENT_COMPONENT] = true;
1445
1448
  function isFragment(node) {
@@ -1963,7 +1966,7 @@ function For(props) {
1963
1966
  if (shared.isFunction(input)) return (_b = input()) != null ? _b : [];
1964
1967
  return input != null ? input : [];
1965
1968
  };
1966
- const getKey = (item) => keyFn ? keyFn(item) : item;
1969
+ const getKey = (item, index) => keyFn ? keyFn(item, index) : item;
1967
1970
  const normalizeNodes = (value) => {
1968
1971
  if (Array.isArray(value)) {
1969
1972
  const nodes = [];
@@ -1998,14 +2001,14 @@ function For(props) {
1998
2001
  }
1999
2002
  fallbackNodes = [];
2000
2003
  };
2001
- const renderItem = (item, index, parent, before) => {
2004
+ const renderItem = (item, index, parent, before, key = getKey(item, index)) => {
2002
2005
  const parentScope = getActiveScope();
2003
2006
  const scope = createScope(parentScope);
2004
2007
  let mountedNodes = [];
2005
2008
  runWithScope(scope, () => {
2006
2009
  mountedNodes = mountValue(renderFn(item, index), parent, before);
2007
2010
  });
2008
- return { key: getKey(item), item, nodes: mountedNodes, scope };
2011
+ return { key, item, nodes: mountedNodes, scope };
2009
2012
  };
2010
2013
  const disposeItem = (entry) => {
2011
2014
  disposeScope(entry.scope);
@@ -2074,7 +2077,7 @@ function For(props) {
2074
2077
  let maxOldSeen = 0;
2075
2078
  const newKeys = new Array(newLen);
2076
2079
  for (let i = 0; i < newLen; i++) {
2077
- newKeys[i] = getKey(newItems[i]);
2080
+ newKeys[i] = getKey(newItems[i], i);
2078
2081
  }
2079
2082
  for (let i = 0; i < newLen; i++) {
2080
2083
  const item = newItems[i];
@@ -2091,11 +2094,11 @@ function For(props) {
2091
2094
  } else {
2092
2095
  if (!batchFragment) batchFragment = document.createDocumentFragment();
2093
2096
  disposeItem(reused);
2094
- newEntries[i] = renderItem(item, i, batchFragment, null);
2097
+ newEntries[i] = renderItem(item, i, batchFragment, null, key);
2095
2098
  }
2096
2099
  } else {
2097
2100
  if (!batchFragment) batchFragment = document.createDocumentFragment();
2098
- newEntries[i] = renderItem(item, i, batchFragment, null);
2101
+ newEntries[i] = renderItem(item, i, batchFragment, null, key);
2099
2102
  }
2100
2103
  }
2101
2104
  for (const list of oldKeyMap.values()) {