@estjs/template 0.0.16-beta.1 → 0.0.16-beta.2

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,3 +1,3 @@
1
- 'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var Be=Object.getOwnPropertySymbols;var gt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var ze=(e,t)=>{var n={};for(var o in e)gt.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Be)for(var o of Be(e))t.indexOf(o)<0&&Et.call(e,o)&&(n[o]=e[o]);return n};var be=(e,t,n)=>new Promise((o,r)=>{var i=s=>{try{c(n.next(s));}catch(a){r(a);}},l=s=>{try{c(n.throw(s));}catch(a){r(a);}},c=s=>s.done?o(s.value):Promise.resolve(s.value).then(i,l);c((n=n.apply(e,t)).next());});var ue="_$spread$";var We="http://www.w3.org/2000/svg",xe="http://www.w3.org/2000/xlink",Ae="http://www.w3.org/2000/xmlns/";var we=Symbol(""),ie=Symbol(""),Pe=Symbol(""),Xe=Symbol("");var I=null,vt=0;function _(){return I}function H(e=I){let t={id:++vt,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(t)),t}function A(e,t){let n=I;I=e;try{return t()}finally{I=n;}}function w(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,w(o));e.children.clear();}let t=I;I=e;try{if(e.onDestroy){for(let o=0;o<e.onDestroy.length;o++)try{e.onDestroy[o]();}catch(r){}e.onDestroy=null;}if(e.cleanup){for(let o=0;o<e.cleanup.length;o++)try{e.cleanup[o]();}catch(r){}e.cleanup=null;}}finally{I=t;}(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 P(e){let t=I;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 f=shared.isObject(n)?n:null,y=shared.isObject(o)?o:null;if(f)for(let h in f)h!==ue&&(!y||!(h in y))&&G(e,h,f[h],null);if(y)for(let h in y)h!==ue&&G(e,h,f==null?void 0:f[h],y[h]);return}let r=(e==null?void 0:e.namespaceURI)===We,i=r&&t.startsWith("xlink:"),l=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 s=t.toLowerCase();if(s==="innerhtml"||s==="srcdoc")return;if(o==null){if(i)e.removeAttributeNS(xe,t.slice(6));else if(l){let f=t.slice(6);e.removeAttributeNS(Ae,f);}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((s==="href"||s==="src"||s==="xlink:href"||s==="action"||s==="formaction"||s==="poster")&&shared.isString(a)){let f=a.trim().toLowerCase();if(f.startsWith("javascript:")||f.startsWith("data:"))return}if(i){e.setAttributeNS(xe,t,String(a));return}if(l){e.setAttributeNS(Ae,t,String(a));return}if(r)e.setAttribute(t,String(a));else if(t in e)try{e[t]=a;}catch(f){e.setAttribute(t,String(a));}else e.setAttribute(t,String(a));}function fe(e,t,n,o=false){if(t===n)return;let r=de(n);if(!r){e.removeAttribute("class");return}(shared.isString(t)?t:de(t))!==r&&(o?e.setAttribute("class",r):e.className=r);}var de=shared.normalizeClassName;var Ge=/\s*!important$/,Rt=["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 i in r)(!n||n[i]==null)&&J(o,i,"");}else if(t&&shared.isString(t)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,i;for(;(i=r.exec(t))!==null;){let l=i[1].trim();l&&n&&shared.isObject(n)&&n[l]==null&&J(o,l,"");}}if(n&&!shared.isString(n)){let r=n;for(let i in r){let l=r[i];(!t||shared.isString(t)||t[i]!==l)&&l!=null&&J(o,i,l);}}}function J(e,t,n){if(shared.isArray(n)){for(let r of n)J(e,t,r);return}if((n==null||n==="")&&(n=""),t.startsWith("--")){e.setProperty(t,n);return}let o=Dt(e,t);shared.isString(n)&&Ge.test(n)?e.setProperty(shared.camelCase(o),n.replace(Ge,""),"important"):e[o]=n;}function Dt(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 Rt){let i=r+o;if(i in e)return ke[t]=i}return t}var Te=0;function Je(){return String(Te++)}function Ft(){Te=0;}var B=false;function le(){return B}var Q=new Map;function It(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 Ht(){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 Le(e){B=true,Te=0,Q.clear(),ye.length=0,se.clear(),It(e),Ht();}function Me(){B=false,Q.clear(),ye.length=0,se.clear();}function Ot(e){if(!shared.isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let t=null;return ()=>{if(!B)return t||(t=me(e)),t();let n=Je(),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 Vt(e,t,n,o){B||fe(e,t,n,o);}function jt(e,t,n,o){B||G(e,t,n,o);}function Ut(e,t,n){B||pe(e,t,n);}function Fe(e,t){return t&&t.parentNode===e?t:null}function Qe(e,t,n,o){let r=Fe(e,o),i=t.length,l=n.length;if(i===0&&l===0)return n;if(i===0){for(let d=0;d<l;d++)L(e,n[d],r);return n}if(l===0){for(let d=0;d<i;d++)U(t[d]);return []}let c=0,s=i-1,a=l-1;for(;c<=s&&c<=a&&t[c]===n[c];)c++;for(;s>=c&&a>=c&&t[s]===n[a];)s--,a--;if(c>s){if(c<=a){let d=a+1,f=Fe(e,d<l?n[d]:r);for(let y=c;y<=a;y++)L(e,n[y],f);}}else if(c>a)for(let d=c;d<=s;d++)U(t[d]);else Kt(e,t,n,c,s,a,r);return n}function Kt(e,t,n,o,r,i,l){let c=i-o+1,s=new Map;for(let p=o;p<=i;p++)s.set(n[p],p);let a=new Int32Array(c);a.fill(0);let d=0,f=false,y=0;for(let p=o;p<=r;p++){let m=t[p];if(d>=c){U(m);continue}let u=s.get(m);u===void 0?U(m):(a[u-o]=p+1,u>=y?y=u:f=true,d++);}let h=f?Ie(a):[],v=h.length-1;for(let p=c-1;p>=0;p--){let m=o+p,u=n[m],g=Fe(e,m+1<n.length?n[m+1]:l);a[p]===0?L(e,u,g):f&&(v<0||p!==h[v]?L(e,u,g):v--);}}function Ie(e){let t=new Int32Array(e.length),n=[0],o=e.length,r,i,l,c,s;for(r=0;r<o;r++){let a=e[r];if(a!==0){if(i=n[n.length-1],e[i]<a){t[r]=i,n.push(r);continue}for(l=0,c=n.length-1;l<c;)s=l+c>>1,e[n[s]]<a?l=s+1:c=s;a<e[n[l]]&&(l>0&&(t[r]=n[l-1]),n[l]=r);}}for(l=n.length,c=n[l-1];l-- >0;)n[l]=c,c=t[c];return n}function U(e){if(e)if(O(e))e.destroy();else {let t=e;t.parentNode&&t.remove();}}function L(e,t,n){if(!e||!t)return;let o=O(n)?n.firstChild:n;if(O(t)){t.mount(e,o);return}o?e.insertBefore(t,o):e.appendChild(t);}function Z(e){return shared.isHTMLElement(e)?e:shared.isPrimitive(e)?document.createTextNode(shared.isFalsy(e)?"":String(e)):e}function z(e,t,n){if(!e)return;let o=_(),r=[],i=true,l=s=>s instanceof Node?[s]:shared.isNull(s)||shared.isUndefined(s)||shared.isString(s)||shared.isNumber(s)||shared.isBoolean(s)?[Z(s)]:shared.coerceArray(s).map(a=>shared.isFunction(a)?a():a).flatMap(a=>a).map(Z),c=signals.effect(()=>{let s=()=>{let a=shared.isFunction(t)?t():t,d=l(a);if(i&&le()&&d.every(f=>f instanceof Node&&f.parentNode===e)){r=d,i=false;return}r=Qe(e,r,d,n),i=false;};o&&!o.isDestroyed?A(o,s):s();});return P(()=>{c.stop();for(let s of r)U(s);r=[];}),r}function Zt(e){return (e==null?void 0:e.firstChild)||null}function en(e,t=1){for(;e&&t>0;)e=e.nextSibling,t--;return e||null}function tn(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,i=a=>{let d=a.target;(d.matches(r)||d.closest(r))&&n.call(e,a);},s=o,{delegate:l}=s,c=ze(s,["delegate"]);return e.addEventListener(t,i,c),()=>{e.removeEventListener(t,i,c);}}function He(e,t,n){let o=e[t];o||(o=[],e[t]=o),o.push(n);}function tt(e,t,n){let o=e.length;if(o===0)return;let r;for(let i=0;i<o;i++)try{let l=e[i]();if(shared.isPromise(l)){let c=l.catch(s=>{});(r||(r=[])).push(c);}}catch(l){}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 nn(e){let t=_();t&&He(t,"onUpdate",e);}function te(e){let t=_();t&&He(t,"onDestroy",e);}function nt(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let t=e.onMount,n=A(e,()=>tt(t,e.id,"mount"));return t.length=0,e.isMounted=true,n}function ot(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return A(e,()=>tt(e.onUpdate,e.id,"update"))}function it(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 ln(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return n.get?n.get.call(e):n.value}var st;st="normal";var ne=class{constructor(t,n={}){this.component=t;this.props=n;this[st]=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={};it(o,n),this.reactiveProps=signals.shallowReactive(o);}mount(t,n){var i;if(this.parentNode=t,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let l of this.renderedNodes)L(t,l,n);return this.state=2,this.renderedNodes}let o=H((i=this.parentScope)!=null?i:_());this.scope=o;let r=A(o,()=>{var c;let l=this.component(this.reactiveProps);return shared.isFunction(l)&&(l=l(this.reactiveProps)),(signals.isSignal(l)||signals.isComputed(l))&&(l=l.value),(c=z(t,l,n))!=null?c:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,nt(o),this.renderedNodes}update(t){this.props=t;let n=this.scope;!n||n.isDestroyed||(it(this.reactiveProps,t!=null?t:{},true),this.syncSpecialProps(t),ot(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(),w(t);for(let n of this.renderedNodes)U(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=ln(t,o);if(o==="ref"){this.rootRefCleanup=this.bindRootRef(r,n);continue}if(shared.isOn(o)&&shared.isFunction(r)){let i=o.slice(2).toLowerCase();this.rootEventCleanups.push(ee(n,i,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.value;return t.value=n,()=>{t.value===n&&(t.value=o);}}}};function O(e){return !!e&&!!e.normal}function he(e,t){return O(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 cn(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;n.innerHTML&&(n.innerHTML="");let r=H(),i;try{A(r,()=>{let l=he(e);O(l)&&(i=l,L(n,l));});}catch(l){throw w(r),l}return {root:i,unmount:()=>{w(r),i==null||i.destroy();}}}function an(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;Le(n);let o=H(),r;try{A(o,()=>{let i=he(e);O(i)&&(r=i,z(n,i));});}catch(i){throw w(o),i}finally{Me();}return {root:r,unmount:()=>{w(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 Ue(e,t){Object.defineProperty(e,"target",{configurable:true,value:t});}function at(e){let t=e.target,n=e.type,o=e.target,r=e.currentTarget,i=()=>{let c=t[`_$${n}`];if(c&&shared.isFunction(c)&&!t.disabled){let s=t[`${n}Data`];if(s?c.call(t,s,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)&&Ue(e,t.host),true},l=()=>{for(;i()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return t||document}}),e.composedPath){let c=e.composedPath();Ue(e,c[0]);for(let s=0;s<c.length-2&&(t=c[s],!!i());s++){if(t._$host){t=t._$host,l();break}if(t.parentNode===r)break}}else l();Ue(e,o);}var ge=Symbol("_$EVENTS");function dn(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,at));}function fn(e=window.document){let t=e,n=t[ge];if(n){for(let o of n.keys())e.removeEventListener(o,at);delete t[ge];}}function oe(e,t,n,o){let r=ee(e,t,n,o);_()&&P(r);}var hn={event:"change",forceChangeEvent:true,read:e=>e.checked,write:(e,t)=>{let n=e,o=!!t;n.checked!==o&&(n.checked=o);}},gn={event:"change",forceChangeEvent: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);}},En={event:"change",forceChangeEvent:true,read:e=>e.files,write:()=>{}},vn={event:"input",needsComposition:true,read:e=>e.value,write:(e,t)=>{let n=e,o=t==null?"":String(t);n.value!==o&&(n.value=o);}},Sn={event:"change",forceChangeEvent: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 {let o=t==null?"":String(t);n.value!==o&&(n.value=o);}}},Nn={event:"input",needsComposition:true,read:e=>e.value,write:(e,t)=>{let n=e,o=t==null?"":String(t);n.value!==o&&(n.value=o);}};function Cn(e,t){let n=e.nodeName;if(n==="INPUT"){let o=e.type;return t==="checked"?o==="radio"?gn:hn:t==="files"?En:vn}return n==="SELECT"?Sn:n==="TEXTAREA"?Nn:{event:"input",read:o=>o[t],write:(o,r)=>{o[t]=r;}}}function _n(e,t,n){if(!shared.isString(e))return e;if(t&&(e=e.trim()),n&&e!==""){let o=Number(e);if(!Number.isNaN(o))return o}return e}function bn(e){let t=e.getRootNode();return (t instanceof Document||t instanceof ShadowRoot)&&t.activeElement===e}function xn(e,t,n,o,r={}){if(!e)return;let i=Cn(e,t),{trim:l,number:c,lazy:s}=r,a=t==="files",d=()=>shared.isFunction(n)?n():n,f=m=>a?m:_n(m,l,c),y=s||i.forceChangeEvent?"change":i.event,h=false,v=()=>{if(h)return;let m=i.read(e);if(m===void 0)return;if(a){o(m);return}let u=f(m);Object.is(d(),u)||o(u);};oe(e,y,v),!s&&!a&&(l||c)&&y!=="change"&&oe(e,"change",()=>{i.write(e,f(i.read(e)));}),i.needsComposition&&!s&&(oe(e,"compositionstart",()=>{h=true;}),oe(e,"compositionend",()=>{h&&(h=false,v());}));let p=signals.effect(()=>{let m=d();if(i.needsComposition&&!s&&bn(e)){if(h)return;let u=f(i.read(e));if(Object.is(u,m))return}i.write(e,m);});_()&&P(()=>p.stop());}function An(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 ut(e){return !e||e.children==null?null:e.children}ut[we]=true;function wn(e){return !!e&&!!e[we]}function Ee(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 ft(e){if(le()){let d=Tn(e);if(d)return d}let t=document.createComment("portal");t[ie]=true;let{children:n}=e;if(n==null)return t;let o=_(),r=null,i=(d,f)=>{r=H(o),A(r,()=>{z(d,()=>n,f);});},l=()=>{r&&(w(r),r=null);},c=(d,f)=>{if(l(),d){let y=t.parentNode;if(!y)return;i(y,t);return}f&&i(f);},s=false,a=signals.effect(()=>{let d=ve(e),f=d?null:Ee(e);s&&c(d,f);});return Oe(()=>{s=!0;let d=ve(e),f=d?null:Ee(e);if(d||f){c(d,f);return}queueMicrotask(()=>{t.parentNode&&c(ve(e),Ee(e));});}),P(()=>{a.stop(),l();}),t}ft[ie]=true;function Tn(e){if(ve(e))return null;let t=Re();if(!t)return null;let n=Ee(e);return !n||!De(n)?null:(t[ie]=true,t)}function Rn(e){return !!e&&!!e[ie]}function Ne(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function pt(e){let t=e;for(;shared.isFunction(t);)t=t();return signals.isSignal(t)||signals.isComputed(t)?pt(t.value):t}var ae=Symbol("SuspenseContext");function mt(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,i=null,l=p=>{let m=pt(p);if(shared.isArray(m)){let u=[];for(let g of m){let S=l(g);shared.isArray(S)?u.push(...S):u.push(S);}return u}return Z(m)},c=p=>{let m=l(p),u=shared.isArray(m)?m:[m];for(let g of u)g!=null&&L(t,g);},s=()=>{Ne(t),e.fallback!=null&&c(e.fallback);},a=()=>{r||(r=true,s());},d=()=>{!r||!(i||e.children!=null&&!shared.isPromise(e.children))||(r=false,Ne(t),i?f(i):e.children!=null&&!shared.isPromise(e.children)&&f(e.children));},f=p=>{if(r||(Ne(t),p==null))return;let m=shared.isArray(p)?p:[p];for(let u of m)u!=null&&c(u);r&&s();},y={register:p=>{o++,a(),p.then(()=>{n&&(o--,o===0&&d());}).catch(m=>{n&&(o--,o===0&&d());});},increment:()=>{o++,a();},decrement:()=>{o=Math.max(0,o-1),o===0&&d();}};je(ae,y);let h=e.children;return shared.isPromise(h)?(h.then(p=>{i=p;}).catch(()=>{}),y.register(h)):h!=null?f(h):a(),te(()=>{n=false,o=0,i=null,Ne(t),t.remove();}),t}mt[Pe]=true;function In(e){return !!e&&!!e[Pe]}function Hn(e,t){let n=signals.signal(t==null?void 0:t.initialValue),o=signals.signal(true),r=signals.signal(null),i=signals.signal("pending"),l=0,c=null,s=false,a=ce(ae,null),d=()=>be(null,null,function*(){let h=++l;o.value=true,i.value="pending",r.value=null,s=false,a&&a.increment();try{let v=e();c=v,v.catch(()=>{});let p=yield v;h===l&&(n.value=p,i.value="ready",o.value=!1);}catch(v){h===l&&(r.value=v instanceof Error?v:new Error(String(v)),i.value="errored",o.value=false);}finally{a&&a.decrement();}});d();let f=(()=>(!s&&o.value&&c&&a&&(s=true,a.register(c)),n.value));return f.loading=o,f.error=r,f.state=i,[f,{mutate:h=>{n.value=h,i.value="ready",o.value=false,r.value=null;},refetch:()=>be(null,null,function*(){yield d();})}]}function yt(e){return shared.isFunction(e)?e:e.default}function $e(e,t,n){let o=new ne(t,n);return o.mount(e),o}function Vn(e,t={}){let{delay:n=200,timeout:o,ssr:r="blocking",onError:i}=t;if(typeof window=="undefined"){if(r==="client-only"){let m=()=>"";return m.__asyncLoader=e,m.__asyncResolved=()=>null,m}let y=null,h=null,v=()=>h||(h=e().then(m=>{y=yt(m);}).catch(()=>{}),h);v();let p=m=>y?y(m):"";return p.__asyncLoader=v,p.__asyncResolved=()=>y,p}let l=null,c=null,s="pending",a=null;function d(){return a||(a=e().then(y=>{l=yt(y),s="resolved";}).catch(y=>{c=y instanceof Error?y:new Error(String(y)),s="errored",a=null;}),a)}d();function f(y){var W;if(s==="resolved"&&l){let N=document.createElement("div");N.style.display="contents";let M=$e(N,l,y);return P(()=>M.destroy()),N}if(s==="errored"&&c){let N=document.createElement("div");if(N.style.display="contents",t.error){let M=true,R=null,K=(q,E)=>{M&&(R==null||R.destroy(),R=$e(N,q,E));},X=()=>{a=null,s="pending",c=null,t.loading&&K(t.loading),d().then(()=>{M&&(s==="resolved"&&l?K(l,y):s==="errored"&&c&&t.error&&K(t.error,{error:c,retry:X}));});};K(t.error,{error:c,retry:X}),te(()=>{M=false,R==null||R.destroy(),R=null;});}return N}let h=document.createElement("div");h.style.display="contents";let v=true,p=null,m=null,u=null,g=(N,M)=>{v&&(p==null||p.destroy(),p=$e(h,N,M));},S=N=>()=>{a=null,s="pending",c=null,t.loading&&g(t.loading),d().then(()=>{s==="resolved"&&l?g(l,N):s==="errored"&&c&&t.error&&g(t.error,{error:c,retry:S(N)});});};te(()=>{v=false,p==null||p.destroy(),p=null,m!=null&&clearTimeout(m),u!=null&&clearTimeout(u);});let b=(W=ce(ae))!=null?W:null,k=N=>g(N,y),T=N=>{t.error&&g(t.error,{error:N,retry:S(y)});},V=()=>{t.loading&&g(t.loading);},j=d().then(()=>{v&&(s==="resolved"&&l?k(l):s==="errored"&&c&&(T(c),i&&i(c,S(y))),m!=null&&clearTimeout(m),u!=null&&clearTimeout(u));});return b&&b.register(j),n>0?m=setTimeout(()=>{v&&s==="pending"&&V();},n):t.loading&&V(),o!=null&&(u=setTimeout(()=>{if(v&&s==="pending"){let N=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);c=N,s="errored",T(N),i&&i(N,S(y));}},o)),h}return f.__asyncLoader=d,f.__asyncResolved=()=>l,f}function ht(e){let t=document.createDocumentFragment(),n=document.createComment("");t.appendChild(n);let o=[],r=[],i=e.key,l=e.children,c=()=>{var g,S;let u=e.each;return signals.isSignal(u)?(g=u.value)!=null?g:[]:shared.isFunction(u)?(S=u())!=null?S:[]:u!=null?u:[]},s=u=>i?i(u):u,a=u=>{if(Array.isArray(u)){let g=[];for(let S of u)g.push(...a(S));return g}return [Z(u)]},d=(u,g,S)=>{let b=a(u);for(let k of b)S?g.insertBefore(k,S):g.appendChild(k);return b},f=(u,g)=>{if(!e.fallback)return;r=d(e.fallback(),u,g);},y=()=>{for(let u of r)u.parentNode&&u.parentNode.removeChild(u);r=[];},h=(u,g,S,b)=>{let k=_(),T=H(k),V=[];return A(T,()=>{V=d(l(u,g),S,b);}),{key:s(u),item:u,nodes:V,scope:T}},v=u=>{w(u.scope);for(let g of u.nodes)g.parentNode&&g.parentNode.removeChild(g);},p=signals.effect(()=>{let u=c(),g=n.parentNode;if(!g){if(u.length===0)f(t,n);else {o=new Array(u.length);let S=0;for(let b of u)o[S]=h(b,S,t,n),S++;}return}m(g,u);});function m(u,g){let S=o.length,b=g.length;if(b===0){for(let E=0;E<S;E++)v(o[E]);o=[],e.fallback&&r.length===0&&f(u,n);return}if(S===0||r.length>0){r.length>0&&y(),o=new Array(b);let E=document.createDocumentFragment();for(let x=0;x<b;x++)o[x]=h(g[x],x,E,null);u.insertBefore(E,n);return}let k=new Map;for(let E=0;E<S;E++){let x=o[E],F=k.get(x.key),$=[x,E];F?F.push($):k.set(x.key,[$]);}let T=new Array(b),V=[],j=null,W=new Int32Array(b),N=false,M=0,R=new Array(b);for(let E=0;E<b;E++)R[E]=s(g[E]);for(let E=0;E<b;E++){let x=g[E],F=R[E],$=k.get(F);if($&&$.length>0){let[re,D]=$.shift();Object.is(re.item,x)?(re.item=x,T[E]=re,W[E]=D+1,D<M?N=true:M=D):(j||(j=document.createDocumentFragment()),v(re),T[E]=h(x,E,j,null));}else j||(j=document.createDocumentFragment()),T[E]=h(x,E,j,null);}for(let E of k.values())for(let[x]of E)V.push(x);for(let E of V)v(E);let K=N?Ie(W):[],X=K.length-1,q=n;for(let E=b-1;E>=0;E--){let F=T[E].nodes;if(!(W[E]===0)&&N&&X>=0&&E===K[X]){X--;for(let D=F.length-1;D>=0;D--)q=F[D];continue}for(let D=F.length-1;D>=0;D--){let _e=F[D];_e.nextSibling!==q&&u.insertBefore(_e,q),q=_e;}}o=T;}return P(()=>{p.stop();for(let u of o)v(u);o=[],y(),n.parentNode&&n.parentNode.removeChild(n);}),t}ht[Xe]=true;
2
- exports.Component=ne;exports.For=ht;exports.Fragment=ut;exports.Portal=ft;exports.Suspense=mt;exports.addEvent=ee;exports.addEventListener=oe;exports.beginHydration=Le;exports.bindElement=xn;exports.child=Zt;exports.clearDelegatedEvents=fn;exports.consumeTeleportAnchor=Re;exports.consumeTeleportBlock=De;exports.createApp=cn;exports.createComponent=he;exports.createResource=Hn;exports.defineAsyncComponent=Vn;exports.delegateEvents=dn;exports.endHydration=Me;exports.getHydrationKey=Je;exports.getRenderedElement=Ot;exports.hydrate=an;exports.inject=ce;exports.insert=z;exports.isComponent=O;exports.isFragment=wn;exports.isHydrating=le;exports.isPortal=Rn;exports.isSuspense=In;exports.next=en;exports.normalizeClass=de;exports.nthChild=tn;exports.omitProps=An;exports.onDestroy=te;exports.onMount=Oe;exports.onUpdate=nn;exports.patchAttr=G;exports.patchAttrHydrate=jt;exports.patchClass=fe;exports.patchClassHydrate=Vt;exports.patchStyle=pe;exports.patchStyleHydrate=Ut;exports.provide=je;exports.resetHydrationKey=Ft;exports.setStyle=J;exports.template=me;//# sourceMappingURL=template.cjs.js.map
1
+ 'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var Be=Object.getOwnPropertySymbols;var vt=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var We=(e,t)=>{var n={};for(var o in e)vt.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Be)for(var o of Be(e))t.indexOf(o)<0&&St.call(e,o)&&(n[o]=e[o]);return n};var Ce=(e,t,n)=>new Promise((o,r)=>{var l=i=>{try{c(n.next(i));}catch(a){r(a);}},s=i=>{try{c(n.throw(i));}catch(a){r(a);}},c=i=>i.done?o(i.value):Promise.resolve(i.value).then(l,s);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 H=null,Et=0;function C(){return H}function O(e=H){let t={id:++Et,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(t)),t}function A(e,t){let n=H;H=e;try{return t()}finally{H=n;}}function P(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,P(o));e.children.clear();}let t=H;H=e;try{if(e.onDestroy){for(let o=0;o<e.onDestroy.length;o++)try{e.onDestroy[o]();}catch(r){}e.onDestroy=null;}if(e.cleanup){for(let o=0;o<e.cleanup.length;o++)try{e.cleanup[o]();}catch(r){}e.cleanup=null;}}finally{H=t;}(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 k(e){let t=H;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 f=shared.isObject(n)?n:null,p=shared.isObject(o)?o:null;if(f)for(let h in f)h!==ue&&(!p||!(h in p))&&G(e,h,f[h],null);if(p)for(let h in p)h!==ue&&G(e,h,f==null?void 0:f[h],p[h]);return}let r=(e==null?void 0:e.namespaceURI)===Xe,l=r&&t.startsWith("xlink:"),s=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 i=t.toLowerCase();if(i==="innerhtml"||i==="srcdoc")return;if(o==null){if(l)e.removeAttributeNS(we,t.slice(6));else if(s){let f=t.slice(6);e.removeAttributeNS(xe,f);}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((i==="href"||i==="src"||i==="xlink:href"||i==="action"||i==="formaction"||i==="poster")&&shared.isString(a)){let f=a.trim().toLowerCase();if(f.startsWith("javascript:")||f.startsWith("data:"))return}if(l){e.setAttributeNS(we,t,String(a));return}if(s){e.setAttributeNS(xe,t,String(a));return}if(r)e.setAttribute(t,String(a));else if(t in e)try{e[t]=a;}catch(f){e.setAttribute(t,String(a));}else e.setAttribute(t,String(a));}function fe(e,t,n,o=false){if(t===n)return;let r=de(n);if(!r){e.removeAttribute("class");return}(shared.isString(t)?t:de(t))!==r&&(o?e.setAttribute("class",r):e.className=r);}var de=shared.normalizeClassName;var Ye=/\s*!important$/,Dt=["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 l in r)(!n||n[l]==null)&&J(o,l,"");}else if(t&&shared.isString(t)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,l;for(;(l=r.exec(t))!==null;){let s=l[1].trim();s&&n&&shared.isObject(n)&&n[s]==null&&J(o,s,"");}}if(n&&!shared.isString(n)){let r=n;for(let l in r){let s=r[l];(!t||shared.isString(t)||t[l]!==s)&&s!=null&&J(o,l,s);}}}function J(e,t,n){if(shared.isArray(n)){for(let r of n)J(e,t,r);return}if((n==null||n==="")&&(n=""),t.startsWith("--")){e.setProperty(t,n);return}let o=Mt(e,t);shared.isString(n)&&Ye.test(n)?e.setProperty(shared.camelCase(o),n.replace(Ye,""),"important"):e[o]=n;}function Mt(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 Dt){let l=r+o;if(l in e)return ke[t]=l}return t}var Te=0;function Qe(){return String(Te++)}function It(){Te=0;}var z=false;function le(){return z}var Q=new Map;function Ht(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 Ot(){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){z=true,Te=0,Q.clear(),ye.length=0,se.clear(),Ht(e),Ot();}function Le(){z=false,Q.clear(),ye.length=0,se.clear();}function Vt(e){if(!shared.isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let t=null;return ()=>{if(!z)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 jt(e,t,n,o){z||fe(e,t,n,o);}function Kt(e,t,n,o){z||G(e,t,n,o);}function Ut(e,t,n){z||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),l=t.length,s=n.length;if(l===0&&s===0)return n;if(l===0){for(let d=0;d<s;d++)M(e,n[d],r);return n}if(s===0){for(let d=0;d<l;d++)K(t[d]);return []}let c=0,i=l-1,a=s-1;for(;c<=i&&c<=a&&t[c]===n[c];)c++;for(;i>=c&&a>=c&&t[i]===n[a];)i--,a--;if(c>i){if(c<=a){let d=a+1,f=Fe(e,d<s?n[d]:r);for(let p=c;p<=a;p++)M(e,n[p],f);}}else if(c>a)for(let d=c;d<=i;d++)K(t[d]);else $t(e,t,n,c,i,a,r);return n}function $t(e,t,n,o,r,l,s){let c=l-o+1,i=new Map;for(let m=o;m<=l;m++)i.set(n[m],m);let a=new Int32Array(c);a.fill(0);let d=0,f=false,p=0;for(let m=o;m<=r;m++){let g=t[m];if(d>=c){K(g);continue}let u=i.get(g);u===void 0?K(g):(a[u-o]=m+1,u>=p?p=u:f=true,d++);}let h=f?Ie(a):[],S=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]:s);a[m]===0?M(e,u,y):f&&(S<0||m!==h[S]?M(e,u,y):S--);}}function Ie(e){let t=new Int32Array(e.length),n=[0],o=e.length,r,l,s,c,i;for(r=0;r<o;r++){let a=e[r];if(a!==0){if(l=n[n.length-1],e[l]<a){t[r]=l,n.push(r);continue}for(s=0,c=n.length-1;s<c;)i=s+c>>1,e[n[i]]<a?s=i+1:c=i;a<e[n[s]]&&(s>0&&(t[r]=n[s-1]),n[s]=r);}}for(s=n.length,c=n[s-1];s-- >0;)n[s]=c,c=t[c];return n}function K(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 B(e,t,n){if(!e)return;let o=C(),r=[],l=true,s=i=>{if(i instanceof Node)return [i];if(L(i))return [i];let a=typeof i;return i==null||a==="string"||a==="number"||a==="boolean"?[Z(i)]:shared.coerceArray(i).map(d=>shared.isFunction(d)?d():d).flatMap(d=>d).map(Z)},c=signals.effect(()=>{let i=()=>{let a=shared.isFunction(t)?t():t,d=s(a);if(l&&le()&&d.every(f=>f instanceof Node&&f.parentNode===e)){r=d,l=false;return}r=Ze(e,r,d,n),l=false;};o&&!o.isDestroyed?A(o,i):i();});return k(()=>{c.stop();for(let i of r)K(i);r=[];}),r}function Wt(e){return (e==null?void 0:e.firstChild)||null}function Xt(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,l=a=>{let d=a.target;(d.matches(r)||d.closest(r))&&n.call(e,a);},i=o,{delegate:s}=i,c=We(i,["delegate"]);return e.addEventListener(t,l,c),()=>{e.removeEventListener(t,l,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 l=0;l<o;l++)try{let s=e[l]();if(shared.isPromise(s)){let c=s.catch(i=>{});(r||(r=[])).push(c);}}catch(s){}if(r)return Promise.all(r).then(()=>{})}function Oe(e){let t=C();if(t){if(t.isMounted){try{let n=e();shared.isPromise(n)&&n.catch(o=>{});}catch(n){}return}He(t,"onMount",e);}}function Gt(e){let t=C();t&&He(t,"onUpdate",e);}function te(e){let t=C();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=A(e,()=>nt(t,e.id,"mount"));return t.length=0,e.isMounted=true,n}function rt(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return A(e,()=>nt(e.onUpdate,e.id,"update"))}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 Zt(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=C();let o={};st(o,n),this.reactiveProps=signals.shallowReactive(o);}mount(t,n){var l;if(this.parentNode=t,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let s of this.renderedNodes)M(t,s,n);return this.state=2,this.renderedNodes}let o=O((l=this.parentScope)!=null?l:C());this.scope=o;let r=A(o,()=>{var c;let s=this.component(this.reactiveProps);return shared.isFunction(s)&&(s=s(this.reactiveProps)),(signals.isSignal(s)||signals.isComputed(s))&&(s=s.value),(c=B(t,s,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)K(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=Zt(t,o);if(o==="ref"){this.rootRefCleanup=this.bindRootRef(r,n);continue}if(shared.isOn(o)&&shared.isFunction(r)){let l=o.slice(2).toLowerCase();this.rootEventCleanups.push(ee(n,l,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.value;return t.value=n,()=>{t.value===n&&(t.value=o);}}}};function L(e){return !!e&&!!e.normal}function he(e,t){return L(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 en(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;n.innerHTML&&(n.innerHTML="");let r=O(),l;try{A(r,()=>{let s=he(e);L(s)&&(l=s,M(n,s));});}catch(s){throw P(r),s}return {root:l,unmount:()=>{P(r),l==null||l.destroy();}}}function tn(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;Me(n);let o=O(),r;try{A(o,()=>{let l=he(e);L(l)&&(r=l,B(n,l));});}catch(l){throw P(o),l}finally{Le();}return {root:r,unmount:()=>{P(o),r==null||r.destroy();}}}function je(e,t){let n=C();n&&(n.provides||(n.provides=new Map),n.provides.set(e,t));}function ce(e,t){let n=C();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,l=()=>{let c=t[`_$${n}`];if(c&&shared.isFunction(c)&&!t.disabled){let i=t[`${n}Data`];if(i?c.call(t,i,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},s=()=>{for(;l()&&(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 i=0;i<c.length-2&&(t=c[i],!!l());i++){if(t._$host){t=t._$host,s();break}if(t.parentNode===r)break}}else s();Ke(e,o);}var ge=Symbol("_$EVENTS");function on(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 rn(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);C()&&k(r);}function Ue(e,t){let n=e,o=t==null?"":String(t);n.value!==o&&(n.value=o);}var an={event:"change",forceChange:true,read:e=>e.checked,write(e,t){let n=e,o=!!t;n.checked!==o&&(n.checked=o);}},un={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);}},dn={event:"change",forceChange:true,read:e=>e.files,write(){}},fn={event:"input",ime:true,read:e=>e.value,write:Ue},mn={event:"input",ime:true,read:e=>e.value,write:Ue},pn={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 Ue(e,t);}};function yn(e,t){switch(e.nodeName){case "INPUT":return t==="checked"?e.type==="radio"?un:an:t==="files"?dn:fn;case "SELECT":return pn;case "TEXTAREA":return mn;default:return {event:"input",read:n=>n[t],write(n,o){n[t]=o;}}}}function hn(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 gn(e){let t=e.getRootNode();return (t instanceof Document||t instanceof ShadowRoot)&&t.activeElement===e}function vn(e,t,n,o,r={}){if(!e)return;let{event:l,read:s,write:c,forceChange:i,ime:a}=yn(e,t),d=r.trim===true,f=r.number===true,p=r.lazy===true,h=(d||f)&&t!=="files",S=shared.isFunction(n)?n:()=>n,m=h?N=>hn(N,d,f):N=>N,g=false,u=p||i?"change":l,y=()=>{if(g)return;let N=s(e);if(N===void 0)return;let x=m(N);Object.is(S(),x)||o(x);};oe(e,u,y),!p&&h&&u!=="change"&&oe(e,"change",()=>c(e,m(s(e)))),a&&!p&&(oe(e,"compositionstart",()=>{g=true;}),oe(e,"compositionend",()=>{g&&(g=false,y());}));let E=signals.effect(()=>{let N=S();a&&!p&&gn(e)&&(g||Object.is(m(s(e)),N))||c(e,N);});C()&&k(()=>E.stop());}function Sn(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){return !e||e.children==null?null:e.children}dt[Ae]=true;function En(e){return !!e&&!!e[Ae]}function ve(e){let t=shared.isFunction(e.target)?e.target():e.target;return t==null?null:shared.isString(t)?document.querySelector(t):t}function Se(e){return shared.isFunction(e.disabled)?!!e.disabled():!!e.disabled}function mt(e){if(le()){let d=_n(e);if(d)return d}let t=document.createComment("portal");t[ie]=true;let{children:n}=e;if(n==null)return t;let o=C(),r=null,l=(d,f)=>{r=O(o),A(r,()=>{B(d,()=>n,f);});},s=()=>{r&&(P(r),r=null);},c=(d,f)=>{if(s(),d){let p=t.parentNode;if(!p)return;l(p,t);return}f&&l(f);},i=false,a=signals.effect(()=>{let d=Se(e),f=d?null:ve(e);i&&c(d,f);});return Oe(()=>{i=!0;let d=Se(e),f=d?null:ve(e);if(d||f){c(d,f);return}queueMicrotask(()=>{t.parentNode&&c(Se(e),ve(e));});}),k(()=>{a.stop(),s();}),t}mt[ie]=true;function _n(e){if(Se(e))return null;let t=Re();if(!t)return null;let n=ve(e);return !n||!De(n)?null:(t[ie]=true,t)}function Cn(e){return !!e&&!!e[ie]}function Ne(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function pt(e){let t=e;for(;shared.isFunction(t);)t=t();return signals.isSignal(t)||signals.isComputed(t)?pt(t.value):t}var ae=Symbol("SuspenseContext");function yt(e){var S;if(!shared.isBrowser())return (S=e.fallback)!=null?S:"";let t=document.createElement("div");t.style.display="contents";let n=true,o=0,r=false,l=null,s=m=>{let g=pt(m);if(shared.isArray(g)){let u=[];for(let y of g){let E=s(y);shared.isArray(E)?u.push(...E):u.push(E);}return u}return Z(g)},c=m=>{let g=s(m),u=shared.isArray(g)?g:[g];for(let y of u)y!=null&&M(t,y);},i=()=>{Ne(t),e.fallback!=null&&c(e.fallback);},a=()=>{r||(r=true,i());},d=()=>{!r||!(l||e.children!=null&&!shared.isPromise(e.children))||(r=false,Ne(t),l?f(l):e.children!=null&&!shared.isPromise(e.children)&&f(e.children));},f=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&&i();},p={register:m=>{o++,a(),m.then(()=>{n&&(o--,o===0&&d());}).catch(g=>{n&&(o--,o===0&&d());});},increment:()=>{o++,a();},decrement:()=>{o=Math.max(0,o-1),o===0&&d();}};je(ae,p);let h=e.children;return shared.isPromise(h)?(h.then(m=>{l=m;}).catch(()=>{}),p.register(h)):h!=null?f(h):a(),te(()=>{n=false,o=0,l=null,Ne(t),t.remove();}),t}yt[Pe]=true;function kn(e){return !!e&&!!e[Pe]}function Tn(e,t){let n=signals.signal(t==null?void 0:t.initialValue),o=signals.signal(true),r=signals.signal(null),l=signals.signal("pending"),s=0,c=null,i=false,a=ce(ae,null),d=()=>Ce(null,null,function*(){let h=++s;o.value=true,l.value="pending",r.value=null,i=false,a&&a.increment();try{let S=e();c=S,S.catch(()=>{});let m=yield S;h===s&&(n.value=m,l.value="ready",o.value=!1);}catch(S){h===s&&(r.value=S instanceof Error?S:new Error(String(S)),l.value="errored",o.value=false);}finally{a&&a.decrement();}});d();let f=(()=>(!i&&o.value&&c&&a&&(i=true,a.register(c)),n.value));return f.loading=o,f.error=r,f.state=l,[f,{mutate:h=>{n.value=h,l.value="ready",o.value=false,r.value=null;},refetch:()=>Ce(null,null,function*(){yield d();})}]}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 Dn(e,t={}){let{delay:n=200,timeout:o,ssr:r="blocking",onError:l}=t;if(typeof window=="undefined"){if(r==="client-only"){let g=()=>"";return g.__asyncLoader=e,g.__asyncResolved=()=>null,g}let p=null,h=null,S=()=>h||(h=e().then(g=>{p=ht(g);}).catch(()=>{}),h);S();let m=g=>p?p(g):"";return m.__asyncLoader=S,m.__asyncResolved=()=>p,m}let s=null,c=null,i="pending",a=null;function d(){return a||(a=e().then(p=>{s=ht(p),i="resolved";}).catch(p=>{c=p instanceof Error?p:new Error(String(p)),i="errored",a=null;}),a)}d();function f(p){var W;if(i==="resolved"&&s){let b=document.createElement("div");b.style.display="contents";let F=ze(b,s,p);return k(()=>F.destroy()),b}if(i==="errored"&&c){let b=document.createElement("div");if(b.style.display="contents",t.error){let F=true,R=null,U=(q,v)=>{F&&(R==null||R.destroy(),R=ze(b,q,v));},X=()=>{a=null,i="pending",c=null,t.loading&&U(t.loading),d().then(()=>{F&&(i==="resolved"&&s?U(s,p):i==="errored"&&c&&t.error&&U(t.error,{error:c,retry:X}));});};U(t.error,{error:c,retry:X}),te(()=>{F=false,R==null||R.destroy(),R=null;});}return b}let h=document.createElement("div");h.style.display="contents";let S=true,m=null,g=null,u=null,y=(b,F)=>{S&&(m==null||m.destroy(),m=ze(h,b,F));},E=b=>()=>{a=null,i="pending",c=null,t.loading&&y(t.loading),d().then(()=>{i==="resolved"&&s?y(s,b):i==="errored"&&c&&t.error&&y(t.error,{error:c,retry:E(b)});});};te(()=>{S=false,m==null||m.destroy(),m=null,g!=null&&clearTimeout(g),u!=null&&clearTimeout(u);});let N=(W=ce(ae))!=null?W:null,x=b=>y(b,p),T=b=>{t.error&&y(t.error,{error:b,retry:E(p)});},V=()=>{t.loading&&y(t.loading);},j=d().then(()=>{S&&(i==="resolved"&&s?x(s):i==="errored"&&c&&(T(c),l&&l(c,E(p))),g!=null&&clearTimeout(g),u!=null&&clearTimeout(u));});return N&&N.register(j),n>0?g=setTimeout(()=>{S&&i==="pending"&&V();},n):t.loading&&V(),o!=null&&(u=setTimeout(()=>{if(S&&i==="pending"){let b=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);c=b,i="errored",T(b),l&&l(b,E(p));}},o)),h}return f.__asyncLoader=d,f.__asyncResolved=()=>s,f}function gt(e){let t=document.createDocumentFragment(),n=document.createComment("");t.appendChild(n);let o=[],r=[],l=e.key,s=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:[]},i=u=>l?l(u):u,a=u=>{if(Array.isArray(u)){let y=[];for(let E of u)y.push(...a(E));return y}return [Z(u)]},d=(u,y,E)=>{let N=a(u);for(let x of N)E?y.insertBefore(x,E):y.appendChild(x);return N},f=(u,y)=>{if(!e.fallback)return;r=d(e.fallback(),u,y);},p=()=>{for(let u of r)u.parentNode&&u.parentNode.removeChild(u);r=[];},h=(u,y,E,N)=>{let x=C(),T=O(x),V=[];return A(T,()=>{V=d(s(u,y),E,N);}),{key:i(u),item:u,nodes:V,scope:T}},S=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)f(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 v=0;v<E;v++)S(o[v]);o=[],e.fallback&&r.length===0&&f(u,n);return}if(E===0||r.length>0){r.length>0&&p(),o=new Array(N);let v=document.createDocumentFragment();for(let w=0;w<N;w++)o[w]=h(y[w],w,v,null);u.insertBefore(v,n);return}let x=new Map;for(let v=0;v<E;v++){let w=o[v],I=x.get(w.key),$=[w,v];I?I.push($):x.set(w.key,[$]);}let T=new Array(N),V=[],j=null,W=new Int32Array(N),b=false,F=0,R=new Array(N);for(let v=0;v<N;v++)R[v]=i(y[v]);for(let v=0;v<N;v++){let w=y[v],I=R[v],$=x.get(I);if($&&$.length>0){let[re,D]=$.shift();Object.is(re.item,w)?(re.item=w,T[v]=re,W[v]=D+1,D<F?b=true:F=D):(j||(j=document.createDocumentFragment()),S(re),T[v]=h(w,v,j,null));}else j||(j=document.createDocumentFragment()),T[v]=h(w,v,j,null);}for(let v of x.values())for(let[w]of v)V.push(w);for(let v of V)S(v);let U=b?Ie(W):[],X=U.length-1,q=n;for(let v=N-1;v>=0;v--){let I=T[v].nodes;if(!(W[v]===0)&&b&&X>=0&&v===U[X]){X--;for(let D=I.length-1;D>=0;D--)q=I[D];continue}for(let D=I.length-1;D>=0;D--){let _e=I[D];_e.nextSibling!==q&&u.insertBefore(_e,q),q=_e;}}o=T;}return k(()=>{m.stop();for(let u of o)S(u);o=[],p(),n.parentNode&&n.parentNode.removeChild(n);}),t}gt[qe]=true;
2
+ exports.Component=ne;exports.For=gt;exports.Fragment=dt;exports.Portal=mt;exports.Suspense=yt;exports.addEvent=ee;exports.addEventListener=oe;exports.beginHydration=Me;exports.bindElement=vn;exports.child=Wt;exports.clearDelegatedEvents=rn;exports.consumeTeleportAnchor=Re;exports.consumeTeleportBlock=De;exports.createApp=en;exports.createComponent=he;exports.createResource=Tn;exports.defineAsyncComponent=Dn;exports.delegateEvents=on;exports.endHydration=Le;exports.getHydrationKey=Qe;exports.getRenderedElement=Vt;exports.hydrate=tn;exports.inject=ce;exports.insert=B;exports.isComponent=L;exports.isFragment=En;exports.isHydrating=le;exports.isPortal=Cn;exports.isSuspense=kn;exports.next=Xt;exports.normalizeClass=de;exports.nthChild=qt;exports.omitProps=Sn;exports.onDestroy=te;exports.onMount=Oe;exports.onUpdate=Gt;exports.patchAttr=G;exports.patchAttrHydrate=Kt;exports.patchClass=fe;exports.patchClassHydrate=jt;exports.patchStyle=me;exports.patchStyleHydrate=Ut;exports.provide=je;exports.resetHydrationKey=It;exports.setStyle=J;exports.template=pe;//# sourceMappingURL=template.cjs.js.map
3
3
  //# sourceMappingURL=template.cjs.js.map