essor 0.0.7-beta.1 → 0.0.7-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
 
20
20
  // src/version.ts
21
- var __essor_version = "0.0.6";
21
+ var __essor_version = "0.0.7-beta.1";
22
22
 
23
23
  // ../shared/dist/essor-shared.js
24
24
  var isObject = (val) => val !== null && typeof val === "object";
@@ -989,17 +989,16 @@ function convertToHtmlTag(tag) {
989
989
  // src/template/patch.ts
990
990
  function patchChildren(parent, childrenMap, nextChildren, before) {
991
991
  const result = /* @__PURE__ */ new Map();
992
- const children = Array.from(childrenMap.values());
993
- const childrenLength = children.length;
992
+ const children = childrenMap.values();
994
993
  if (childrenMap.size > 0 && nextChildren.length === 0) {
995
- if (parent.childNodes.length === childrenLength + (before ? 1 : 0)) {
994
+ if (parent.childNodes.length === childrenMap.size + (before ? 1 : 0)) {
996
995
  parent.innerHTML = "";
997
996
  if (before) {
998
997
  insertChild(parent, before);
999
998
  }
1000
999
  } else {
1001
1000
  const range = document.createRange();
1002
- const child = children[0];
1001
+ const child = children.next().value;
1003
1002
  const start = isJsxElement(child) ? child.firstChild : child;
1004
1003
  range.setStartBefore(start);
1005
1004
  if (before) {
@@ -1009,7 +1008,7 @@ function patchChildren(parent, childrenMap, nextChildren, before) {
1009
1008
  }
1010
1009
  range.deleteContents();
1011
1010
  }
1012
- children.forEach((node) => {
1011
+ childrenMap.forEach((node) => {
1013
1012
  if (isJsxElement(node)) {
1014
1013
  node.unmount();
1015
1014
  }
@@ -1018,14 +1017,13 @@ function patchChildren(parent, childrenMap, nextChildren, before) {
1018
1017
  }
1019
1018
  const replaces = [];
1020
1019
  const nextChildrenMap = mapKeys(nextChildren);
1021
- let childIndex = 0;
1022
1020
  for (let [i, child] of nextChildren.entries()) {
1023
- let currChild = children[childIndex];
1021
+ let currChild = children.next().value;
1024
1022
  let currKey = getKey(currChild, i);
1025
1023
  while (currChild && !nextChildrenMap.has(currKey)) {
1026
1024
  removeChild(currChild);
1027
1025
  childrenMap.delete(currKey);
1028
- currChild = children[++childIndex];
1026
+ currChild = children.next().value;
1029
1027
  currKey = getKey(currChild, i);
1030
1028
  }
1031
1029
  const key = getKey(child, i);
@@ -1034,9 +1032,7 @@ function patchChildren(parent, childrenMap, nextChildren, before) {
1034
1032
  child = patch(parent, origChild, child);
1035
1033
  }
1036
1034
  if (currChild) {
1037
- if (currChild === origChild) {
1038
- childIndex++;
1039
- } else if (currChild) {
1035
+ if (currChild === origChild) ; else if (currChild) {
1040
1036
  const placeholder = document.createComment("");
1041
1037
  insertChild(parent, placeholder, currChild);
1042
1038
  replaces.push([placeholder, child]);
@@ -1082,7 +1078,7 @@ function mapKeys(children) {
1082
1078
  return result;
1083
1079
  }
1084
1080
  function getKey(node, index) {
1085
- const id = node instanceof Element ? node.id : void 0;
1081
+ const id = node == null ? void 0 : node.id;
1086
1082
  const result = id === "" ? void 0 : id;
1087
1083
  return result != null ? result : `_$${index}$`;
1088
1084
  }
@@ -16,7 +16,7 @@ var __spreadValues = (a, b) => {
16
16
  };
17
17
 
18
18
  // src/version.ts
19
- var __essor_version = "0.0.6";
19
+ var __essor_version = "0.0.7-beta.1";
20
20
 
21
21
  // ../shared/dist/essor-shared.js
22
22
  var isObject = (val) => val !== null && typeof val === "object";
@@ -987,17 +987,16 @@ function convertToHtmlTag(tag) {
987
987
  // src/template/patch.ts
988
988
  function patchChildren(parent, childrenMap, nextChildren, before) {
989
989
  const result = /* @__PURE__ */ new Map();
990
- const children = Array.from(childrenMap.values());
991
- const childrenLength = children.length;
990
+ const children = childrenMap.values();
992
991
  if (childrenMap.size > 0 && nextChildren.length === 0) {
993
- if (parent.childNodes.length === childrenLength + (before ? 1 : 0)) {
992
+ if (parent.childNodes.length === childrenMap.size + (before ? 1 : 0)) {
994
993
  parent.innerHTML = "";
995
994
  if (before) {
996
995
  insertChild(parent, before);
997
996
  }
998
997
  } else {
999
998
  const range = document.createRange();
1000
- const child = children[0];
999
+ const child = children.next().value;
1001
1000
  const start = isJsxElement(child) ? child.firstChild : child;
1002
1001
  range.setStartBefore(start);
1003
1002
  if (before) {
@@ -1007,7 +1006,7 @@ function patchChildren(parent, childrenMap, nextChildren, before) {
1007
1006
  }
1008
1007
  range.deleteContents();
1009
1008
  }
1010
- children.forEach((node) => {
1009
+ childrenMap.forEach((node) => {
1011
1010
  if (isJsxElement(node)) {
1012
1011
  node.unmount();
1013
1012
  }
@@ -1016,14 +1015,13 @@ function patchChildren(parent, childrenMap, nextChildren, before) {
1016
1015
  }
1017
1016
  const replaces = [];
1018
1017
  const nextChildrenMap = mapKeys(nextChildren);
1019
- let childIndex = 0;
1020
1018
  for (let [i, child] of nextChildren.entries()) {
1021
- let currChild = children[childIndex];
1019
+ let currChild = children.next().value;
1022
1020
  let currKey = getKey(currChild, i);
1023
1021
  while (currChild && !nextChildrenMap.has(currKey)) {
1024
1022
  removeChild(currChild);
1025
1023
  childrenMap.delete(currKey);
1026
- currChild = children[++childIndex];
1024
+ currChild = children.next().value;
1027
1025
  currKey = getKey(currChild, i);
1028
1026
  }
1029
1027
  const key = getKey(child, i);
@@ -1032,9 +1030,7 @@ function patchChildren(parent, childrenMap, nextChildren, before) {
1032
1030
  child = patch(parent, origChild, child);
1033
1031
  }
1034
1032
  if (currChild) {
1035
- if (currChild === origChild) {
1036
- childIndex++;
1037
- } else if (currChild) {
1033
+ if (currChild === origChild) ; else if (currChild) {
1038
1034
  const placeholder = document.createComment("");
1039
1035
  insertChild(parent, placeholder, currChild);
1040
1036
  replaces.push([placeholder, child]);
@@ -1080,7 +1076,7 @@ function mapKeys(children) {
1080
1076
  return result;
1081
1077
  }
1082
1078
  function getKey(node, index) {
1083
- const id = node instanceof Element ? node.id : void 0;
1079
+ const id = node == null ? void 0 : node.id;
1084
1080
  const result = id === "" ? void 0 : id;
1085
1081
  return result != null ? result : `_$${index}$`;
1086
1082
  }
package/dist/essor.esm.js CHANGED
@@ -1,6 +1,6 @@
1
- var je=Object.defineProperty;var me=Object.getOwnPropertySymbols;var Re=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable;var he=(e,t,n)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t)=>{for(var n in t||(t={}))Re.call(t,n)&&he(e,n,t[n]);if(me)for(var n of me(t))_e.call(t,n)&&he(e,n,t[n]);return e};var ge="0.0.6";var C=e=>e!==null&&typeof e=="object";var M=Array.isArray;function U(e){return typeof e=="string"}function Le(e){return e===null}function ye(e){return e==null}var d=e=>typeof e=="function";function Z(e){return e===!1||e===null||e===void 0||e===""}var A=e=>["string","number","boolean","symbol","undefined"].includes(typeof e)||Le(e),Q=e=>e instanceof HTMLElement||e instanceof SVGElement;function Y(e){return Array.isArray(e)?e.flat():[e]}var J=(e,t)=>e!==t&&(e===e||t===t),Te=Function.prototype;function y(e,t){return U(e)?e.indexOf(t)===0:!1}function w(e,t=new WeakMap){if(e===null||typeof e!="object")return e;if(t.has(e))return t.get(e);if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(e instanceof Map){let s=new Map;return t.set(e,s),e.forEach((o,i)=>{s.set(w(i,t),w(o,t));}),s}if(e instanceof Set){let s=new Set;return t.set(e,s),e.forEach(o=>{s.add(w(o,t));}),s}let n=Array.isArray(e)?[]:{};t.set(e,n);let r=Object.keys(e);for(let s of r)n[s]=w(e[s],t);return n}function _(e,t,n=new WeakMap){if(A(e)&&A(t))return e===t;if(e===t)return !0;if(e==null||t==null||typeof e!="object"||typeof t!="object"||e.constructor!==t.constructor)return !1;if(n.has(e))return n.get(e)===t;if(n.set(e,t),Array.isArray(e)){if(e.length!==t.length)return !1;for(let[o,i]of e.entries())if(!_(i,t[o],n))return !1;return !0}if(e instanceof Map){if(e.size!==t.size)return !1;for(let[o,i]of e)if(!t.has(o)||!_(i,t.get(o),n))return !1;return !0}if(e instanceof Set){if(e.size!==t.size)return !1;let o=Array.from(e).sort(),i=Array.from(t).sort();for(let[a,c]of o.entries())if(!_(c,i[a],n))return !1;return !0}let r=Object.keys(e),s=new Set(Object.keys(t));if(r.length!==s.size)return !1;for(let o of r)if(!s.has(o)||!_(e[o],t[o],n))return !1;return !0}function I(e,t){return Array.isArray(t)?t.includes(e):d(t)?t(e):!1}var be=e=>e.replaceAll(/[A-Z]+/g,(t,n)=>`${n>0?"-":""}${t.toLocaleLowerCase()}`);var ve=e=>e.charAt(0).toUpperCase()+e.slice(1);var N=null,L=null,te=new WeakMap,ne=new WeakMap,re=new Set,ee=new WeakMap,We=["push","pop","shift","unshift","splice","sort","reverse"];function W(e,t){if(!N&&!L)return;let n=ne.get(e);n||(n=new Map,ne.set(e,n));let r=n.get(t);r||(r=new Set,n.set(t,r)),N&&r.add(N);let s=te.get(e);s||(s=new Map,te.set(e,s));let o=s.get(t);o||(o=new Set,s.set(t,o)),L&&o.add(L);}function F(e,t){let n=ne.get(e);if(!n)return;let r=n.get(t);r&&r.forEach(o=>re.has(o)&&o());let s=te.get(e);if(s){let o=s.get(t);o&&o.forEach(i=>i.run());}}var G=class{constructor(t){this._value=t;}valueOf(){return W(this,"value"),this.__triggerObject(),this._value}toString(){return W(this,"value"),this.__triggerObject(),String(this._value)}toJSON(){return this._value}get value(){return W(this,"value"),this.__triggerObject(),this._value}__triggerObject(){!A(this._value)&&!Q(this._value)&&O(this._value);}set value(t){p(t)&&(console.warn("Signal cannot be set to another signal, use .peek() instead"),t=t.peek()),J(t,this._value)&&(this._value=t,!A(this._value)&&!Q(this._value)&&this.__triggerObject(),F(this,"value"));}peek(){return this._value}update(){F(this,"value");}};function P(e){return p(e)?e:new G(e)}function p(e){return e instanceof G}var X=class{constructor(t){this.fn=t;this._deps=new Set;let n=L;L=this,this._value=this.fn(),L=n;}peek(){return this._value}run(){let t=this.fn();J(t,this._value)&&(this._value=t,this._deps.forEach(n=>n()));}get value(){return N&&this._deps.add(N),W(this,"_value"),this._value}};function oe(e){return new X(e)}function z(e){return e instanceof X}function S(e){function t(){let n=N;N=t,e(),N=n;}return re.add(t),t(),()=>{re.delete(t),N=null;}}function se(e,t){return Object.entries(e).reduce((r,[s,o])=>(r[s]=I(s,t)||p(o)?o:P(o),r),{})}function xe(e,t){return e?p(e)?e.peek():M(e)?e.map(n=>xe(n,t)):C(e)?Object.entries(e).reduce((n,[r,s])=>(I(r,t)?n[r]=s:n[r]=p(s)?s.peek():s,n),{}):e:{}}var Ne=Symbol("useReactive");function H(e){return e&&e[Ne]===!0}function Pe(e){return H(e)?k({},e):e}function O(e,t){if(!C(e)||H(e))return e;if(ee.has(e))return ee.get(e);Array.isArray(e)&&We.forEach(s=>{let o=e[s];W(e,"length"),Object.defineProperties(e,{[s]:{value(...i){let a=o.apply(this,i);return F(e,"length"),a},enumerable:!1,configurable:!0,writable:!0}});});let n={get(s,o,i){if(o===Ne||y(o,"_"))return !0;let a=Reflect.get(s,o,i),c=p(a)?a.value:a;return I(o,t)?c:(W(s,o),C(c)?O(c):c)},set(s,o,i,a){if(I(o,t))return Reflect.set(s,o,i,a),!0;let c=Reflect.get(s,o,a);p(c)&&(c=c.value),p(i)&&(i=i.value);let f=Reflect.set(s,o,i,a);return J(i,c)&&F(s,o),f},deleteProperty(s,o){let i=Reflect.get(s,o),a=Reflect.deleteProperty(s,o);return i!==void 0&&F(s,o),a}},r=new Proxy(e,n);return ee.set(e,r),r}function ie(e,...t){console.warn.apply(console,[`[Essor warn]: ${e}`].concat(t));}function He(e,t,n){return $e(e,t,n)}function $e(e,t,n){let r,s=n==null?void 0:n.deep;if(p(e)||z(e)?r=()=>e.value:H(e)?r=()=>k({},e):M(e)?r=()=>e.map(c=>p(c)||z(c)?c.value:H(c)?k({},c):d(c)?c():ie("Invalid source",c)):d(e)?r=e:(ie("Invalid source type",e),r=Te),t&&s){let c=r;r=()=>$(c());}let o,i=()=>{let c=w(r());_(c,o)||(t&&t(c,o),o=A(c)?c:w(c));},a=S(i);return n!=null&&n.immediate&&i(),a}function $(e,t=new Set){return !C(e)||t.has(e)||(t.add(e),M(e)?e.forEach(n=>$(n,t)):e instanceof Map?e.forEach((n,r)=>{$(r,t),$(n,t);}):e instanceof Set?e.forEach(n=>$(n,t)):Object.keys(e).forEach(n=>{$(e[n],t);})),e}var B=0,ae=new Map;function Ke(e){let{state:t,getters:n,actions:r}=e,s=k({},t!=null?t:{}),o=O(t!=null?t:{}),i=[],a=[],f=k({state:o},{patch$(u){Object.assign(o,u),i.forEach(l=>l(o)),a.forEach(l=>l(o));},subscribe$(u){i.push(u);},unsubscribe$(u){let l=i.indexOf(u);l!==-1&&i.splice(l,1);},onAction$(u){a.push(u);},reset$(){Object.assign(o,s);}});for(let u in n){let l=n[u];l&&(f[u]=oe(l.bind(o,o)));}for(let u in r){let l=r[u];l&&(f[u]=l.bind(o));}return ae.set(B,f),++B,f}function Ie(e){return function(){return ae.has(B)?ae.get(B):Ke(e)}}var E=class E{constructor(t,n,r){this.template=t;this.props=n;this.key=r;this.proxyProps={};this.context={};this.emitter=new Set;this.mounted=!1;this.rootNode=null;this.hooks={mounted:new Set,destroy:new Set};this.trackMap=new Map;this.proxyProps=se(n,s=>y(s,"on")||y(s,"update"));}addEventListener(){}removeEventListener(){}get firstChild(){var t,n;return (n=(t=this.rootNode)==null?void 0:t.firstChild)!=null?n:null}get isConnected(){var t,n;return (n=(t=this.rootNode)==null?void 0:t.isConnected)!=null?n:!1}addHook(t,n){var r;(r=this.hooks[t])==null||r.add(n);}getContext(t){return E.context[t]}setContext(t,n){E.context[t]=n;}inheritNode(t){this.context=t.context,this.hooks=t.hooks,Object.assign(this.proxyProps,t.proxyProps),this.rootNode=t.rootNode,this.trackMap=t.trackMap;let n=this.props;this.props=t.props,this.patchProps(n);}unmount(){var t;this.hooks.destroy.forEach(n=>n()),Object.values(this.hooks).forEach(n=>n.clear()),(t=this.rootNode)==null||t.unmount(),this.rootNode=null,this.proxyProps={},this.mounted=!1,this.emitter.forEach(n=>n()),E.context={};}mount(t,n){var s,o,i,a;if(!d(this.template))throw new Error("Template must be a function");if(this.isConnected)return (o=(s=this.rootNode)==null?void 0:s.mount(t,n))!=null?o:[];E.ref=this,this.rootNode=this.template(O(this.proxyProps,["children"])),E.ref=null,this.mounted=!0;let r=(a=(i=this.rootNode)==null?void 0:i.mount(t,n))!=null?a:[];return this.hooks.mounted.forEach(c=>c()),this.patchProps(this.props),r}getNodeTrack(t,n){let r=this.trackMap.get(t);return r||(r={cleanup:()=>{}},this.trackMap.set(t,r)),n||r.cleanup(),r}patchProps(t){var n,r,s,o,i;for(let[a,c]of Object.entries(t))if(y(a,"on")&&((n=this.rootNode)!=null&&n.nodes)){let f=a.slice(2).toLowerCase(),u=c,l=b(this.rootNode.nodes[0],f,u);this.emitter.add(l);}else if(a==="ref")p(c)?t[a].value=(r=this.rootNode)==null?void 0:r.nodes[0]:d(c)&&t[a]((s=this.rootNode)==null?void 0:s.nodes[0]);else if(y(a,"update"))t[a]=p(c)?c.value:c;else {let f=(i=(o=this.proxyProps)[a])!=null?i:o[a]=P(c),u=this.getNodeTrack(a);u.cleanup=S(()=>{f.value=d(c)?c():c;});}this.props=t;}};E.ref=null,E.context={};var T=E;function Fe(e,t,n){return U(e)&&(Ee(e)&&(e=ke(e),t={1:t}),e=Se(e)),d(e)?new T(e,t,n):new K(e,t,n)}function v(e){return e instanceof T||e instanceof K}function Se(e){let t=document.createElement("template");return t.innerHTML=e,t}function Je(e){return e.children}function ce(e){if(v(e)||e instanceof Node)return e;let t=Z(e)?"":String(e);return document.createTextNode(t)}function x(e,t,n=null){let r=v(n)?n.firstChild:n;v(t)?t.mount(e,r):r?r.before(t):e.append(t);}function j(e){v(e)?e.unmount():e.parentNode&&e.remove();}function ue(e,t,n){x(e,t,n),j(n);}function le(e,t,n){if(t==="class"){typeof n=="string"?e.className=n:Array.isArray(n)?e.className=n.join(" "):n&&typeof n=="object"&&(e.className=Object.entries(n).reduce((r,[s,o])=>r+(o?` ${s}`:""),"").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(s=>{e.style.setProperty(be(s),String(r[s]));});}return}Z(n)?e.removeAttribute(t):n===!0?e.setAttribute(t,""):e.setAttribute(t,String(n));}function Me(e,t){if(e instanceof HTMLInputElement){if(e.type==="checkbox")return b(e,"change",()=>{t(!!e.checked);});if(e.type==="date")return b(e,"change",()=>{t(e.value?e.value:"");});if(e.type==="file")return b(e,"change",()=>{e.files&&t(e.files);});if(e.type==="number")return b(e,"input",()=>{let n=Number.parseFloat(e.value);t(Number.isNaN(n)?"":String(n));});if(e.type==="radio")return b(e,"change",()=>{t(e.checked?e.value:"");});if(e.type==="text")return b(e,"input",()=>{t(e.value);})}if(e instanceof HTMLSelectElement)return b(e,"change",()=>{t(e.value);});if(e instanceof HTMLTextAreaElement)return b(e,"input",()=>{t(e.value);})}var Ce=Promise.resolve();function Ge(e){return e?Ce.then(e):Ce}function b(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}var Xe=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],ze=["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"];function Ee(e){return ze.includes(e)}function ke(e){return Xe.includes(e)?`<${e}/>`:`<${e}></${e}>`}function we(e,t,n,r){let s=new Map,o=Array.from(t.values()),i=o.length;if(t.size>0&&n.length===0){if(e.childNodes.length===i+(r?1:0))e.innerHTML="",r&&x(e,r);else {let u=document.createRange(),l=o[0],m=v(l)?l.firstChild:l;u.setStartBefore(m),r?u.setEndBefore(r):u.setEndAfter(e),u.deleteContents();}return o.forEach(u=>{v(u)&&u.unmount();}),s}let a=[],c=De(n),f=0;for(let[u,l]of n.entries()){let m=o[f],R=D(m,u);for(;m&&!c.has(R);)j(m),t.delete(R),m=o[++f],R=D(m,u);let pe=D(l,u),q=t.get(pe);if(q&&(l=Be(e,q,l)),m)if(m===q)f++;else if(m){let de=document.createComment("");x(e,de,m),a.push([de,l]);}else x(e,l,r);else x(e,l,r);s.set(pe,l);}return a.forEach(([u,l])=>ue(e,l,u)),t.forEach((u,l)=>{u.isConnected&&!s.has(l)&&j(u);}),s}function Be(e,t,n){return t===n?t:v(t)&&v(n)&&t.template===n.template?(n.inheritNode(t),n):t instanceof Text&&n instanceof Text?(t.textContent!==n.textContent&&(t.textContent=n.textContent),t):(ue(e,n,t),n)}function De(e){let t=new Map;for(let[n,r]of e.entries()){let s=D(r,n);t.set(s,r);}return t}function D(e,t){let n=e instanceof Element?e.id:void 0,r=n===""?void 0:n;return r!=null?r:`_$${t}$`}var K=class e{constructor(t,n,r){this.template=t;this.props=n;this.key=r;this.treeMap=new Map;this.mounted=!1;this.nodes=[];this.provides={};this.trackMap=new Map;this.parent=null;}get firstChild(){var t;return (t=this.nodes[0])!=null?t:null}get isConnected(){return this.mounted}addEventListener(){}removeEventListener(){}unmount(){this.trackMap.forEach(t=>{var n,r;(n=t.cleanup)==null||n.call(t),(r=t.lastNodes)==null||r.forEach(s=>{t.isRoot?j(s):s instanceof e&&s.unmount();});}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(t=>j(t)),this.nodes=[],this.mounted=!1;}mount(t,n){var o;if(this.parent=t,this.isConnected)return this.nodes.forEach(i=>x(t,i,n)),this.nodes;let r=this.template.content.cloneNode(!0),s=r.firstChild;return (o=s==null?void 0:s.hasAttribute)!=null&&o.call(s,"_svg_")&&(s.remove(),s==null||s.childNodes.forEach(i=>{r.append(i);})),this.nodes=Array.from(r.childNodes),this.mapNodeTree(t,r),x(t,r,n),this.patchNodes(this.props),this.mounted=!0,this.nodes}mapNodeTree(t,n){let r=1;this.treeMap.set(0,t);let s=o=>{o.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(r++,o);let i=o.firstChild;for(;i;)s(i),i=i.nextSibling;};s(n);}patchNodes(t){for(let n in t){let r=Number(n),s=this.treeMap.get(r);if(s){let o=this.props[n];this.patchNode(n,s,o,r===0);}}this.props=t;}getNodeTrack(t,n,r){var o;let s=this.trackMap.get(t);return s||(s={cleanup:()=>{}},n&&(s.lastNodes=new Map),r&&(s.isRoot=!0),this.trackMap.set(t,s)),(o=s.cleanup)==null||o.call(s),s}inheritNode(t){this.mounted=t.mounted,this.nodes=t.nodes,this.trackMap=t.trackMap,this.treeMap=t.treeMap;let n=this.props;this.props=t.props,this.patchNodes(n);}patchNode(t,n,r,s){for(let o in r)if(o==="children"&&r.children)if(M(r.children))r.children.filter(Boolean).forEach((i,a)=>{var R;let[c,f]=M(i)?i:[i,null],u=ye(f)?null:(R=this.treeMap.get(f))!=null?R:null,l=`${t}:${o}:${a}`,m=this.getNodeTrack(l,!0,s);Oe(m,n,c,u);});else {let i=`${t}:${o}:0`,a=this.getNodeTrack(i,!0,s);Oe(a,n,r.children,null);}else if(o==="ref")p(r[o])?r[o].value=n:d(r[o])&&r[o](n);else if(y(o,"on")){let i=o.slice(2).toLocaleLowerCase(),a=this.getNodeTrack(`${t}:${o}`),c=r[o];a.cleanup=b(n,i,c);}else if(!y(o,"update")){let i=this.getNodeTrack(`${t}:${o}`),a=r[o],c=p(a)?a:P(a);Ae(i,n,o,c.value);let f=S(()=>{c.value=p(a)?a.value:a,Ae(i,n,o,c.value);}),u,l=`update${ve(o)}`;r[l]&&(u=Me(n,m=>{r[l](m);})),i.cleanup=()=>{f&&f(),u&&u();};}}};function Ae(e,t,n,r){let s=t;s.setAttribute&&(d(r)?e.cleanup=S(()=>{le(s,n,r());}):le(s,n,r));}function Oe(e,t,n,r){d(n)?e.cleanup=S(()=>{let s=Y(n()).map(ce);e.lastNodes=we(t,e.lastNodes,s,r);}):Y(n).forEach((s,o)=>{let i=ce(s);e.lastNodes.set(String(o),i),x(t,i,r);});}function Ve(e){var t;V("onMounted"),(t=T.ref)==null||t.addHook("mounted",e);}function qe(e){var t;V("onDestroy"),(t=T.ref)==null||t.addHook("destroy",e);}function V(e){T.ref||console.error(`"${e}" can only be called within the component function body
2
- and cannot be used in asynchronous or deferred calls.`);}function Ue(e,t){var n;V("useProvide"),(n=T.ref)==null||n.setContext(e,t);}function Ze(e,t){var n;return V("useInject"),((n=T.ref)==null?void 0:n.getContext(e))||t}function Qe(){let e=null;return new Proxy({},{get(t,n){return n==="__is_ref"?!0:e},set(t,n,r){return e=r,!0}})}function Ye(e){return Object.entries(e).map(([t,n])=>`${t}=${JSON.stringify(escape(String(n)))}`).join(" ")}function fe(e,t){if(d(e))return e(t);let n=Array.isArray(e)?e.reduce((o,i,a)=>(o[a+1]={template:i},o),{}):e,r={},s={};if(C(n))for(let[o,i]of Object.entries(n)){let a=t[o];if(a){for(let c in a)y(c,"on")&&d(a[c])&&delete a[c];if(a.children){for(let[c,f]of a.children)r[f]||(r[f]=[]),r[f].push(c);delete a.children;}}s[o]={template:i.template,prop:a};}return Object.entries(s).map(([o,{template:i,prop:a}])=>{let c=i;return a&&(c+=` ${Ye(a)}`),r[o]&&(c+=r[o].map(f=>fe(f,a)).join("")),c}).join("")}function mn(e,t){return fe(e,t)}function hn(e,t,n={}){t.innerHTML=fe(e,n);}globalThis&&(globalThis.__essor_version=ge);
1
+ var Ae=Object.defineProperty;var pe=Object.getOwnPropertySymbols;var Oe=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var de=(e,t,n)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t)=>{for(var n in t||(t={}))Oe.call(t,n)&&de(e,n,t[n]);if(pe)for(var n of pe(t))je.call(t,n)&&de(e,n,t[n]);return e};var me="0.0.7-beta.1";var k=e=>e!==null&&typeof e=="object";var C=Array.isArray;function q(e){return typeof e=="string"}function Re(e){return e===null}function he(e){return e==null}var d=e=>typeof e=="function";function U(e){return e===!1||e===null||e===void 0||e===""}var w=e=>["string","number","boolean","symbol","undefined"].includes(typeof e)||Re(e),Z=e=>e instanceof HTMLElement||e instanceof SVGElement;function Q(e){return Array.isArray(e)?e.flat():[e]}var J=(e,t)=>e!==t&&(e===e||t===t),ge=Function.prototype;function g(e,t){return q(e)?e.indexOf(t)===0:!1}function M(e,t=new WeakMap){if(e===null||typeof e!="object")return e;if(t.has(e))return t.get(e);if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(e instanceof Map){let o=new Map;return t.set(e,o),e.forEach((s,a)=>{o.set(M(a,t),M(s,t));}),o}if(e instanceof Set){let o=new Set;return t.set(e,o),e.forEach(s=>{o.add(M(s,t));}),o}let n=Array.isArray(e)?[]:{};t.set(e,n);let r=Object.keys(e);for(let o of r)n[o]=M(e[o],t);return n}function _(e,t,n=new WeakMap){if(w(e)&&w(t))return e===t;if(e===t)return !0;if(e==null||t==null||typeof e!="object"||typeof t!="object"||e.constructor!==t.constructor)return !1;if(n.has(e))return n.get(e)===t;if(n.set(e,t),Array.isArray(e)){if(e.length!==t.length)return !1;for(let[s,a]of e.entries())if(!_(a,t[s],n))return !1;return !0}if(e instanceof Map){if(e.size!==t.size)return !1;for(let[s,a]of e)if(!t.has(s)||!_(a,t.get(s),n))return !1;return !0}if(e instanceof Set){if(e.size!==t.size)return !1;let s=Array.from(e).sort(),a=Array.from(t).sort();for(let[c,i]of s.entries())if(!_(i,a[c],n))return !1;return !0}let r=Object.keys(e),o=new Set(Object.keys(t));if(r.length!==o.size)return !1;for(let s of r)if(!o.has(s)||!_(e[s],t[s],n))return !1;return !0}function I(e,t){return Array.isArray(t)?t.includes(e):d(t)?t(e):!1}var ye=e=>e.replaceAll(/[A-Z]+/g,(t,n)=>`${n>0?"-":""}${t.toLocaleLowerCase()}`);var Te=e=>e.charAt(0).toUpperCase()+e.slice(1);var x=null,W=null,ee=new WeakMap,te=new WeakMap,ne=new Set,Y=new WeakMap,_e=["push","pop","shift","unshift","splice","sort","reverse"];function L(e,t){if(!x&&!W)return;let n=te.get(e);n||(n=new Map,te.set(e,n));let r=n.get(t);r||(r=new Set,n.set(t,r)),x&&r.add(x);let o=ee.get(e);o||(o=new Map,ee.set(e,o));let s=o.get(t);s||(s=new Set,o.set(t,s)),W&&s.add(W);}function F(e,t){let n=te.get(e);if(!n)return;let r=n.get(t);r&&r.forEach(s=>ne.has(s)&&s());let o=ee.get(e);if(o){let s=o.get(t);s&&s.forEach(a=>a.run());}}var G=class{constructor(t){this._value=t;}valueOf(){return L(this,"value"),this.__triggerObject(),this._value}toString(){return L(this,"value"),this.__triggerObject(),String(this._value)}toJSON(){return this._value}get value(){return L(this,"value"),this.__triggerObject(),this._value}__triggerObject(){!w(this._value)&&!Z(this._value)&&A(this._value);}set value(t){p(t)&&(console.warn("Signal cannot be set to another signal, use .peek() instead"),t=t.peek()),J(t,this._value)&&(this._value=t,!w(this._value)&&!Z(this._value)&&this.__triggerObject(),F(this,"value"));}peek(){return this._value}update(){F(this,"value");}};function P(e){return p(e)?e:new G(e)}function p(e){return e instanceof G}var z=class{constructor(t){this.fn=t;this._deps=new Set;let n=W;W=this,this._value=this.fn(),W=n;}peek(){return this._value}run(){let t=this.fn();J(t,this._value)&&(this._value=t,this._deps.forEach(n=>n()));}get value(){return x&&this._deps.add(x),L(this,"_value"),this._value}};function re(e){return new z(e)}function X(e){return e instanceof z}function N(e){function t(){let n=x;x=t,e(),x=n;}return ne.add(t),t(),()=>{ne.delete(t),x=null;}}function oe(e,t){return Object.entries(e).reduce((r,[o,s])=>(r[o]=I(o,t)||p(s)?s:P(s),r),{})}function be(e,t){return e?p(e)?e.peek():C(e)?e.map(n=>be(n,t)):k(e)?Object.entries(e).reduce((n,[r,o])=>(I(r,t)?n[r]=o:n[r]=p(o)?o.peek():o,n),{}):e:{}}var ve=Symbol("useReactive");function H(e){return e&&e[ve]===!0}function We(e){return H(e)?E({},e):e}function A(e,t){if(!k(e)||H(e))return e;if(Y.has(e))return Y.get(e);Array.isArray(e)&&_e.forEach(o=>{let s=e[o];L(e,"length"),Object.defineProperties(e,{[o]:{value(...a){let c=s.apply(this,a);return F(e,"length"),c},enumerable:!1,configurable:!0,writable:!0}});});let n={get(o,s,a){if(s===ve||g(s,"_"))return !0;let c=Reflect.get(o,s,a),i=p(c)?c.value:c;return I(s,t)?i:(L(o,s),k(i)?A(i):i)},set(o,s,a,c){if(I(s,t))return Reflect.set(o,s,a,c),!0;let i=Reflect.get(o,s,c);p(i)&&(i=i.value),p(a)&&(a=a.value);let u=Reflect.set(o,s,a,c);return J(a,i)&&F(o,s),u},deleteProperty(o,s){let a=Reflect.get(o,s),c=Reflect.deleteProperty(o,s);return a!==void 0&&F(o,s),c}},r=new Proxy(e,n);return Y.set(e,r),r}function se(e,...t){console.warn.apply(console,[`[Essor warn]: ${e}`].concat(t));}function Le(e,t,n){return Pe(e,t,n)}function Pe(e,t,n){let r,o=n==null?void 0:n.deep;if(p(e)||X(e)?r=()=>e.value:H(e)?r=()=>E({},e):C(e)?r=()=>e.map(i=>p(i)||X(i)?i.value:H(i)?E({},i):d(i)?i():se("Invalid source",i)):d(e)?r=e:(se("Invalid source type",e),r=ge),t&&o){let i=r;r=()=>$(i());}let s,a=()=>{let i=M(r());_(i,s)||(t&&t(i,s),s=w(i)?i:M(i));},c=N(a);return n!=null&&n.immediate&&a(),c}function $(e,t=new Set){return !k(e)||t.has(e)||(t.add(e),C(e)?e.forEach(n=>$(n,t)):e instanceof Map?e.forEach((n,r)=>{$(r,t),$(n,t);}):e instanceof Set?e.forEach(n=>$(n,t)):Object.keys(e).forEach(n=>{$(e[n],t);})),e}var B=0,ie=new Map;function He(e){let{state:t,getters:n,actions:r}=e,o=E({},t!=null?t:{}),s=A(t!=null?t:{}),a=[],c=[],u=E({state:s},{patch$(l){Object.assign(s,l),a.forEach(f=>f(s)),c.forEach(f=>f(s));},subscribe$(l){a.push(l);},unsubscribe$(l){let f=a.indexOf(l);f!==-1&&a.splice(f,1);},onAction$(l){c.push(l);},reset$(){Object.assign(s,o);}});for(let l in n){let f=n[l];f&&(u[l]=re(f.bind(s,s)));}for(let l in r){let f=r[l];f&&(u[l]=f.bind(s));}return ie.set(B,u),++B,u}function $e(e){return function(){return ie.has(B)?ie.get(B):He(e)}}var S=class S{constructor(t,n,r){this.template=t;this.props=n;this.key=r;this.proxyProps={};this.context={};this.emitter=new Set;this.mounted=!1;this.rootNode=null;this.hooks={mounted:new Set,destroy:new Set};this.trackMap=new Map;this.proxyProps=oe(n,o=>g(o,"on")||g(o,"update"));}addEventListener(){}removeEventListener(){}get firstChild(){var t,n;return (n=(t=this.rootNode)==null?void 0:t.firstChild)!=null?n:null}get isConnected(){var t,n;return (n=(t=this.rootNode)==null?void 0:t.isConnected)!=null?n:!1}addHook(t,n){var r;(r=this.hooks[t])==null||r.add(n);}getContext(t){return S.context[t]}setContext(t,n){S.context[t]=n;}inheritNode(t){this.context=t.context,this.hooks=t.hooks,Object.assign(this.proxyProps,t.proxyProps),this.rootNode=t.rootNode,this.trackMap=t.trackMap;let n=this.props;this.props=t.props,this.patchProps(n);}unmount(){var t;this.hooks.destroy.forEach(n=>n()),Object.values(this.hooks).forEach(n=>n.clear()),(t=this.rootNode)==null||t.unmount(),this.rootNode=null,this.proxyProps={},this.mounted=!1,this.emitter.forEach(n=>n()),S.context={};}mount(t,n){var o,s,a,c;if(!d(this.template))throw new Error("Template must be a function");if(this.isConnected)return (s=(o=this.rootNode)==null?void 0:o.mount(t,n))!=null?s:[];S.ref=this,this.rootNode=this.template(A(this.proxyProps,["children"])),S.ref=null,this.mounted=!0;let r=(c=(a=this.rootNode)==null?void 0:a.mount(t,n))!=null?c:[];return this.hooks.mounted.forEach(i=>i()),this.patchProps(this.props),r}getNodeTrack(t,n){let r=this.trackMap.get(t);return r||(r={cleanup:()=>{}},this.trackMap.set(t,r)),n||r.cleanup(),r}patchProps(t){var n,r,o,s,a;for(let[c,i]of Object.entries(t))if(g(c,"on")&&((n=this.rootNode)!=null&&n.nodes)){let u=c.slice(2).toLowerCase(),l=i,f=T(this.rootNode.nodes[0],u,l);this.emitter.add(f);}else if(c==="ref")p(i)?t[c].value=(r=this.rootNode)==null?void 0:r.nodes[0]:d(i)&&t[c]((o=this.rootNode)==null?void 0:o.nodes[0]);else if(g(c,"update"))t[c]=p(i)?i.value:i;else {let u=(a=(s=this.proxyProps)[c])!=null?a:s[c]=P(i),l=this.getNodeTrack(c);l.cleanup=N(()=>{u.value=d(i)?i():i;});}this.props=t;}};S.ref=null,S.context={};var y=S;function Ke(e,t,n){return q(e)&&(Ne(e)&&(e=Se(e),t={1:t}),e=xe(e)),d(e)?new y(e,t,n):new K(e,t,n)}function b(e){return e instanceof y||e instanceof K}function xe(e){let t=document.createElement("template");return t.innerHTML=e,t}function Ie(e){return e.children}function ae(e){if(b(e)||e instanceof Node)return e;let t=U(e)?"":String(e);return document.createTextNode(t)}function v(e,t,n=null){let r=b(n)?n.firstChild:n;b(t)?t.mount(e,r):r?r.before(t):e.append(t);}function O(e){b(e)?e.unmount():e.parentNode&&e.remove();}function ce(e,t,n){v(e,t,n),O(n);}function ue(e,t,n){if(t==="class"){typeof n=="string"?e.className=n:Array.isArray(n)?e.className=n.join(" "):n&&typeof n=="object"&&(e.className=Object.entries(n).reduce((r,[o,s])=>r+(s?` ${o}`:""),"").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(o=>{e.style.setProperty(ye(o),String(r[o]));});}return}U(n)?e.removeAttribute(t):n===!0?e.setAttribute(t,""):e.setAttribute(t,String(n));}function ke(e,t){if(e instanceof HTMLInputElement){if(e.type==="checkbox")return T(e,"change",()=>{t(!!e.checked);});if(e.type==="date")return T(e,"change",()=>{t(e.value?e.value:"");});if(e.type==="file")return T(e,"change",()=>{e.files&&t(e.files);});if(e.type==="number")return T(e,"input",()=>{let n=Number.parseFloat(e.value);t(Number.isNaN(n)?"":String(n));});if(e.type==="radio")return T(e,"change",()=>{t(e.checked?e.value:"");});if(e.type==="text")return T(e,"input",()=>{t(e.value);})}if(e instanceof HTMLSelectElement)return T(e,"change",()=>{t(e.value);});if(e instanceof HTMLTextAreaElement)return T(e,"input",()=>{t(e.value);})}var Ee=Promise.resolve();function Fe(e){return e?Ee.then(e):Ee}function T(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}var Je=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Ge=["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"];function Ne(e){return Ge.includes(e)}function Se(e){return Je.includes(e)?`<${e}/>`:`<${e}></${e}>`}function Ce(e,t,n,r){let o=new Map,s=t.values();if(t.size>0&&n.length===0){if(e.childNodes.length===t.size+(r?1:0))e.innerHTML="",r&&v(e,r);else {let i=document.createRange(),u=s.next().value,l=b(u)?u.firstChild:u;i.setStartBefore(l),r?i.setEndBefore(r):i.setEndAfter(e),i.deleteContents();}return t.forEach(i=>{b(i)&&i.unmount();}),o}let a=[],c=Xe(n);for(let[i,u]of n.entries()){let l=s.next().value,f=D(l,i);for(;l&&!c.has(f);)O(l),t.delete(f),l=s.next().value,f=D(l,i);let j=D(u,i),R=t.get(j);if(R&&(u=ze(e,R,u)),l){if(l!==R)if(l){let fe=document.createComment("");v(e,fe,l),a.push([fe,u]);}else v(e,u,r);}else v(e,u,r);o.set(j,u);}return a.forEach(([i,u])=>ce(e,u,i)),t.forEach((i,u)=>{i.isConnected&&!o.has(u)&&O(i);}),o}function ze(e,t,n){return t===n?t:b(t)&&b(n)&&t.template===n.template?(n.inheritNode(t),n):t instanceof Text&&n instanceof Text?(t.textContent!==n.textContent&&(t.textContent=n.textContent),t):(ce(e,n,t),n)}function Xe(e){let t=new Map;for(let[n,r]of e.entries()){let o=D(r,n);t.set(o,r);}return t}function D(e,t){let n=e==null?void 0:e.id,r=n===""?void 0:n;return r!=null?r:`_$${t}$`}var K=class e{constructor(t,n,r){this.template=t;this.props=n;this.key=r;this.treeMap=new Map;this.mounted=!1;this.nodes=[];this.provides={};this.trackMap=new Map;this.parent=null;}get firstChild(){var t;return (t=this.nodes[0])!=null?t:null}get isConnected(){return this.mounted}addEventListener(){}removeEventListener(){}unmount(){this.trackMap.forEach(t=>{var n,r;(n=t.cleanup)==null||n.call(t),(r=t.lastNodes)==null||r.forEach(o=>{t.isRoot?O(o):o instanceof e&&o.unmount();});}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(t=>O(t)),this.nodes=[],this.mounted=!1;}mount(t,n){var s;if(this.parent=t,this.isConnected)return this.nodes.forEach(a=>v(t,a,n)),this.nodes;let r=this.template.content.cloneNode(!0),o=r.firstChild;return (s=o==null?void 0:o.hasAttribute)!=null&&s.call(o,"_svg_")&&(o.remove(),o==null||o.childNodes.forEach(a=>{r.append(a);})),this.nodes=Array.from(r.childNodes),this.mapNodeTree(t,r),v(t,r,n),this.patchNodes(this.props),this.mounted=!0,this.nodes}mapNodeTree(t,n){let r=1;this.treeMap.set(0,t);let o=s=>{s.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(r++,s);let a=s.firstChild;for(;a;)o(a),a=a.nextSibling;};o(n);}patchNodes(t){for(let n in t){let r=Number(n),o=this.treeMap.get(r);if(o){let s=this.props[n];this.patchNode(n,o,s,r===0);}}this.props=t;}getNodeTrack(t,n,r){var s;let o=this.trackMap.get(t);return o||(o={cleanup:()=>{}},n&&(o.lastNodes=new Map),r&&(o.isRoot=!0),this.trackMap.set(t,o)),(s=o.cleanup)==null||s.call(o),o}inheritNode(t){this.mounted=t.mounted,this.nodes=t.nodes,this.trackMap=t.trackMap,this.treeMap=t.treeMap;let n=this.props;this.props=t.props,this.patchNodes(n);}patchNode(t,n,r,o){for(let s in r)if(s==="children"&&r.children)if(C(r.children))r.children.filter(Boolean).forEach((a,c)=>{var R;let[i,u]=C(a)?a:[a,null],l=he(u)?null:(R=this.treeMap.get(u))!=null?R:null,f=`${t}:${s}:${c}`,j=this.getNodeTrack(f,!0,o);we(j,n,i,l);});else {let a=`${t}:${s}:0`,c=this.getNodeTrack(a,!0,o);we(c,n,r.children,null);}else if(s==="ref")p(r[s])?r[s].value=n:d(r[s])&&r[s](n);else if(g(s,"on")){let a=s.slice(2).toLocaleLowerCase(),c=this.getNodeTrack(`${t}:${s}`),i=r[s];c.cleanup=T(n,a,i);}else if(!g(s,"update")){let a=this.getNodeTrack(`${t}:${s}`),c=r[s],i=p(c)?c:P(c);Me(a,n,s,i.value);let u=N(()=>{i.value=p(c)?c.value:c,Me(a,n,s,i.value);}),l,f=`update${Te(s)}`;r[f]&&(l=ke(n,j=>{r[f](j);})),a.cleanup=()=>{u&&u(),l&&l();};}}};function Me(e,t,n,r){let o=t;o.setAttribute&&(d(r)?e.cleanup=N(()=>{ue(o,n,r());}):ue(o,n,r));}function we(e,t,n,r){d(n)?e.cleanup=N(()=>{let o=Q(n()).map(ae);e.lastNodes=Ce(t,e.lastNodes,o,r);}):Q(n).forEach((o,s)=>{let a=ae(o);e.lastNodes.set(String(s),a),v(t,a,r);});}function Be(e){var t;V("onMounted"),(t=y.ref)==null||t.addHook("mounted",e);}function De(e){var t;V("onDestroy"),(t=y.ref)==null||t.addHook("destroy",e);}function V(e){y.ref||console.error(`"${e}" can only be called within the component function body
2
+ and cannot be used in asynchronous or deferred calls.`);}function Ve(e,t){var n;V("useProvide"),(n=y.ref)==null||n.setContext(e,t);}function qe(e,t){var n;return V("useInject"),((n=y.ref)==null?void 0:n.getContext(e))||t}function Ue(){let e=null;return new Proxy({},{get(t,n){return n==="__is_ref"?!0:e},set(t,n,r){return e=r,!0}})}function Ze(e){return Object.entries(e).map(([t,n])=>`${t}=${JSON.stringify(escape(String(n)))}`).join(" ")}function le(e,t){if(d(e))return e(t);let n=Array.isArray(e)?e.reduce((s,a,c)=>(s[c+1]={template:a},s),{}):e,r={},o={};if(k(n))for(let[s,a]of Object.entries(n)){let c=t[s];if(c){for(let i in c)g(i,"on")&&d(c[i])&&delete c[i];if(c.children){for(let[i,u]of c.children)r[u]||(r[u]=[]),r[u].push(i);delete c.children;}}o[s]={template:a.template,prop:c};}return Object.entries(o).map(([s,{template:a,prop:c}])=>{let i=a;return c&&(i+=` ${Ze(c)}`),r[s]&&(i+=r[s].map(u=>le(u,c)).join("")),i}).join("")}function pn(e,t){return le(e,t)}function dn(e,t,n={}){t.innerHTML=le(e,n);}globalThis&&(globalThis.__essor_version=me);
3
3
 
4
- export { T as ComponentNode, Je as Fragment, K as TemplateNode, ge as __essor_version, Ie as createStore, Fe as h, z as isComputed, v as isJsxElement, H as isReactive, p as isSignal, Ge as nextTick, qe as onDestroy, Ve as onMount, fe as renderTemplate, mn as renderToString, se as signalObject, hn as ssgRender, Se as template, Pe as unReactive, xe as unSignal, oe as useComputed, S as useEffect, Ze as useInject, Ue as useProvide, O as useReactive, Qe as useRef, P as useSignal, He as useWatch };
4
+ export { y as ComponentNode, Ie as Fragment, K as TemplateNode, me as __essor_version, $e as createStore, Ke as h, X as isComputed, b as isJsxElement, H as isReactive, p as isSignal, Fe as nextTick, De as onDestroy, Be as onMount, le as renderTemplate, pn as renderToString, oe as signalObject, dn as ssgRender, xe as template, We as unReactive, be as unSignal, re as useComputed, N as useEffect, qe as useInject, Ve as useProvide, A as useReactive, Ue as useRef, P as useSignal, Le as useWatch };
5
5
  //# sourceMappingURL=out.js.map
6
6
  //# sourceMappingURL=essor.esm.js.map