@estjs/template 0.0.15-beta.9 → 0.0.16-beta.1

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 Je=Object.defineProperty;var ge=Object.getOwnPropertySymbols;var Qe=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable;var Ne=(e,t,o)=>t in e?Je(e,t,{enumerable:true,configurable:true,writable:true,value:o}):e[t]=o,$=(e,t)=>{for(var o in t||(t={}))Qe.call(t,o)&&Ne(e,o,t[o]);if(ge)for(var o of ge(t))Ze.call(t,o)&&Ne(e,o,t[o]);return e};var K=(e,t,o)=>new Promise((n,r)=>{var s=c=>{try{a(o.next(c));}catch(f){r(f);}},i=c=>{try{a(o.throw(c));}catch(f){r(f);}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,i);a((o=o.apply(e,t)).next());});var M=null,et=0;function g(){return M}function Se(e){M=e;}function X(e=M){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 o=M;M=e;try{return t()}finally{M=o;}}function O(e){var t,o,n,r,s;if(!(!e||e.isDestroyed)){if(e.children)for(;e.children.size>0;){let i=e.children.values().next().value;i&&O(i);}if(e.onDestroy){for(let i of e.onDestroy)try{i();}catch(a){}e.onDestroy.clear();}if(e.cleanup){for(let i of e.cleanup)try{i();}catch(a){}e.cleanup.clear();}(t=e.parent)!=null&&t.children&&e.parent.children.delete(e),(o=e.children)==null||o.clear(),(n=e.provides)==null||n.clear(),(r=e.onMount)==null||r.clear(),(s=e.onUpdate)==null||s.clear(),Se(e.parent),e.parent=null,e.isDestroyed=true;}}function H(e){let t=M;t&&(t.cleanup||(t.cleanup=new Set),t.cleanup.add(e));}var ve="_$spread$";var Ee="http://www.w3.org/2000/svg",q="http://www.w3.org/2000/xlink",B="http://www.w3.org/2000/xmlns/";var xe=1e3,Ae=new WeakMap;function _e(e){let t=Ae.get(e);if(!t){let o=e.name||"anonymous",n=Pe(e.toString()).toString(36);t=`${o}_${n}`,Ae.set(e,t);}return t}function Pe(e){let t=0,o=e.length<100?e.length:100;for(let n=0;n<o;n++)t=Math.trunc((t<<5)-t+e.charCodeAt(n));return t<0?-t:t}var rt=0;function Q(e){if(!shared.isFalsy(e)){if(shared.isString(e))return e.length<=xe?e:`${e.slice(0,xe-10)}_${Pe(e).toString(36)}`;if(shared.isNumber(e))return String(e);if(shared.isSymbol(e)){let t=Symbol.keyFor(e);if(t)return `_s.${t}`;let o=e.description;return o?`_s.${o}`:`${rt++}`}return String(e)}}var J=Symbol("essor.key");function V(e,t){if(p(e)||!e||e.nodeType===Node.DOCUMENT_NODE)return;let o=Q(t);shared.isFalsy(o)?delete e[J]:e[J]=o;}function D(e){if(e)return p(e)?e.key:e[J]}function T(e){if(shared.isHTMLElement(e))return e;if(shared.isPrimitive(e)){let t=shared.isFalsy(e)?"":String(e);return document.createTextNode(t)}return e}function k(e,t){let o=D(e),n=D(t);if(o!==n)return false;let r=p(e),s=p(t);if(r&&s)return e.component===t.component;if(r!==s)return false;if(shared.isPrimitive(e)||shared.isPrimitive(t))return e===t;let i=e,a=t;return i.nodeType!==a.nodeType?false:i.nodeType===Node.ELEMENT_NODE?i.tagName===a.tagName:true}function ee(e,t){if(e===t)return true;if(!e||!t||Array.isArray(e)!==Array.isArray(t))return false;for(let o in e)if(e[o]!==t[o])return false;for(let o in t)if(!(o in e))return false;return true}function E(e){if(e)try{if(p(e))e.destroy();else {let t=e;t.parentElement&&t.remove();}}catch(t){shared.error("Failed to remove node:",t);}}function y(e,t,o){if(!(!e||!t))try{let n=p(o)?o.firstChild:o;if(p(t)){t.mount(e,n);return}n?e.insertBefore(t,n):e.appendChild(t);}catch(n){shared.error("Failed to insert node:",n);}}function j(e,t,o){if(!(!e||!t||!o||t===o))try{let n=p(o)?o.beforeNode:o.nextSibling;E(o),y(e,t,n);}catch(n){shared.error("Failed to replace node:",n);}}function x(e){if(e){if(p(e))return e.firstChild;if(!shared.isPrimitive(e))return e}}function De(e,t){if(p(e)||p(t))return;let o=D(e);o&&!D(t)&&V(t,o);}function w(e,t,o){if(o===t)return t;let n=shared.isHTMLElement(t);if(shared.isHTMLElement(o)&&n){if(o.isEqualNode(t))return t;if(t.tagName===o.tagName){let a=t.attributes,c=o.attributes;for(let f=a.length-1;f>=0;f--){let l=a[f].name;o.hasAttribute(l)||t.removeAttribute(l);}for(let f=0,l=c.length;f<l;f++){let u=c[f];t.getAttribute(u.name)!==u.value&&t.setAttribute(u.name,u.value);}return De(t,o),t}}if(shared.isTextNode(t)&&shared.isTextNode(o))return t.textContent!==o.textContent&&(t.textContent=o.textContent),De(t,o),t;let s=p(t),i=p(o);return s&&i&&t.component===o.component?o.update(t):(j(e,o,t),o)}function Te(e,t,o,n){let r=t.length,s=o.length;if(r===0&&s===0)return [];if(r===0){for(let i=0;i<s;i++)y(e,o[i],n);return o}if(s===0){for(let i=0;i<r;i++)E(t[i]);return []}if(r===1&&s===1){let i=t[0],a=o[0];return k(i,a)?(w(e,i,a),o[0]=i):j(e,a,i),o}if(r===2&&s===2){let i=t[0],a=t[1],c=o[0],f=o[1];if(k(i,c)&&k(a,f))return w(e,i,c),w(e,a,f),o[0]=i,o[1]=a,o;if(k(i,f)&&k(a,c)){w(e,i,f),w(e,a,c);let l=x(a),u=x(i);return l&&u&&l.parentNode===e&&e.insertBefore(l,u),o[0]=a,o[1]=i,o}}return at(e,t,o,n)}function at(e,t,o,n){let r=0,s=0,i=t.length-1,a=o.length-1,c=t[0],f=t[i],l=o[0],u=o[a];for(;r<=i&&s<=a;)if(!c)c=t[++r];else if(!f)f=t[--i];else if(k(c,l))w(e,c,l),o[s]=c,c=t[++r],l=o[++s];else break;for(;r<=i&&s<=a;)if(!c)c=t[++r];else if(!f)f=t[--i];else if(k(f,u))w(e,f,u),o[a]=f,f=t[--i],u=o[--a];else break;if(r>i){if(s<=a){let m=a+1<o.length?x(o[a+1]):n;for(let S=s;S<=a;S++)y(e,o[S],m);}}else if(s>a)for(let m=r;m<=i;m++){let S=t[m];S&&E(S);}else ft(e,t,o,r,i,s,a,n);return o}function ft(e,t,o,n,r,s,i,a){let c=i-s+1,f;for(let h=s;h<=i;h++){let v=D(o[h]);v!==void 0&&(f||(f=Object.create(null)),f[v]=h);}let l=new Int32Array(c),u=false,m=0,S=0;for(let h=n;h<=r;h++){let v=t[h];if(!v)continue;if(S>=c){E(v);continue}let N,C=D(v);if(C!==void 0&&f&&C in f)N=f[C];else for(let I=s;I<=i;I++)if(l[I-s]===0&&C===void 0&&D(o[I])===void 0&&k(v,o[I])){N=I;break}N===void 0?E(v):(l[N-s]=h+1,N>=m?m=N:u=true,w(e,v,o[N]),o[N]=v,S++);}let _=u?ut(l):[],R=_.length-1,P=a;for(let h=c-1;h>=0;h--){let v=s+h,N=o[v];if(l[h]===0)y(e,N,P),P=x(N)||P;else if(u)if(R<0||h!==_[R]){let C=x(N);C&&C.parentNode===e&&y(e,C,P),P=C||P;}else P=x(N)||P,R--;else P=x(N)||P;}}function ut(e){let t=e.length;if(t===0)return [];if(t===1)return e[0]!==0?[0]:[];let o=[],n=new Int32Array(t),r,s,i,a,c;for(r=0;r<t;r++){let f=e[r];if(f!==0){if(s=o[o.length-1],o.length===0||e[s]<f){n[r]=s,o.push(r);continue}for(i=0,a=o.length-1;i<a;)c=i+a>>1,e[o[c]]<f?i=c+1:a=c;f<e[o[i]]&&(i>0&&(n[r]=o[i-1]),o[i]=r);}}for(i=o.length,a=o[i-1];i-- >0;)o[i]=a,a=n[a];return o}var oe=false;function lt(){oe=true;}function dt(){oe=false;}function L(){return oe}function b(e,t,o,n){e.addEventListener(t,o,n),H(()=>{e.removeEventListener(t,o,n);});}function Nt(e,t,o,n){shared.isHtmlInputElement(e)?St(e,n):shared.isHtmlSelectElement(e)?vt(e,n):shared.isHtmlTextAreaElement(e)&&b(e,"input",()=>{n(e.value);});}function St(e,t){switch(e.type){case "checkbox":b(e,"change",()=>{t(!!e.checked);});break;case "radio":b(e,"change",()=>{t(e.checked?e.value:"");});break;case "file":b(e,"change",()=>{t(e.files);});break;case "number":case "range":b(e,"input",()=>{t(e.value||"");});break;case "date":case "datetime-local":case "month":case "time":case "week":b(e,"change",()=>{t(e.value||"");});break;default:b(e,"input",()=>{t(e.value);});break}}function vt(e,t){b(e,"change",()=>{if(e.multiple){let o=Array.from(e.options).filter(n=>n.selected).map(n=>n.value);t(o);}else t(e.value);});}var we=true;function Et(e,t,o,n,r){let s=()=>{let i=shared.isFunction(o)?o():o,a=shared.coerceArray(i).map(c=>shared.isFunction(c)?c():c).flatMap(c=>c).map(T);return we&&L()?(we=false,r):Te(t,r,a,n)};return e&&!e.isDestroyed?A(e,s):s()}function ne(e,t,o){if(!e)return;let n=g(),r=[],s=signals.effect(()=>{r=Et(n,e,t,o,r);});return H(()=>{s(),r.forEach(i=>E(i)),r.length=0;}),r}function xt(e,t){let o=t.length,n=new Array(o),r=new Set(t),s=1,i=0,a=c=>{if(c.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){if(r.has(s)&&(n[i++]=c,i===o))return true;s++;}let f=c.firstChild;for(;f;){if(a(f))return true;f=f.nextSibling;}return false};return a(e),n}function At(e){let t=g();if(t){if(t.isMounted){try{e();}catch(o){}return}t.onMount||(t.onMount=new Set),t.onMount.add(e);}}function bt(e){let t=g();t&&(t.onUpdate||(t.onUpdate=new Set),t.onUpdate.add(e));}function _t(e){let t=g();t&&(t.onDestroy||(t.onDestroy=new Set),t.onDestroy.add(e));}function Me(e){!e||e.isDestroyed||e.isMounted||(e.isMounted=true,e.onMount&&A(e,()=>{for(let t of e.onMount)try{t();}catch(o){}}));}function z(e){if(!(!e||e.isDestroyed)&&e.onUpdate)for(let t of e.onUpdate)try{t();}catch(o){}}function re(e){At(e);}function ie(e){_t(e);}function Pt(e){bt(e);}var Fe;Fe="normal";var Y=class{constructor(t,o={}){this.component=t;this.props=o;this.renderedNodes=[];this.scope=null;this.parentNode=void 0;this.beforeNode=void 0;this.reactiveProps={};this.state=0;this.parentScope=null;this[Fe]=true;this.key=o.key?Q(o.key):_e(t),this.reactiveProps=signals.shallowReactive($({},o||{})),this.parentScope=g();}get isConnected(){return this.state===2}get firstChild(){for(let t of this.renderedNodes){let o=x(t);if(o)return o}}mount(t,o){var s;if(this.parentNode=t,this.beforeNode=o,this.state=1,this.renderedNodes.length>0){for(let i of this.renderedNodes)y(t,i,o);return this.state=2,this.renderedNodes}let n=(s=this.parentScope)!=null?s:g();this.scope=X(n);let r=A(this.scope,()=>{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=ne(t,i,o))!=null?c:[]});return this.renderedNodes=r,A(this.scope,()=>{this.applyProps(this.props||{});}),this.state=2,this.scope&&Me(this.scope),this.renderedNodes}update(t){if(this.key!==t.key)return this.mount(t.parentNode,t.beforeNode),this;if(this.parentNode=t.parentNode,this.beforeNode=t.beforeNode,this.scope=t.scope,this.parentScope=t.parentScope,this.renderedNodes=t.renderedNodes,this.state=t.state,this.reactiveProps=t.reactiveProps,!this.props||Object.keys(this.props).length===0)return !this.isConnected&&this.parentNode?(this.mount(this.parentNode,this.beforeNode),this):(this.scope&&(A(this.scope,()=>{this.applyProps(this.props||{});}),z(this.scope)),this);let o=false;for(let n in this.props){if(n==="key")continue;let r=this.props[n],s=this.reactiveProps[n];Object.is(s,r)||shared.isObject(s)&&shared.isObject(r)&&ee(s,r)||(this.reactiveProps[n]=r,o=true);}return !this.isConnected&&this.parentNode&&this.mount(this.parentNode,this.beforeNode),this.scope&&(o||!this.isConnected)&&(A(this.scope,()=>{this.applyProps(this.props||{});}),o&&z(this.scope)),this}forceUpdate(){return K(this,null,function*(){if(yield Promise.resolve(),this.state===5||!this.parentNode||!this.scope)return;let t=[...this.renderedNodes];try{A(this.scope,()=>{let o=this.component(this.reactiveProps);shared.isFunction(o)&&(o=o(this.reactiveProps)),(signals.isSignal(o)||signals.isComputed(o))&&(o=o.value);let n=shared.coerceArray(o);if(this.parentNode){let r=this.beforeNode;if(!r&&this.renderedNodes.length>0){let s=this.renderedNodes[this.renderedNodes.length-1],i=x(s);i&&(r=i.nextSibling);}for(let s of this.renderedNodes)E(s);for(let s of n)y(this.parentNode,s,r);this.renderedNodes=n;}}),this.scope&&z(this.scope);}catch(o){throw this.renderedNodes=t,o}})}destroy(){if(this.state===4||this.state===5)return;this.state=4;let t=this.scope;t&&(O(t),this.scope=null);for(let o of this.renderedNodes)E(o);this.renderedNodes=[],this.parentNode=void 0,this.beforeNode=void 0,this.parentScope=null,this.reactiveProps={},this.props={},this.state=5;}applyProps(t){if(!t)return;let o=this.firstChild;for(let[n,r]of Object.entries(t))if(shared.startsWith(n,"on")&&o){let s=n.slice(2).toLowerCase();shared.isHTMLElement(o)&&b(o,s,r);}else n==="ref"&&signals.isSignal(r)&&(r.value=o);this.props=t;}};function p(e){return !!e&&!!e.normal}function ce(e,t){return p(e)?e:new Y(e,t)}function wt(e){let t,o=()=>{let n=document.createElement("template");n.innerHTML=e;let r=n.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(t||(t=o())).cloneNode(true)}function Mt(e,t){let o=shared.isString(t)?document.querySelector(t):t;if(!o){shared.error(`Target element not found: ${t}`);return}o.innerHTML&&(shared.error(`Target element is not empty, it will be delete: ${t}`),o.innerHTML="");let r=ce(e);return r.mount(o),r}function ae(e,t){let o=g();o&&(o.provides||(o.provides=new Map),o.provides.set(e,t));}function fe(e,t){let o=g();if(!o)return t;let n=o;for(;n;){if(n.provides){let r=n.provides.get(e);if(r)return r}n=n.parent;}return t}function It(e){let t=e.target,o=`${e.type}`,n=e.target,r=e.currentTarget,s=c=>Object.defineProperty(e,"target",{configurable:true,value:c}),i=()=>{let c=t[`_$${o}`];if(c&&shared.isFunction(c)&&!t.disabled){let f=t[`${o}Data`];if(f?c.call(t,f,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)&&s(t.host),true},a=()=>{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();s(c[0]);for(let f=0;f<c.length-2&&(t=c[f],!!i());f++){if(t._$host){t=t._$host,a();break}if(t.parentNode===r)break}}else a();s(n);}var Ue=Symbol("_$EVENTS");function Ht(e,t=window.document){let o=t,n=o[Ue]||(o[Ue]=new Set);for(let r of e)n.has(r)||(n.add(r),t.addEventListener(r,It));}function Ft(e,t){let o=new Set(t);return new Proxy(e,{get(n,r){if(!o.has(r))return Reflect.get(n,r)},ownKeys(n){return Reflect.ownKeys(n).filter(r=>!o.has(r))},getOwnPropertyDescriptor(n,r){if(!o.has(r))return Reflect.getOwnPropertyDescriptor(n,r)},has(n,r){return o.has(r)?false:Reflect.has(n,r)}})}function $e(e,t,o,n=false){if(t===o||L())return;let r=G(o),s=G(t);r&&s===r||(r?n?e.setAttribute("class",r):e.className=r:e.removeAttribute("class"));}function G(e){return shared.normalizeClassName(e)}var Oe=/\s*!important$/,Ot=["Webkit","Moz","ms"],ue={};function ze(e,t,o){let n=e.style,r=shared.isString(o);if(!L()){if(o&&r){t!==o&&(n.cssText=o);return}if(!o){t&&e.removeAttribute("style");return}if(t&&!shared.isString(t))for(let s in t)(!o||o[s]==null)&&F(n,s,"");else if(t&&shared.isString(t)){let s=t.split(";");for(let i of s){let a=i.indexOf(":");if(a>0){let c=i.slice(0,a).trim();o&&shared.isObject(o)&&o[c]==null&&F(n,c,"");}}}if(o&&!shared.isString(o))for(let s in o){let i=o[s];(!t||shared.isString(t)||t[s]!==i)&&i!=null&&F(n,s,i);}}}function F(e,t,o){if(shared.isArray(o)){for(let r of o)F(e,t,r);return}if((o==null||o==="")&&(o=""),t.startsWith("--")){e.setProperty(t,o);return}let n=jt(e,t);typeof o=="string"&&Oe.test(o)?e.setProperty(shared.camelCase(n),o.replace(Oe,""),"important"):e[n]=o;}function jt(e,t){let o=ue[t];if(o)return o;let n=shared.camelCase(t);if(n!=="filter"&&n in e)return ue[t]=n;n=shared.capitalize(n);for(let r of Ot){let s=r+n;if(s in e)return ue[t]=s}return t}function le(e,t,o,n){if(t==="key"){n==null?V(e,void 0):V(e,String(n));return}if(t===ve){Object.keys(n).forEach(u=>{le(e,u,o==null?void 0:o[u],n==null?void 0:n[u]);});return}if(L())return;let r=(e==null?void 0:e.namespaceURI)===Ee,s=r&&t.startsWith("xlink:"),i=r&&t.startsWith("xmlns:"),a=shared.isSpecialBooleanAttr(t)||shared.isBooleanAttr(t);if(o===n)return;let c=t.toLowerCase();if(c.length>2&&c.charCodeAt(0)===111&&c.charCodeAt(1)===110||c==="innerhtml")return;if(n==null){if(s)e.removeAttributeNS(q,t.slice(6));else if(i){let u=t.slice(6);e.removeAttributeNS(B,u);}else e.removeAttribute(t);return}if(s){e.setAttributeNS(q,t,String(n));return}if(i){e.setAttributeNS(B,t,String(n));return}if(a){shared.includeBooleanAttr(n)?e.setAttribute(t,""):e.removeAttribute(t);return}let f=shared.isSymbol(n)?String(n):n;if((c==="href"||c==="src"||c==="xlink:href")&&typeof f=="string"){let u=f.trim().toLowerCase();if(u.startsWith("javascript:")||u.startsWith("data:"))return}if(r)e.setAttribute(t,String(f));else if(t in e)try{e[t]=f;}catch(u){e.setAttribute(t,String(f));}else e.setAttribute(t,String(f));}function Ye(e,t,o,n){if(!(n!=null&&n.delegate))return e.addEventListener(t,o,n),()=>e.removeEventListener(t,o,n);let r=n.delegate,s=a=>{let c=a.target;(c.matches(r)||c.closest(r))&&o.call(e,a);},i=$({},n);return i.delegate=void 0,e.addEventListener(t,s,i),()=>{e.removeEventListener(t,s,i);}}function de(e){return e==null?void 0:e.children}de.fragment=true;function Ge(e){return !!e&&!!e.fragment}function pe(e){if(typeof document=="undefined"){let n=e.children;return n?(shared.isArray(n)?n:[n]).map(s=>String(s||"")).join(""):""}let t=document.createComment("portal");t.portal=true;let o=e.children;if(o){let n=shared.isArray(o)?o:[o],r=[];re(()=>{let s=shared.isString(e.target)?document.querySelector(e.target):e.target;s&&(n.forEach(i=>{if(i!=null){let a=T(i);a&&(y(s,a),r.push(a));}}),H(()=>{r.forEach(i=>{typeof i!="string"&&i.parentNode===s&&s.removeChild(i);});}));});}return t}pe.portal=true;function Xe(e){return !!e&&!!e.portal}var ye=Symbol("SuspenseContext");function he(e){if(shared.isUndefined(document)){let u=e.fallback;return u?String(u||""):""}let t=document.createElement("div");t.style.display="contents";let o=true,n=0,r=false,s=null,i=()=>{if(!r){for(r=true;t.firstChild;)t.removeChild(t.firstChild);if(e.fallback!=null){let u=T(e.fallback);u&&y(t,u);}}},a=()=>{if(!(!r||!(s||e.children!=null&&!shared.isPromise(e.children)))){for(r=false;t.firstChild;)t.removeChild(t.firstChild);s?c(s):e.children!=null&&!shared.isPromise(e.children)&&c(e.children);}},c=u=>{for(;t.firstChild;)t.removeChild(t.firstChild);if(u==null)return;let m=g();if((shared.isArray(u)?u:[u]).forEach(_=>{if(_!=null){p(_)&&(_.parentContext=m);let R=T(_);R&&y(t,R);}}),r){for(;t.firstChild;)t.removeChild(t.firstChild);if(e.fallback!=null){let _=T(e.fallback);_&&y(t,_);}}},f={register:u=>{n++,i(),u.then(()=>{o&&(n--,n===0&&a());}).catch(m=>{o&&(n--,n===0&&a());});},increment:()=>{n++,i();},decrement:()=>{n--,n===0&&a();}};ae(ye,f);let l=e.children;return shared.isPromise(l)?(l.then(u=>{s=u;}).catch(()=>{}),f.register(l)):l!=null?c(l):i(),ie(()=>{for(o=false;t.firstChild;)t.removeChild(t.firstChild);}),t}he.suspense=true;function qe(e){return !!e&&!!e.suspense}function Be(e,t){let o=signals.signal(t==null?void 0:t.initialValue),n=signals.signal(true),r=signals.signal(null),s=signals.signal("pending"),i=0,a=null,c=()=>K(null,null,function*(){let u=++i;n.value=true,s.value="pending",r.value=null;try{let m=e();a=m.then(()=>{}).catch(()=>{});let S=yield m;u===i&&(o.value=S,s.value="ready",n.value=!1);}catch(m){u===i&&(r.value=m instanceof Error?m:new Error(String(m)),s.value="errored",n.value=false);}});c();let f=(()=>{if(n.value&&a){let u=fe(ye,null);u&&u.register(a);}return o.value});return f.loading=n,f.error=r,f.state=s,[f,{mutate:u=>{o.value=u,s.value="ready",n.value=false,r.value=null;},refetch:()=>K(null,null,function*(){yield c();})}]}
2
- exports.Component=Y;exports.Fragment=de;exports.Portal=pe;exports.Suspense=he;exports.addEvent=Ye;exports.addEventListener=b;exports.bindElement=Nt;exports.createApp=Mt;exports.createComponent=ce;exports.createResource=Be;exports.createScope=X;exports.delegateEvents=Ht;exports.disposeScope=O;exports.endHydration=dt;exports.getActiveScope=g;exports.getFirstDOMNode=x;exports.inject=fe;exports.insert=ne;exports.insertNode=y;exports.isComponent=p;exports.isFragment=Ge;exports.isHydrating=L;exports.isPortal=Xe;exports.isSameNode=k;exports.isSuspense=qe;exports.mapNodes=xt;exports.normalizeClass=G;exports.normalizeNode=T;exports.omitProps=Ft;exports.onCleanup=H;exports.onDestroy=ie;exports.onMount=re;exports.onUpdate=Pt;exports.patchAttr=le;exports.patchClass=$e;exports.patchStyle=ze;exports.provide=ae;exports.removeNode=E;exports.replaceNode=j;exports.runWithScope=A;exports.setActiveScope=Se;exports.setStyle=F;exports.shallowCompare=ee;exports.startHydration=lt;exports.template=wt;//# sourceMappingURL=template.cjs.js.map
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
3
3
  //# sourceMappingURL=template.cjs.js.map