@estjs/template 0.0.16-beta.8 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3SR36LGP.js +1 -0
- package/dist/{chunk-OEKE4VTS.dev.esm.js → chunk-R6JICOKI.dev.js} +23 -26
- package/dist/chunk-R6JICOKI.dev.js.map +1 -0
- package/dist/internal.cjs +1 -0
- package/dist/{internal.dev.cjs.js → internal.dev.cjs} +23 -26
- package/dist/internal.dev.cjs.map +1 -0
- package/dist/internal.dev.js +3 -0
- package/dist/{internal.dev.esm.js.map → internal.dev.js.map} +1 -1
- package/dist/internal.js +1 -0
- package/dist/template.cjs +2 -0
- package/dist/template.d.cts +112 -18
- package/dist/template.d.ts +112 -18
- package/dist/{template.dev.cjs.js → template.dev.cjs} +894 -110
- package/dist/template.dev.cjs.map +1 -0
- package/dist/{template.dev.esm.js → template.dev.js} +864 -86
- package/dist/template.dev.js.map +1 -0
- package/dist/template.js +2 -0
- package/package.json +21 -22
- package/dist/chunk-IA4OZ7NW.esm.js +0 -1
- package/dist/chunk-OEKE4VTS.dev.esm.js.map +0 -1
- package/dist/internal.cjs.js +0 -1
- package/dist/internal.dev.cjs.js.map +0 -1
- package/dist/internal.dev.esm.js +0 -3
- package/dist/internal.esm.js +0 -1
- package/dist/template.cjs.js +0 -2
- package/dist/template.dev.cjs.js.map +0 -1
- package/dist/template.dev.esm.js.map +0 -1
- package/dist/template.esm.js +0 -2
package/dist/template.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {c,f,h,a,e,g,b}from'./chunk-3SR36LGP.js';import {normalizeClassName,SPREAD_NAME,isObject,startsWith,isSpecialBooleanAttr,isBooleanAttr,includeBooleanAttr,isSymbol,isString,isArray,kebabCase,camelCase,capitalize,HYDRATION_ANCHOR_ATTR,isBrowser,warn,isPromise,isFunction,isOn,coerceArray}from'@estjs/shared';import {effect,shallowReactive,isSignal,isComputed,isReactive,signal}from'@estjs/signals';var un="ref",fn="key",dn="http://www.w3.org/2000/svg",He="http://www.w3.org/2000/xlink",Ve="http://www.w3.org/2000/xmlns/";var je=Symbol(""),fe=Symbol(""),$e=Symbol(""),mn=Symbol(""),Ke=Symbol(""),Be=Symbol("");function Z(e,n,t,o){if(n===fn){o==null?e.removeAttribute(n):e.setAttribute(n,String(o));return}if(n===SPREAD_NAME){let y=isObject(t)?t:null,v=isObject(o)?o:null;if(y)for(let E in y)E!==SPREAD_NAME&&(!v||!(E in v))&&Z(e,E,y[E],null);if(v)for(let E in v)E!==SPREAD_NAME&&Z(e,E,y==null?void 0:y[E],v[E]);return}let r=(e==null?void 0:e.namespaceURI)===dn,s=r&&startsWith(n,"xlink:"),i=r&&startsWith(n,"xmlns:"),l=isSpecialBooleanAttr(n)||isBooleanAttr(n);if(t===o||n.length>2&&n.charCodeAt(0)===111&&n.charCodeAt(1)===110)return;let c=n.toLowerCase();if(c==="innerhtml"||c==="srcdoc")return;if(o==null){if(s)e.removeAttributeNS(He,n.slice(6));else if(i){let y=n.slice(6);e.removeAttributeNS(Ve,y);}else e.removeAttribute(n);return}if(l){includeBooleanAttr(o)?e.setAttribute(n,""):e.removeAttribute(n);return}let d=isSymbol(o)?String(o):o;if((c==="href"||c==="src"||c==="xlink:href"||c==="action"||c==="formaction"||c==="poster")&&isString(d)){let y=d.trim().toLowerCase();if(startsWith(y,"javascript:")||startsWith(y,"data:"))return}if(s){e.setAttributeNS(He,n,String(d));return}if(i){e.setAttributeNS(Ve,n,String(d));return}if(r)e.setAttribute(n,String(d));else if(n in e)try{e[n]=d;}catch(y){e.setAttribute(n,String(d));}else e.setAttribute(n,String(d));}function Ne(e,n,t,o=false){if(n===t)return;let r=Ce(t);if(!r){e.removeAttribute("class");return}(isString(n)?n:Ce(n))!==r&&(o?e.setAttribute("class",r):e.className=r);}var Ce=normalizeClassName;var yn=/\s*!important$/,at=["Webkit","Moz","ms"],Ge={};function Se(e,n,t){let o=e.style;if(t&&isString(t)){n!==t&&(o.cssText=t);return}if(!t){n&&e.removeAttribute("style");return}if(n&&!isString(n)){let r=n;for(let s in r)(!t||t[s]==null)&&ne(o,s,"");}else if(n&&isString(n)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,s;for(;(s=r.exec(n))!==null;){let i=s[1].trim();i&&t&&isObject(t)&&t[i]==null&&ne(o,i,"");}}if(t&&!isString(t)){let r=t;for(let s in r){let i=r[s];(!n||isString(n)||n[s]!==i)&&i!=null&&ne(o,s,i);}}}function ne(e,n,t){if(isArray(t)){for(let s of t)ne(e,n,s);return}(t==null||t==="")&&(t="");let o=isString(t)&&yn.test(t)?"important":"";if(o&&(t=t.replace(yn,"")),startsWith(n,"--")){o?e.setProperty(n,t,o):e.setProperty(n,t);return}let r=ut(e,n);o?e.setProperty(ct(r),t,o):e[r]=t;}function ct(e){let n=kebabCase(e);return startsWith(e,"Webkit")||startsWith(e,"Moz")||startsWith(e,"ms")?`-${n}`:n}function ut(e,n){let t=Ge[n];if(t)return t;let o=camelCase(n);if(o!=="filter"&&o in e)return Ge[n]=o;o=capitalize(o);for(let r of at){let s=r+o;if(s in e)return Ge[n]=s}return n}var Ue=0;function hn(){return String(Ue++)}function pt(){Ue=0;}var q=false;function oe(){return q}var te=new Map;function yt(e){let n=e.querySelectorAll("[data-hk]");for(let t of n){let o=t.dataset.hk;o!=null&&!te.has(o)&&te.set(o,t);}}var we=[],de=new Map;function ht(){if(typeof document=="undefined")return;let e=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),n;for(;n=e.nextNode();){let t=n.data;if(t==="teleport-anchor")we.push(n);else if(t==="teleport-start"){let o=n.parentElement;if(!o)continue;let r=de.get(o);r||(r=[],de.set(o,r)),r.push(n);}}}function ze(){var e;return (e=we.shift())!=null?e:null}function We(e){let n=de.get(e),t=n==null?void 0:n.shift();if(!t)return null;let o=[],r=t.nextSibling;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data==="teleport-end")return {start:t,end:r,nodes:o};o.push(r),r=r.nextSibling;}return null}function qe(e){q=true,Ue=0,te.clear(),we.length=0,de.clear(),yt(e),ht();}function Xe(){q=false,te.clear(),we.length=0,de.clear();}function gn(e,n,t){var s,i;if(!q||t&&t.parentNode!==e)return null;if(n.length===0)return [];let o=new Array(n.length),r=t?t.previousSibling:e.lastChild;for(let l=n.length-1;l>=0;l--){if(!r)return null;let c=n[l],d=c.nodeType;if(d===Node.TEXT_NODE){let f=(s=c.textContent)!=null?s:"";if(!f||r.nodeType!==Node.TEXT_NODE)return null;let y=(i=r.textContent)!=null?i:"";if(y===f){o[l]=r,r=r.previousSibling;continue}if(!y.endsWith(f))return null;let v=y.slice(0,y.length-f.length);if(!v)return null;let E=document.createTextNode(v);e.insertBefore(E,r),r.textContent=f,o[l]=r,r=E;continue}if(r.nodeType!==d)return null;if(d===Node.ELEMENT_NODE){if(r.tagName!==c.tagName)return null}else if(d===Node.COMMENT_NODE&&r.data!==c.data)return null;o[l]=r,r=r.previousSibling;}return o}function vn(e){var t,o,r;return (r=(o=e.dataset.hk)!=null?o:(t=e.closest("[data-hk]"))==null?void 0:t.dataset.hk)!=null?r:null}function gt(e,n){if(!q||!e||n<0)return null;let t=e instanceof Element?vn(e):null,o=t?`${t}-${n}`:String(n),r=e.firstChild;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data===o)return r;r=r.nextSibling;}return null}function vt(e,n){if(!q||!(e instanceof Element)||n<0)return null;let t=vn(e),o=t?`${t}-${n}`:String(n),r=e.firstChild;for(;r;){if(r instanceof Element&&r.getAttribute(HYDRATION_ANCHOR_ATTR)===o)return r;r=r.nextSibling;}return null}function Et(e){if(!isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let n=null;return ()=>{if(!q)return n||(n=be(e)),n();let t=hn(),o=te.get(t);return o?(te.delete(t),o):(warn(`[essor] hydration mismatch: no SSR element for key "${t}"`),n||(n=be(e)),n())}}function Ct(e,n,t,o){q||Ne(e,n,t,o);}function Nt(e,n,t,o){q||Z(e,n,t,o);}function Tt(e,n,t){q||Se(e,n,t);}function Ye(e,n){return n&&n.parentNode===e?n:null}function En(e,n,t,o){let r=Ye(e,o),s=n.length,i=t.length;if(s===0&&i===0)return t;if(s===0){for(let f=0;f<i;f++)G(e,t[f],r);return t}if(i===0){for(let f=0;f<s;f++)Y(n[f]);return []}let l=0,c=s-1,d=i-1;for(;l<=c&&l<=d&&n[l]===t[l];)l++;for(;c>=l&&d>=l&&n[c]===t[d];)c--,d--;if(l>c){if(l<=d){let f=d+1,y=Ye(e,f<i?t[f]:r);for(let v=l;v<=d;v++)G(e,t[v],y);}}else if(l>d)for(let f=l;f<=c;f++)Y(n[f]);else St(e,n,t,l,c,d,r);return t}function St(e,n,t,o,r,s,i){let l=s-o+1,c=l<=4?C=>{for(let N=o;N<=s;N++)if(t[N]===C)return N}:(()=>{let C=new Map;for(let N=o;N<=s;N++)C.set(t[N],N);return N=>C.get(N)})(),d=new Int32Array(l),f=0,y=false,v=0;for(let C=o;C<=r;C++){let N=n[C];if(f>=l){Y(N);continue}let p=c(N);p===void 0?Y(N):(d[p-o]=C+1,p>=v?v=p:y=true,f++);}let E=y?Je(d):[],_=E.length-1;for(let C=l-1;C>=0;C--){let N=o+C,p=t[N],T=Ye(e,N+1<t.length?t[N+1]:i);d[C]===0?G(e,p,T):y&&(_<0||C!==E[_]?G(e,p,T):_--);}}function Je(e){let n=new Int32Array(e.length),t=[0],o=e.length,r,s,i,l,c;for(r=0;r<o;r++){let d=e[r];if(d!==0){if(s=t[t.length-1],e[s]<d){n[r]=s,t.push(r);continue}for(i=0,l=t.length-1;i<l;)c=i+l>>1,e[t[c]]<d?i=c+1:l=c;d<e[t[i]]&&(i>0&&(n[r]=t[i-1]),t[i]=r);}}for(i=t.length,l=t[i-1];i-- >0;)t[i]=l,l=n[l];return t}function Y(e){if(e)if(V(e))e.destroy();else {let n=e;n.parentNode&&n.remove();}}function G(e,n,t){if(!e||!n)return;let o=V(t)?t.firstChild:t;if(V(n)){n.mount(e,o);return}o?e.insertBefore(n,o):e.appendChild(n);}function re(e){if(e instanceof Node||V(e))return e;let n=typeof e;return e==null||n==="string"||n==="number"||n==="boolean"||n==="symbol"?document.createTextNode(e===false||e==null?"":String(e)):document.createTextNode(String(e))}function J(e,n,t){if(!e)return;let o=c(),r=[],s=true,i=c=>{if(c instanceof Node)return [c];if(V(c))return [c];let d=typeof c;return c==null||d==="string"||d==="number"||d==="boolean"?[re(c)]:coerceArray(c).map(f=>isFunction(f)?f():f).flatMap(f=>f).map(re)},l=effect(()=>{let c=()=>{let d=isFunction(n)?n():n,f=i(d);if(s&&oe()&&f.every(y=>y instanceof Node&&y.parentNode===e)){r=f,s=false;return}if(s&&oe()){let y=gn(e,f,t);if(y){r=y,s=false;return}}r=En(e,r,f,t),s=false;};o&&!o.isDestroyed?f(o,c):c();});return h(()=>{l.stop();for(let c of r)Y(c);r=[];}),r}function _t(e){return (e==null?void 0:e.firstChild)||null}function At(e,n=1){for(;e&&n>0;)e=e.nextSibling,n--;return e||null}function xt(e,n){if(!e||n<0)return null;let t=e.firstChild;for(;t&&n>0;)t=t.nextSibling,n--;return t||null}function ie(e,n,t,o){if(!(o!=null&&o.delegate))return e.addEventListener(n,t,o),()=>e.removeEventListener(n,t,o);let r=o.delegate,s=d=>{let f=d.target;(f.matches(r)||f.closest(r))&&t.call(e,d);},c=o,{delegate:i}=c,l=a(c,["delegate"]);return e.addEventListener(n,s,l),()=>{e.removeEventListener(n,s,l);}}function Qe(e,n,t){let o=e[n];o||(o=[],e[n]=o),o.push(t);}function Tn(e,n,t){let o=e.length;if(o===0)return;let r;for(let s=0;s<o;s++)try{let i=e[s]();if(isPromise(i)){let l=i.catch(c=>{});(r||(r=[])).push(l);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function Q(e){let n=c();if(n){if(n.isMounted){try{let t=e();isPromise(t)&&t.catch(o=>{});}catch(t){}return}Qe(n,"onMount",e);}}function kt(e){let n=c();n&&Qe(n,"onUpdate",e);}function se(e){let n=c();n&&Qe(n,"onDestroy",e);}function Sn(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let n=e.onMount,t=f(e,()=>Tn(n,e.id));return n.length=0,e.isMounted=true,t}function bn(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return f(e,()=>Tn(e.onUpdate,e.id))}function _n(e,n,t=false){for(let o of Object.getOwnPropertyNames(n))Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o));if(t){let o=Object.getOwnPropertyNames(n);for(let r of Object.getOwnPropertyNames(e))o.includes(r)||delete e[r];}}function An(e,n){let t=Object.getOwnPropertyDescriptor(e,n);return t.get?t.get.call(e):t.value}var xn;xn="normal";var le=class{constructor(n,t={}){this.component=n;this.props=t;this[xn]=true;this.scope=null;this.state=0;this.beforeNode=void 0;this.renderedNodes=[];this.firstChild=void 0;this.parentNode=void 0;this.rootEventCleanups=[];this.parentScope=c();let o={};_n(o,t),this.reactiveProps=shallowReactive(o);}mount(n,t){var s;if(this.parentNode=n,this.beforeNode=t,this.state=1,this.renderedNodes.length>0){for(let i of this.renderedNodes)G(n,i,t);return this.state=2,this.renderedNodes}let o=e((s=this.parentScope)!=null?s:c());this.scope=o;let r=f(o,()=>{var l;let i=this.component(this.reactiveProps);return isFunction(i)&&(i=i(this.reactiveProps)),(isSignal(i)||isComputed(i))&&(i=i.value),(l=J(n,i,t))!=null?l:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,Sn(o),this.renderedNodes}update(n){this.props=n;let t=this.scope;!t||t.isDestroyed||(_n(this.reactiveProps,n!=null?n:{},true),this.syncSpecialProps(n),bn(t));}forceUpdate(){if(!this.parentNode)return;let n=this.parentNode,t=this.beforeNode;this.destroy(),this.mount(n,t);}destroy(){let n=this.scope;if(!(!n||n.isDestroyed)){this.scope=null,this.releaseSpecialProps(),g(n);for(let t of this.renderedNodes)Y(t);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;for(let t of Object.getOwnPropertyNames(this.reactiveProps))delete this.reactiveProps[t];}}syncSpecialProps(n){if(!n)return;let t=this.firstChild;if(!(!t||!(t instanceof Element))){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(n)){if(o===un){let r=An(n,o);this.rootRefCleanup=this.bindRootRef(r,t);continue}if(isOn(o)){let r=An(n,o);if(!isFunction(r))continue;let s=o.slice(2).toLowerCase(),i=t,l=`_$${s}`,c=i[l];if(isFunction(c)){i[l]=r,this.rootEventCleanups.push(()=>{i[l]===r&&(i[l]=c);});continue}let d=r,f=y=>{i.disabled||d.call(i,y);};this.rootEventCleanups.push(ie(i,s,f));}}}}releaseSpecialProps(){for(let n of this.rootEventCleanups)n();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(n,t){if(isFunction(n))return n(t),()=>n(null);if(isSignal(n)){let o=n,r=o.value;return o.value=t,()=>{o.value===t&&(o.value=r);}}}};function V(e){return !!e&&!!e.normal}function Ae(e,n){return V(e)?e:new le(e,n)}function be(e){let n,t=()=>{let o=document.createElement("template");o.innerHTML=e;let r=o.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(n||(n=t())).cloneNode(true)}function Ft(e$1,n){let t=isString(n)?document.querySelector(n):n;if(!t)return;t.innerHTML&&(t.innerHTML="");let r=e(),s;try{f(r,()=>{let i=Ae(e$1);V(i)&&(s=i,G(t,i));});}catch(i){throw g(r),i}return {root:s,unmount:()=>{g(r),s==null||s.destroy();}}}function Dt(e$1,n){let t=isString(n)?document.querySelector(n):n;if(!t)return;qe(t);let o=e(),r;try{f(o,()=>{let s=Ae(e$1);V(s)&&(r=s,J(t,s));});}catch(s){throw g(o),s}finally{Xe();}return {root:r,unmount:()=>{g(o),r==null||r.destroy();}}}function Ze(e,n){let t=c();t&&(t.provides||(t.provides=new Map),t.provides.set(e,n));}function me(e,n){let t=c();if(!t)return n;let o=t;for(;o;){if(o.provides&&o.provides.has(e))return o.provides.get(e);o=o.parent;}return n}function en(e,n){Object.defineProperty(e,"target",{configurable:true,value:n});}function Rn(e){let n=e.target,t=e.type,o=e.target,r=e.currentTarget,s=()=>{let l=n[`_$${t}`];if(l&&isFunction(l)&&!n.disabled){let c=n[`${t}Data`];if(c?l.call(n,c,e):l.call(n,e),e.cancelBubble)return false}return n.host&&!isString(n.host)&&!n.host._$host&&isFunction(n.contains)&&n.contains(e.target)&&en(e,n.host),true},i=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return n||document}}),e.composedPath){let l=e.composedPath();en(e,l[0]);for(let c=0;c<l.length-2&&(n=l[c],!!s());c++){if(n._$host){n=n._$host,i();break}if(n.parentNode===r)break}}else i();en(e,o);}var xe=Symbol("_$EVENTS");function It(e,n=globalThis.document){let t=n,o=t[xe]||(t[xe]=new Set);for(let r of e)o.has(r)||(o.add(r),n.addEventListener(r,Rn));}function Ot(e=globalThis.document){let n=e,t=n[xe];if(t){for(let o of t.keys())e.removeEventListener(o,Rn);delete n[xe];}}function ae(e,n,t,o){let r=ie(e,n,t,o);c()&&h(r);}var $t=e=>e,Kt=typeof DataTransfer!="undefined"?new DataTransfer().files:[];function Dn(e,n){let t=e,o=n==null?"":String(n);t.value!==o&&(t.value=o);}var Bt={event:"change",forceChange:true,checkboxArray:true,read:e=>e.checked,write(e,n){let t=e,o=isArray(n)?n.map(String).includes(t.value):!!n;t.checked!==o&&(t.checked=o);}},Gt={event:"change",forceChange:true,read(e){let n=e;return n.checked?n.value:""},write(e,n){let t=e,o=String(n)===t.value;t.checked!==o&&(t.checked=o);}},Ut={event:"change",forceChange:true,read:e=>e.files,write(e,n){if(n==null)try{e.files=Kt;}catch(t){}}},Ln={event:"input",ime:true,read:e=>e.value,write:Dn},zt={event:"change",forceChange:true,read(e){let n=e;return n.multiple?Array.from(n.selectedOptions,t=>t.value):n.value},write(e,n){let t=e;if(!t.multiple)return Dn(e,n);let o=new Set((isArray(n)?n:[]).map(String));for(let r of Array.from(t.options))r.selected=o.has(r.value);}};function Fn(e){return {event:"input",read:n=>n[e],write(n,t){n[e]=t;}}}function Wt(e,n){switch(e.nodeName){case "INPUT":return n==="checked"?e.type==="radio"?Gt:Bt:n==="files"?Ut:n==="value"?Ln:Fn(n);case "SELECT":return zt;case "TEXTAREA":return Ln;default:return Fn(n)}}function qt(e,n,t){if(!isString(e))return e;let o=n?e.trim():e;if(t){let r=n?o:o.trim();if(r!==""){let s=Number(r);if(!Number.isNaN(s))return s}}return o}function Xt(e){let n=e.getRootNode();return (n instanceof Document||n instanceof ShadowRoot)&&n.activeElement===e}function Yt(e,n){if(n!=="value"||e.nodeName!=="INPUT")return false;let t=e.type;return t==="number"||t==="range"}function Jt(e,n,t,o,r={}){if(!e)return;let{event:s,read:i,write:l,forceChange:c$1,ime:d,checkboxArray:f}=Wt(e,n),y=r.trim===true,v=r.number===true||Yt(e,n),E=r.lazy===true,_=(y||v)&&n!=="files",C=isFunction(t)?t:()=>t,N=_?S=>qt(S,y,v):$t,p=f?S=>{let R=C();if(!isArray(R))return N(S);let L=e.value,O=R.filter(a=>String(a)!==L);return S&&O.push(L),O}:N,T=false,u=E||c$1?"change":s,w=()=>{if(T)return;let S=i(e);if(S===void 0)return;let R=p(S);Object.is(C(),R)||o(R);};ae(e,u,w),!E&&_&&u!=="change"&&ae(e,"change",()=>l(e,N(i(e)))),d&&(ae(e,"compositionstart",()=>{T=true;}),ae(e,"compositionend",()=>{T=false,E||w();}));let k=effect(()=>{let S=C();d&&T||d&&!E&&Xt(e)&&Object.is(N(i(e)),S)||l(e,S);});c()&&h(()=>k.stop());}function Mn(e){let n=e;return Array.isArray(n)&&n.length===1&&(n=n[0]),typeof n=="function"?n():n}function In(e){let n=Object.getOwnPropertyDescriptor(e,"children");return n!=null&&n.get?()=>Mn(n.get.call(e)):()=>Mn(e.children)}function Qt(e,n){let t=new Set(n);return new Proxy(e,{get(o,r){if(!t.has(r))return Reflect.get(o,r)},ownKeys(o){return Reflect.ownKeys(o).filter(r=>!t.has(r))},getOwnPropertyDescriptor(o,r){if(!t.has(r))return Reflect.getOwnPropertyDescriptor(o,r)},has(o,r){return t.has(r)?false:Reflect.has(o,r)}})}function On(e){var t;if(e&&((t=Object.getOwnPropertyDescriptor(e,"children"))!=null&&t.get||isReactive(e)))return [()=>e.children];let n=e==null?void 0:e.children;return n==null?null:n}On[je]=true;function eo(e){return !!e&&!!e[je]}function ke(e){let n=isFunction(e.target)?e.target():e.target;return n==null?null:isString(n)?document.querySelector(n):n}function Pe(e){return isFunction(e.disabled)?!!e.disabled():!!e.disabled}function Vn(e$1){if(oe()){let f=oo(e$1);if(f)return f}let n=document.createComment("portal");n[fe]=true;let{children:t}=e$1;if(t==null)return n;let o=c(),r=null,s=(f$1,y)=>{r=e(o),f(r,()=>{J(f$1,()=>t,y);});},i=()=>{r&&(g(r),r=null);},l=(f,y)=>{if(i(),f){let v=n.parentNode;if(!v)return;s(v,n);return}y&&s(y);},c$1=false,d=effect(()=>{let f=Pe(e$1),y=f?null:ke(e$1);c$1&&l(f,y);});return Q(()=>{c$1=!0;let f=Pe(e$1),y=f?null:ke(e$1);if(f||y){l(f,y);return}queueMicrotask(()=>{n.parentNode&&l(Pe(e$1),ke(e$1));});}),h(()=>{d.stop(),i();}),n}Vn[fe]=true;function oo(e){if(Pe(e))return null;let n=ze();if(!n)return null;let t=ke(e);return !t||!We(t)?null:(n[fe]=true,n)}function ro(e){return !!e&&!!e[fe]}function Le(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function jn(e){let n=e;for(;isFunction(n);)n=n();return isSignal(n)||isComputed(n)?jn(n.value):n}var pe=Symbol("SuspenseContext");function $n(e){var _;if(!isBrowser())return (_=e.fallback)!=null?_:"";let n=document.createElement("div");n.style.display="contents";let t=true,o=0,r=false,s=null,i=C=>{let N=jn(C);if(isArray(N)){let p=[];for(let T of N){let u=i(T);isArray(u)?p.push(...u):p.push(u);}return p}return re(N)},l=C=>{let N=i(C),p=isArray(N)?N:[N];for(let T of p)T!=null&&G(n,T);},c=()=>{Le(n),e.fallback!=null&&l(e.fallback);},d=()=>{r||(r=true,c());},f=()=>{!r||!(s||e.children!=null&&!isPromise(e.children))||(r=false,Le(n),s?y(s):e.children!=null&&!isPromise(e.children)&&y(e.children));},y=C=>{if(r||(Le(n),C==null))return;let N=isArray(C)?C:[C];for(let p of N)p!=null&&l(p);r&&c();},v={register:C=>{o++,d(),C.then(()=>{t&&(o--,o===0&&f());}).catch(N=>{t&&(o--,o===0&&f());});},increment:()=>{o++,d();},decrement:()=>{o=Math.max(0,o-1),o===0&&f();}};Ze(pe,v);let E=e.children;return isPromise(E)?(E.then(C=>{s=C;}).catch(()=>{}),v.register(E)):E!=null?y(E):d(),se(()=>{t=false,o=0,s=null,Le(n),n.remove();}),n}$n[$e]=true;function co(e){return !!e&&!!e[$e]}function uo(e,n){let t=signal(n==null?void 0:n.initialValue),o=signal(true),r=signal(null),s=signal("pending"),i=0,l=null,c=false,d=me(pe,null),f=()=>b(null,null,function*(){let E=++i;o.value=true,s.value="pending",r.value=null,c=false,d&&d.increment();try{let _=e();l=_,_.catch(()=>{});let C=yield _;E===i&&(t.value=C,s.value="ready",o.value=!1);}catch(_){E===i&&(r.value=_ instanceof Error?_:new Error(String(_)),s.value="errored",o.value=false);}finally{d&&d.decrement();}});f();let y=(()=>(!c&&o.value&&l&&d&&(c=true,d.register(l)),t.value));return y.loading=o,y.error=r,y.state=s,[y,{mutate:E=>{t.value=E,s.value="ready",o.value=false,r.value=null;},refetch:()=>b(null,null,function*(){yield f();})}]}function Kn(e){return isFunction(e)?e:e.default}function on(e,n,t){let o=new le(n,t);return o.mount(e),o}function mo(e,n={}){let{delay:t=200,timeout:o,ssr:r="blocking",onError:s}=n;if(typeof window=="undefined"){if(r==="client-only"){let N=()=>"";return N.__asyncLoader=e,N.__asyncResolved=()=>null,N}let v=null,E=null,_=()=>E||(E=e().then(N=>{v=Kn(N);}).catch(()=>{}),E);_();let C=N=>v?v(N):"";return C.__asyncLoader=_,C.__asyncResolved=()=>v,C}let i=null,l=null,c="pending",d=null;function f(){return d||(d=e().then(v=>{i=Kn(v),c="resolved";}).catch(v=>{l=v instanceof Error?v:new Error(String(v)),c="errored",d=null;}),d)}f();function y(v){var O;if(c==="resolved"&&i){let a=document.createElement("div");a.style.display="contents";let g=on(a,i,v);return h(()=>g.destroy()),a}if(c==="errored"&&l){let a=document.createElement("div");if(a.style.display="contents",n.error){let g=true,m=null,P=(A,h)=>{g&&(m==null||m.destroy(),m=on(a,A,h));},b=()=>{d=null,c="pending",l=null,n.loading&&P(n.loading),f().then(()=>{g&&(c==="resolved"&&i?P(i,v):c==="errored"&&l&&n.error&&P(n.error,{error:l,retry:b}));});};P(n.error,{error:l,retry:b}),se(()=>{g=false,m==null||m.destroy(),m=null;});}return a}let E=document.createElement("div");E.style.display="contents";let _=true,C=null,N=null,p=null,T=(a,g)=>{_&&(C==null||C.destroy(),C=on(E,a,g));},u=a=>()=>{d=null,c="pending",l=null,n.loading&&T(n.loading),f().then(()=>{c==="resolved"&&i?T(i,a):c==="errored"&&l&&n.error&&T(n.error,{error:l,retry:u(a)});});};se(()=>{_=false,C==null||C.destroy(),C=null,N!=null&&clearTimeout(N),p!=null&&clearTimeout(p);});let w=(O=me(pe))!=null?O:null,k=a=>T(a,v),S=a=>{n.error&&T(n.error,{error:a,retry:u(v)});},R=()=>{n.loading&&T(n.loading);},L=f().then(()=>{_&&(c==="resolved"&&i?k(i):c==="errored"&&l&&(S(l),s&&s(l,u(v))),N!=null&&clearTimeout(N),p!=null&&clearTimeout(p));});return w&&w.register(L),t>0?N=setTimeout(()=>{_&&c==="pending"&&R();},t):n.loading&&R(),o!=null&&(p=setTimeout(()=>{if(_&&c==="pending"){let a=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);l=a,c="errored",S(a),s&&s(a,u(v));}},o)),E}return y.__asyncLoader=f,y.__asyncResolved=()=>i,y}function Bn(e$1){let n=document.createDocumentFragment(),t=document.createComment("");n.appendChild(t);let o=[],r=[],s=e$1.key,i=e$1.children,l=Array.isArray(i)&&i.length===1&&isFunction(i[0])?i[0]:e$1.children;if(!isFunction(l))throw new TypeError("<For> requires `children` to be a function (item, index) => Node");let c$1=()=>{var T,u;let p=e$1.each;return isSignal(p)?(T=p.value)!=null?T:[]:isFunction(p)?(u=p())!=null?u:[]:p!=null?p:[]},d=(p,T)=>s?s(p,T):p,f$1=(p,T,u)=>{if(p==null||p===false)return [];if(Array.isArray(p)){let k=[];for(let S of p)k.push(...f$1(S,T,u));return k}if(V(p))return G(T,p,u!=null?u:void 0),p.renderedNodes;let w=re(p);return G(T,w,u!=null?u:void 0),[w]},y=(p,T)=>{if(!e$1.fallback)return;r=f$1(e$1.fallback(),p,T);},v=()=>{for(let p of r)p.parentNode&&p.parentNode.removeChild(p);r=[];},E=(p,T,u,w,k=d(p,T))=>{let S=c(),R=e(S),L=[];return f(R,()=>{L=f$1(l(p,T),u,w);}),{key:k,item:p,nodes:L,scope:R}},_=p=>{g(p.scope);for(let T of p.nodes)T.parentNode&&T.parentNode.removeChild(T);},C=effect(()=>{let p=c$1(),T=t.parentNode;if(!T){if(p.length===0)y(n,t);else {o=new Array(p.length);let u=0;for(let w of p)o[u]=E(w,u,n,t),u++;}return}N(T,p);});function N(p,T){let u=o.length,w=T.length;if(w===0){for(let h=0;h<u;h++)_(o[h]);o=[],e$1.fallback&&r.length===0&&y(p,t);return}if(u===0||r.length>0){r.length>0&&v(),o=new Array(w);let h=document.createDocumentFragment();for(let x=0;x<w;x++)o[x]=E(T[x],x,h,null);p.insertBefore(h,t);return}let k=new Map;for(let h=0;h<u;h++){let x=o[h],F=k.get(x.key),j=[x,h];F?F.push(j):k.set(x.key,[j]);}let S=new Array(w),R=[],L=null,O=new Int32Array(w),a=false,g=0,m=new Array(w);for(let h=0;h<w;h++)m[h]=d(T[h],h);for(let h=0;h<w;h++){let x=T[h],F=m[h],j=k.get(F);if(j&&j.length>0){let[X,z]=j.shift();Object.is(X.item,x)?(X.item=x,S[h]=X,O[h]=z+1,z<g?a=true:g=z):(L||(L=document.createDocumentFragment()),_(X),S[h]=E(x,h,L,null,F));}else L||(L=document.createDocumentFragment()),S[h]=E(x,h,L,null,F);}for(let h of k.values())for(let[x]of h)R.push(x);for(let h of R)_(h);let P=a?Je(O):[],b=P.length-1,A=t;for(let h=w-1;h>=0;h--){let F=S[h].nodes;if(!(O[h]===0)&&a&&b>=0&&h===P[b]){b--;for(let z=F.length-1;z>=0;z--)A=F[z];continue}for(let z=F.length-1;z>=0;z--){let Ie=F[z];Ie.nextSibling!==A&&p.insertBefore(Ie,A),A=Ie;}}o=S;}return h(()=>{C.stop();for(let p of o)_(p);o=[],v(),t.parentNode&&t.parentNode.removeChild(t);}),n}Bn[mn]=true;function sn(e){var s,i,l,c,d,f,y,v,E,_;let n=(s=e.name)!=null?s:"v",t=(i=e.enterFromClass)!=null?i:`${n}-enter-from`,o=(l=e.enterActiveClass)!=null?l:`${n}-enter-active`,r=(c=e.enterToClass)!=null?c:`${n}-enter-to`;return {enterFrom:t,enterActive:o,enterTo:r,leaveFrom:(d=e.leaveFromClass)!=null?d:`${n}-leave-from`,leaveActive:(f=e.leaveActiveClass)!=null?f:`${n}-leave-active`,leaveTo:(y=e.leaveToClass)!=null?y:`${n}-leave-to`,appearFrom:(v=e.appearFromClass)!=null?v:t,appearActive:(E=e.appearActiveClass)!=null?E:o,appearTo:(_=e.appearToClass)!=null?_:r}}var Gn=e=>e?e.endsWith("ms")?Number(e.slice(0,-2).replace(",",".")):Number(e.slice(0,-1).replace(",","."))*1e3:0;function Un(e,n){let t=e.split(", "),o=n.split(", "),r=0;for(let[s,i]of o.entries()){let l=Gn(i)+Gn(t[s%t.length]||"0s");l>r&&(r=l);}return r}function Wn(e,n){let t=getComputedStyle(e),o=n!=="animation"?Un(t.transitionDelay,t.transitionDuration):0,r=n!=="transition"?Un(t.animationDelay,t.animationDuration):0;return o===0&&r===0?null:o>=r?{event:"transitionend",timeout:o}:{event:"animationend",timeout:r}}function U(e,n){for(let t of n.split(/\s+/))t&&e.classList.add(t);}function H(e,n){for(let t of n.split(/\s+/))t&&e.classList.remove(t);}function he(e){requestAnimationFrame(()=>requestAnimationFrame(e));}function Me(e){e.offsetHeight;}function ce(e,n,t,o){if(t!=null){setTimeout(o,t);return}let r=Wn(e,n);if(!r){o();return}let s=false,i=()=>{s||(s=true,e.removeEventListener(r.event,l),o());},l=()=>i();e.addEventListener(r.event,l),setTimeout(i,r.timeout+1);}function ue(e,n){return e==null?null:typeof e=="number"?e:e[n]}function zn(e){if(e==null||e===false)return null;if(Array.isArray(e))return e[0]instanceof Element?e[0]:null;if(e instanceof Element)return e;if(V(e)){let n=e;if(n.scope==null){let o=document.createDocumentFragment();n.mount(o);}let t=n.firstChild;return t instanceof Element?t:null}return null}var De=Symbol("enter_cb"),ye=Symbol("leave_cb");function qn(e){let n=document.createComment(""),t=sn(e),o=e.css!==false,r=In(e),s="idle",i=null,l=null,c=false,d,f=false,y=false,v=false,E=(u,w)=>{var g;let k=u[ye];k&&k(true),s="entering";let S=w==="appear"?t.appearFrom:t.enterFrom,R=w==="appear"?t.appearActive:t.enterActive,L=w==="appear"?t.appearTo:t.enterTo;(g=e.onBeforeEnter)==null||g.call(e,u),o&&(U(u,S),U(u,R));let O=false,a=m=>{var P,b;O||(O=true,u[De]=void 0,o&&(H(u,S),H(u,R),H(u,L)),m?(P=e.onEnterCancelled)==null||P.call(e,u):(s="entered",(b=e.onAfterEnter)==null||b.call(e,u)));};u[De]=a,he(()=>{if(!O)if(o&&(H(u,S),U(u,L)),e.onEnter)e.onEnter(u,()=>a(false));else if(o){let m=ue(e.duration,"enter");ce(u,e.type,m,()=>a(false));}else a(false);});},_=(u,w)=>{var a;let k=u[De];k&&(k(true),Me(u)),s="leaving",(a=e.onBeforeLeave)==null||a.call(e,u),o&&(U(u,t.leaveFrom),U(u,t.leaveActive));let S=false,R=g=>{var m,P;S||(S=true,u[ye]=void 0,o&&(H(u,t.leaveFrom),H(u,t.leaveActive),H(u,t.leaveTo)),g?(m=e.onLeaveCancelled)==null||m.call(e,u):(s="idle",w(),(P=e.onAfterLeave)==null||P.call(e,u)));};u[ye]=R;let L=ue(e.duration,"leave"),O=o&&!e.onLeave&&L==null?!!Wn(u,e.type):false;if(!e.onLeave&&L==null&&!O){R(false);return}he(()=>{S||(o&&(H(u,t.leaveFrom),U(u,t.leaveTo)),e.onLeave?e.onLeave(u,()=>R(false)):o?ce(u,e.type,L,()=>R(false)):R(false));});},C=(u,w)=>{if(u&&s==="leaving"&&l){let S=l,R=S[ye];R&&R(true),l=null,i=S,E(S,"enter");return}if(u===i)return;let k=i;if(i=u,k){l=k;let S=k;_(S,()=>{S.parentNode&&S.parentNode.removeChild(S),l===S&&(l=null);});}u&&n.parentNode?(n.parentNode.insertBefore(u,n),w&&!e.appear?s="entered":E(u,w&&e.appear?"appear":"enter")):!k&&!u&&(s="idle");},N=()=>{if(y=false,v||!f)return;let u=d;f=false,d=void 0;try{C(zn(u),!1);}catch(w){}},p=u=>{d=u,f=true,!y&&(y=true,queueMicrotask(N));},T=effect(()=>{let u=r();c?p(u):(d=u,f=true);});return Q(()=>{c=!0;let u=f?zn(d):null;f=!1,d=void 0,C(u,!0);}),h(()=>{v=true,T.stop();for(let u of [i,l]){if(!u)continue;let w=u[De],k=u[ye];w==null||w(true),k==null||k(true),u.parentNode&&u.parentNode.removeChild(u);}i=null,l=null,s="idle";}),n}qn[Ke]=true;function go(e){return !!e&&!!e[Ke]}function an(e,n){if(e==null||e===false)return {el:null,comp:null};if(Array.isArray(e)&&e.length===1)return an(e[0],n);if(isFunction(e))return an(e(),n);if(e instanceof HTMLElement)return {el:e,comp:null};if(V(e)){let t=e;t.scope==null&&t.mount(n);let o=t.firstChild;return o instanceof HTMLElement?{el:o,comp:t}:{el:null,comp:t}}return {el:null,comp:null}}function Co(e){return {position:e.style.position,top:e.style.top,left:e.style.left,width:e.style.width,height:e.style.height}}function ln(e,n){e.style.position=n.position,e.style.top=n.top,e.style.left=n.left,e.style.width=n.width,e.style.height=n.height;}function Xn(e$1){var R,L,O;let n=(R=e$1.tag)!=null?R:"div",t=document.createElement(n),o=sn(e$1),r=e$1.css!==false,s=(O=e$1.moveClass)!=null?O:`${(L=e$1.name)!=null?L:"v"}-move`,i=e$1.key,l=e$1.children,c$1=Array.isArray(l)&&l.length===1&&isFunction(l[0])?l[0]:e$1.children;if(!isFunction(c$1)||!isFunction(i))throw new TypeError("<TransitionGroup> requires `children: (item, index) => Node` and `key: (item, index) => unknown`");let d=()=>{var g,m;let a=e$1.each;return isSignal(a)?(g=a.value)!=null?g:[]:isFunction(a)?(m=a())!=null?m:[]:a!=null?a:[]},f$1=[],y=false,v=(a,g$1)=>{let m=c(),P=e(m),b;f(P,()=>{b=c$1(a,g$1);});let{el:A,comp:h}=an(b,t);return A?{key:i(a,g$1),item:a,el:A,comp:h,scope:P,state:"entering"}:(g(P),null)},E=a=>{if(a.comp){for(let g of a.comp.renderedNodes)g.parentNode===t&&t.removeChild(g);return}a.el.parentNode===t&&t.removeChild(a.el);},_=a=>{var g$1,m;(g$1=a.cancelEnter)==null||g$1.call(a,true),(m=a.cancelLeave)==null||m.call(a,true),a.comp&&a.comp.destroy(),E(a),g(a.scope);},C=a=>{var b,A,h;let g=a.el;if((b=a.cancelLeave)==null||b.call(a,true),!r){a.state="present",(A=e$1.onAfterEnter)==null||A.call(e$1,g);return}(h=e$1.onBeforeEnter)==null||h.call(e$1,g),U(g,o.enterFrom),U(g,o.enterActive);let m=false,P=x=>{var F,j;m||(m=true,a.cancelEnter=void 0,H(g,o.enterFrom),H(g,o.enterActive),H(g,o.enterTo),x?(F=e$1.onEnterCancelled)==null||F.call(e$1,g):(a.state="present",(j=e$1.onAfterEnter)==null||j.call(e$1,g)));};a.cancelEnter=P,a.state="entering",he(()=>{if(!m)if(H(g,o.enterFrom),U(g,o.enterTo),e$1.onEnter)e$1.onEnter(g,()=>P(false));else {let x=ue(e$1.duration,"enter");ce(g,e$1.type,x,()=>P(false));}});},N=(a,g$1)=>{var h,x;let m=a.el;a.cancelEnter&&(a.cancelEnter(true),Me(m)),a.state="leaving",a.savedStyles=Co(m);let P=t.getBoundingClientRect();if(m.style.position="absolute",m.style.top=`${g$1.top-P.top}px`,m.style.left=`${g$1.left-P.left}px`,m.style.width=`${g$1.width}px`,m.style.height=`${g$1.height}px`,!r){a.savedStyles&&ln(m,a.savedStyles),E(a),g(a.scope),a.comp&&a.comp.destroy(),(h=e$1.onAfterLeave)==null||h.call(e$1,m);return}(x=e$1.onBeforeLeave)==null||x.call(e$1,m),U(m,o.leaveFrom),U(m,o.leaveActive);let b=false,A=F=>{var j,X;if(!b){if(b=true,a.cancelLeave=void 0,H(m,o.leaveFrom),H(m,o.leaveActive),H(m,o.leaveTo),F){a.savedStyles&&ln(m,a.savedStyles),a.savedStyles=void 0,(j=e$1.onLeaveCancelled)==null||j.call(e$1,m);return}a.savedStyles&&ln(m,a.savedStyles),a.savedStyles=void 0,E(a),g(a.scope),a.comp&&a.comp.destroy(),(X=e$1.onAfterLeave)==null||X.call(e$1,m);}};a.cancelLeave=A,he(()=>{if(!b)if(H(m,o.leaveFrom),U(m,o.leaveTo),e$1.onLeave)e$1.onLeave(m,()=>A(false));else {let F=ue(e$1.duration,"leave");ce(m,e$1.type,F,()=>A(false));}});},p=(a,g)=>{if(!r||a.state!=="present")return;let m=a.el,P=m.getBoundingClientRect(),b=g.left-P.left,A=g.top-P.top;if(!b&&!A)return;let h=m.style.transform,x=m.style.transitionDuration;m.style.transform=`translate(${b}px, ${A}px)`,m.style.transitionDuration="0s",U(m,s),Me(m),m.style.transform=h,m.style.transitionDuration=x;let F=ue(e$1.duration,"enter");ce(m,e$1.type,F,()=>{H(m,s);});},T=()=>{for(let a of f$1)a.state!=="leaving"&&(a.prevRect=a.el.getBoundingClientRect());},u=a=>{let g=new Map;for(let A of f$1)g.set(A.key,A);let m=[];for(let[A,h]of a.entries()){let x=i(h,A),F=g.get(x);if(F)g.delete(x),F.item=h,m.push(F);else {let j=v(h,A);j&&m.push(j);}}let P=[];for(let A of g.values())A.state!=="leaving"&&P.push(A);let b=null;for(let A=m.length-1;A>=0;A--){let h=m[A].el;(h.parentNode!==t||h.nextSibling!==b)&&t.insertBefore(h,b),b=h;}return {next:m,leaving:P}},w=(a,g)=>{if(g){let b=[];for(let[A,h]of a.entries()){let x=v(h,A);x&&(x.el.parentNode!==t&&t.appendChild(x.el),x.state="present",b.push(x));}f$1=b;return}T();let{next:m,leaving:P}=u(a);for(let b of m)b.state!=="present"&&C(b);for(let b of P){let A=b.prevRect;A&&N(b,A);}for(let b of m)b.state!=="present"||!b.prevRect||(p(b,b.prevRect),b.prevRect=void 0);f$1=m.concat(P);},k=null,S=effect(()=>{let a=d();if(!y){k=a;return}w(a,false);});return Q(()=>{y=!0,k&&(w(k,!0),k=null);}),h(()=>{S.stop();for(let a of f$1)_(a);f$1=[],t.parentNode&&t.parentNode.removeChild(t);}),t}Xn[Be]=true;function No(e){return !!e&&!!e[Be]}
|
|
2
|
+
export{le as Component,Bn as For,On as Fragment,Vn as Portal,$n as Suspense,qn as Transition,Xn as TransitionGroup,ie as addEvent,ae as addEventListener,qe as beginHydration,Jt as bindElement,_t as child,Ot as clearDelegatedEvents,ze as consumeTeleportAnchor,We as consumeTeleportBlock,Ft as createApp,Ae as createComponent,uo as createResource,mo as defineAsyncComponent,It as delegateEvents,Xe as endHydration,hn as getHydrationKey,Et as getRenderedElement,Dt as hydrate,vt as hydrationAnchor,gt as hydrationMarker,me as inject,J as insert,V as isComponent,eo as isFragment,oe as isHydrating,ro as isPortal,co as isSuspense,go as isTransition,No as isTransitionGroup,At as next,Ce as normalizeClass,xt as nthChild,Qt as omitProps,se as onDestroy,Q as onMount,kt as onUpdate,Z as patchAttr,Nt as patchAttrHydrate,Ne as patchClass,Ct as patchClassHydrate,Se as patchStyle,Tt as patchStyleHydrate,Ze as provide,pt as resetHydrationKey,ne as setStyle,be as template};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estjs/template",
|
|
3
|
-
"version": "0.0.16
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [],
|
|
@@ -17,39 +17,39 @@
|
|
|
17
17
|
"dist",
|
|
18
18
|
"types"
|
|
19
19
|
],
|
|
20
|
-
"main": "./dist/template.
|
|
21
|
-
"module": "./dist/template.
|
|
20
|
+
"main": "./dist/template.js",
|
|
21
|
+
"module": "./dist/template.js",
|
|
22
22
|
"types": "./dist/template.d.ts",
|
|
23
23
|
"exports": {
|
|
24
24
|
"./internal": {
|
|
25
25
|
"development": {
|
|
26
26
|
"types": "./dist/internal.d.ts",
|
|
27
|
-
"require": "./dist/internal.dev.cjs
|
|
28
|
-
"import": "./dist/internal.dev.
|
|
27
|
+
"require": "./dist/internal.dev.cjs",
|
|
28
|
+
"import": "./dist/internal.dev.js"
|
|
29
29
|
},
|
|
30
30
|
"types": "./dist/internal.d.ts",
|
|
31
|
-
"require": "./dist/internal.cjs
|
|
32
|
-
"import": "./dist/internal.
|
|
31
|
+
"require": "./dist/internal.cjs",
|
|
32
|
+
"import": "./dist/internal.js"
|
|
33
33
|
},
|
|
34
34
|
".": {
|
|
35
35
|
"browser": {
|
|
36
36
|
"development": {
|
|
37
37
|
"types": "./dist/template.d.ts",
|
|
38
|
-
"require": "./dist/template.dev.cjs
|
|
39
|
-
"import": "./dist/template.dev.
|
|
38
|
+
"require": "./dist/template.dev.cjs",
|
|
39
|
+
"import": "./dist/template.dev.js"
|
|
40
40
|
},
|
|
41
41
|
"types": "./dist/template.d.ts",
|
|
42
|
-
"require": "./dist/template.cjs
|
|
43
|
-
"import": "./dist/template.
|
|
42
|
+
"require": "./dist/template.cjs",
|
|
43
|
+
"import": "./dist/template.js"
|
|
44
44
|
},
|
|
45
45
|
"development": {
|
|
46
46
|
"types": "./dist/template.d.ts",
|
|
47
|
-
"require": "./dist/template.dev.cjs
|
|
48
|
-
"import": "./dist/template.dev.
|
|
47
|
+
"require": "./dist/template.dev.cjs",
|
|
48
|
+
"import": "./dist/template.dev.js"
|
|
49
49
|
},
|
|
50
50
|
"types": "./dist/template.d.ts",
|
|
51
|
-
"require": "./dist/template.cjs
|
|
52
|
-
"import": "./dist/template.
|
|
51
|
+
"require": "./dist/template.cjs",
|
|
52
|
+
"import": "./dist/template.js"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"typesVersions": {
|
|
@@ -60,16 +60,15 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"sideEffects": false,
|
|
63
|
-
"unpkg": "dist/template.
|
|
64
|
-
"jsdelivr": "dist/template.
|
|
63
|
+
"unpkg": "dist/template.js",
|
|
64
|
+
"jsdelivr": "dist/template.js",
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"
|
|
67
|
-
"@estjs/
|
|
68
|
-
"@estjs/signals": "0.0.16-beta.8"
|
|
66
|
+
"@estjs/shared": "0.0.16",
|
|
67
|
+
"@estjs/signals": "0.0.16"
|
|
69
68
|
},
|
|
70
69
|
"devDependencies": {
|
|
71
|
-
"@babel/core": "^7.
|
|
72
|
-
"babel-plugin-essor": "0.0.16
|
|
70
|
+
"@babel/core": "^7.29.7",
|
|
71
|
+
"babel-plugin-essor": "0.0.16"
|
|
73
72
|
},
|
|
74
73
|
"scripts": {
|
|
75
74
|
"build": "tsup && cross-env NODE_ENV=production tsup --clean=false",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import'@estjs/shared';import {setCurrentScope,effectScope}from'@estjs/signals';var d=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var m=(e,r)=>{var n={};for(var o in e)S.call(e,o)&&r.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&d)for(var o of d(e))r.indexOf(o)<0&&y.call(e,o)&&(n[o]=e[o]);return n};var D=(e,r,n)=>new Promise((o,c)=>{var p=l=>{try{i(n.next(l));}catch(u){c(u);}},a=l=>{try{i(n.throw(l));}catch(u){c(u);}},i=l=>l.done?o(l.value):Promise.resolve(l.value).then(p,a);i((n=n.apply(e,r)).next());});var t=null,h=0;function w(){return t}function T(e){t=e,setCurrentScope(e==null?void 0:e.effectScope);}function k(e=t){let r=e?e.effectScope.run(()=>effectScope()):effectScope(true),n={id:++h,effectScope:r,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=new Set),e.children.add(n)),n}function s(e,r){let n=t;t=e;try{return e.effectScope.run(r)}finally{t=n;}}function _(e){var r;if(!(!e||e.isDestroyed)){if(e.isDestroyed=true,e.children&&e.children.size>0){for(let n of e.children)n&&(n.parent=null,_(n));e.children.clear();}s(e,()=>{if(e.onDestroy){for(let n=0;n<e.onDestroy.length;n++)try{e.onDestroy[n]();}catch(o){}e.onDestroy=null;}if(e.cleanup){for(let n=0;n<e.cleanup.length;n++)try{e.cleanup[n]();}catch(o){}e.cleanup=null;}}),e.effectScope.stop(),(r=e.parent)!=null&&r.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 C(e){let r=t;r&&(r.cleanup||(r.cleanup=[]),r.cleanup.push(e));}export{m as a,D as b,w as c,T as d,k as e,s as f,_ as g,C as h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scope.ts"],"names":[],"mappings":"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","file":"chunk-OEKE4VTS.dev.esm.js","sourcesContent":["import { error } from '@estjs/shared';\nimport { type EffectScope, effectScope, setCurrentScope } from '@estjs/signals';\nimport type { InjectionKey } from './provide';\n\n/**\n * Scope represents an execution context in the component tree.\n * It manages provides, cleanup functions, and lifecycle hooks.\n */\nexport interface Scope {\n /** Unique identifier for debugging */\n readonly id: number;\n\n /** Reactive effect scope tied to this template scope */\n readonly effectScope: EffectScope;\n\n /** Parent scope in the hierarchy */\n parent: Scope | null;\n\n /** Child scopes (lazy initialized) */\n children: Set<Scope> | null;\n\n /** Provided values (lazy initialized) */\n provides: Map<InjectionKey<unknown> | string | number | symbol, unknown> | null;\n\n /** Cleanup functions (lazy initialized) */\n cleanup: Array<() => void> | null;\n\n /** Mount lifecycle hooks (lazy initialized) */\n onMount: Array<() => void | Promise<void>> | null;\n\n /** Update lifecycle hooks (lazy initialized) */\n onUpdate: Array<() => void | Promise<void>> | null;\n\n /** Destroy lifecycle hooks (lazy initialized) */\n onDestroy: Array<() => void | Promise<void>> | null;\n\n /** Whether the scope has been mounted */\n isMounted: boolean;\n\n /** Whether the scope has been destroyed */\n isDestroyed: boolean;\n}\n\n/** Currently active scope */\nlet activeScope: Scope | null = null;\n\n/** Scope ID counter for unique identification */\nlet scopeId = 0;\n\n/**\n * Get the currently active scope.\n *\n * @returns The active scope or null if none is active.\n */\nexport function getActiveScope(): Scope | null {\n return activeScope;\n}\n\n/**\n * Set the active scope (internal use).\n *\n * @param scope - The scope to set as active.\n * @returns {void}\n */\nexport function setActiveScope(scope: Scope | null): void {\n activeScope = scope;\n setCurrentScope(scope?.effectScope);\n}\n\n/**\n * Create a new scope with optional parent.\n * If no parent is provided, uses the current active scope as parent.\n *\n * @param parent - Optional parent scope (defaults to active scope).\n * @returns A new scope instance.\n */\nexport function createScope(parent: Scope | null = activeScope): Scope {\n const reactiveScope = parent ? parent.effectScope.run(() => effectScope())! : effectScope(true);\n const scope: Scope = {\n id: ++scopeId,\n effectScope: reactiveScope,\n parent,\n children: null, // Lazy initialized\n provides: null, // Lazy initialized\n cleanup: null, // Lazy initialized\n onMount: null, // Lazy initialized\n onUpdate: null, // Lazy initialized\n onDestroy: null, // Lazy initialized\n isMounted: false,\n isDestroyed: false,\n };\n\n // Establish parent-child relationship\n if (parent) {\n if (!parent.children) {\n parent.children = new Set();\n }\n parent.children.add(scope);\n }\n\n return scope;\n}\n\n/**\n * Run a function within a scope, ensuring proper cleanup.\n * The previous active scope is restored even if the function throws.\n *\n * @param scope - The scope to run within.\n * @param fn - The function to execute.\n * @returns The return value of the function.\n */\nexport function runWithScope<T>(scope: Scope, fn: () => T): T {\n const prevScope = activeScope;\n activeScope = scope;\n\n try {\n return scope.effectScope.run(fn) as T;\n } finally {\n // Restore previous scope directly\n activeScope = prevScope;\n }\n}\n\n/**\n * Dispose a scope and all its children.\n * Children are disposed first (depth-first), then the scope itself.\n *\n * @param scope - The scope to dispose.\n * @returns {void}\n */\nexport function disposeScope(scope: Scope): void {\n // Idempotent: already destroyed\n if (!scope || scope.isDestroyed) {\n return;\n }\n\n // Mark destroyed immediately to block re-entrant disposeScope calls\n // (e.g. an onDestroy hook that accidentally disposes the same scope again).\n scope.isDestroyed = true;\n\n // Dispose children first (depth-first)\n // Iterate directly safely by unlinking parent reference to prevent mutation during iteration\n if (scope.children && scope.children.size > 0) {\n for (const child of scope.children) {\n if (child) {\n child.parent = null;\n disposeScope(child);\n }\n }\n scope.children.clear();\n }\n\n // Execute destroy lifecycle hooks and cleanup functions within the scope's\n // context so that inject/provide/getActiveScope work correctly in callbacks.\n //\n // NOTE: `scope.isDestroyed` is already `true` at this point — this is\n // intentional to prevent re-entrant `disposeScope()` calls from within\n // hooks. Callbacks that inspect `getActiveScope()?.isDestroyed` should\n // be aware of this.\n runWithScope(scope, () => {\n // Execute destroy lifecycle hooks\n if (scope.onDestroy) {\n for (let i = 0; i < scope.onDestroy.length; i++) {\n try {\n scope.onDestroy[i]();\n } catch (error_) {\n if (__DEV__) {\n error(`Scope(${scope.id}): Error in destroy hook:`, error_);\n }\n }\n }\n scope.onDestroy = null;\n }\n\n // Execute cleanup functions\n if (scope.cleanup) {\n for (let i = 0; i < scope.cleanup.length; i++) {\n try {\n scope.cleanup[i]();\n } catch (error_) {\n if (__DEV__) {\n error(`Scope(${scope.id}): Error in cleanup:`, error_);\n }\n }\n }\n scope.cleanup = null;\n }\n });\n\n scope.effectScope.stop();\n\n // Remove from parent's children\n if (scope.parent?.children) {\n scope.parent.children.delete(scope);\n }\n\n // Clear all internal collections to prevent memory leaks\n if (scope.provides) {\n scope.provides.clear();\n scope.provides = null;\n }\n scope.onMount = null;\n scope.onUpdate = null;\n scope.children = null;\n\n // Break parent reference to prevent memory leaks\n scope.parent = null;\n}\n\n/**\n * Register a cleanup function in the current scope.\n * The function will be called when the scope is disposed.\n *\n * @param fn - The cleanup function.\n */\nexport function onCleanup(fn: () => void): void {\n const scope = activeScope;\n\n if (!scope) {\n if (__DEV__) {\n error('onCleanup() must be called within a scope');\n }\n return;\n }\n\n // Lazy initialize cleanup array\n if (!scope.cleanup) {\n scope.cleanup = [];\n }\n\n scope.cleanup.push(fn);\n}\n"]}
|
package/dist/internal.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';require('@estjs/shared');var signals=require('@estjs/signals');var o=null,p=0;function f(){return o}function a(e){o=e,signals.setCurrentScope(e==null?void 0:e.effectScope);}function S(e=o){let n=e?e.effectScope.run(()=>signals.effectScope()):signals.effectScope(true),r={id:++p,effectScope:n,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(r)),r}function t(e,n){let r=o;o=e;try{return e.effectScope.run(n)}finally{o=r;}}function i(e){var n;if(!(!e||e.isDestroyed)){if(e.isDestroyed=true,e.children&&e.children.size>0){for(let r of e.children)r&&(r.parent=null,i(r));e.children.clear();}t(e,()=>{if(e.onDestroy){for(let r=0;r<e.onDestroy.length;r++)try{e.onDestroy[r]();}catch(c){}e.onDestroy=null;}if(e.cleanup){for(let r=0;r<e.cleanup.length;r++)try{e.cleanup[r]();}catch(c){}e.cleanup=null;}}),e.effectScope.stop(),(n=e.parent)!=null&&n.children&&e.parent.children.delete(e),e.provides&&(e.provides.clear(),e.provides=null),e.onMount=null,e.onUpdate=null,e.children=null,e.parent=null;}}exports.createScope=S;exports.disposeScope=i;exports.getActiveScope=f;exports.runWithScope=t;exports.setActiveScope=a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scope.ts"],"names":["setCurrentScope","effectScope","error"],"mappings":"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","file":"internal.dev.cjs.js","sourcesContent":["import { error } from '@estjs/shared';\nimport { type EffectScope, effectScope, setCurrentScope } from '@estjs/signals';\nimport type { InjectionKey } from './provide';\n\n/**\n * Scope represents an execution context in the component tree.\n * It manages provides, cleanup functions, and lifecycle hooks.\n */\nexport interface Scope {\n /** Unique identifier for debugging */\n readonly id: number;\n\n /** Reactive effect scope tied to this template scope */\n readonly effectScope: EffectScope;\n\n /** Parent scope in the hierarchy */\n parent: Scope | null;\n\n /** Child scopes (lazy initialized) */\n children: Set<Scope> | null;\n\n /** Provided values (lazy initialized) */\n provides: Map<InjectionKey<unknown> | string | number | symbol, unknown> | null;\n\n /** Cleanup functions (lazy initialized) */\n cleanup: Array<() => void> | null;\n\n /** Mount lifecycle hooks (lazy initialized) */\n onMount: Array<() => void | Promise<void>> | null;\n\n /** Update lifecycle hooks (lazy initialized) */\n onUpdate: Array<() => void | Promise<void>> | null;\n\n /** Destroy lifecycle hooks (lazy initialized) */\n onDestroy: Array<() => void | Promise<void>> | null;\n\n /** Whether the scope has been mounted */\n isMounted: boolean;\n\n /** Whether the scope has been destroyed */\n isDestroyed: boolean;\n}\n\n/** Currently active scope */\nlet activeScope: Scope | null = null;\n\n/** Scope ID counter for unique identification */\nlet scopeId = 0;\n\n/**\n * Get the currently active scope.\n *\n * @returns The active scope or null if none is active.\n */\nexport function getActiveScope(): Scope | null {\n return activeScope;\n}\n\n/**\n * Set the active scope (internal use).\n *\n * @param scope - The scope to set as active.\n * @returns {void}\n */\nexport function setActiveScope(scope: Scope | null): void {\n activeScope = scope;\n setCurrentScope(scope?.effectScope);\n}\n\n/**\n * Create a new scope with optional parent.\n * If no parent is provided, uses the current active scope as parent.\n *\n * @param parent - Optional parent scope (defaults to active scope).\n * @returns A new scope instance.\n */\nexport function createScope(parent: Scope | null = activeScope): Scope {\n const reactiveScope = parent ? parent.effectScope.run(() => effectScope())! : effectScope(true);\n const scope: Scope = {\n id: ++scopeId,\n effectScope: reactiveScope,\n parent,\n children: null, // Lazy initialized\n provides: null, // Lazy initialized\n cleanup: null, // Lazy initialized\n onMount: null, // Lazy initialized\n onUpdate: null, // Lazy initialized\n onDestroy: null, // Lazy initialized\n isMounted: false,\n isDestroyed: false,\n };\n\n // Establish parent-child relationship\n if (parent) {\n if (!parent.children) {\n parent.children = new Set();\n }\n parent.children.add(scope);\n }\n\n return scope;\n}\n\n/**\n * Run a function within a scope, ensuring proper cleanup.\n * The previous active scope is restored even if the function throws.\n *\n * @param scope - The scope to run within.\n * @param fn - The function to execute.\n * @returns The return value of the function.\n */\nexport function runWithScope<T>(scope: Scope, fn: () => T): T {\n const prevScope = activeScope;\n activeScope = scope;\n\n try {\n return scope.effectScope.run(fn) as T;\n } finally {\n // Restore previous scope directly\n activeScope = prevScope;\n }\n}\n\n/**\n * Dispose a scope and all its children.\n * Children are disposed first (depth-first), then the scope itself.\n *\n * @param scope - The scope to dispose.\n * @returns {void}\n */\nexport function disposeScope(scope: Scope): void {\n // Idempotent: already destroyed\n if (!scope || scope.isDestroyed) {\n return;\n }\n\n // Mark destroyed immediately to block re-entrant disposeScope calls\n // (e.g. an onDestroy hook that accidentally disposes the same scope again).\n scope.isDestroyed = true;\n\n // Dispose children first (depth-first)\n // Iterate directly safely by unlinking parent reference to prevent mutation during iteration\n if (scope.children && scope.children.size > 0) {\n for (const child of scope.children) {\n if (child) {\n child.parent = null;\n disposeScope(child);\n }\n }\n scope.children.clear();\n }\n\n // Execute destroy lifecycle hooks and cleanup functions within the scope's\n // context so that inject/provide/getActiveScope work correctly in callbacks.\n //\n // NOTE: `scope.isDestroyed` is already `true` at this point — this is\n // intentional to prevent re-entrant `disposeScope()` calls from within\n // hooks. Callbacks that inspect `getActiveScope()?.isDestroyed` should\n // be aware of this.\n runWithScope(scope, () => {\n // Execute destroy lifecycle hooks\n if (scope.onDestroy) {\n for (let i = 0; i < scope.onDestroy.length; i++) {\n try {\n scope.onDestroy[i]();\n } catch (error_) {\n if (__DEV__) {\n error(`Scope(${scope.id}): Error in destroy hook:`, error_);\n }\n }\n }\n scope.onDestroy = null;\n }\n\n // Execute cleanup functions\n if (scope.cleanup) {\n for (let i = 0; i < scope.cleanup.length; i++) {\n try {\n scope.cleanup[i]();\n } catch (error_) {\n if (__DEV__) {\n error(`Scope(${scope.id}): Error in cleanup:`, error_);\n }\n }\n }\n scope.cleanup = null;\n }\n });\n\n scope.effectScope.stop();\n\n // Remove from parent's children\n if (scope.parent?.children) {\n scope.parent.children.delete(scope);\n }\n\n // Clear all internal collections to prevent memory leaks\n if (scope.provides) {\n scope.provides.clear();\n scope.provides = null;\n }\n scope.onMount = null;\n scope.onUpdate = null;\n scope.children = null;\n\n // Break parent reference to prevent memory leaks\n scope.parent = null;\n}\n\n/**\n * Register a cleanup function in the current scope.\n * The function will be called when the scope is disposed.\n *\n * @param fn - The cleanup function.\n */\nexport function onCleanup(fn: () => void): void {\n const scope = activeScope;\n\n if (!scope) {\n if (__DEV__) {\n error('onCleanup() must be called within a scope');\n }\n return;\n }\n\n // Lazy initialize cleanup array\n if (!scope.cleanup) {\n scope.cleanup = [];\n }\n\n scope.cleanup.push(fn);\n}\n"]}
|
package/dist/internal.dev.esm.js
DELETED
package/dist/internal.esm.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{e as createScope,g as disposeScope,c as getActiveScope,f as runWithScope,d as setActiveScope}from'./chunk-IA4OZ7NW.esm.js';
|
package/dist/template.cjs.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var We=Object.getOwnPropertySymbols;var vt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var Be=(e,t)=>{var n={};for(var o in e)vt.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&We)for(var o of We(e))t.indexOf(o)<0&&Et.call(e,o)&&(n[o]=e[o]);return n};var _e=(e,t,n)=>new Promise((o,r)=>{var s=l=>{try{c(n.next(l));}catch(a){r(a);}},i=l=>{try{c(n.throw(l));}catch(a){r(a);}},c=l=>l.done?o(l.value):Promise.resolve(l.value).then(s,i);c((n=n.apply(e,t)).next());});var ue="_$spread$";var Xe="http://www.w3.org/2000/svg",we="http://www.w3.org/2000/xlink",xe="http://www.w3.org/2000/xmlns/";var Ae=Symbol(""),ie=Symbol(""),Pe=Symbol(""),qe=Symbol("");var q=null,Nt=0;function _(){return q}function O(e=q){let t=e?e.effectScope.run(()=>signals.effectScope()):signals.effectScope(true),n={id:++Nt,effectScope:t,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=new Set),e.children.add(n)),n}function x(e,t){let n=q;q=e;try{return e.effectScope.run(t)}finally{q=n;}}function P(e){var t;if(!(!e||e.isDestroyed)){if(e.isDestroyed=true,e.children&&e.children.size>0){for(let n of e.children)n&&(n.parent=null,P(n));e.children.clear();}x(e,()=>{if(e.onDestroy){for(let n=0;n<e.onDestroy.length;n++)try{e.onDestroy[n]();}catch(o){}e.onDestroy=null;}if(e.cleanup){for(let n=0;n<e.cleanup.length;n++)try{e.cleanup[n]();}catch(o){}e.cleanup=null;}}),e.effectScope.stop(),(t=e.parent)!=null&&t.children&&e.parent.children.delete(e),e.provides&&(e.provides.clear(),e.provides=null),e.onMount=null,e.onUpdate=null,e.children=null,e.parent=null;}}function k(e){let t=q;t&&(t.cleanup||(t.cleanup=[]),t.cleanup.push(e));}function G(e,t,n,o){if(t==="key"){o==null?e.removeAttribute(t):e.setAttribute(t,String(o));return}if(t===ue){let d=shared.isObject(n)?n:null,p=shared.isObject(o)?o:null;if(d)for(let h in d)h!==ue&&(!p||!(h in p))&&G(e,h,d[h],null);if(p)for(let h in p)h!==ue&&G(e,h,d==null?void 0:d[h],p[h]);return}let r=(e==null?void 0:e.namespaceURI)===Xe,s=r&&t.startsWith("xlink:"),i=r&&t.startsWith("xmlns:"),c=shared.isSpecialBooleanAttr(t)||shared.isBooleanAttr(t);if(n===o||t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110)return;let l=t.toLowerCase();if(l==="innerhtml"||l==="srcdoc")return;if(o==null){if(s)e.removeAttributeNS(we,t.slice(6));else if(i){let d=t.slice(6);e.removeAttributeNS(xe,d);}else e.removeAttribute(t);return}if(c){shared.includeBooleanAttr(o)?e.setAttribute(t,""):e.removeAttribute(t);return}let a=shared.isSymbol(o)?String(o):o;if((l==="href"||l==="src"||l==="xlink:href"||l==="action"||l==="formaction"||l==="poster")&&shared.isString(a)){let d=a.trim().toLowerCase();if(d.startsWith("javascript:")||d.startsWith("data:"))return}if(s){e.setAttributeNS(we,t,String(a));return}if(i){e.setAttributeNS(xe,t,String(a));return}if(r)e.setAttribute(t,String(a));else if(t in e)try{e[t]=a;}catch(d){e.setAttribute(t,String(a));}else e.setAttribute(t,String(a));}function de(e,t,n,o=false){if(t===n)return;let r=fe(n);if(!r){e.removeAttribute("class");return}(shared.isString(t)?t:fe(t))!==r&&(o?e.setAttribute("class",r):e.className=r);}var fe=shared.normalizeClassName;var Je=/\s*!important$/,Ft=["Webkit","Moz","ms"],ke={};function me(e,t,n){let o=e.style;if(n&&shared.isString(n)){t!==n&&(o.cssText=n);return}if(!n){t&&e.removeAttribute("style");return}if(t&&!shared.isString(t)){let r=t;for(let s in r)(!n||n[s]==null)&&J(o,s,"");}else if(t&&shared.isString(t)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,s;for(;(s=r.exec(t))!==null;){let i=s[1].trim();i&&n&&shared.isObject(n)&&n[i]==null&&J(o,i,"");}}if(n&&!shared.isString(n)){let r=n;for(let s in r){let i=r[s];(!t||shared.isString(t)||t[s]!==i)&&i!=null&&J(o,s,i);}}}function J(e,t,n){if(shared.isArray(n)){for(let s of n)J(e,t,s);return}(n==null||n==="")&&(n="");let o=shared.isString(n)&&Je.test(n)?"important":"";if(o&&(n=n.replace(Je,"")),t.startsWith("--")){o?e.setProperty(t,n,o):e.setProperty(t,n);return}let r=Ht(e,t);o?e.setProperty(It(r),n,o):e[r]=n;}function It(e){let t=shared.kebabCase(e);return e.startsWith("Webkit")||e.startsWith("Moz")||e.startsWith("ms")?`-${t}`:t}function Ht(e,t){let n=ke[t];if(n)return n;let o=shared.camelCase(t);if(o!=="filter"&&o in e)return ke[t]=o;o=shared.capitalize(o);for(let r of Ft){let s=r+o;if(s in e)return ke[t]=s}return t}var Te=0;function Qe(){return String(Te++)}function jt(){Te=0;}var U=false;function le(){return U}var Q=new Map;function Kt(e){let t=e.querySelectorAll("[data-hk]");for(let n of t){let o=n.dataset.hk;o!=null&&!Q.has(o)&&Q.set(o,n);}}var ye=[],se=new Map;function $t(){if(typeof document=="undefined")return;let e=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),t;for(;t=e.nextNode();){let n=t.data;if(n==="teleport-anchor")ye.push(t);else if(n==="teleport-start"){let o=t.parentElement;if(!o)continue;let r=se.get(o);r||(r=[],se.set(o,r)),r.push(t);}}}function Re(){var e;return (e=ye.shift())!=null?e:null}function De(e){let t=se.get(e),n=t==null?void 0:t.shift();if(!n)return null;let o=[],r=n.nextSibling;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data==="teleport-end")return {start:n,end:r,nodes:o};o.push(r),r=r.nextSibling;}return null}function Me(e){U=true,Te=0,Q.clear(),ye.length=0,se.clear(),Kt(e),$t();}function Le(){U=false,Q.clear(),ye.length=0,se.clear();}function Ut(e){if(!shared.isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let t=null;return ()=>{if(!U)return t||(t=pe(e)),t();let n=Qe(),o=Q.get(n);return o?(Q.delete(n),o):(shared.warn(`[essor] hydration mismatch: no SSR element for key "${n}"`),t||(t=pe(e)),t())}}function zt(e,t,n,o){U||de(e,t,n,o);}function Wt(e,t,n,o){U||G(e,t,n,o);}function Bt(e,t,n){U||me(e,t,n);}function Fe(e,t){return t&&t.parentNode===e?t:null}function Ze(e,t,n,o){let r=Fe(e,o),s=t.length,i=n.length;if(s===0&&i===0)return n;if(s===0){for(let f=0;f<i;f++)L(e,n[f],r);return n}if(i===0){for(let f=0;f<s;f++)j(t[f]);return []}let c=0,l=s-1,a=i-1;for(;c<=l&&c<=a&&t[c]===n[c];)c++;for(;l>=c&&a>=c&&t[l]===n[a];)l--,a--;if(c>l){if(c<=a){let f=a+1,d=Fe(e,f<i?n[f]:r);for(let p=c;p<=a;p++)L(e,n[p],d);}}else if(c>a)for(let f=c;f<=l;f++)j(t[f]);else Xt(e,t,n,c,l,a,r);return n}function Xt(e,t,n,o,r,s,i){let c=s-o+1,l=new Map;for(let m=o;m<=s;m++)l.set(n[m],m);let a=new Int32Array(c);a.fill(0);let f=0,d=false,p=0;for(let m=o;m<=r;m++){let g=t[m];if(f>=c){j(g);continue}let u=l.get(g);u===void 0?j(g):(a[u-o]=m+1,u>=p?p=u:d=true,f++);}let h=d?Ie(a):[],v=h.length-1;for(let m=c-1;m>=0;m--){let g=o+m,u=n[g],y=Fe(e,g+1<n.length?n[g+1]:i);a[m]===0?L(e,u,y):d&&(v<0||m!==h[v]?L(e,u,y):v--);}}function Ie(e){let t=new Int32Array(e.length),n=[0],o=e.length,r,s,i,c,l;for(r=0;r<o;r++){let a=e[r];if(a!==0){if(s=n[n.length-1],e[s]<a){t[r]=s,n.push(r);continue}for(i=0,c=n.length-1;i<c;)l=i+c>>1,e[n[l]]<a?i=l+1:c=l;a<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r);}}for(i=n.length,c=n[i-1];i-- >0;)n[i]=c,c=t[c];return n}function j(e){if(e)if(F(e))e.destroy();else {let t=e;t.parentNode&&t.remove();}}function L(e,t,n){if(!e||!t)return;let o=F(n)?n.firstChild:n;if(F(t)){t.mount(e,o);return}o?e.insertBefore(t,o):e.appendChild(t);}function Z(e){if(e instanceof Node||F(e))return e;let t=typeof e;return e==null||t==="string"||t==="number"||t==="boolean"||t==="symbol"?document.createTextNode(e===false||e==null?"":String(e)):document.createTextNode(String(e))}function z(e,t,n){if(!e)return;let o=_(),r=[],s=true,i=l=>{if(l instanceof Node)return [l];if(F(l))return [l];let a=typeof l;return l==null||a==="string"||a==="number"||a==="boolean"?[Z(l)]:shared.coerceArray(l).map(f=>shared.isFunction(f)?f():f).flatMap(f=>f).map(Z)},c=signals.effect(()=>{let l=()=>{let a=shared.isFunction(t)?t():t,f=i(a);if(s&&le()&&f.every(d=>d instanceof Node&&d.parentNode===e)){r=f,s=false;return}r=Ze(e,r,f,n),s=false;};o&&!o.isDestroyed?x(o,l):l();});return k(()=>{c.stop();for(let l of r)j(l);r=[];}),r}function Yt(e){return (e==null?void 0:e.firstChild)||null}function Jt(e,t=1){for(;e&&t>0;)e=e.nextSibling,t--;return e||null}function Qt(e,t){if(!e||t<0)return null;let n=e.firstChild;for(;n&&t>0;)n=n.nextSibling,t--;return n||null}function ee(e,t,n,o){if(!(o!=null&&o.delegate))return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o);let r=o.delegate,s=a=>{let f=a.target;(f.matches(r)||f.closest(r))&&n.call(e,a);},l=o,{delegate:i}=l,c=Be(l,["delegate"]);return e.addEventListener(t,s,c),()=>{e.removeEventListener(t,s,c);}}function He(e,t,n){let o=e[t];o||(o=[],e[t]=o),o.push(n);}function nt(e,t,n){let o=e.length;if(o===0)return;let r;for(let s=0;s<o;s++)try{let i=e[s]();if(shared.isPromise(i)){let c=i.catch(l=>{});(r||(r=[])).push(c);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function Oe(e){let t=_();if(t){if(t.isMounted){try{let n=e();shared.isPromise(n)&&n.catch(o=>{});}catch(n){}return}He(t,"onMount",e);}}function Zt(e){let t=_();t&&He(t,"onUpdate",e);}function te(e){let t=_();t&&He(t,"onDestroy",e);}function ot(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let t=e.onMount,n=x(e,()=>nt(t,e.id));return t.length=0,e.isMounted=true,n}function rt(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return x(e,()=>nt(e.onUpdate,e.id))}function st(e,t,n=false){let o=n?new Set:null;for(let r of Object.getOwnPropertyNames(t))o==null||o.add(r),Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));if(o)for(let r of Object.getOwnPropertyNames(e))o.has(r)||delete e[r];}function lt(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return n.get?n.get.call(e):n.value}var ct;ct="normal";var ne=class{constructor(t,n={}){this.component=t;this.props=n;this[ct]=true;this.scope=null;this.state=0;this.beforeNode=void 0;this.renderedNodes=[];this.firstChild=void 0;this.parentNode=void 0;this.rootEventCleanups=[];this.parentScope=_();let o={};st(o,n),this.reactiveProps=signals.shallowReactive(o);}mount(t,n){var s;if(this.parentNode=t,this.beforeNode=n,this.state=1,this.renderedNodes.length>0){for(let i of this.renderedNodes)L(t,i,n);return this.state=2,this.renderedNodes}let o=O((s=this.parentScope)!=null?s:_());this.scope=o;let r=x(o,()=>{var c;let i=this.component(this.reactiveProps);return shared.isFunction(i)&&(i=i(this.reactiveProps)),(signals.isSignal(i)||signals.isComputed(i))&&(i=i.value),(c=z(t,i,n))!=null?c:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,ot(o),this.renderedNodes}update(t){this.props=t;let n=this.scope;!n||n.isDestroyed||(st(this.reactiveProps,t!=null?t:{},true),this.syncSpecialProps(t),rt(n));}forceUpdate(){if(!this.parentNode)return;let t=this.parentNode,n=this.beforeNode;this.destroy(),this.mount(t,n);}destroy(){let t=this.scope;if(!(!t||t.isDestroyed)){this.scope=null,this.releaseSpecialProps(),P(t);for(let n of this.renderedNodes)j(n);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;}}syncSpecialProps(t){if(!t)return;let n=this.firstChild;if(n){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(t)){if(o==="ref"){let r=lt(t,o);this.rootRefCleanup=this.bindRootRef(r,n);continue}if(shared.isOn(o)){let r=lt(t,o);if(!shared.isFunction(r))continue;let s=o.slice(2).toLowerCase();this.rootEventCleanups.push(ee(n,s,r));}}}}releaseSpecialProps(){for(let t of this.rootEventCleanups)t();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(t,n){if(shared.isFunction(t))return t(n),()=>t(null);if(signals.isSignal(t)){let o=t,r=o.value;return o.value=n,()=>{o.value===n&&(o.value=r);}}}};function F(e){return !!e&&!!e.normal}function he(e,t){return F(e)?e:new ne(e,t)}function pe(e){let t,n=()=>{let o=document.createElement("template");o.innerHTML=e;let r=o.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(t||(t=n())).cloneNode(true)}function on(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;n.innerHTML&&(n.innerHTML="");let r=O(),s;try{x(r,()=>{let i=he(e);F(i)&&(s=i,L(n,i));});}catch(i){throw P(r),i}return {root:s,unmount:()=>{P(r),s==null||s.destroy();}}}function rn(e,t){let n=shared.isString(t)?document.querySelector(t):t;if(!n)return;Me(n);let o=O(),r;try{x(o,()=>{let s=he(e);F(s)&&(r=s,z(n,s));});}catch(s){throw P(o),s}finally{Le();}return {root:r,unmount:()=>{P(o),r==null||r.destroy();}}}function je(e,t){let n=_();n&&(n.provides||(n.provides=new Map),n.provides.set(e,t));}function ce(e,t){let n=_();if(!n)return t;let o=n;for(;o;){if(o.provides&&o.provides.has(e))return o.provides.get(e);o=o.parent;}return t}function Ke(e,t){Object.defineProperty(e,"target",{configurable:true,value:t});}function ft(e){let t=e.target,n=e.type,o=e.target,r=e.currentTarget,s=()=>{let c=t[`_$${n}`];if(c&&shared.isFunction(c)&&!t.disabled){let l=t[`${n}Data`];if(l?c.call(t,l,e):c.call(t,e),e.cancelBubble)return false}return t.host&&!shared.isString(t.host)&&!t.host._$host&&shared.isFunction(t.contains)&&t.contains(e.target)&&Ke(e,t.host),true},i=()=>{for(;s()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return t||document}}),e.composedPath){let c=e.composedPath();Ke(e,c[0]);for(let l=0;l<c.length-2&&(t=c[l],!!s());l++){if(t._$host){t=t._$host,i();break}if(t.parentNode===r)break}}else i();Ke(e,o);}var ge=Symbol("_$EVENTS");function ln(e,t=window.document){let n=t,o=n[ge]||(n[ge]=new Set);for(let r of e)o.has(r)||(o.add(r),t.addEventListener(r,ft));}function cn(e=window.document){let t=e,n=t[ge];if(n){for(let o of n.keys())e.removeEventListener(o,ft);delete t[ge];}}function oe(e,t,n,o){let r=ee(e,t,n,o);_()&&k(r);}function $e(e,t){let n=e,o=t==null?"":String(t);n.value!==o&&(n.value=o);}var dn={event:"change",forceChange:true,read:e=>e.checked,write(e,t){let n=e,o=!!t;n.checked!==o&&(n.checked=o);}},mn={event:"change",forceChange:true,read(e){let t=e;return t.checked?t.value:""},write(e,t){let n=e,o=String(t)===n.value;n.checked!==o&&(n.checked=o);}},pn={event:"change",forceChange:true,read:e=>e.files,write(){}},yn={event:"input",ime:true,read:e=>e.value,write:$e},hn={event:"input",ime:true,read:e=>e.value,write:$e},gn={event:"change",forceChange:true,read(e){let t=e;return t.multiple?Array.from(t.selectedOptions,n=>n.value):t.value},write(e,t){let n=e;if(n.multiple){let o=new Set((Array.isArray(t)?t:[]).map(String));for(let r of Array.from(n.options))r.selected=o.has(r.value);}else $e(e,t);}};function Sn(e,t){switch(e.nodeName){case "INPUT":return t==="checked"?e.type==="radio"?mn:dn:t==="files"?pn:yn;case "SELECT":return gn;case "TEXTAREA":return hn;default:return {event:"input",read:n=>n[t],write(n,o){n[t]=o;}}}}function vn(e,t,n){if(!shared.isString(e))return e;let o=e;if(t&&(o=o.trim()),n&&o!==""){let r=Number(o);if(!Number.isNaN(r))return r}return o}function En(e){let t=e.getRootNode();return (t instanceof Document||t instanceof ShadowRoot)&&t.activeElement===e}function Nn(e,t,n,o,r={}){if(!e)return;let{event:s,read:i,write:c,forceChange:l,ime:a}=Sn(e,t),f=r.trim===true,d=r.number===true,p=r.lazy===true,h=(f||d)&&t!=="files",v=shared.isFunction(n)?n:()=>n,m=h?N=>vn(N,f,d):N=>N,g=false,u=p||l?"change":s,y=()=>{if(g)return;let N=i(e);if(N===void 0)return;let A=m(N);Object.is(v(),A)||o(A);};oe(e,u,y),!p&&h&&u!=="change"&&oe(e,"change",()=>c(e,m(i(e)))),a&&!p&&(oe(e,"compositionstart",()=>{g=true;}),oe(e,"compositionend",()=>{g&&(g=false,y());}));let E=signals.effect(()=>{let N=v();a&&!p&&En(e)&&(g||Object.is(m(i(e)),N))||c(e,N);});_()&&k(()=>E.stop());}function bn(e,t){let n=new Set(t);return new Proxy(e,{get(o,r){if(!n.has(r))return Reflect.get(o,r)},ownKeys(o){return Reflect.ownKeys(o).filter(r=>!n.has(r))},getOwnPropertyDescriptor(o,r){if(!n.has(r))return Reflect.getOwnPropertyDescriptor(o,r)},has(o,r){return n.has(r)?false:Reflect.has(o,r)}})}function dt(e){let t=e==null?void 0:e.children;return t==null?null:t}dt[Ae]=true;function Cn(e){return !!e&&!!e[Ae]}function Se(e){let t=shared.isFunction(e.target)?e.target():e.target;return t==null?null:shared.isString(t)?document.querySelector(t):t}function ve(e){return shared.isFunction(e.disabled)?!!e.disabled():!!e.disabled}function pt(e){if(le()){let f=xn(e);if(f)return f}let t=document.createComment("portal");t[ie]=true;let{children:n}=e;if(n==null)return t;let o=_(),r=null,s=(f,d)=>{r=O(o),x(r,()=>{z(f,()=>n,d);});},i=()=>{r&&(P(r),r=null);},c=(f,d)=>{if(i(),f){let p=t.parentNode;if(!p)return;s(p,t);return}d&&s(d);},l=false,a=signals.effect(()=>{let f=ve(e),d=f?null:Se(e);l&&c(f,d);});return Oe(()=>{l=!0;let f=ve(e),d=f?null:Se(e);if(f||d){c(f,d);return}queueMicrotask(()=>{t.parentNode&&c(ve(e),Se(e));});}),k(()=>{a.stop(),i();}),t}pt[ie]=true;function xn(e){if(ve(e))return null;let t=Re();if(!t)return null;let n=Se(e);return !n||!De(n)?null:(t[ie]=true,t)}function An(e){return !!e&&!!e[ie]}function Ne(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function yt(e){let t=e;for(;shared.isFunction(t);)t=t();return signals.isSignal(t)||signals.isComputed(t)?yt(t.value):t}var ae=Symbol("SuspenseContext");function ht(e){var v;if(!shared.isBrowser())return (v=e.fallback)!=null?v:"";let t=document.createElement("div");t.style.display="contents";let n=true,o=0,r=false,s=null,i=m=>{let g=yt(m);if(shared.isArray(g)){let u=[];for(let y of g){let E=i(y);shared.isArray(E)?u.push(...E):u.push(E);}return u}return Z(g)},c=m=>{let g=i(m),u=shared.isArray(g)?g:[g];for(let y of u)y!=null&&L(t,y);},l=()=>{Ne(t),e.fallback!=null&&c(e.fallback);},a=()=>{r||(r=true,l());},f=()=>{!r||!(s||e.children!=null&&!shared.isPromise(e.children))||(r=false,Ne(t),s?d(s):e.children!=null&&!shared.isPromise(e.children)&&d(e.children));},d=m=>{if(r||(Ne(t),m==null))return;let g=shared.isArray(m)?m:[m];for(let u of g)u!=null&&c(u);r&&l();},p={register:m=>{o++,a(),m.then(()=>{n&&(o--,o===0&&f());}).catch(g=>{n&&(o--,o===0&&f());});},increment:()=>{o++,a();},decrement:()=>{o=Math.max(0,o-1),o===0&&f();}};je(ae,p);let h=e.children;return shared.isPromise(h)?(h.then(m=>{s=m;}).catch(()=>{}),p.register(h)):h!=null?d(h):a(),te(()=>{n=false,o=0,s=null,Ne(t),t.remove();}),t}ht[Pe]=true;function Dn(e){return !!e&&!!e[Pe]}function Mn(e,t){let n=signals.signal(t==null?void 0:t.initialValue),o=signals.signal(true),r=signals.signal(null),s=signals.signal("pending"),i=0,c=null,l=false,a=ce(ae,null),f=()=>_e(null,null,function*(){let h=++i;o.value=true,s.value="pending",r.value=null,l=false,a&&a.increment();try{let v=e();c=v,v.catch(()=>{});let m=yield v;h===i&&(n.value=m,s.value="ready",o.value=!1);}catch(v){h===i&&(r.value=v instanceof Error?v:new Error(String(v)),s.value="errored",o.value=false);}finally{a&&a.decrement();}});f();let d=(()=>(!l&&o.value&&c&&a&&(l=true,a.register(c)),n.value));return d.loading=o,d.error=r,d.state=s,[d,{mutate:h=>{n.value=h,s.value="ready",o.value=false,r.value=null;},refetch:()=>_e(null,null,function*(){yield f();})}]}function gt(e){return shared.isFunction(e)?e:e.default}function ze(e,t,n){let o=new ne(t,n);return o.mount(e),o}function Fn(e,t={}){let{delay:n=200,timeout:o,ssr:r="blocking",onError:s}=t;if(typeof window=="undefined"){if(r==="client-only"){let g=()=>"";return g.__asyncLoader=e,g.__asyncResolved=()=>null,g}let p=null,h=null,v=()=>h||(h=e().then(g=>{p=gt(g);}).catch(()=>{}),h);v();let m=g=>p?p(g):"";return m.__asyncLoader=v,m.__asyncResolved=()=>p,m}let i=null,c=null,l="pending",a=null;function f(){return a||(a=e().then(p=>{i=gt(p),l="resolved";}).catch(p=>{c=p instanceof Error?p:new Error(String(p)),l="errored",a=null;}),a)}f();function d(p){var W;if(l==="resolved"&&i){let b=document.createElement("div");b.style.display="contents";let H=ze(b,i,p);return k(()=>H.destroy()),b}if(l==="errored"&&c){let b=document.createElement("div");if(b.style.display="contents",t.error){let H=true,R=null,K=(X,S)=>{H&&(R==null||R.destroy(),R=ze(b,X,S));},B=()=>{a=null,l="pending",c=null,t.loading&&K(t.loading),f().then(()=>{H&&(l==="resolved"&&i?K(i,p):l==="errored"&&c&&t.error&&K(t.error,{error:c,retry:B}));});};K(t.error,{error:c,retry:B}),te(()=>{H=false,R==null||R.destroy(),R=null;});}return b}let h=document.createElement("div");h.style.display="contents";let v=true,m=null,g=null,u=null,y=(b,H)=>{v&&(m==null||m.destroy(),m=ze(h,b,H));},E=b=>()=>{a=null,l="pending",c=null,t.loading&&y(t.loading),f().then(()=>{l==="resolved"&&i?y(i,b):l==="errored"&&c&&t.error&&y(t.error,{error:c,retry:E(b)});});};te(()=>{v=false,m==null||m.destroy(),m=null,g!=null&&clearTimeout(g),u!=null&&clearTimeout(u);});let N=(W=ce(ae))!=null?W:null,A=b=>y(b,p),I=b=>{t.error&&y(t.error,{error:b,retry:E(p)});},V=()=>{t.loading&&y(t.loading);},T=f().then(()=>{v&&(l==="resolved"&&i?A(i):l==="errored"&&c&&(I(c),s&&s(c,E(p))),g!=null&&clearTimeout(g),u!=null&&clearTimeout(u));});return N&&N.register(T),n>0?g=setTimeout(()=>{v&&l==="pending"&&V();},n):t.loading&&V(),o!=null&&(u=setTimeout(()=>{if(v&&l==="pending"){let b=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);c=b,l="errored",I(b),s&&s(b,E(p));}},o)),h}return d.__asyncLoader=f,d.__asyncResolved=()=>i,d}function St(e){let t=document.createDocumentFragment(),n=document.createComment("");t.appendChild(n);let o=[],r=[],s=e.key,i=e.children,c=()=>{var y,E;let u=e.each;return signals.isSignal(u)?(y=u.value)!=null?y:[]:shared.isFunction(u)?(E=u())!=null?E:[]:u!=null?u:[]},l=(u,y)=>s?s(u,y):u,a=u=>{if(Array.isArray(u)){let y=[];for(let E of u)y.push(...a(E));return y}return [Z(u)]},f=(u,y,E)=>{let N=a(u);for(let A of N)E?y.insertBefore(A,E):y.appendChild(A);return N},d=(u,y)=>{if(!e.fallback)return;r=f(e.fallback(),u,y);},p=()=>{for(let u of r)u.parentNode&&u.parentNode.removeChild(u);r=[];},h=(u,y,E,N,A=l(u,y))=>{let I=_(),V=O(I),T=[];return x(V,()=>{T=f(i(u,y),E,N);}),{key:A,item:u,nodes:T,scope:V}},v=u=>{P(u.scope);for(let y of u.nodes)y.parentNode&&y.parentNode.removeChild(y);},m=signals.effect(()=>{let u=c(),y=n.parentNode;if(!y){if(u.length===0)d(t,n);else {o=new Array(u.length);let E=0;for(let N of u)o[E]=h(N,E,t,n),E++;}return}g(y,u);});function g(u,y){let E=o.length,N=y.length;if(N===0){for(let S=0;S<E;S++)v(o[S]);o=[],e.fallback&&r.length===0&&d(u,n);return}if(E===0||r.length>0){r.length>0&&p(),o=new Array(N);let S=document.createDocumentFragment();for(let w=0;w<N;w++)o[w]=h(y[w],w,S,null);u.insertBefore(S,n);return}let A=new Map;for(let S=0;S<E;S++){let w=o[S],D=A.get(w.key),$=[w,S];D?D.push($):A.set(w.key,[$]);}let I=new Array(N),V=[],T=null,W=new Int32Array(N),b=false,H=0,R=new Array(N);for(let S=0;S<N;S++)R[S]=l(y[S],S);for(let S=0;S<N;S++){let w=y[S],D=R[S],$=A.get(D);if($&&$.length>0){let[re,M]=$.shift();Object.is(re.item,w)?(re.item=w,I[S]=re,W[S]=M+1,M<H?b=true:H=M):(T||(T=document.createDocumentFragment()),v(re),I[S]=h(w,S,T,null,D));}else T||(T=document.createDocumentFragment()),I[S]=h(w,S,T,null,D);}for(let S of A.values())for(let[w]of S)V.push(w);for(let S of V)v(S);let K=b?Ie(W):[],B=K.length-1,X=n;for(let S=N-1;S>=0;S--){let D=I[S].nodes;if(!(W[S]===0)&&b&&B>=0&&S===K[B]){B--;for(let M=D.length-1;M>=0;M--)X=D[M];continue}for(let M=D.length-1;M>=0;M--){let Ce=D[M];Ce.nextSibling!==X&&u.insertBefore(Ce,X),X=Ce;}}o=I;}return k(()=>{m.stop();for(let u of o)v(u);o=[],p(),n.parentNode&&n.parentNode.removeChild(n);}),t}St[qe]=true;
|
|
2
|
-
exports.Component=ne;exports.For=St;exports.Fragment=dt;exports.Portal=pt;exports.Suspense=ht;exports.addEvent=ee;exports.addEventListener=oe;exports.beginHydration=Me;exports.bindElement=Nn;exports.child=Yt;exports.clearDelegatedEvents=cn;exports.consumeTeleportAnchor=Re;exports.consumeTeleportBlock=De;exports.createApp=on;exports.createComponent=he;exports.createResource=Mn;exports.defineAsyncComponent=Fn;exports.delegateEvents=ln;exports.endHydration=Le;exports.getHydrationKey=Qe;exports.getRenderedElement=Ut;exports.hydrate=rn;exports.inject=ce;exports.insert=z;exports.isComponent=F;exports.isFragment=Cn;exports.isHydrating=le;exports.isPortal=An;exports.isSuspense=Dn;exports.next=Jt;exports.normalizeClass=fe;exports.nthChild=Qt;exports.omitProps=bn;exports.onDestroy=te;exports.onMount=Oe;exports.onUpdate=Zt;exports.patchAttr=G;exports.patchAttrHydrate=Wt;exports.patchClass=de;exports.patchClassHydrate=zt;exports.patchStyle=me;exports.patchStyleHydrate=Bt;exports.provide=je;exports.resetHydrationKey=jt;exports.setStyle=J;exports.template=pe;
|