essor 0.0.13-beta.3 → 0.0.13-beta.4
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/essor.cjs.js +4 -4
- package/dist/essor.cjs.js.map +1 -1
- package/dist/essor.d.cts +1 -1
- package/dist/essor.d.ts +1 -1
- package/dist/essor.dev.cjs.js +4 -4
- package/dist/essor.dev.esm.js +4 -4
- package/dist/essor.esm.js +4 -4
- package/dist/essor.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/essor.cjs.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* essor v0.0.13-beta.
|
|
4
|
+
* essor v0.0.13-beta.4
|
|
5
5
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
6
6
|
* @license MIT
|
|
7
7
|
**/
|
|
8
|
-
var Ce="0.0.13-beta.3";var E=e=>e!==null&&typeof e=="object";var g=Array.isArray;function W(e){return typeof e=="string"}function we(e){return typeof e=="symbol"}function G(e){return R.call(e)==="[object Set]"}function Q(e){return R.call(e)==="[object WeakMap]"}function Y(e){return R.call(e)==="[object WeakSet]"}function B(e){return R.call(e)==="[object Map]"}function ke(e){return e==null}var m=e=>typeof e=="function";function ee(e){return e===!1||e===null||e===void 0}var te=e=>R.call(e)==="[object Object]";function ne(e){return W(e)?!Number.isNaN(Number(e)):!1}var R=Object.prototype.toString;var tt=Object.prototype.hasOwnProperty,K=(e,t)=>tt.call(e,t);function re(e){return g(e)?e.flat():[e]}var k=(e,t)=>e!==t&&(e===e||t===t),ie=Function.prototype;function M(e,t){return W(e)?e.indexOf(t)===0:!1}function Me(e){return e.replaceAll(/["&'<>]/g,t=>{switch(t){case"&":return "&";case"<":return "<";case">":return ">";case'"':return """;case"'":return "'";default:return t}})}function P(e,t){return g(t)?t.includes(e):m(t)?t(e):!1}var xe=e=>e.replaceAll(/[A-Z]+/g,(t,n)=>`${n>0?"-":""}${t.toLocaleLowerCase()}`);var Te=e=>e.charAt(0).toUpperCase()+e.slice(1);function se(e,...t){console.warn.apply(console,[`[Essor warn]: ${e}`].concat(t));}var nt=Object.defineProperty,Oe=Object.getOwnPropertySymbols,rt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,$e=(e,t,n)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V=(e,t)=>{for(var n in t||(t={}))rt.call(t,n)&&$e(e,n,t[n]);if(Oe)for(var n of Oe(t))it.call(t,n)&&$e(e,n,t[n]);return e},le=[],ae=[],je=Promise.resolve(),ce=!1;function pe(e){return e?je.then(e):je}function st(e){le.includes(e)||(le.push(e),De());}function De(){ce||(ce=!0,pe(at));}function ot(e){lt(e,ae);}function lt(e,t){t.includes(e)||(t.push(e),De());}function at(){ce=!1,ct();let e;for(;e=le.shift();)e&&e();}function ct(){for(;ae.length>0;){let e=ae.shift();e&&e();}}function ut(e,t){return t==="sync"?()=>e():t==="pre"?()=>ot(e):()=>{pe(()=>st(e));}}var y=null,ue=new WeakMap,oe=new WeakMap,L=Symbol(""),I=Symbol(""),Re=Symbol(""),Pe=Symbol(""),fe=Symbol(""),v=Symbol(""),x=Symbol(""),he=!1,q=new Set;function h(e,t){if(!y)return;let n=ue.get(e);n||(n=new Map,ue.set(e,n));let r=n.get(t);r||(r=new Set,n.set(t,r)),y&&r.add(y);}function b(e,t){let n=ue.get(e);if(!n)return;let r=n.get(t);r&&r.forEach(i=>{if(K(i,"active")&&!i.active){r.delete(i);return}he?q.add(i):i();});}var me=class{constructor(e,t=!1){this.__signal=!0,this.__shallow=t,this.__value=e;}get value(){return h(this,Re),E(this.__value)&&!this.__shallow?D(this.__value):this.__value}set value(e){p(e)&&(e=e.peek()),k(e,this.__value)&&(this.__value=e,b(this,Re));}peek(){return this.__value}};function ge(e){return p(e)?e:new me(e)}function Kt(e){return new me(e,!0)}function Fe(e){return new me(e,!0)}function p(e){return !!(e&&e!=null&&e.__signal)}var ft=class{constructor(e){this.fn=e,this.__computed=!0;let t=y;y=this.run.bind(this),this.__value=this.fn(),y=t;}peek(){return this.__value}run(){let e=this.fn();k(e,this.__value)&&(this.__value=e,b(this,Pe));}get value(){return h(this,Pe),this.__value}};function ht(e){return new ft(e)}function ze(e){return !!(e&&e.__computed)}function T(e,t={}){let{flush:n="pre",onTrack:r,onTrigger:i}=t;function s(){let l=y;y=s.init?s:s.scheduler,e(),i&&i(),y=l;}let o=ut(s,n);return s.scheduler=o,s.init=!0,s.active=!0,r&&r(),s(),()=>{s.active=!1,y=null;}}function qt(e,t){return !e||!E(e)?e:Object.entries(e).reduce((n,[r,i])=>(n[r]=P(r,t)||p(i)?i:ge(i),n),{})}function f(e){return e&&(H(e)?e[I]:p(e)?e.peek():g(e)?e.map(t=>f(t)):te(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,f(n)])):e)}function H(e){return !!(e&&typeof e=="object"&&e[L])}function ve(e,t){return D(e,!1,t)}function Ut(e,t){return D(e,!0,t)}var dt=(e,t)=>({get(n,r,i){if(r===L)return !0;if(r===I)return n;let s=Reflect.get(n,r,i),o=p(s)?s.value:s;return P(r,t)?o:(h(n,r),E(o)&&!e?D(o):o)},set(n,r,i,s){if(P(r,t))return Reflect.set(n,r,i,s),!0;let o=Reflect.get(n,r,s);p(o)&&(o=o.value),p(i)&&(i=i.value);let l=Reflect.set(n,r,i,s);return k(i,o)&&b(n,r),l},deleteProperty(n,r){let i=Reflect.get(n,r),s=Reflect.deleteProperty(n,r);return i!==void 0&&b(n,r),s}}),Ae=pt();function pt(){let e={};return ["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){let r=f(this);for(let s=0,o=this.length;s<o;s++)h(r,`${s}`);let i=r[t](...n);return i===-1||i===!1?r[t](...n):i};}),["push","pop","shift","unshift","splice","sort","reverse"].forEach(t=>{e[t]=function(...n){let r=f(this),i=r[t].apply(this,n);return b(r,fe),i};}),["forEach","map","filter","reduce","reduceRight","some","every","find","findIndex","findLast","findLastIndex","entries","keys","values"].forEach(t=>{e[t]=function(...n){let r=f(this);return h(r,fe),r[t].apply(this,n)};}),e}var mt=(e,t)=>({get(n,r,i){if(r===L)return !0;if(r===I)return n;if(Ae.hasOwnProperty(r))return Reflect.get(Ae,r,i);let s=Reflect.get(n,r,i);return P(r,t)?s:(ne(r)&&h(n,r),h(n,"length"),E(s)&&!e?D(s):s)},set(n,r,i,s){let o=Reflect.get(n,r,s),l=Reflect.set(n,r,i,s);return k(i,o)&&(ne(r)&&b(n,r),(r==="length"||!o)&&b(n,"length")),l}}),gt={get(e,t){return t===L?!0:t===I?e:((t===Symbol.iterator||t==="size")&&h(e,v),Reflect.get(K(Le,t)&&t in e?Le:e,t,e))}},vt={get(e,t){return t===L?!0:t===I?e:Reflect.get(K(Ie,t)&&t in e?Ie:e,t,e)}},Le={get(e){let t=f(this);return h(t,v),t.get(e)},set(e,t){let n=f(this),r=n.set(e,t);return b(n,v),r},add(e){let t=f(this),n=t.add(e);return b(t,v),n},has(e){let t=f(this);return h(t,v),t.has(e)},delete(e){let t=f(this),n=t.has(e),r=t.delete(e);return n&&b(t,v),r},clear(){let e=f(this),t=e.size>0,n=e.clear();return t&&b(e,v),n},forEach(e,t){let n=f(this);h(n,v),n.forEach((r,i)=>{e.call(t,r,i,n);});},get size(){let e=f(this);return h(e,v),e.size},keys(){let e=f(this);return h(e,v),e.keys()},values(){let e=f(this);return h(e,v),e.values()},entries(){let e=f(this);return h(e,v),e.entries()},[Symbol.iterator](){let e=f(this);return h(e,v),e[Symbol.iterator]()}},Ie={get(e){let t=f(this);return h(t,x),t.get(e)},set(e,t){let n=f(this),r=n.set(e,t);return b(n,x),r},add(e){let t=f(this),n=t.add(e);return b(t,x),n},has(e){let t=f(this);return h(t,x),t.has(e)},delete(e){let t=f(this),n=t.delete(e);return b(t,x),n}};function D(e,t=!1,n){if(!E(e)||H(e))return e;if(oe.has(e))return oe.get(e);let r;g(e)?(h(e,fe),r=mt(t,n)):G(e)||B(e)?(h(e,v),r=gt):Y(e)||Q(e)?(h(e,x),r=vt):r=dt(t,n);let i=new Proxy(e,r);return oe.set(e,i),i}function Vt(e){H(e)&&(Q(e)||Y(e)||bt(()=>{g(e)?e.length=0:G(e)||B(e)?e.clear():E(e)&&Object.keys(e).forEach(t=>{delete e[t];});}));}function bt(e){try{he=!0,e();}finally{he=!1,yt();}}function yt(){q.size>0&&(q.forEach(e=>e()),q.clear());}function Xt(e,t,n){return _t(e,t,n)}var He=void 0,U,de=!1;function Nt(e){U=e,de||(de=!0,pe(St));}function St(){U==null||U(),U=null,de=!1;}function _t(e,t,{deep:n,immediate:r}={}){let i,s=g(e);if(p(e)||ze(e))i=()=>e.value;else if(H(e))i=()=>V({},e);else if(s)i=()=>e.map(a=>Et(a));else if(m(e))i=e;else return se("Invalid source type",e),ie;if(t&&n){let a=i,d=n===!0?1/0:n;i=()=>A(a(),d);}let o=s?Array.from({length:e.length}).fill(He):He,l=!1,u=()=>{let a=i();k(a,o)&&(r&&t&&(t(a,o),o=a),l&&t&&Nt(()=>{t(a,o),o=a;}),!l&&(o=a));},c=T(u,{flush:"sync"});return l=!0,r&&u(),c}function Et(e){return p(e)||ze(e)?e.value:H(e)?V({},e):m(e)?e():(se("Invalid source",e),ie)}function A(e,t=1/0,n){if(t<=0||!E(e)||(n=n||new Set,n.has(e)))return e;if(n.add(e),t--,p(e))A(e.value,t,n);else if(g(e))for(let r of e)A(r,t,n);else if(G(e)||B(e))e.forEach(r=>{A(r,t,n);});else if(te(e))for(let r in e)A(e[r],t,n);return e}function Ct(e){let{state:t,getters:n,actions:r}=e,i=V({},t!=null?t:{}),s=ve(t!=null?t:{}),o=[],l=[],u=V({state:s},{patch$(c){Object.assign(s,c),o.forEach(a=>a(s)),l.forEach(a=>a(s));},subscribe$(c){o.push(c);},unsubscribe$(c){let a=o.indexOf(c);a!==-1&&o.splice(a,1);},onAction$(c){l.push(c);},reset$(){Object.assign(s,i);}});for(let c in n){let a=n[c];a&&Object.defineProperty(u,c,{get(){return ht(a.bind(s,s)).value},enumerable:!0,configurable:!0});}for(let c in r){let a=r[c];a&&(u[c]=a.bind(s));}return u}function Jt(e){return function(){return Ct(e)}}var Ue=new Map,wt=class{constructor(){this.renderMode=0;}get isSSG(){return this.renderMode===1}get isSSR(){return this.renderMode===2}get isClient(){return this.renderMode===0}setSSR(){this.renderMode=2;}setSSG(){this.renderMode=1;}setClient(){this.renderMode=0;}},S=new wt;function kt(e,t){Ue.set(e,{index:t});}function Mt(e){return Ue.get(e).index}var be=class F{constructor(){this.hooks={mounted:new Set,destroy:new Set};}addEventListener(){}removeEventListener(){}addHook(t,n){var r;(r=this.hooks[t])==null||r.add(n);}getContext(t){return F.context[t]}setContext(t,n){F.context[t]=n;}initRef(){F.ref=this;}removeRef(){F.ref=null;}clearHooks(){Object.values(this.hooks).forEach(t=>t.clear());}};be.ref=null;be.context={};var w=be;function ye(e){return e instanceof Ne}var O=1,Ne=class extends w{constructor(e,t={},n){if(super(),this.template=e,this.props=t,this.key=n,kt(e,O),g(this.template)){let r=" __PLACEHOLDER__ ",s=this.template.join(r).replaceAll(/(<[^>]+>)|([^<]+)/g,(o,l,u)=>l?l.includes("data-ci")?o:l.replace(/<\s*([\da-z]+)(\s[^>]*)?>/i,(c,a,d)=>`<${a} data-ci="${O}"${d||""}>`):u&&u.replace(r,"").trim()?`<!--0-${O}-->${u}<!$>`:o);this.template=s.split(r);}}mount(){this.initRef();let e=this.render();return this.removeRef(),e}render(){if(m(this.template)){let t=this.template(this.props);return ye(t)?t.mount():String(t)}let e=this.template;return Object.keys(this.props).forEach(t=>{let n=this.props[t],r=n.children;xt(n);let i=e.findIndex(s=>s.includes(`data-hk="${t}"`));r&&r.forEach(([s])=>{O++;let o=Ve(s,n);this.template[i]+=o;}),this.template[i].replaceAll(`data-hk="${t}"`,`data-hk="${t}" ${Tt(n)}`);}),e.join("")}};function xt(e){Object.entries(e).forEach(([t,n])=>{t==="children"||m(n)?delete e[t]:p(n)&&(e[t]=n.value);});}function Tt(e){return Object.entries(e).filter(([t,n])=>t!=="children"&&!m(n)).map(([t,n])=>`${t}="${Me(String(n))}"`).join(" ")}function Ve(e,t){if(m(e))return Ve(e(t),t);if(p(e))return `<!--1-${O}-->${e.value}<!$>`;if(ye(e)){let n=e.mount();return m(n)?n(t):Ze(n)}else return `<!--1-${O}-->${e}<!$>`}var Xe="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr".split(","),Ot="a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,spacer,span,strike,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,xmp".split(",");function We(e){if(_(e)||e instanceof Node||ye(e))return e;let t=ee(e)?"":String(e);return document.createTextNode(t)}function C(e,t,n=null){let r=_(n)?n.firstChild:n,i=S.isSSR;_(t)?t.mount(e,r):r&&!i?r.before(t):i||e.append(t);}function X(e){_(e)?e.unmount():e.parentNode&&e.remove();}function Je(e,t,n){C(e,t,n),X(n);}function Ge(e,t,n){if(t==="class"){typeof n=="string"?e.className=n:g(n)?e.className=n.join(" "):n&&typeof n=="object"&&(e.className=Object.entries(n).reduce((r,[i,s])=>r+(s?` ${i}`:""),"").trim());return}if(t==="style"){if(typeof n=="string")e.style.cssText=n;else if(n&&typeof n=="object"){let r=n;Object.keys(r).forEach(i=>{e.style.setProperty(xe(i),String(r[i]));});}return}ee(n)?e.removeAttribute(t):n===!0?e.setAttribute(t,""):e instanceof HTMLInputElement&&t==="value"?e.value=String(n):e.setAttribute(t,String(n));}function $t(e,t){if(e instanceof HTMLInputElement)switch(e.type){case"checkbox":return N(e,"change",()=>{t(!!e.checked);});case"date":return N(e,"change",()=>{t(e.value?e.value:"");});case"file":return N(e,"change",()=>{e.files&&t(e.files);});case"number":return N(e,"input",()=>{let n=Number.parseFloat(e.value);t(Number.isNaN(n)?"":String(n));});case"radio":return N(e,"change",()=>{t(e.checked?e.value:"");});case"text":return N(e,"input",()=>{t(e.value);})}if(e instanceof HTMLSelectElement)return N(e,"change",()=>{t(e.value);});if(e instanceof HTMLTextAreaElement)return N(e,"input",()=>{t(e.value);})}Promise.resolve();function N(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function jt(e){let t=[],n=[],r=/<\/?([\da-z-]+)([^>]*)>/gi,i=0;for(;;){let s=r.exec(e);if(!s)break;let[o,l]=s,u=o[1]==="/";if(n.push(e.slice(i,s.index)),i=s.index+o.length,u){for(;t.length>0&&t[t.length-1]!==l;){let c=t.pop();c&&n.push(`</${c}>`);}t.length>0&&t.pop();}else Xe.includes(l)||t.push(l);n.push(o);}for(n.push(e.slice(i));t.length>0;){let s=t.pop();s&&n.push(`</${s}>`);}return n.join("")}function Rt(e){return Ot.includes(e)}function Pt(e){return Xe.includes(e)?`<${e}/>`:`<${e}></${e}>`}function Ze(e){return p(e)?e.value:e}var Se=class extends w{constructor(e,t,n){super(),this.template=e,this.props=t,this.key=n,this.emitter=new Set,this.rootNode=null,this.trackMap=new Map,this.proxyProps=t?ve(t,r=>M(r,"on")||M(r,"update")||r==="children"):{};}get firstChild(){var e,t;return (t=(e=this.rootNode)==null?void 0:e.firstChild)!=null?t:null}get isConnected(){var e,t;return (t=(e=this.rootNode)==null?void 0:e.isConnected)!=null?t:!1}mount(e,t){var n,r,i,s;if(!m(this.template))throw new Error("Template must be a function");if(this.isConnected)return (r=(n=this.rootNode)==null?void 0:n.mount(e,t))!=null?r:[];this.initRef(),this.rootNode=this.template(this.proxyProps);let o=(s=(i=this.rootNode)==null?void 0:i.mount(e,t))!=null?s:[];return this.hooks.mounted.forEach(l=>l()),this.patchProps(this.props),this.removeRef(),o}unmount(){var e;this.hooks.destroy.forEach(t=>t()),this.clearHooks(),(e=this.rootNode)==null||e.unmount(),this.rootNode=null,this.proxyProps={};for(let t of this.emitter)t();this.emitter.clear();}inheritNode(e){Object.assign(this.proxyProps,e.proxyProps),this.rootNode=e.rootNode,this.trackMap=e.trackMap,this.hooks=e.hooks;let t=this.props;this.props=e.props,this.patchProps(t);}getNodeTrack(e){let t=this.trackMap.get(e);return t||(t={cleanup:()=>{}},this.trackMap.set(e,t)),t.cleanup(),t}patchProps(e){var t,n;if(e){for(let[r,i]of Object.entries(e))if(M(r,"on")&&((t=this.rootNode)!=null&&t.firstChild)){let s=r.slice(2).toLowerCase(),o=N(this.rootNode.nodes[0],s,i);this.emitter.add(o);}else if(r==="ref")i.value=(n=this.rootNode)==null?void 0:n.firstChild;else if(M(r,"update"))this.props[r]=Ze(i);else if(r!=="children"){let s=this.getNodeTrack(r);s.cleanup=T(()=>{this.proxyProps[r]=m(i)?i():i;});}this.props=e;}}};function At(e,t,n,r){let i=new Map,s=Array.from(t.values());if(t.size>0&&n.length===0)return Lt(e,s,r),i;let o=[],l=Ht(n),u=0;for(let[c,a]of n.entries()){let d=s[u],j=$(d,c);for(;d&&!l.has(j);)X(d),t.delete(j),d=s[++u],j=$(d,c);let _e=$(a,c),Z=t.get(_e);if(Z&&(a=It(e,Z,a)),d)if(d===Z)u++;else {let Ee=document.createComment("");C(e,Ee,d),o.push([Ee,a]);}else C(e,a,r);i.set(_e,a);}return o.forEach(([c,a])=>Je(e,a,c)),t.forEach((c,a)=>{c.isConnected&&!i.has(a)&&X(c);}),i}function Lt(e,t,n){if(e.childNodes.length===t.length+(n?1:0))e.innerHTML="",n&&C(e,n);else {let r=document.createRange(),i=t[0],s=_(i)?i.firstChild:i;r.setStartBefore(s),n?r.setEndBefore(n):r.setEndAfter(e),r.deleteContents();}t.forEach(r=>{_(r)&&r.unmount();});}function It(e,t,n){return t===n?t:_(t)&&_(n)&&t.template===n.template?(n.inheritNode(t),n):t instanceof Text&&n instanceof Text?(t.textContent!==n.textContent&&(t.textContent=n.textContent),t):(Je(e,n,t),n)}function Ht(e){let t=new Map;for(let[n,r]of e.entries()){let i=$(r,n);t.set(i,r);}return t}function $(e,t){if(_(e)){let n=e.key;if(n!=null)return String(n)}return `_$${t}$`}var Qe=class{constructor(e,t,n){this.template=e,this.props=t,this.key=n,this.treeMap=new Map,this.mounted=!1,this.nodes=[],this.trackMap=new Map,this.bindValueKeys=[],this.parent=null,this.key||(this.key=t==null?void 0:t.key),S.isSSR&&(this.componentIndex=Mt(this.template));}addEventListener(){}removeEventListener(){}get firstChild(){var e;return (e=this.nodes[0])!=null?e:null}get isConnected(){return this.mounted}mount(e,t){var n;if(this.parent=e,this.isConnected)return this.nodes.forEach(s=>C(e,s,t)),this.nodes;g(this.template)&&(this.template=et(this.template.join("")));let r=this.template.content.cloneNode(!0),i=r.firstChild;return (n=i==null?void 0:i.hasAttribute)!=null&&n.call(i,"_svg_")&&(i.remove(),i==null||i.childNodes.forEach(s=>{r.append(s);})),this.nodes=Array.from(r.childNodes),S.isSSR?this.mapSSGNodeTree(e):this.mapNodeTree(e,r),C(e,r,t),this.patchProps(this.props),this.mounted=!0,this.nodes}unmount(){this.trackMap.forEach(e=>{var t;(t=e.cleanup)==null||t.call(e);}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>X(e)),this.nodes=[],this.mounted=!1;}patchProps(e){e&&(Object.entries(e).forEach(([t,n])=>{let r=Number(t),i=this.treeMap.get(r);i&&this.patchProp(t,i,n,r===0);}),this.props=e);}inheritNode(e){this.mounted=e.mounted,this.nodes=e.nodes,this.trackMap=e.trackMap,this.treeMap=e.treeMap;let t=this.props;this.props=e.props,this.patchProps(t);}mapSSGNodeTree(e){this.treeMap.set(0,e);let t=n=>{var r;if(n.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){if(n.nodeType===Node.COMMENT_NODE){let[s,o]=((r=n.textContent)==null?void 0:r.split("-"))||"";if(+s==0&&+o===this.componentIndex){let l=n.nextSibling;this.treeMap.set(+o,l);}}else if(n.nodeType!==Node.TEXT_NODE){let{ci:s="-1",hk:o}=(n==null?void 0:n.dataset)||{};o&&+s===this.componentIndex&&this.treeMap.set(+o,n);}}let i=n.firstChild;for(;i;)t(i),i=i.nextSibling;};t(e);}mapNodeTree(e,t){let n=1;this.treeMap.set(0,e);let r=i=>{i.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(n++,i);let s=i.firstChild;for(;s;)r(s),s=s.nextSibling;};r(t);}getNodeTrack(e,t,n){var r;let i=this.trackMap.get(e);return i||(i={cleanup:()=>{}},t&&(i.lastNodes=new Map),n&&(i.isRoot=!0),this.trackMap.set(e,i)),(r=i.cleanup)==null||r.call(i),i}patchProp(e,t,n,r){for(let i in n)if(i==="children"&&n.children)if(g(n.children))n.children.filter(Boolean).forEach((s,o)=>{var l;let[u,c]=g(s)?s:[s,null],a=ke(c)?null:(l=this.treeMap.get(c))!=null?l:null,d=`${e}:${i}:${o}`,j=this.getNodeTrack(d,!0,r);Be(j,t,u,a);});else {let s=`${e}:${i}:0`,o=this.getNodeTrack(s,!0,r);Be(o,t,n.children,null);}else if(i==="ref")n[i].value=t;else if(M(i,"on")){let s=i.slice(2).toLocaleLowerCase(),o=this.getNodeTrack(`${e}:${i}`),l=n[i];o.cleanup=N(t,s,l);}else {let s=`update${Te(i)}`;if(this.bindValueKeys.includes(i))break;n[s]&&this.bindValueKeys.push(s);let o=this.getNodeTrack(`${e}:${i}`),l=n[i],u=p(l)?l:ge(l);qe(o,t,i,u.value);let c=T(()=>{u.value=p(l)?l.value:l,qe(o,t,i,u.value);}),a;n[s]&&!Dt(i)&&(a=$t(t,d=>{n[s](d);})),o.cleanup=()=>{c&&c(),a&&a();};}}};function Be(e,t,n,r){m(n)?e.cleanup=T(()=>{let i=re(n()).map(We);S.isSSR?e.lastNodes=Ke(t,i,r):e.lastNodes=At(t,e.lastNodes,i,r);}):re(n).forEach((i,s)=>{let o=We(i),l=$(o,s);S.isSSR?e.lastNodes=Ke(t,[o],r):(e.lastNodes.set(l,o),C(t,o,r));});}function Ke(e,t,n){let r=new Map,i=Array.from(e.childNodes).filter(s=>{var o,l;return s.nodeType===Node.TEXT_NODE&&((o=s.previousSibling)==null?void 0:o.nodeType)===Node.COMMENT_NODE&&((l=s.nextSibling)==null?void 0:l.nodeType)===Node.COMMENT_NODE});return t.forEach((s,o)=>{let l=$(s,o);s.nodeType===Node.TEXT_NODE?i.forEach(u=>{s.textContent===u.textContent&&e.replaceChild(s,u);}):C(e,s,n),r.set(l,s);}),r}function qe(e,t,n,r){let i=t;i.setAttribute&&(m(r)?e.cleanup=T(()=>{Ge(i,n,r());}):Ge(i,n,r));}function Ye(e,t,n){return W(e)&&(Rt(e)?(e=Pt(e),t={1:t}):e===""&&(t={0:t}),e=et(e)),m(e)?new Se(e,t,n):new Qe(e,t,n)}function Dt(e){return e instanceof Se}function _(e){return e instanceof Se||e instanceof Qe}function et(e){let t=document.createElement("template");return t.innerHTML=jt(e),t}function rn(e){return e.children}function sn(e){var t;J("onMounted"),(t=w.ref)==null||t.addHook("mounted",e);}function on(e){var t;J("onDestroy"),(t=w.ref)==null||t.addHook("destroy",e);}function J(e,t){w.ref||console.error(`"${e}"(key: ${we(t)?t.toString():t}) can only be called within the component function body
|
|
8
|
+
var Ce="0.0.13-beta.4";var E=e=>e!==null&&typeof e=="object";var g=Array.isArray;function W(e){return typeof e=="string"}function we(e){return typeof e=="symbol"}function G(e){return R.call(e)==="[object Set]"}function Q(e){return R.call(e)==="[object WeakMap]"}function Y(e){return R.call(e)==="[object WeakSet]"}function B(e){return R.call(e)==="[object Map]"}function ke(e){return e==null}var m=e=>typeof e=="function";function ee(e){return e===!1||e===null||e===void 0}var te=e=>R.call(e)==="[object Object]";function ne(e){return W(e)?!Number.isNaN(Number(e)):!1}var R=Object.prototype.toString;var tt=Object.prototype.hasOwnProperty,K=(e,t)=>tt.call(e,t);function re(e){return g(e)?e.flat():[e]}var k=(e,t)=>e!==t&&(e===e||t===t),ie=Function.prototype;function M(e,t){return W(e)?e.indexOf(t)===0:!1}function Me(e){return e.replaceAll(/["&'<>]/g,t=>{switch(t){case"&":return "&";case"<":return "<";case">":return ">";case'"':return """;case"'":return "'";default:return t}})}function P(e,t){return g(t)?t.includes(e):m(t)?t(e):!1}var xe=e=>e.replaceAll(/[A-Z]+/g,(t,n)=>`${n>0?"-":""}${t.toLocaleLowerCase()}`);var Te=e=>e.charAt(0).toUpperCase()+e.slice(1);function se(e,...t){console.warn.apply(console,[`[Essor warn]: ${e}`].concat(t));}var nt=Object.defineProperty,Oe=Object.getOwnPropertySymbols,rt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,$e=(e,t,n)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V=(e,t)=>{for(var n in t||(t={}))rt.call(t,n)&&$e(e,n,t[n]);if(Oe)for(var n of Oe(t))it.call(t,n)&&$e(e,n,t[n]);return e},le=[],ae=[],je=Promise.resolve(),ce=!1;function pe(e){return e?je.then(e):je}function st(e){le.includes(e)||(le.push(e),De());}function De(){ce||(ce=!0,pe(at));}function ot(e){lt(e,ae);}function lt(e,t){t.includes(e)||(t.push(e),De());}function at(){ce=!1,ct();let e;for(;e=le.shift();)e&&e();}function ct(){for(;ae.length>0;){let e=ae.shift();e&&e();}}function ut(e,t){return t==="sync"?()=>e():t==="pre"?()=>ot(e):()=>{pe(()=>st(e));}}var y=null,ue=new WeakMap,oe=new WeakMap,L=Symbol(""),I=Symbol(""),Re=Symbol(""),Pe=Symbol(""),fe=Symbol(""),v=Symbol(""),x=Symbol(""),he=!1,q=new Set;function h(e,t){if(!y)return;let n=ue.get(e);n||(n=new Map,ue.set(e,n));let r=n.get(t);r||(r=new Set,n.set(t,r)),y&&r.add(y);}function b(e,t){let n=ue.get(e);if(!n)return;let r=n.get(t);r&&r.forEach(i=>{if(K(i,"active")&&!i.active){r.delete(i);return}he?q.add(i):i();});}var me=class{constructor(e,t=!1){this.__signal=!0,this.__shallow=t,this.__value=e;}get value(){return h(this,Re),E(this.__value)&&!this.__shallow?D(this.__value):this.__value}set value(e){p(e)&&(e=e.peek()),k(e,this.__value)&&(this.__value=e,b(this,Re));}peek(){return this.__value}};function ge(e){return p(e)?e:new me(e)}function Kt(e){return new me(e,!0)}function Fe(e){return new me(e,!0)}function p(e){return !!(e&&e!=null&&e.__signal)}var ft=class{constructor(e){this.fn=e,this.__computed=!0;let t=y;y=this.run.bind(this),this.__value=this.fn(),y=t;}peek(){return this.__value}run(){let e=this.fn();k(e,this.__value)&&(this.__value=e,b(this,Pe));}get value(){return h(this,Pe),this.__value}};function ht(e){return new ft(e)}function ze(e){return !!(e&&e.__computed)}function T(e,t={}){let{flush:n="pre",onTrack:r,onTrigger:i}=t;function s(){let l=y;y=s.init?s:s.scheduler,e(),i&&i(),y=l;}let o=ut(s,n);return s.scheduler=o,s.init=!0,s.active=!0,r&&r(),s(),()=>{s.active=!1,y=null;}}function qt(e,t){return !e||!E(e)?e:Object.entries(e).reduce((n,[r,i])=>(n[r]=P(r,t)||p(i)?i:ge(i),n),{})}function f(e){return e&&(H(e)?e[I]:p(e)?e.peek():g(e)?e.map(t=>f(t)):te(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,f(n)])):e)}function H(e){return !!(e&&typeof e=="object"&&e[L])}function ve(e,t){return D(e,!1,t)}function Ut(e,t){return D(e,!0,t)}var dt=(e,t)=>({get(n,r,i){if(r===L)return !0;if(r===I)return n;let s=Reflect.get(n,r,i),o=p(s)?s.value:s;return P(r,t)?o:(h(n,r),E(o)&&!e?D(o):o)},set(n,r,i,s){if(P(r,t))return Reflect.set(n,r,i,s),!0;let o=Reflect.get(n,r,s);p(o)&&(o=o.value),p(i)&&(i=i.value);let l=Reflect.set(n,r,i,s);return k(i,o)&&b(n,r),l},deleteProperty(n,r){let i=Reflect.get(n,r),s=Reflect.deleteProperty(n,r);return i!==void 0&&b(n,r),s}}),Ae=pt();function pt(){let e={};return ["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){let r=f(this);for(let s=0,o=this.length;s<o;s++)h(r,`${s}`);let i=r[t](...n);return i===-1||i===!1?r[t](...n):i};}),["push","pop","shift","unshift","splice","sort","reverse"].forEach(t=>{e[t]=function(...n){let r=f(this),i=r[t].apply(this,n);return b(r,fe),i};}),["forEach","map","filter","reduce","reduceRight","some","every","find","findIndex","findLast","findLastIndex","entries","keys","values"].forEach(t=>{e[t]=function(...n){let r=f(this);return h(r,fe),r[t].apply(this,n)};}),e}var mt=(e,t)=>({get(n,r,i){if(r===L)return !0;if(r===I)return n;if(Ae.hasOwnProperty(r))return Reflect.get(Ae,r,i);let s=Reflect.get(n,r,i);return P(r,t)?s:(ne(r)&&h(n,r),h(n,"length"),E(s)&&!e?D(s):s)},set(n,r,i,s){let o=Reflect.get(n,r,s),l=Reflect.set(n,r,i,s);return k(i,o)&&(ne(r)&&b(n,r),(r==="length"||!o)&&b(n,"length")),l}}),gt={get(e,t){return t===L?!0:t===I?e:((t===Symbol.iterator||t==="size")&&h(e,v),Reflect.get(K(Le,t)&&t in e?Le:e,t,e))}},vt={get(e,t){return t===L?!0:t===I?e:Reflect.get(K(Ie,t)&&t in e?Ie:e,t,e)}},Le={get(e){let t=f(this);return h(t,v),t.get(e)},set(e,t){let n=f(this),r=n.set(e,t);return b(n,v),r},add(e){let t=f(this),n=t.add(e);return b(t,v),n},has(e){let t=f(this);return h(t,v),t.has(e)},delete(e){let t=f(this),n=t.has(e),r=t.delete(e);return n&&b(t,v),r},clear(){let e=f(this),t=e.size>0,n=e.clear();return t&&b(e,v),n},forEach(e,t){let n=f(this);h(n,v),n.forEach((r,i)=>{e.call(t,r,i,n);});},get size(){let e=f(this);return h(e,v),e.size},keys(){let e=f(this);return h(e,v),e.keys()},values(){let e=f(this);return h(e,v),e.values()},entries(){let e=f(this);return h(e,v),e.entries()},[Symbol.iterator](){let e=f(this);return h(e,v),e[Symbol.iterator]()}},Ie={get(e){let t=f(this);return h(t,x),t.get(e)},set(e,t){let n=f(this),r=n.set(e,t);return b(n,x),r},add(e){let t=f(this),n=t.add(e);return b(t,x),n},has(e){let t=f(this);return h(t,x),t.has(e)},delete(e){let t=f(this),n=t.delete(e);return b(t,x),n}};function D(e,t=!1,n){if(!E(e)||H(e))return e;if(oe.has(e))return oe.get(e);let r;g(e)?(h(e,fe),r=mt(t,n)):G(e)||B(e)?(h(e,v),r=gt):Y(e)||Q(e)?(h(e,x),r=vt):r=dt(t,n);let i=new Proxy(e,r);return oe.set(e,i),i}function Vt(e){H(e)&&(Q(e)||Y(e)||bt(()=>{g(e)?e.length=0:G(e)||B(e)?e.clear():E(e)&&Object.keys(e).forEach(t=>{delete e[t];});}));}function bt(e){try{he=!0,e();}finally{he=!1,yt();}}function yt(){q.size>0&&(q.forEach(e=>e()),q.clear());}function Xt(e,t,n){return _t(e,t,n)}var He=void 0,U,de=!1;function Nt(e){U=e,de||(de=!0,pe(St));}function St(){U==null||U(),U=null,de=!1;}function _t(e,t,{deep:n,immediate:r}={}){let i,s=g(e);if(p(e)||ze(e))i=()=>e.value;else if(H(e))i=()=>V({},e);else if(s)i=()=>e.map(a=>Et(a));else if(m(e))i=e;else return se("Invalid source type",e),ie;if(t&&n){let a=i,d=n===!0?1/0:n;i=()=>A(a(),d);}let o=s?Array.from({length:e.length}).fill(He):He,l=!1,u=()=>{let a=i();k(a,o)&&(r&&t&&(t(a,o),o=a),l&&t&&Nt(()=>{t(a,o),o=a;}),!l&&(o=a));},c=T(u,{flush:"sync"});return l=!0,r&&u(),c}function Et(e){return p(e)||ze(e)?e.value:H(e)?V({},e):m(e)?e():(se("Invalid source",e),ie)}function A(e,t=1/0,n){if(t<=0||!E(e)||(n=n||new Set,n.has(e)))return e;if(n.add(e),t--,p(e))A(e.value,t,n);else if(g(e))for(let r of e)A(r,t,n);else if(G(e)||B(e))e.forEach(r=>{A(r,t,n);});else if(te(e))for(let r in e)A(e[r],t,n);return e}function Ct(e){let{state:t,getters:n,actions:r}=e,i=V({},t!=null?t:{}),s=ve(t!=null?t:{}),o=[],l=[],u=V({state:s},{patch$(c){Object.assign(s,c),o.forEach(a=>a(s)),l.forEach(a=>a(s));},subscribe$(c){o.push(c);},unsubscribe$(c){let a=o.indexOf(c);a!==-1&&o.splice(a,1);},onAction$(c){l.push(c);},reset$(){Object.assign(s,i);}});for(let c in n){let a=n[c];a&&Object.defineProperty(u,c,{get(){return ht(a.bind(s,s)).value},enumerable:!0,configurable:!0});}for(let c in r){let a=r[c];a&&(u[c]=a.bind(s));}return u}function Jt(e){return function(){return Ct(e)}}var Ue=new Map,wt=class{constructor(){this.renderMode=0;}get isSSG(){return this.renderMode===1}get isSSR(){return this.renderMode===2}get isClient(){return this.renderMode===0}setSSR(){this.renderMode=2;}setSSG(){this.renderMode=1;}setClient(){this.renderMode=0;}},S=new wt;function kt(e,t){Ue.set(e,{index:t});}function Mt(e){return Ue.get(e).index}var be=class F{constructor(){this.hooks={mounted:new Set,destroy:new Set};}addEventListener(){}removeEventListener(){}addHook(t,n){var r;(r=this.hooks[t])==null||r.add(n);}getContext(t){return F.context[t]}setContext(t,n){F.context[t]=n;}initRef(){F.ref=this;}removeRef(){F.ref=null;}clearHooks(){Object.values(this.hooks).forEach(t=>t.clear());}};be.ref=null;be.context={};var w=be;function ye(e){return e instanceof Ne}var O=1,Ne=class extends w{constructor(e,t={},n){if(super(),this.template=e,this.props=t,this.key=n,kt(e,O),g(this.template)){let r=" __PLACEHOLDER__ ",s=this.template.join(r).replaceAll(/(<[^>]+>)|([^<]+)/g,(o,l,u)=>l?l.includes("data-ci")?o:l.replace(/<\s*([\da-z]+)(\s[^>]*)?>/i,(c,a,d)=>`<${a} data-ci="${O}"${d||""}>`):u&&u.replace(r,"").trim()?`<!--0-${O}-->${u}<!$>`:o);this.template=s.split(r);}}mount(){this.initRef();let e=this.render();return this.removeRef(),e}render(){if(m(this.template)){let t=this.template(this.props);return ye(t)?t.mount():String(t)}let e=this.template;return Object.keys(this.props).forEach(t=>{let n=this.props[t],r=n.children;xt(n);let i=e.findIndex(s=>s.includes(`data-hk="${t}"`));r&&r.forEach(([s])=>{O++;let o=Ve(s,n);this.template[i]+=o;}),this.template[i].replaceAll(`data-hk="${t}"`,`data-hk="${t}" ${Tt(n)}`);}),e.join("")}};function xt(e){Object.entries(e).forEach(([t,n])=>{t==="children"||m(n)?delete e[t]:p(n)&&(e[t]=n.value);});}function Tt(e){return Object.entries(e).filter(([t,n])=>t!=="children"&&!m(n)).map(([t,n])=>`${t}="${Me(String(n))}"`).join(" ")}function Ve(e,t){if(m(e))return Ve(e(t),t);if(p(e))return `<!--1-${O}-->${e.value}<!$>`;if(ye(e)){let n=e.mount();return m(n)?n(t):Ze(n)}else return `<!--1-${O}-->${e}<!$>`}var Xe="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr".split(","),Ot="a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,spacer,span,strike,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,xmp".split(",");function We(e){if(_(e)||e instanceof Node||ye(e))return e;let t=ee(e)?"":String(e);return document.createTextNode(t)}function C(e,t,n=null){let r=_(n)?n.firstChild:n,i=S.isSSR;_(t)?t.mount(e,r):r&&!i?r.before(t):i||e.append(t);}function X(e){_(e)?e.unmount():e.parentNode&&e.remove();}function Je(e,t,n){C(e,t,n),X(n);}function Ge(e,t,n){if(t==="class"){typeof n=="string"?e.className=n:g(n)?e.className=n.join(" "):n&&typeof n=="object"&&(e.className=Object.entries(n).reduce((r,[i,s])=>r+(s?` ${i}`:""),"").trim());return}if(t==="style"){if(typeof n=="string")e.style.cssText=n;else if(n&&typeof n=="object"){let r=n;Object.keys(r).forEach(i=>{e.style.setProperty(xe(i),String(r[i]));});}return}ee(n)?e.removeAttribute(t):n===!0?e.setAttribute(t,""):e instanceof HTMLInputElement&&t==="value"?e.value=String(n):e.setAttribute(t,String(n));}function $t(e,t){if(e instanceof HTMLInputElement)switch(e.type){case"checkbox":return N(e,"change",()=>{t(!!e.checked);});case"date":return N(e,"change",()=>{t(e.value?e.value:"");});case"file":return N(e,"change",()=>{e.files&&t(e.files);});case"number":return N(e,"input",()=>{let n=Number.parseFloat(e.value);t(Number.isNaN(n)?"":String(n));});case"radio":return N(e,"change",()=>{t(e.checked?e.value:"");});case"text":return N(e,"input",()=>{t(e.value);})}if(e instanceof HTMLSelectElement)return N(e,"change",()=>{t(e.value);});if(e instanceof HTMLTextAreaElement)return N(e,"input",()=>{t(e.value);})}Promise.resolve();function N(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function jt(e){let t=[],n=[],r=/<\/?([\da-z-]+)([^>]*)>/gi,i=0;for(;;){let s=r.exec(e);if(!s)break;let[o,l]=s,u=o[1]==="/";if(n.push(e.slice(i,s.index)),i=s.index+o.length,u){for(;t.length>0&&t[t.length-1]!==l;){let c=t.pop();c&&n.push(`</${c}>`);}t.length>0&&t.pop();}else Xe.includes(l)||t.push(l);n.push(o);}for(n.push(e.slice(i));t.length>0;){let s=t.pop();s&&n.push(`</${s}>`);}return n.join("")}function Rt(e){return Ot.includes(e)}function Pt(e){return Xe.includes(e)?`<${e}/>`:`<${e}></${e}>`}function Ze(e){return p(e)?e.value:e}var Se=class extends w{constructor(e,t,n){super(),this.template=e,this.props=t,this.key=n,this.emitter=new Set,this.rootNode=null,this.trackMap=new Map,this.proxyProps=t?ve(t,r=>M(r,"on")||M(r,"update")||r==="children"):{};}get firstChild(){var e,t;return (t=(e=this.rootNode)==null?void 0:e.firstChild)!=null?t:null}get isConnected(){var e,t;return (t=(e=this.rootNode)==null?void 0:e.isConnected)!=null?t:!1}mount(e,t){var n,r,i,s;if(!m(this.template))throw new Error("Template must be a function");if(this.isConnected)return (r=(n=this.rootNode)==null?void 0:n.mount(e,t))!=null?r:[];this.initRef(),this.rootNode=this.template(this.proxyProps);let o=(s=(i=this.rootNode)==null?void 0:i.mount(e,t))!=null?s:[];return this.hooks.mounted.forEach(l=>l()),this.patchProps(this.props),this.removeRef(),o}unmount(){var e;this.hooks.destroy.forEach(t=>t()),this.clearHooks(),(e=this.rootNode)==null||e.unmount(),this.rootNode=null,this.proxyProps={};for(let t of this.emitter)t();this.emitter.clear();}inheritNode(e){Object.assign(this.proxyProps,e.proxyProps),this.rootNode=e.rootNode,this.trackMap=e.trackMap,this.hooks=e.hooks;let t=this.props;this.props=e.props,this.patchProps(t);}getNodeTrack(e){let t=this.trackMap.get(e);return t||(t={cleanup:()=>{}},this.trackMap.set(e,t)),t.cleanup(),t}patchProps(e){var t,n;if(e){for(let[r,i]of Object.entries(e))if(M(r,"on")&&((t=this.rootNode)!=null&&t.firstChild)){let s=r.slice(2).toLowerCase(),o=N(this.rootNode.nodes[0],s,i);this.emitter.add(o);}else if(r==="ref")i.value=(n=this.rootNode)==null?void 0:n.firstChild;else if(M(r,"update"))this.props[r]=Ze(i);else if(r!=="children"){let s=this.getNodeTrack(r);s.cleanup=T(()=>{this.proxyProps[r]=m(i)?i():i;});}this.props=e;}}};function At(e,t,n,r){let i=new Map,s=Array.from(t.values());if(t.size>0&&n.length===0)return Lt(e,s,r),i;let o=[],l=Ht(n),u=0;for(let[c,a]of n.entries()){let d=s[u],j=$(d,c);for(;d&&!l.has(j);)X(d),t.delete(j),d=s[++u],j=$(d,c);let _e=$(a,c),Z=t.get(_e);if(Z&&(a=It(e,Z,a)),d)if(d===Z)u++;else {let Ee=document.createComment("");C(e,Ee,d),o.push([Ee,a]);}else C(e,a,r);i.set(_e,a);}return o.forEach(([c,a])=>Je(e,a,c)),t.forEach((c,a)=>{c.isConnected&&!i.has(a)&&X(c);}),i}function Lt(e,t,n){if(e.childNodes.length===t.length+(n?1:0))e.innerHTML="",n&&C(e,n);else {let r=document.createRange(),i=t[0],s=_(i)?i.firstChild:i;r.setStartBefore(s),n?r.setEndBefore(n):r.setEndAfter(e),r.deleteContents();}t.forEach(r=>{_(r)&&r.unmount();});}function It(e,t,n){return t===n?t:_(t)&&_(n)&&t.template===n.template?(n.inheritNode(t),n):t instanceof Text&&n instanceof Text?(t.textContent!==n.textContent&&(t.textContent=n.textContent),t):(Je(e,n,t),n)}function Ht(e){let t=new Map;for(let[n,r]of e.entries()){let i=$(r,n);t.set(i,r);}return t}function $(e,t){if(_(e)){let n=e.key;if(n!=null)return String(n)}return `_$${t}$`}var Qe=class{constructor(e,t,n){this.template=e,this.props=t,this.key=n,this.treeMap=new Map,this.mounted=!1,this.nodes=[],this.trackMap=new Map,this.bindValueKeys=[],this.parent=null,this.key||(this.key=t==null?void 0:t.key),S.isSSR&&(this.componentIndex=Mt(this.template));}addEventListener(){}removeEventListener(){}get firstChild(){var e;return (e=this.nodes[0])!=null?e:null}get isConnected(){return this.mounted}mount(e,t){var n;if(this.parent=e,this.isConnected)return this.nodes.forEach(s=>C(e,s,t)),this.nodes;g(this.template)&&(this.template=et(this.template.join("")));let r=this.template.content.cloneNode(!0),i=r.firstChild;return (n=i==null?void 0:i.hasAttribute)!=null&&n.call(i,"_svg_")&&(i.remove(),i==null||i.childNodes.forEach(s=>{r.append(s);})),this.nodes=Array.from(r.childNodes),S.isSSR?this.mapSSGNodeTree(e):this.mapNodeTree(e,r),C(e,r,t),this.patchProps(this.props),this.mounted=!0,this.nodes}unmount(){this.trackMap.forEach(e=>{var t;(t=e.cleanup)==null||t.call(e);}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>X(e)),this.nodes=[],this.mounted=!1;}patchProps(e){e&&(Object.entries(e).forEach(([t,n])=>{let r=Number(t),i=this.treeMap.get(r);i&&this.patchProp(t,i,n,r===0);}),this.props=e);}inheritNode(e){this.mounted=e.mounted,this.nodes=e.nodes,this.trackMap=e.trackMap,this.treeMap=e.treeMap;let t=this.props;this.props=e.props,this.patchProps(t);}mapSSGNodeTree(e){this.treeMap.set(0,e);let t=n=>{var r;if(n.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){if(n.nodeType===Node.COMMENT_NODE){let[s,o]=((r=n.textContent)==null?void 0:r.split("-"))||"";if(+s==0&&+o===this.componentIndex){let l=n.nextSibling;this.treeMap.set(+o,l);}}else if(n.nodeType!==Node.TEXT_NODE){let{ci:s="-1",hk:o}=(n==null?void 0:n.dataset)||{};o&&+s===this.componentIndex&&this.treeMap.set(+o,n);}}let i=n.firstChild;for(;i;)t(i),i=i.nextSibling;};t(e);}mapNodeTree(e,t){let n=1;this.treeMap.set(0,e);let r=i=>{i.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(n++,i);let s=i.firstChild;for(;s;)r(s),s=s.nextSibling;};r(t);}getNodeTrack(e,t,n){var r;let i=this.trackMap.get(e);return i||(i={cleanup:()=>{}},t&&(i.lastNodes=new Map),n&&(i.isRoot=!0),this.trackMap.set(e,i)),(r=i.cleanup)==null||r.call(i),i}patchProp(e,t,n,r){for(let i in n)if(i==="children"&&n.children)if(g(n.children))n.children.filter(Boolean).forEach((s,o)=>{var l;let[u,c]=g(s)?s:[s,null],a=ke(c)?null:(l=this.treeMap.get(c))!=null?l:null,d=`${e}:${i}:${o}`,j=this.getNodeTrack(d,!0,r);Be(j,t,u,a);});else {let s=`${e}:${i}:0`,o=this.getNodeTrack(s,!0,r);Be(o,t,n.children,null);}else if(i==="ref")n[i].value=t;else if(M(i,"on")){let s=i.slice(2).toLocaleLowerCase(),o=this.getNodeTrack(`${e}:${i}`),l=n[i];o.cleanup=N(t,s,l);}else {let s=`update${Te(i)}`;if(this.bindValueKeys.includes(i))break;n[s]&&this.bindValueKeys.push(s);let o=this.getNodeTrack(`${e}:${i}`),l=n[i],u=p(l)?l:ge(l);qe(o,t,i,u.value);let c=T(()=>{u.value=p(l)?l.value:l,qe(o,t,i,u.value);}),a;n[s]&&!Dt(i)&&(a=$t(t,d=>{n[s](d);})),o.cleanup=()=>{c&&c(),a&&a();};}}};function Be(e,t,n,r){m(n)?e.cleanup=T(()=>{let i=re(n()).map(We);S.isSSR?e.lastNodes=Ke(t,i,r):e.lastNodes=At(t,e.lastNodes,i,r);}):re(n).forEach((i,s)=>{let o=We(i),l=$(o,s);S.isSSR?e.lastNodes=Ke(t,[o],r):(e.lastNodes.set(l,o),C(t,o,r));});}function Ke(e,t,n){let r=new Map,i=Array.from(e.childNodes).filter(s=>{var o,l;return s.nodeType===Node.TEXT_NODE&&((o=s.previousSibling)==null?void 0:o.nodeType)===Node.COMMENT_NODE&&((l=s.nextSibling)==null?void 0:l.nodeType)===Node.COMMENT_NODE});return t.forEach((s,o)=>{let l=$(s,o);s.nodeType===Node.TEXT_NODE?i.forEach(u=>{s.textContent===u.textContent&&e.replaceChild(s,u);}):C(e,s,n),r.set(l,s);}),r}function qe(e,t,n,r){let i=t;i.setAttribute&&(m(r)?e.cleanup=T(()=>{Ge(i,n,r());}):Ge(i,n,r));}function Ye(e,t,n){return W(e)&&(Rt(e)?(e=Pt(e),t={1:t}):e===""&&(t={0:t}),e=et(e)),m(e)?new Se(e,t,n):new Qe(e,t,n)}function Dt(e){return e instanceof Se}function _(e){return e instanceof Se||e instanceof Qe}function et(e){let t=document.createElement("template");return t.innerHTML=jt(e),t}function rn(e){return e.children}function sn(e){var t;J("onMounted"),(t=w.ref)==null||t.addHook("mounted",e);}function on(e){var t;J("onDestroy"),(t=w.ref)==null||t.addHook("destroy",e);}function J(e,t){w.ref||console.error(`"${e}"(key: ${we(t)?t.toString():t}) can only be called within the component function body
|
|
9
9
|
and cannot be used in asynchronous or deferred calls.`);}function ln(e,t){var n;J("useProvide",e),(n=w.ref)==null||n.setContext(e,t);}function an(e,t){var n;return J("useInject",e),((n=w.ref)==null?void 0:n.getContext(e))||t}function cn(){return Fe(null)}function un(e,t){S.setSSG();let r=new Ne(e,t||{}).mount();return S.setClient(),r}function fn(e,t){let n=typeof t=="string"?document.querySelector(t):t;if(!n)throw new Error(`Could not find container: ${t}`);S.setSSR(),Ye(e).mount(n),S.setClient();}function hn(e,t){return S.isSSG?new Ne(e,t):Ye(e,t)}globalThis&&(globalThis.__essor_version__=Ce);/**
|
|
10
|
-
* @estjs/signal v0.0.13-beta.
|
|
10
|
+
* @estjs/signal v0.0.13-beta.4
|
|
11
11
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
12
12
|
* @license MIT
|
|
13
13
|
**/
|
|
14
14
|
/**
|
|
15
|
-
* @estjs/template v0.0.13-beta.
|
|
15
|
+
* @estjs/template v0.0.13-beta.4
|
|
16
16
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
17
17
|
* @license MIT
|
|
18
18
|
**/
|