@estjs/template 0.0.15 → 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
- import {isHTMLElement,isPrimitive,isFalsy,isNull,isObject,isArray,isHtmlInputElement,isHtmlSelectElement,isHtmlTextAreaElement,isFunction,hasChanged,isPromise,coerceArray,startsWith,isString,error,isBrowser,normalizeClassName,camelCase,capitalize,isSpecialBooleanAttr,isBooleanAttr,includeBooleanAttr,isSymbol,isUndefined,isNumber,isTextNode}from'@estjs/shared';import {effect,shallowReactive,isSignal,isComputed,signal,memoEffect,untrack}from'@estjs/signals';var _t=Object.defineProperty;var Me=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,Pt=Object.prototype.propertyIsEnumerable;var Re=(e,t,n)=>t in e?_t(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,V=(e,t)=>{for(var n in t||(t={}))Ct.call(t,n)&&Re(e,n,t[n]);if(Me)for(var n of Me(t))Pt.call(t,n)&&Re(e,n,t[n]);return e};var ie=(e,t,n)=>new Promise((o,r)=>{var s=a=>{try{c(n.next(a));}catch(u){r(u);}},i=a=>{try{c(n.throw(a));}catch(u){r(u);}},c=a=>a.done?o(a.value):Promise.resolve(a.value).then(s,i);c((n=n.apply(e,t)).next());});var kt={mount:"mount",destroy:"destroy",update:"update"};function se(e,t,n){let o=e[t];o||(o=e[t]=[]),o.includes(n)||o.push(n);}function ce(e,t,n){let o=e.length;if(o===0)return;let r;for(let s=0;s<o;s++)try{let i=e[s]();if(isPromise(i)){let c=i.catch(a=>{});(r!=null?r:r=[]).push(c);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function ae(e){let t=C();if(t){if(t.isMounted){try{let n=e();isPromise(n)&&n.catch(o=>{});}catch(n){}return}se(t,"onMount",e);}}function Tt(e){let t=C();t&&se(t,"onUpdate",e);}function ue(e){let t=C();t&&se(t,"onDestroy",e);}function He(e){var o;if(e.isDestroyed||!((o=e.onMount)!=null&&o.length)){e.isMounted=true;return}let t=e.onMount,n=L(e,()=>ce(t,e.id,kt.mount));return t.length=0,e.isMounted=true,n}function fe(e){var o;if(e.isDestroyed||!((o=e.onUpdate)!=null&&o.length))return;let t=e.onUpdate,n=L(e,()=>ce(t,e.id,"update"));return t.length=0,n}function Fe(e){var t;if(!(e.isDestroyed||!((t=e.onDestroy)!=null&&t.length)))return L(e,()=>ce(e.onDestroy,e.id,"destroy"))}var M=null,Dt=0;function C(){return M}function O(e){M=e;}function z(e=M){let t={id:++Dt,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=[]),e.children.push(t)),t}function L(e,t){let n=M;M=e;try{return t()}finally{M=n;}}function $(e){var n,o,r;if(!e||e.isDestroyed)return;let t=e.parent;if(e.children){for(let s of e.children)$(s);e.children.length=0;}if((n=e.onDestroy)!=null&&n.length&&(Fe(e),e.onDestroy.length=0),(o=e.cleanup)!=null&&o.length){for(let s of e.cleanup)try{s();}catch(i){}e.cleanup.length=0;}if(t!=null&&t.children){let s=t.children.indexOf(e);s!==-1&&t.children.splice(s,1);}(r=e.provides)==null||r.clear(),e.onMount&&(e.onMount.length=0),e.onUpdate&&(e.onUpdate.length=0),e.parent=null,e.isDestroyed=true,M===e&&(M=t);}function H(e){let t=M;t&&(t.cleanup||(t.cleanup=[]),t.cleanup.push(e));}var Ke="_$spread$";var Oe="http://www.w3.org/2000/svg",le="http://www.w3.org/2000/xlink",de="http://www.w3.org/2000/xmlns/";var pe=Symbol(""),me=Symbol(""),X=Symbol(""),ye=Symbol(""),Ve=Symbol("");var $e=1e3,je=new WeakMap;function ze(e){let t=je.get(e);if(!t){let n=e.name||"anonymous",o=Ye(e.toString()).toString(36);t=`${n}_${o}`,je.set(e,t);}return t}function Ye(e){let t=0,n=e.length<100?e.length:100;for(let o=0;o<n;o++)t=Math.trunc((t<<5)-t+e.charCodeAt(o));return t<0?-t:t}var Rt=0;function ge(e){if(!isFalsy(e)){if(isString(e))return e.length<=$e?e:`${e.slice(0,$e-10)}_${Ye(e).toString(36)}`;if(isNumber(e))return String(e);if(isSymbol(e)){let t=Symbol.keyFor(e);if(t)return `_s.${t}`;let n=e.description;return n?`_s.${n}`:`${Rt++}`}return String(e)}}var he=Symbol("essor.key");function Y(e,t){if(y(e)||!e||e.nodeType===Node.DOCUMENT_NODE)return;let n=ge(t);isFalsy(n)?delete e[he]:e[he]=n;}function R(e){if(e)return y(e)?e.key:e[he]}function I(e){if(isHTMLElement(e))return e;if(isPrimitive(e)){let t=isFalsy(e)?"":String(e);return document.createTextNode(t)}return e}function w(e,t){let n=R(e),o=R(t);if(n!==o)return false;let r=y(e),s=y(t);if(r&&s)return e.component===t.component;if(r!==s)return false;if(isPrimitive(e)||isPrimitive(t))return e===t;let i=e,c=t;return i.nodeType!==c.nodeType?false:i.nodeType===Node.ELEMENT_NODE?i.tagName===c.tagName:true}function Se(e,t){if(e===t)return true;if(isNull(e)||isNull(t)||!isObject(e)||!isObject(t)||isArray(e)!==isArray(t))return false;let n=e,o=t,r=Object.keys(n),s=Object.keys(o);if(r.length!==s.length)return false;for(let i of r)if(!(i in o)||n[i]!==o[i])return false;return true}function k(e){if(!e)return;if(y(e)){e.destroy();return}let t=e;t.parentElement&&t.remove();}function P(e,t,n){if(!e||!t)return;if(y(t)){let r=y(n)?n.firstChild:n;t.mount(e,r);return}let o=y(n)?n.firstChild:n;o?e.insertBefore(t,o):e.appendChild(t);}function q(e,t,n){if(!e||!t||!n||t===n)return;let o=y(n)?n.beforeNode:n.nextSibling;k(n),P(e,t,o);}function T(e){if(e){if(y(e))return e.firstChild;if(!isPrimitive(e))return e}}function Je(e,t){if(y(e)||y(t))return;let n=R(e);n&&!R(t)&&Y(t,n);}function F(e,t,n){if(n===t)return t;let o=isHTMLElement(t);if(isHTMLElement(n)&&o){if(n.isEqualNode(t))return t;if(t.tagName===n.tagName){let c=t.attributes,a=n.attributes;for(let u=c.length-1;u>=0;u--){let p=c[u].name;n.hasAttribute(p)||t.removeAttribute(p);}for(let u=0,p=a.length;u<p;u++){let f=a[u];t.getAttribute(f.name)!==f.value&&t.setAttribute(f.name,f.value);}return Je(t,n),t}}if(isTextNode(t)&&isTextNode(n))return t.textContent!==n.textContent&&(t.textContent=n.textContent),Je(t,n),t;let s=y(t),i=y(n);return s&&i&&t.component===n.component?n.update(t):(q(e,n,t),n)}function Qe(e,t,n,o){let r=t.length,s=n.length;if(r===0&&s===0)return [];if(r===0){for(let i=0;i<s;i++)P(e,n[i],o);return n}if(s===0){for(let i=0;i<r;i++)k(t[i]);return []}if(r===1&&s===1){let i=t[0],c=n[0];return w(i,c)?(F(e,i,c),n[0]=i):q(e,c,i),n}if(r===2&&s===2){let i=t[0],c=t[1],a=n[0],u=n[1];if(w(i,a)&&w(c,u))return F(e,i,a),F(e,c,u),n[0]=i,n[1]=c,n;if(w(i,u)&&w(c,a)){F(e,i,u),F(e,c,a);let p=T(c),f=T(i);return p&&f&&p.parentNode===e&&e.insertBefore(p,f),n[0]=c,n[1]=i,n}}return Kt(e,t,n,o)}function Kt(e,t,n,o){let r=0,s=0,i=t.length-1,c=n.length-1,a=t[0],u=t[i],p=n[0],f=n[c];for(;r<=i&&s<=c;)if(!a)a=t[++r];else if(!u)u=t[--i];else if(w(a,p))F(e,a,p),n[s]=a,a=t[++r],p=n[++s];else break;for(;r<=i&&s<=c;)if(!a)a=t[++r];else if(!u)u=t[--i];else if(w(u,f))F(e,u,f),n[c]=u,u=t[--i],f=n[--c];else break;if(r>i){if(s<=c){let l=c+1<n.length?T(n[c+1]):o;for(let m=s;m<=c;m++)P(e,n[m],l);}}else if(s>c)for(let l=r;l<=i;l++){let m=t[l];m&&k(m);}else Ot(e,t,n,r,i,s,c,o);return n}function Ot(e,t,n,o,r,s,i,c){let a=i-s+1,u;for(let S=s;S<=i;S++){let v=R(n[S]);v!==void 0&&(u||(u=Object.create(null)),u[v]=S);}let p=new Int32Array(a),f=false,l=0,m=0;for(let S=o;S<=r;S++){let v=t[S];if(!v)continue;if(m>=a){k(v);continue}let A,b=R(v);if(b!==void 0&&u&&b in u)A=u[b];else for(let d=s;d<=i;d++)if(p[d-s]===0&&b===void 0&&R(n[d])===void 0&&w(v,n[d])){A=d;break}A===void 0?k(v):(p[A-s]=S+1,A>=l?l=A:f=true,F(e,v,n[A]),n[A]=v,m++);}let E=f?Vt(p):[],x=E.length-1,h=c;for(let S=a-1;S>=0;S--){let v=s+S,A=n[v];if(p[S]===0)P(e,A,h),h=T(A)||h;else if(f)if(x<0||S!==E[x]){let b=T(A);b&&b.parentNode===e&&P(e,b,h),h=b||h;}else h=T(A)||h,x--;else h=T(A)||h;}}function Vt(e){let t=e.length;if(t===0)return [];if(t===1)return e[0]!==0?[0]:[];let n=[],o=new Int32Array(t),r,s,i,c,a;for(r=0;r<t;r++){let u=e[r];if(u!==0){if(s=n[n.length-1],n.length===0||e[s]<u){o[r]=s,n.push(r);continue}for(i=0,c=n.length-1;i<c;)a=i+c>>1,e[n[a]]<u?i=a+1:c=a;u<e[n[i]]&&(i>0&&(o[r]=n[i-1]),n[i]=r);}}for(i=n.length,c=n[i-1];i-- >0;)n[i]=c,c=o[c];return n}function D(e,t,n,o){e.addEventListener(t,n,o),H(()=>{e.removeEventListener(t,n,o);});}function Bt(e,t,n,o){isHtmlInputElement(e)?Gt(e,o):isHtmlSelectElement(e)?Wt(e,o):isHtmlTextAreaElement(e)&&D(e,"input",()=>{o(e.value);});}function Gt(e,t){switch(e.type){case "checkbox":D(e,"change",()=>{t(!!e.checked);});break;case "radio":D(e,"change",()=>{t(e.checked?e.value:"");});break;case "file":D(e,"change",()=>{t(e.files);});break;case "number":case "range":D(e,"input",()=>{t(e.value||"");});break;case "date":case "datetime-local":case "month":case "time":case "week":D(e,"change",()=>{t(e.value||"");});break;default:D(e,"input",()=>{t(e.value);});break}}function Wt(e,t){D(e,"change",()=>{if(e.multiple){let n=Array.from(e.options).filter(o=>o.selected).map(o=>o.value);t(n);}else t(e.value);});}function Ee(e,t,n){if(!e)return;let o=[],r=C(),s=effect(()=>{let i=()=>{let c=isFunction(t)?t():t,a=coerceArray(c).map(u=>isFunction(u)?u():u).flatMap(I);o=Qe(e,o,a,n);};r?L(r,i):i();});return H(()=>{s(),o.forEach(i=>k(i)),o.length=0;}),o}function ve(e,t){let n=t.length,o=new Array(n),r=new Set(t),s=1,i=0,c=a=>{if(a.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){if(r.has(s)&&(o[i++]=a,i===n))return true;s++;}let u=a.firstChild;for(;u;){if(c(u))return true;u=u.nextSibling;}return false};return c(e),o}var ot;ot=pe;var Q=class{constructor(t,n={}){this.component=t;this.props=n;this.renderedNodes=[];this.scope=null;this.parentNode=void 0;this.beforeNode=void 0;this.reactiveProps={};this._propSnapshots={};this.state=0;this.parentScope=null;this[ot]=true;this.key=n.key?ge(n.key):ze(t),this.reactiveProps=shallowReactive(V({},n)),this.parentScope=C();for(let o in n){let r=n[o];isObject(r)&&(this._propSnapshots[o]=isArray(r)?[...r]:V({},r));}}get isConnected(){return this.state===2}get firstChild(){for(let t of this.renderedNodes){let n=T(t);if(n)return n}}mount(t,n){var i,c;if(this.parentNode=t,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let a of this.renderedNodes)P(t,a,n);return this.state=2,this.renderedNodes}let o=(i=this.parentScope)!=null?i:C();this.scope=z(o),O(this.scope);let r=this.component(this.reactiveProps);isFunction(r)&&(r=r(this.reactiveProps)),(isSignal(r)||isComputed(r))&&(r=r.value);let s=(c=Ee(t,r,n))!=null?c:[];return this.renderedNodes=s,this.applyProps(this.props),this.state=2,He(this.scope),this.renderedNodes}update(t){return this.key!==t.key?(this.mount(t.parentNode,t.beforeNode),this):(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._propSnapshots=t._propSnapshots,this._updateReactiveProps(this.props),!this.isConnected&&this.parentNode?(this.mount(this.parentNode,this.beforeNode),this):(this.scope&&(O(this.scope),this.applyProps(this.props),fe(this.scope)),this))}_updateReactiveProps(t){for(let n in t){if(n==="key")continue;let o=t[n],r=this.reactiveProps[n];if(o===r&&!this._propSnapshots[n])continue;if(isObject(o)){let i=this._propSnapshots[n];if(i&&Se(o,i))continue;let c=isArray(o)?[...o]:V({},o);this.reactiveProps[n]=c,this._propSnapshots[n]=c;}else hasChanged(o,r)&&(this.reactiveProps[n]=o,this._propSnapshots[n]&&delete this._propSnapshots[n]);}}unwrapRenderResult(t){return isFunction(t)&&(t=t(this.reactiveProps)),(isSignal(t)||isComputed(t))&&(t=t.value),y(t)&&(t=t.mount(this.parentNode,this.beforeNode)),isPromise(t)&&(t=t.then(n=>this.unwrapRenderResult(n))),t}forceUpdate(){if(this.state===5||!this.parentNode||!this.scope)return;let t=[...this.renderedNodes];try{L(this.scope,()=>{let n=this.component(this.reactiveProps);isFunction(n)&&(n=n(this.reactiveProps)),(isSignal(n)||isComputed(n))&&(n=n.value);let o=coerceArray(n),r=this._getAnchorNode();if(this.parentNode){for(let s of this.renderedNodes)k(s);for(let s of o)P(this.parentNode,s,r);this.renderedNodes=o;}}),this.scope&&fe(this.scope);}catch(n){throw this.renderedNodes=t,n}}_getAnchorNode(){if(this.beforeNode)return this.beforeNode;if(this.renderedNodes.length>0){let t=this.renderedNodes[this.renderedNodes.length-1],n=T(t);if(n)return n.nextSibling}}destroy(){if(this.state===4||this.state===5)return;this.state=4;for(let n of this.renderedNodes)k(n);let t=this.scope;t&&($(t),this.scope=null),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 n=this.firstChild;for(let[o,r]of Object.entries(t))if(startsWith(o,"on")){if(!n||!isHTMLElement(n))return;let s=o.slice("on".length).toLowerCase();D(n,s,r);}else o==="ref"&&isSignal(r)&&(r.value=n);this.props=t;}};function y(e){return !!e&&!!e[pe]}function B(e,t){return y(e)?e:new Q(e,t)}function be(e){let t,n=()=>{let o=document.createElement("template");o.innerHTML=e;let r=o.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(t||(t=n())).cloneNode(true)}function on(e,t){let n=isString(t)?document.querySelector(t):t;if(!n){error(`Target element not found: ${t}`);return}n.innerHTML&&(error(`Target element is not empty, it will be delete: ${t}`),n.innerHTML="");let r=y(e)?e:B(e);return r.mount(n),r}function _e(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){let r=o.provides.get(e);if(r)return r}o=o.parent;}return t}function Pe(e,t){Object.defineProperty(e,"target",{configurable:true,value:t});}function at(e,t,n){let o=e[`_$${n}`];if(o&&isFunction(o)&&!e.disabled){let r=e[`${n}Data`];if(r?o.call(e,r,t):o.call(e,t),t.cancelBubble)return false}return e.host&&!isString(e.host)&&!e.host._$host&&isFunction(e.contains)&&e.contains(t.target)&&Pe(t,e.host),true}function st(e,t,n){let o=e;for(;at(o,t,n)&&(o=o._$host||o.parentNode||o.host););return o}function sn(e){let t=e.target,n=`${e.type}`,o=e.target,r=e.currentTarget;if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return t||document}}),e.composedPath){let s=e.composedPath();Pe(e,s[0]);for(let i=0;i<s.length-2&&(t=s[i],!!at(t,e,n));i++){if(t._$host){t=t._$host,t=st(t,e,n);break}if(t.parentNode===r)break}}else t=st(t,e,n);Pe(e,o);}var ct=Symbol("_$EVENTS");function cn(e,t=window.document){let n=t,o=n[ct]||(n[ct]=new Set);for(let r of e)o.has(r)||(o.add(r),t.addEventListener(r,sn));}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)}})}var ke=false;function Z(){ke=true;}function G(){ke=false;}function K(){return ke}var ut=0;function ee(){return `${ut++}`}function te(){ut=0;}var lt=/^\d+-\d+$/;function dt(e){return ()=>{if(!isBrowser())return null;let t=ee(),n=document.querySelector(`[data-hk="${t}"]`);return n||be(e)()}}function pt(e,t){let n=e.dataset.hk;if(!n)return ve(e,t);let o=[],r=e.querySelectorAll(`[data-idx^="${n}"]`);r.length>0&&o.push(...Array.from(r).filter(a=>{let u=a.dataset.idx;return u!==null&&lt.test(u)}).map(a=>{let u=a.dataset.idx||"",[p,f]=u.split("-");return {hk:p,idx:f,node:a}}));let s=[],i=a=>{if(a.nodeType===Node.COMMENT_NODE&&a.textContent&&lt.test(a.textContent)){let[p,f]=a.textContent.split("-");s.push({hk:p,idx:f,node:a});}let u=a.firstChild;for(;u;)i(u),u=u.nextSibling;};i(e),o.push(...s);let c=[e];return t.forEach(a=>{let u=o.find(p=>p.idx===String(a));u&&c.push(u.node);}),c}function mt(e,t){Z(),te();try{let n=isString(t)?document.querySelector(t):t;if(!n){error("Hydration error: Root element not found");return}let o=B(e);return o.mount(n),G(),o}catch(n){error("Hydration error:",n),G();return}}function yt(e,t,n,o=false){if(t===n||K())return;let r=ne(n),s=ne(t);r&&s===r||(r?o?e.setAttribute("class",r):e.className=r:e.removeAttribute("class"));}function ne(e){return normalizeClassName(e)}var ht=/\s*!important$/,yn=["Webkit","Moz","ms"],Te={};function Nt(e,t,n){let o=e.style,r=isString(n);if(!K()){if(n&&r){t!==n&&(o.cssText=n);return}if(!n){t&&e.removeAttribute("style");return}if(t&&!isString(t))for(let s in t)(!n||n[s]==null)&&U(o,s,"");else if(t&&isString(t)){let s=t.split(";");for(let i of s){let c=i.indexOf(":");if(c>0){let a=i.slice(0,c).trim();n&&isObject(n)&&n[a]==null&&U(o,a,"");}}}if(n&&!isString(n))for(let s in n){let i=n[s];(!t||isString(t)||t[s]!==i)&&i!=null&&U(o,s,i);}}}function U(e,t,n){if(isArray(n)){for(let r of n)U(e,t,r);return}if((n==null||n==="")&&(n=""),t.startsWith("--")){e.setProperty(t,n);return}let o=hn(e,t);isString(n)&&ht.test(n)?e.setProperty(camelCase(o),n.replace(ht,""),"important"):e[o]=n;}function hn(e,t){let n=Te[t];if(n)return n;let o=camelCase(t);if(o!=="filter"&&o in e)return Te[t]=o;o=capitalize(o);for(let r of yn){let s=r+o;if(s in e)return Te[t]=s}return t}function De(e,t,n,o){if(t==="key"){o==null?Y(e,void 0):Y(e,String(o));return}if(t===Ke){Object.keys(o).forEach(f=>{De(e,f,n==null?void 0:n[f],o==null?void 0:o[f]);});return}if(K())return;let r=(e==null?void 0:e.namespaceURI)===Oe,s=r&&t.startsWith("xlink:"),i=r&&t.startsWith("xmlns:"),c=isSpecialBooleanAttr(t)||isBooleanAttr(t);if(n===o)return;let a=t.toLowerCase();if(a.length>2&&a.charCodeAt(0)===111&&a.charCodeAt(1)===110||a==="innerhtml")return;if(o==null){if(s)e.removeAttributeNS(le,t.slice(6));else if(i){let f=t.slice(6);e.removeAttributeNS(de,f);}else e.removeAttribute(t);return}if(s){e.setAttributeNS(le,t,String(o));return}if(i){e.setAttributeNS(de,t,String(o));return}if(c){includeBooleanAttr(o)?e.setAttribute(t,""):e.removeAttribute(t);return}let u=isSymbol(o)?String(o):o;if((a==="href"||a==="src"||a==="xlink:href")&&isString(u)){let f=u.trim().toLowerCase();if(f.startsWith("javascript:")||f.startsWith("data:"))return}if(r)e.setAttribute(t,String(u));else if(t in e)try{e[t]=u;}catch(f){e.setAttribute(t,String(u));}else e.setAttribute(t,String(u));}function St(e,t,n,o){if(!(o!=null&&o.delegate))return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o);let r=o.delegate,s=c=>{let a=c.target;(a.matches(r)||a.closest(r))&&n.call(e,c);},i=V({},o);return i.delegate=void 0,e.addEventListener(t,s,i),()=>{e.removeEventListener(t,s,i);}}function Et(e){if(!(e!=null&&e.children))return error("Fragment component requires children"),null;let{children:t}=e;return t}Et[me]=true;function bn(e){return !!e&&!!e[me]}function xt(e){let t=document.createComment("portal");t[X]=true;let n=e.children;if(n){let o=isArray(n)?n:[n],r=[];ae(()=>{let s=isString(e.target)?document.querySelector(e.target):e.target;s&&(o.forEach(i=>{if(i!=null){let c=I(i);c&&(P(s,c),r.push(c));}}),H(()=>{r.forEach(i=>{!isString(i)&&i.parentNode===s&&s.removeChild(i);});}));});}return t}xt[X]=true;function Cn(e){return !!e&&!!e[X]}var Le=Symbol("SuspenseContext");function At(e){if(isUndefined(document)){let f=e.fallback;return f?String(f||""):""}let t=document.createElement("div");t.style.display="contents";let n=true,o=0,r=false,s=null,i=()=>{if(!r){for(r=true;t.firstChild;)t.removeChild(t.firstChild);if(e.fallback!=null){let f=I(e.fallback);f&&P(t,f);}}},c=()=>{if(!(!r||!(s||e.children!=null&&!isPromise(e.children)))){for(r=false;t.firstChild;)t.removeChild(t.firstChild);s?a(s):e.children!=null&&!isPromise(e.children)&&a(e.children);}},a=f=>{for(;t.firstChild;)t.removeChild(t.firstChild);if(f==null)return;let l=C();if((isArray(f)?f:[f]).forEach(E=>{if(E!=null){y(E)&&(E.parentContext=l);let x=I(E);x&&P(t,x);}}),r){for(;t.firstChild;)t.removeChild(t.firstChild);if(e.fallback!=null){let E=I(e.fallback);E&&P(t,E);}}},u={register:f=>{o++,i(),f.then(()=>{n&&(o--,o===0&&c());}).catch(l=>{n&&(o--,o===0&&c());});},increment:()=>{o++,i();},decrement:()=>{o--,o===0&&c();}};_e(Le,u);let p=e.children;return isPromise(p)?(p.then(f=>{s=f;}).catch(()=>{}),u.register(p)):p!=null?a(p):i(),ue(()=>{for(n=false;t.firstChild;)t.removeChild(t.firstChild);}),t}At[ye]=true;function Tn(e){return !!e&&!!e[ye]}function Dn(e,t){let n=signal(t==null?void 0:t.initialValue),o=signal(true),r=signal(null),s=signal("pending"),i=0,c=null,a=()=>ie(null,null,function*(){let f=++i;o.value=true,s.value="pending",r.value=null;try{let l=e();c=l.then(()=>{}).catch(()=>{});let m=yield l;f===i&&(n.value=m,s.value="ready",o.value=!1);}catch(l){f===i&&(r.value=l instanceof Error?l:new Error(String(l)),s.value="errored",o.value=false);}});a();let u=(()=>{if(o.value&&c){let f=Ce(Le,null);f&&f.register(c);}return n.value});return u.loading=o,u.error=r,u.state=s,[u,{mutate:f=>{n.value=f,s.value="ready",o.value=false,r.value=null;},refetch:()=>ie(null,null,function*(){yield a();})}]}function bt(e){let t=document.createDocumentFragment(),n=document.createComment("");t.appendChild(n);let o=[],r=null,s=e.keyFn,i=e.children,c=()=>{var m,E;let l=e.each;return isSignal(l)?(m=l.value)!=null?m:[]:typeof l=="function"?(E=l())!=null?E:[]:l!=null?l:[]},a=l=>s?s(l):l,u=(l,m,E,x)=>{var A;let h=C(),S=z(h);O(S);let v;try{let b=i(l,m);y(b)?(b.mount(E,x),v=(A=b.firstChild)!=null?A:document.createComment("empty")):(v=b,v.parentNode||(x?E.insertBefore(v,x):E.appendChild(v)));}finally{O(h);}return {key:a(l),node:v,scope:S}},p=l=>{$(l.scope),l.node.parentNode&&l.node.parentNode.removeChild(l.node);};memoEffect(({prev:l})=>{var x;let m=c();if(l===m)return {prev:m};let E=n.parentNode;if(!E){if(m.length===0){if(e.fallback){let h=e.fallback();y(h)?(h.mount(t,n),r=(x=h.firstChild)!=null?x:document.createComment("empty")):(r=h,t.insertBefore(r,n));}return {prev:m}}o=new Array(m.length);for(let[h,S]of m.entries())o[h]=u(S,h,t,n);return {prev:m}}return untrack(()=>f(E,m)),{prev:m}},{prev:[]});function f(l,m){var b;let E=o.length,x=m.length;if(x===0){for(let d=0;d<E;d++)p(o[d]);if(o=[],e.fallback&&!r){let d=e.fallback();y(d)?(d.mount(l,n),r=(b=d.firstChild)!=null?b:document.createComment("empty")):(r=d,l.insertBefore(r,n));}return}if(E===0||r){r&&(r.parentNode&&r.parentNode.removeChild(r),r=null),o=new Array(x);let d=document.createDocumentFragment();for(let _=0;_<x;_++)o[_]=u(m[_],_,d,null);l.insertBefore(d,n);return}let h=new Map;for(let d=0;d<E;d++){let _=o[d],W=h.get(_.key);W?W.push(_):h.set(_.key,[_]);}let S=new Array(x),v=[],A=document.createDocumentFragment();for(let d=0;d<x;d++){let _=m[d],W=a(_),re=h.get(W);re&&re.length>0?S[d]=re.shift():S[d]=u(_,d,A,null);}for(let d of h.values())for(let _ of d)v.push(_);for(let d of v)p(d);for(let d=0;d<x;d++){let _=S[d].node;l.insertBefore(_,n);}o=S;}return H(()=>{for(let l of o)p(l);r&&r.parentNode&&r.parentNode.removeChild(r),n.parentNode&&n.parentNode.removeChild(n);}),t}bt[Ve]=true;
2
- export{Q as Component,bt as For,Et as Fragment,xt as Portal,At as Suspense,St as addEvent,D as addEventListener,Bt as bindElement,on as createApp,B as createComponent,Dn as createResource,z as createScope,cn as delegateEvents,$ as disposeScope,G as endHydration,C as getActiveScope,T as getFirstDOMNode,ee as getHydrationKey,dt as getRenderedElement,mt as hydrate,Ce as inject,Ee as insert,P as insertNode,y as isComponent,bn as isFragment,K as isHydrating,Cn as isPortal,w as isSameNode,Tn as isSuspense,ve as mapNodes,pt as mapSSRNodes,ne as normalizeClass,I as normalizeNode,an as omitProps,H as onCleanup,ue as onDestroy,ae as onMount,Tt as onUpdate,De as patchAttr,yt as patchClass,Nt as patchStyle,_e as provide,k as removeNode,q as replaceNode,te as resetHydrationKey,L as runWithScope,O as setActiveScope,U as setStyle,Se as shallowCompare,Z as startHydration,be as template};//# sourceMappingURL=template.esm.js.map
1
+ import {c,e,g,a,d,f,b}from'./chunk-IRDMO5MX.esm.js';import {normalizeClassName,isObject,isSpecialBooleanAttr,isBooleanAttr,includeBooleanAttr,isSymbol,isString,isArray,camelCase,capitalize,isBrowser,warn,isPromise,isFunction,isOn,isNull,isUndefined,isNumber,isBoolean,coerceArray,isHTMLElement,isPrimitive,isFalsy}from'@estjs/shared';import {effect,shallowReactive,isSignal,isComputed,signal}from'@estjs/signals';var ue="_$spread$";var ze="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(""),We=Symbol("");function G(t,e,n,o){if(e==="key"){o==null?t.removeAttribute(e):t.setAttribute(e,String(o));return}if(e===ue){let f=isObject(n)?n:null,y=isObject(o)?o:null;if(f)for(let h in f)h!==ue&&(!y||!(h in y))&&G(t,h,f[h],null);if(y)for(let h in y)h!==ue&&G(t,h,f==null?void 0:f[h],y[h]);return}let r=(t==null?void 0:t.namespaceURI)===ze,i=r&&e.startsWith("xlink:"),s=r&&e.startsWith("xmlns:"),c=isSpecialBooleanAttr(e)||isBooleanAttr(e);if(n===o||e.length>2&&e.charCodeAt(0)===111&&e.charCodeAt(1)===110)return;let l=e.toLowerCase();if(l==="innerhtml"||l==="srcdoc")return;if(o==null){if(i)t.removeAttributeNS(we,e.slice(6));else if(s){let f=e.slice(6);t.removeAttributeNS(xe,f);}else t.removeAttribute(e);return}if(c){includeBooleanAttr(o)?t.setAttribute(e,""):t.removeAttribute(e);return}let u=isSymbol(o)?String(o):o;if((l==="href"||l==="src"||l==="xlink:href"||l==="action"||l==="formaction"||l==="poster")&&isString(u)){let f=u.trim().toLowerCase();if(f.startsWith("javascript:")||f.startsWith("data:"))return}if(i){t.setAttributeNS(we,e,String(u));return}if(s){t.setAttributeNS(xe,e,String(u));return}if(r)t.setAttribute(e,String(u));else if(e in t)try{t[e]=u;}catch(f){t.setAttribute(e,String(u));}else t.setAttribute(e,String(u));}function fe(t,e,n,o=false){if(e===n)return;let r=de(n);if(!r){t.removeAttribute("class");return}(isString(e)?e:de(e))!==r&&(o?t.setAttribute("class",r):t.className=r);}var de=normalizeClassName;var qe=/\s*!important$/,At=["Webkit","Moz","ms"],ke={};function me(t,e,n){let o=t.style;if(n&&isString(n)){e!==n&&(o.cssText=n);return}if(!n){e&&t.removeAttribute("style");return}if(e&&!isString(e)){let r=e;for(let i in r)(!n||n[i]==null)&&J(o,i,"");}else if(e&&isString(e)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,i;for(;(i=r.exec(e))!==null;){let s=i[1].trim();s&&n&&isObject(n)&&n[s]==null&&J(o,s,"");}}if(n&&!isString(n)){let r=n;for(let i in r){let s=r[i];(!e||isString(e)||e[i]!==s)&&s!=null&&J(o,i,s);}}}function J(t,e,n){if(isArray(n)){for(let r of n)J(t,e,r);return}if((n==null||n==="")&&(n=""),e.startsWith("--")){t.setProperty(e,n);return}let o=Pt(t,e);isString(n)&&qe.test(n)?t.setProperty(camelCase(o),n.replace(qe,""),"important"):t[o]=n;}function Pt(t,e){let n=ke[e];if(n)return n;let o=camelCase(e);if(o!=="filter"&&o in t)return ke[e]=o;o=capitalize(o);for(let r of At){let i=r+o;if(i in t)return ke[e]=i}return e}var Te=0;function Ye(){return String(Te++)}function Rt(){Te=0;}var B=false;function le(){return B}var Q=new Map;function Lt(t){let e=t.querySelectorAll("[data-hk]");for(let n of e){let o=n.dataset.hk;o!=null&&!Q.has(o)&&Q.set(o,n);}}var ye=[],se=new Map;function Ft(){if(typeof document=="undefined")return;let t=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),e;for(;e=t.nextNode();){let n=e.data;if(n==="teleport-anchor")ye.push(e);else if(n==="teleport-start"){let o=e.parentElement;if(!o)continue;let r=se.get(o);r||(r=[],se.set(o,r)),r.push(e);}}}function Re(){var t;return (t=ye.shift())!=null?t:null}function Le(t){let e=se.get(t),n=e==null?void 0:e.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 Fe(t){B=true,Te=0,Q.clear(),ye.length=0,se.clear(),Lt(t),Ft();}function De(){B=false,Q.clear(),ye.length=0,se.clear();}function Dt(t){if(!isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let e=null;return ()=>{if(!B)return e||(e=pe(t)),e();let n=Ye(),o=Q.get(n);return o?(Q.delete(n),o):(warn(`[essor] hydration mismatch: no SSR element for key "${n}"`),e||(e=pe(t)),e())}}function Mt(t,e,n,o){B||fe(t,e,n,o);}function It(t,e,n,o){B||G(t,e,n,o);}function Ht(t,e,n){B||me(t,e,n);}function Me(t,e){return e&&e.parentNode===t?e:null}function Je(t,e,n,o){let r=Me(t,o),i=e.length,s=n.length;if(i===0&&s===0)return n;if(i===0){for(let d=0;d<s;d++)D(t,n[d],r);return n}if(s===0){for(let d=0;d<i;d++)U(e[d]);return []}let c=0,l=i-1,u=s-1;for(;c<=l&&c<=u&&e[c]===n[c];)c++;for(;l>=c&&u>=c&&e[l]===n[u];)l--,u--;if(c>l){if(c<=u){let d=u+1,f=Me(t,d<s?n[d]:r);for(let y=c;y<=u;y++)D(t,n[y],f);}}else if(c>u)for(let d=c;d<=l;d++)U(e[d]);else Ot(t,e,n,c,l,u,r);return n}function Ot(t,e,n,o,r,i,s){let c=i-o+1,l=new Map;for(let m=o;m<=i;m++)l.set(n[m],m);let u=new Int32Array(c);u.fill(0);let d=0,f=false,y=0;for(let m=o;m<=r;m++){let p=e[m];if(d>=c){U(p);continue}let a=l.get(p);a===void 0?U(p):(u[a-o]=m+1,a>=y?y=a:f=true,d++);}let h=f?Ie(u):[],N=h.length-1;for(let m=c-1;m>=0;m--){let p=o+m,a=n[p],g=Me(t,p+1<n.length?n[p+1]:s);u[m]===0?D(t,a,g):f&&(N<0||m!==h[N]?D(t,a,g):N--);}}function Ie(t){let e=new Int32Array(t.length),n=[0],o=t.length,r,i,s,c,l;for(r=0;r<o;r++){let u=t[r];if(u!==0){if(i=n[n.length-1],t[i]<u){e[r]=i,n.push(r);continue}for(s=0,c=n.length-1;s<c;)l=s+c>>1,t[n[l]]<u?s=l+1:c=l;u<t[n[s]]&&(s>0&&(e[r]=n[s-1]),n[s]=r);}}for(s=n.length,c=n[s-1];s-- >0;)n[s]=c,c=e[c];return n}function U(t){if(t)if(O(t))t.destroy();else {let e=t;e.parentNode&&e.remove();}}function D(t,e,n){if(!t||!e)return;let o=O(n)?n.firstChild:n;if(O(e)){e.mount(t,o);return}o?t.insertBefore(e,o):t.appendChild(e);}function Z(t){return isHTMLElement(t)?t:isPrimitive(t)?document.createTextNode(isFalsy(t)?"":String(t)):t}function z(t,e$1,n){if(!t)return;let o=c(),r=[],i=true,s=l=>l instanceof Node?[l]:isNull(l)||isUndefined(l)||isString(l)||isNumber(l)||isBoolean(l)?[Z(l)]:coerceArray(l).map(u=>isFunction(u)?u():u).flatMap(u=>u).map(Z),c$1=effect(()=>{let l=()=>{let u=isFunction(e$1)?e$1():e$1,d=s(u);if(i&&le()&&d.every(f=>f instanceof Node&&f.parentNode===t)){r=d,i=false;return}r=Je(t,r,d,n),i=false;};o&&!o.isDestroyed?e(o,l):l();});return g(()=>{c$1.stop();for(let l of r)U(l);r=[];}),r}function Gt(t){return (t==null?void 0:t.firstChild)||null}function Yt(t,e=1){for(;t&&e>0;)t=t.nextSibling,e--;return t||null}function Jt(t,e){if(!t||e<0)return null;let n=t.firstChild;for(;n&&e>0;)n=n.nextSibling,e--;return n||null}function ee(t,e,n,o){if(!(o!=null&&o.delegate))return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o);let r=o.delegate,i=u=>{let d=u.target;(d.matches(r)||d.closest(r))&&n.call(t,u);},l=o,{delegate:s}=l,c=a(l,["delegate"]);return t.addEventListener(e,i,c),()=>{t.removeEventListener(e,i,c);}}function He(t,e,n){let o=t[e];o||(o=[],t[e]=o),o.push(n);}function et(t,e,n){let o=t.length;if(o===0)return;let r;for(let i=0;i<o;i++)try{let s=t[i]();if(isPromise(s)){let c=s.catch(l=>{});(r||(r=[])).push(c);}}catch(s){}if(r)return Promise.all(r).then(()=>{})}function Oe(t){let e=c();if(e){if(e.isMounted){try{let n=t();isPromise(n)&&n.catch(o=>{});}catch(n){}return}He(e,"onMount",t);}}function Qt(t){let e=c();e&&He(e,"onUpdate",t);}function te(t){let e=c();e&&He(e,"onDestroy",t);}function tt(t){if(t.isDestroyed)return;if(!t.onMount||t.onMount.length===0){t.isMounted=true;return}let e$1=t.onMount,n=e(t,()=>et(e$1,t.id));return e$1.length=0,t.isMounted=true,n}function nt(t){if(!(t.isDestroyed||!t.onUpdate||t.onUpdate.length===0))return e(t,()=>et(t.onUpdate,t.id))}function rt(t,e,n=false){let o=n?new Set:null;for(let r of Object.getOwnPropertyNames(e))o==null||o.add(r),Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r));if(o)for(let r of Object.getOwnPropertyNames(t))o.has(r)||delete t[r];}function nn(t,e){let n=Object.getOwnPropertyDescriptor(t,e);return n.get?n.get.call(t):n.value}var it;it="normal";var ne=class{constructor(e,n={}){this.component=e;this.props=n;this[it]=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={};rt(o,n),this.reactiveProps=shallowReactive(o);}mount(e$1,n){var i;if(this.parentNode=e$1,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let s of this.renderedNodes)D(e$1,s,n);return this.state=2,this.renderedNodes}let o=d((i=this.parentScope)!=null?i:c());this.scope=o;let r=e(o,()=>{var c;let s=this.component(this.reactiveProps);return isFunction(s)&&(s=s(this.reactiveProps)),(isSignal(s)||isComputed(s))&&(s=s.value),(c=z(e$1,s,n))!=null?c:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,tt(o),this.renderedNodes}update(e){this.props=e;let n=this.scope;!n||n.isDestroyed||(rt(this.reactiveProps,e!=null?e:{},true),this.syncSpecialProps(e),nt(n));}forceUpdate(){if(!this.parentNode)return;let e=this.parentNode,n=this.beforeNode;this.destroy(),this.mount(e,n);}destroy(){let e=this.scope;if(!(!e||e.isDestroyed)){this.scope=null,this.releaseSpecialProps(),f(e);for(let n of this.renderedNodes)U(n);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;}}syncSpecialProps(e){if(!e)return;let n=this.firstChild;if(n){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(e)){let r=nn(e,o);if(o==="ref"){this.rootRefCleanup=this.bindRootRef(r,n);continue}if(isOn(o)&&isFunction(r)){let i=o.slice(2).toLowerCase();this.rootEventCleanups.push(ee(n,i,r));}}}}releaseSpecialProps(){for(let e of this.rootEventCleanups)e();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(e,n){if(isFunction(e))return e(n),()=>e(null);if(isSignal(e)){let o=e.value;return e.value=n,()=>{e.value===n&&(e.value=o);}}}};function O(t){return !!t&&!!t.normal}function he(t,e){return O(t)?t:new ne(t,e)}function pe(t){let e,n=()=>{let o=document.createElement("template");o.innerHTML=t;let r=o.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(e||(e=n())).cloneNode(true)}function on(t,e$1){let n=isString(e$1)?document.querySelector(e$1):e$1;if(!n)return;n.innerHTML&&(n.innerHTML="");let r=d(),i;try{e(r,()=>{let s=he(t);O(s)&&(i=s,D(n,s));});}catch(s){throw f(r),s}return {root:i,unmount:()=>{f(r),i==null||i.destroy();}}}function rn(t,e$1){let n=isString(e$1)?document.querySelector(e$1):e$1;if(!n)return;Fe(n);let o=d(),r;try{e(o,()=>{let i=he(t);O(i)&&(r=i,z(n,i));});}catch(i){throw f(o),i}finally{De();}return {root:r,unmount:()=>{f(o),r==null||r.destroy();}}}function je(t,e){let n=c();n&&(n.provides||(n.provides=new Map),n.provides.set(t,e));}function ce(t,e){let n=c();if(!n)return e;let o=n;for(;o;){if(o.provides&&o.provides.has(t))return o.provides.get(t);o=o.parent;}return e}function Ue(t,e){Object.defineProperty(t,"target",{configurable:true,value:e});}function ct(t){let e=t.target,n=t.type,o=t.target,r=t.currentTarget,i=()=>{let c=e[`_$${n}`];if(c&&isFunction(c)&&!e.disabled){let l=e[`${n}Data`];if(l?c.call(e,l,t):c.call(e,t),t.cancelBubble)return false}return e.host&&!isString(e.host)&&!e.host._$host&&isFunction(e.contains)&&e.contains(t.target)&&Ue(t,e.host),true},s=()=>{for(;i()&&(e=e._$host||e.parentNode||e.host););};if(Object.defineProperty(t,"currentTarget",{configurable:true,get(){return e||document}}),t.composedPath){let c=t.composedPath();Ue(t,c[0]);for(let l=0;l<c.length-2&&(e=c[l],!!i());l++){if(e._$host){e=e._$host,s();break}if(e.parentNode===r)break}}else s();Ue(t,o);}var ge=Symbol("_$EVENTS");function ln(t,e=window.document){let n=e,o=n[ge]||(n[ge]=new Set);for(let r of t)o.has(r)||(o.add(r),e.addEventListener(r,ct));}function cn(t=window.document){let e=t,n=e[ge];if(n){for(let o of n.keys())t.removeEventListener(o,ct);delete e[ge];}}function oe(t,e,n,o){let r=ee(t,e,n,o);c()&&g(r);}var fn={event:"change",forceChangeEvent:true,read:t=>t.checked,write:(t,e)=>{let n=t,o=!!e;n.checked!==o&&(n.checked=o);}},mn={event:"change",forceChangeEvent:true,read:t=>{let e=t;return e.checked?e.value:""},write:(t,e)=>{let n=t,o=String(e)===n.value;n.checked!==o&&(n.checked=o);}},pn={event:"change",forceChangeEvent:true,read:t=>t.files,write:()=>{}},yn={event:"input",needsComposition:true,read:t=>t.value,write:(t,e)=>{let n=t,o=e==null?"":String(e);n.value!==o&&(n.value=o);}},hn={event:"change",forceChangeEvent:true,read:t=>{let e=t;return e.multiple?Array.from(e.selectedOptions,n=>n.value):e.value},write:(t,e)=>{let n=t;if(n.multiple){let o=new Set((Array.isArray(e)?e:[]).map(String));for(let r of Array.from(n.options))r.selected=o.has(r.value);}else {let o=e==null?"":String(e);n.value!==o&&(n.value=o);}}},gn={event:"input",needsComposition:true,read:t=>t.value,write:(t,e)=>{let n=t,o=e==null?"":String(e);n.value!==o&&(n.value=o);}};function En(t,e){let n=t.nodeName;if(n==="INPUT"){let o=t.type;return e==="checked"?o==="radio"?mn:fn:e==="files"?pn:yn}return n==="SELECT"?hn:n==="TEXTAREA"?gn:{event:"input",read:o=>o[e],write:(o,r)=>{o[e]=r;}}}function Nn(t,e,n){if(!isString(t))return t;if(e&&(t=t.trim()),n&&t!==""){let o=Number(t);if(!Number.isNaN(o))return o}return t}function vn(t){let e=t.getRootNode();return (e instanceof Document||e instanceof ShadowRoot)&&e.activeElement===t}function Sn(t,e,n,o,r={}){if(!t)return;let i=En(t,e),{trim:s,number:c$1,lazy:l}=r,u=e==="files",d=()=>isFunction(n)?n():n,f=p=>u?p:Nn(p,s,c$1),y=l||i.forceChangeEvent?"change":i.event,h=false,N=()=>{if(h)return;let p=i.read(t);if(p===void 0)return;if(u){o(p);return}let a=f(p);Object.is(d(),a)||o(a);};oe(t,y,N),!l&&!u&&(s||c$1)&&y!=="change"&&oe(t,"change",()=>{i.write(t,f(i.read(t)));}),i.needsComposition&&!l&&(oe(t,"compositionstart",()=>{h=true;}),oe(t,"compositionend",()=>{h&&(h=false,N());}));let m=effect(()=>{let p=d();if(i.needsComposition&&!l&&vn(t)){if(h)return;let a=f(i.read(t));if(Object.is(a,p))return}i.write(t,p);});c()&&g(()=>m.stop());}function Cn(t,e){let n=new Set(e);return new Proxy(t,{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 at(t){return !t||t.children==null?null:t.children}at[Ae]=true;function bn(t){return !!t&&!!t[Ae]}function Ee(t){let e=isFunction(t.target)?t.target():t.target;return e==null?null:isString(e)?document.querySelector(e):e}function Ne(t){return isFunction(t.disabled)?!!t.disabled():!!t.disabled}function dt(t){if(le()){let d=xn(t);if(d)return d}let e$1=document.createComment("portal");e$1[ie]=true;let{children:n}=t;if(n==null)return e$1;let o=c(),r=null,i=(d$1,f)=>{r=d(o),e(r,()=>{z(d$1,()=>n,f);});},s=()=>{r&&(f(r),r=null);},c$1=(d,f)=>{if(s(),d){let y=e$1.parentNode;if(!y)return;i(y,e$1);return}f&&i(f);},l=false,u=effect(()=>{let d=Ne(t),f=d?null:Ee(t);l&&c$1(d,f);});return Oe(()=>{l=!0;let d=Ne(t),f=d?null:Ee(t);if(d||f){c$1(d,f);return}queueMicrotask(()=>{e$1.parentNode&&c$1(Ne(t),Ee(t));});}),g(()=>{u.stop(),s();}),e$1}dt[ie]=true;function xn(t){if(Ne(t))return null;let e=Re();if(!e)return null;let n=Ee(t);return !n||!Le(n)?null:(e[ie]=true,e)}function An(t){return !!t&&!!t[ie]}function Se(t){for(;t.firstChild;)t.removeChild(t.firstChild);}function ft(t){let e=t;for(;isFunction(e);)e=e();return isSignal(e)||isComputed(e)?ft(e.value):e}var ae=Symbol("SuspenseContext");function mt(t){var N;if(!isBrowser())return (N=t.fallback)!=null?N:"";let e=document.createElement("div");e.style.display="contents";let n=true,o=0,r=false,i=null,s=m=>{let p=ft(m);if(isArray(p)){let a=[];for(let g of p){let v=s(g);isArray(v)?a.push(...v):a.push(v);}return a}return Z(p)},c=m=>{let p=s(m),a=isArray(p)?p:[p];for(let g of a)g!=null&&D(e,g);},l=()=>{Se(e),t.fallback!=null&&c(t.fallback);},u=()=>{r||(r=true,l());},d=()=>{!r||!(i||t.children!=null&&!isPromise(t.children))||(r=false,Se(e),i?f(i):t.children!=null&&!isPromise(t.children)&&f(t.children));},f=m=>{if(r||(Se(e),m==null))return;let p=isArray(m)?m:[m];for(let a of p)a!=null&&c(a);r&&l();},y={register:m=>{o++,u(),m.then(()=>{n&&(o--,o===0&&d());}).catch(p=>{n&&(o--,o===0&&d());});},increment:()=>{o++,u();},decrement:()=>{o=Math.max(0,o-1),o===0&&d();}};je(ae,y);let h=t.children;return isPromise(h)?(h.then(m=>{i=m;}).catch(()=>{}),y.register(h)):h!=null?f(h):u(),te(()=>{n=false,o=0,i=null,Se(e),e.remove();}),e}mt[Pe]=true;function Ln(t){return !!t&&!!t[Pe]}function Fn(t,e){let n=signal(e==null?void 0:e.initialValue),o=signal(true),r=signal(null),i=signal("pending"),s=0,c=null,l=false,u=ce(ae,null),d=()=>b(null,null,function*(){let h=++s;o.value=true,i.value="pending",r.value=null,l=false,u&&u.increment();try{let N=t();c=N,N.catch(()=>{});let m=yield N;h===s&&(n.value=m,i.value="ready",o.value=!1);}catch(N){h===s&&(r.value=N instanceof Error?N:new Error(String(N)),i.value="errored",o.value=false);}finally{u&&u.decrement();}});d();let f=(()=>(!l&&o.value&&c&&u&&(l=true,u.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:()=>b(null,null,function*(){yield d();})}]}function pt(t){return isFunction(t)?t:t.default}function $e(t,e,n){let o=new ne(e,n);return o.mount(t),o}function Mn(t,e={}){let{delay:n=200,timeout:o,ssr:r="blocking",onError:i}=e;if(typeof window=="undefined"){if(r==="client-only"){let p=()=>"";return p.__asyncLoader=t,p.__asyncResolved=()=>null,p}let y=null,h=null,N=()=>h||(h=t().then(p=>{y=pt(p);}).catch(()=>{}),h);N();let m=p=>y?y(p):"";return m.__asyncLoader=N,m.__asyncResolved=()=>y,m}let s=null,c=null,l="pending",u=null;function d(){return u||(u=t().then(y=>{s=pt(y),l="resolved";}).catch(y=>{c=y instanceof Error?y:new Error(String(y)),l="errored",u=null;}),u)}d();function f(y){var W;if(l==="resolved"&&s){let S=document.createElement("div");S.style.display="contents";let M=$e(S,s,y);return g(()=>M.destroy()),S}if(l==="errored"&&c){let S=document.createElement("div");if(S.style.display="contents",e.error){let M=true,R=null,K=(q,E)=>{M&&(R==null||R.destroy(),R=$e(S,q,E));},X=()=>{u=null,l="pending",c=null,e.loading&&K(e.loading),d().then(()=>{M&&(l==="resolved"&&s?K(s,y):l==="errored"&&c&&e.error&&K(e.error,{error:c,retry:X}));});};K(e.error,{error:c,retry:X}),te(()=>{M=false,R==null||R.destroy(),R=null;});}return S}let h=document.createElement("div");h.style.display="contents";let N=true,m=null,p=null,a=null,g$1=(S,M)=>{N&&(m==null||m.destroy(),m=$e(h,S,M));},v=S=>()=>{u=null,l="pending",c=null,e.loading&&g$1(e.loading),d().then(()=>{l==="resolved"&&s?g$1(s,S):l==="errored"&&c&&e.error&&g$1(e.error,{error:c,retry:v(S)});});};te(()=>{N=false,m==null||m.destroy(),m=null,p!=null&&clearTimeout(p),a!=null&&clearTimeout(a);});let w=(W=ce(ae))!=null?W:null,k=S=>g$1(S,y),T=S=>{e.error&&g$1(e.error,{error:S,retry:v(y)});},V=()=>{e.loading&&g$1(e.loading);},j=d().then(()=>{N&&(l==="resolved"&&s?k(s):l==="errored"&&c&&(T(c),i&&i(c,v(y))),p!=null&&clearTimeout(p),a!=null&&clearTimeout(a));});return w&&w.register(j),n>0?p=setTimeout(()=>{N&&l==="pending"&&V();},n):e.loading&&V(),o!=null&&(a=setTimeout(()=>{if(N&&l==="pending"){let S=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);c=S,l="errored",T(S),i&&i(S,v(y));}},o)),h}return f.__asyncLoader=d,f.__asyncResolved=()=>s,f}function yt(t){let e$1=document.createDocumentFragment(),n=document.createComment("");e$1.appendChild(n);let o=[],r=[],i=t.key,s=t.children,c$1=()=>{var g,v;let a=t.each;return isSignal(a)?(g=a.value)!=null?g:[]:isFunction(a)?(v=a())!=null?v:[]:a!=null?a:[]},l=a=>i?i(a):a,u=a=>{if(Array.isArray(a)){let g=[];for(let v of a)g.push(...u(v));return g}return [Z(a)]},d$1=(a,g,v)=>{let w=u(a);for(let k of w)v?g.insertBefore(k,v):g.appendChild(k);return w},f$1=(a,g)=>{if(!t.fallback)return;r=d$1(t.fallback(),a,g);},y=()=>{for(let a of r)a.parentNode&&a.parentNode.removeChild(a);r=[];},h=(a,g,v,w)=>{let k=c(),T=d(k),V=[];return e(T,()=>{V=d$1(s(a,g),v,w);}),{key:l(a),item:a,nodes:V,scope:T}},N=a=>{f(a.scope);for(let g of a.nodes)g.parentNode&&g.parentNode.removeChild(g);},m=effect(()=>{let a=c$1(),g=n.parentNode;if(!g){if(a.length===0)f$1(e$1,n);else {o=new Array(a.length);let v=0;for(let w of a)o[v]=h(w,v,e$1,n),v++;}return}p(g,a);});function p(a,g){let v=o.length,w=g.length;if(w===0){for(let E=0;E<v;E++)N(o[E]);o=[],t.fallback&&r.length===0&&f$1(a,n);return}if(v===0||r.length>0){r.length>0&&y(),o=new Array(w);let E=document.createDocumentFragment();for(let x=0;x<w;x++)o[x]=h(g[x],x,E,null);a.insertBefore(E,n);return}let k=new Map;for(let E=0;E<v;E++){let x=o[E],I=k.get(x.key),$=[x,E];I?I.push($):k.set(x.key,[$]);}let T=new Array(w),V=[],j=null,W=new Int32Array(w),S=false,M=0,R=new Array(w);for(let E=0;E<w;E++)R[E]=l(g[E]);for(let E=0;E<w;E++){let x=g[E],I=R[E],$=k.get(I);if($&&$.length>0){let[re,L]=$.shift();Object.is(re.item,x)?(re.item=x,T[E]=re,W[E]=L+1,L<M?S=true:M=L):(j||(j=document.createDocumentFragment()),N(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)N(E);let K=S?Ie(W):[],X=K.length-1,q=n;for(let E=w-1;E>=0;E--){let I=T[E].nodes;if(!(W[E]===0)&&S&&X>=0&&E===K[X]){X--;for(let L=I.length-1;L>=0;L--)q=I[L];continue}for(let L=I.length-1;L>=0;L--){let be=I[L];be.nextSibling!==q&&a.insertBefore(be,q),q=be;}}o=T;}return g(()=>{m.stop();for(let a of o)N(a);o=[],y(),n.parentNode&&n.parentNode.removeChild(n);}),e$1}yt[We]=true;
2
+ export{ne as Component,yt as For,at as Fragment,dt as Portal,mt as Suspense,ee as addEvent,oe as addEventListener,Fe as beginHydration,Sn as bindElement,Gt as child,cn as clearDelegatedEvents,Re as consumeTeleportAnchor,Le as consumeTeleportBlock,on as createApp,he as createComponent,Fn as createResource,Mn as defineAsyncComponent,ln as delegateEvents,De as endHydration,Ye as getHydrationKey,Dt as getRenderedElement,rn as hydrate,ce as inject,z as insert,O as isComponent,bn as isFragment,le as isHydrating,An as isPortal,Ln as isSuspense,Yt as next,de as normalizeClass,Jt as nthChild,Cn as omitProps,te as onDestroy,Oe as onMount,Qt as onUpdate,G as patchAttr,It as patchAttrHydrate,fe as patchClass,Mt as patchClassHydrate,me as patchStyle,Ht as patchStyleHydrate,je as provide,Rt as resetHydrationKey,J as setStyle,pe as template};//# sourceMappingURL=template.esm.js.map
3
3
  //# sourceMappingURL=template.esm.js.map