@neeloong/form 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @neeloong/form v0.12.0
2
+ * @neeloong/form v0.12.1
3
3
  * (c) 2024-2025 Fierflame
4
4
  * @license Apache-2.0
5
5
  */
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @neeloong/form v0.12.0
2
+ * @neeloong/form v0.12.1
3
3
  * (c) 2024-2025 Fierflame
4
4
  * @license Apache-2.0
5
5
  */
@@ -1397,6 +1397,7 @@
1397
1397
  }
1398
1398
  this.#value.set(newValues);
1399
1399
  this.#initValue.set(newValues);
1400
+ this.#onUpdate?.(newValues, this.#index.get(), this);
1400
1401
  return newValues;
1401
1402
  }
1402
1403
 
package/index.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @neeloong/form v0.12.0
2
+ * @neeloong/form v0.12.1
3
3
  * (c) 2024-2025 Fierflame
4
4
  * @license Apache-2.0
5
5
  */
@@ -57,4 +57,4 @@ function(){throw new Error};function j(){return h(this),this.value}function L(e,
57
57
  * Use of this source code is governed by an MIT-style license that can be
58
58
  * found in the LICENSE file at https://angular.io/license
59
59
  */
60
- function(e){const t=Object.create(T);t.value=e;const n=()=>(h(t),t.value);return n[u]=t,n}(r),l=a[u];if(this[M]=l,l.wrapper=this,i){const t=i.equals;t&&(l.equal=t),l.watched=i[e.subtle.watched],l.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return j.call(this[M])}set(t){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(l)throw new Error("Writes to signals not permitted during Watcher callback");L(this[M],t)}};c=M,p=new WeakSet,e.isComputed=e=>r(p,e),e.Computed=class{constructor(t,r){s(this,p),n(this,c);const i=function(e){const t=Object.create(A);t.computation=e;const n=()=>S(t);return n[u]=t,n}(t),o=i[u];if(o.consumerAllowSignalWrites=!0,this[M]=o,o.wrapper=this,r){const t=r.equals;t&&(o.equal=t),o.watched=r[e.subtle.watched],o.unwatched=r[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return S(this[M])}},(t=>{var o,l,c,u;t.untrack=function(e){let t,n=null;try{n=f(null),t=e()}finally{f(n)}return t},t.introspectSources=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(n=t[M].producerNode)?void 0:n.map((e=>e.wrapper)))??[]},t.introspectSinks=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(n=t[M].liveConsumerNode)?void 0:n.map((e=>e.wrapper)))??[]},t.hasSinks=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called hasSinks without a Signal argument");const n=t[M].liveConsumerNode;return!!n&&n.length>0},t.hasSources=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called hasSources without a Computed or Watcher argument");const n=t[M].producerNode;return!!n&&n.length>0};o=M,l=new WeakSet,c=new WeakSet,u=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>r(l,e),t.Watcher=class{constructor(e){s(this,l),s(this,c),n(this,o);let t=Object.create(d);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[M]=t}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");i(this,c,u).call(this,t);const n=this[M];n.dirty=!1;const r=f(n);for(const e of t)h(e[M]);f(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");i(this,c,u).call(this,t);const n=this[M];w(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){v(n.producerNode[e],n.producerIndexOfThis[e]);const t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){const t=n.producerIndexOfThis[e],r=n.producerNode[e];x(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[M].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},t.currentComputed=function(){var e;return null==(e=a)?void 0:e.wrapper},t.watched=Symbol("watched"),t.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(e.Signal||(e.Signal={}));const N=(t,n,r,s)=>{const i=new e.Signal.State("boolean"==typeof n?n:null);let o;if("function"==typeof r)o=new e.Signal.Computed((()=>Boolean(r(t))));else{const t=Boolean(r);o=new e.Signal.Computed((()=>t))}const a=()=>{const e=i.get();return null===e?o.get():e},l=s?new e.Signal.Computed((()=>s.get()||a())):new e.Signal.Computed(a);return[i,l]},k=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,P=e=>e instanceof RegExp?e:null,U=Boolean;function B(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(B).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const q=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(B).filter(U);return t.length?t:null};function R(t,n,r,s){const i=new e.Signal.State(n(r));let o;if("function"==typeof s){const r=s;o=new e.Signal.Computed((()=>n(r(t))))}else{const t=n(s);o=new e.Signal.Computed((()=>t))}const a=new e.Signal.Computed((()=>{const e=i.get();return null===e?o.get():e}));return[i,a]}const _=Symbol();function V(e){const t={[_]:e};for(const[n,r]of e)Object.defineProperty(t,n,{get:()=>r.ref,configurable:!1,enumerable:!0});return Object.defineProperty(t,_,{get:()=>e,configurable:!1,enumerable:!0}),t}let D=null,W=null,K=Object.create(null);function z(e,t){const n=e.type;let r=Y;if(!e.array||W&&t?.parent instanceof W)if("string"==typeof n){const e=K[n];e&&(r=e)}else n&&"object"==typeof n&&D&&(r=D);else W&&(r=W);return new r(e,t)}function H(e){return e?e instanceof Error?e.message:"string"!=typeof e?"":e:""}function F(t,...n){const r=n.flat().filter((e=>"function"==typeof e));if(!r.length)return[()=>Promise.resolve([]),new e.Signal.Computed((()=>[])),()=>{}];const s=new e.Signal.State([]);let i=null;return[function(){i?.abort(),i=new AbortController;const e=i.signal;return s.set([]),Promise.all(r.map((n=>async function(e,n){let r=[];try{r.push(await e(t,n))}catch(e){r.push(e)}const i=r.flat().map(H).filter(Boolean);return!n.aborted&&i.length&&s.set([...s.get(),...i]),i}(n,e)))).then((e=>e.flat()))},new e.Signal.Computed((()=>s.get())),()=>{i?.abort(),s.set([])}]}class Y{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let i=r.get(s);return i||(i=new Set,r.set(s,i)),i.add(n),()=>{i?.delete(n)}}static create(e,t={}){return z({type:e},{...t,parent:null})}static setStore(e,t){return function(e,t){K[e]=t}(e,t)}#t=!1;get null(){return this.#t}get kind(){return""}#n=null;get ref(){return this.#n||V(this)}constructor(t,{null:n,state:r,ref:s,setValue:i,setState:o,convert:a,onUpdate:l,onUpdateState:c,validator:u,validators:f,index:d,size:h,new:p,parent:g,hidden:m,clearable:b,required:v,disabled:y,readonly:w,label:x,description:S,placeholder:O,min:E,max:C,step:A,minLength:$,maxLength:j,pattern:L,values:T}={}){this.schema=t,this.#r.set("object"==typeof r&&r||{});const M=g instanceof Y?g:null;M&&(this.#s=M,this.#i=M.#i),this.#o=t.type,this.#a=t.meta,this.#l=t.component;const U=new e.Signal.State(Boolean(p));this.#c=U;const B=M?new e.Signal.Computed((()=>M.#u.get()||U.get())):new e.Signal.Computed((()=>U.get()));this.#u=B;const _=Boolean(t.immutable),D=!1!==t.creatable;this.#f=_,this.#d=D;const W=t.readonly,K=new e.Signal.State("boolean"==typeof w?w:null);let z;if("function"==typeof W)z=new e.Signal.Computed((()=>Boolean(W(this))));else{const t=Boolean(W);z=new e.Signal.Computed((()=>t))}const G=()=>{if(B.get()?!D:_)return!0;const e=K.get();return null===e?z.get():e},Q=M?M.#h:null;this.#p=K,this.#h=Q?new e.Signal.Computed((()=>Q.get()||G())):new e.Signal.Computed(G),[this.#g,this.#m]=N(this,m,t.hidden,M?M.#m:null),[this.#b,this.#v]=N(this,b,t.clearable,M?M.#v:null),[this.#y,this.#w]=N(this,v,t.required,M?M.#w:null),[this.#x,this.#S]=N(this,y,t.disabled,M?M.#S:null),[this.#O,this.#E]=R(this,k,x,t.label),[this.#C,this.#A]=R(this,k,S,t.description),[this.#$,this.#j]=R(this,k,O,t.placeholder),[this.#L,this.#T]=R(this,I,E,t.min),[this.#M,this.#N]=R(this,I,C,t.max),[this.#k,this.#I]=R(this,I,A,t.step),[this.#P,this.#U]=R(this,I,$,t.minLength),[this.#B,this.#q]=R(this,I,j,t.maxLength),[this.#R,this.#_]=R(this,P,L,t.pattern),[this.#V,this.#D]=R(this,q,T,t.values);const Z=function(t,...n){const r=n.flat().filter((e=>"function"==typeof e));return r.length?new e.Signal.Computed((()=>{const e=[];for(const n of r)try{e.push(n(t))}catch(t){e.push(t)}return e.flat().map(H).filter(Boolean)})):new e.Signal.Computed((()=>[]))}(this,t.validator,u),[X,J,ee]=F(this,t.validators?.change,f?.change),[te,ne,re]=F(this,t.validators?.blur,f?.blur);if(this.listen("change",(()=>{X()})),this.listen("blur",(()=>{te()})),this.#W=function(...t){const n=t.filter(Boolean);return new e.Signal.Computed((()=>n.flatMap((e=>e.get()))))}(Z,J,ne),this.#K=Z,this.#z=X,this.#H=te,this.#F=ee,this.#Y=re,h instanceof e.Signal.State||h instanceof e.Signal.Computed?this.#G=h:this.#G=new e.Signal.State(h||0),n)return this.#t=!0,void(this.#n=V(this));this.#n=s||null,this.#Q=l||null,this.#Z=c||null,this.#X="function"==typeof i?i:null,this.#J="function"==typeof o?o:null,this.#ee="function"==typeof a?a:null,this.#te.set(d??"");for(const[e,n]of Object.entries(t.events||{}))"function"==typeof n&&this.listen(e,n)}#X=null;#J=null;#ee=null;#Q=null;#Z=null;#s=null;#i=this;#o;#a;#l;get store(){return this}get parent(){return this.#s}get root(){return this.#i}get type(){return this.#o}get meta(){return this.#a}get component(){return this.#l}#G;get size(){return this.#G.get()}#te=new e.Signal.State("");get index(){return this.#te.get()}set index(e){this.#te.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#d=!0;get creatable(){return this.#d}#f=!1;get immutable(){return this.#f}#u;#c;get selfNew(){return this.#c.get()}set selfNew(e){this.#c.set(Boolean(e))}get new(){return this.#u.get()}set new(e){this.#c.set(Boolean(e))}#g;#m;get selfHidden(){return this.#g.get()}set selfHidden(e){this.#g.set("boolean"==typeof e?e:null)}get hidden(){return this.#m.get()}set hidden(e){this.#g.set("boolean"==typeof e?e:null)}#b;#v;get selfClearable(){return this.#b.get()}set selfClearable(e){this.#b.set("boolean"==typeof e?e:null)}get clearable(){return this.#v.get()}set clearable(e){this.#b.set("boolean"==typeof e?e:null)}#y;#w;get selfRequired(){return this.#y.get()}set selfRequired(e){this.#y.set("boolean"==typeof e?e:null)}get required(){return this.#w.get()}set required(e){this.#y.set("boolean"==typeof e?e:null)}#x;#S;get selfDisabled(){return this.#x.get()}set selfDisabled(e){this.#x.set("boolean"==typeof e?e:null)}get disabled(){return this.#S.get()}set disabled(e){this.#x.set("boolean"==typeof e?e:null)}#p;#h;get selfReadonly(){return this.#p.get()}set selfReadonly(e){this.#p.set("boolean"==typeof e?e:null)}get readonly(){return this.#h.get()}set readonly(e){this.#p.set("boolean"==typeof e?e:null)}#O;#E;get selfLabel(){return this.#O.get()}set selfLabel(e){this.#O.set(k(e))}get label(){return this.#E.get()}set label(e){this.#O.set(k(e))}#C;#A;get selfDescription(){return this.#C.get()}set selfDescription(e){this.#C.set(k(e))}get description(){return this.#A.get()}set description(e){this.#C.set(k(e))}#$;#j;get selfPlaceholder(){return this.#$.get()}set selfPlaceholder(e){this.#$.set(k(e))}get placeholder(){return this.#j.get()}set placeholder(e){this.#$.set(k(e))}#L;#T;get selfMin(){return this.#L.get()}set selfMin(e){this.#L.set(I(e))}get min(){return this.#T.get()}set min(e){this.#L.set(I(e))}#M;#N;get selfMax(){return this.#M.get()}set selfMax(e){this.#M.set(I(e))}get max(){return this.#N.get()}set max(e){this.#M.set(I(e))}#k;#I;get selfStep(){return this.#k.get()}set selfStep(e){this.#k.set(I(e))}get step(){return this.#I.get()}set step(e){this.#k.set(I(e))}#P;#U;get selfMinLength(){return this.#P.get()}set selfMinLength(e){this.#P.set(I(e))}get minLength(){return this.#U.get()}set minLength(e){this.#P.set(I(e))}#B;#q;get selfMaxLength(){return this.#B.get()}set selfMaxLength(e){this.#B.set(I(e))}get maxLength(){return this.#q.get()}set maxLength(e){this.#B.set(I(e))}#R;#_;get selfPattern(){return this.#R.get()}set selfPattern(e){this.#R.set(P(e))}get pattern(){return this.#_.get()}set pattern(e){this.#R.set(P(e))}#V;#D;get selfValues(){return this.#V.get()}set selfValues(e){this.#V.set(q(e))}get values(){return this.#D.get()}set values(e){this.#V.set(q(e))}#W;#K;#z;#H;#F;#Y;get errors(){return this.#W.get()}get error(){return this.#W.get()[0]}*[Symbol.iterator](){}child(e){return null}#ne=!1;#re=new e.Signal.State(null);#se=new e.Signal.State(this.#re.get());#r=new e.Signal.State(null);get changed(){return this.#se.get()===this.#re.get()}get value(){return this.#se.get()}set value(e){const t=this.#X?.(e),n=void 0===t?e:t;this.#se.set(n),this.#ne||this.#re.set(n),this.#Q?.(n,this.#te.get(),this),this.#ie()}get state(){return this.#r.get()}set state(e){const t=this.#J?.(e),n=void 0===t?e:t;this.#r.set(n),this.#Z?.(n,this.#te.get(),this),this.#ie()}#ie(){this.#oe||(this.#oe=!0,queueMicrotask((()=>{const e=this.#se.get(),t=this.#r.get();this.#ae(e,t)})))}reset(e=this.#re.get()){this.#le(e)}#le(e){const t=this.#X?.(e),n=void 0===t?e:t;if(this.#F(),this.#Y(),this.#ne=!0,!n||"object"!=typeof n){for(const[,e]of this)e.#le(null);return this.#se.set(n),this.#re.set(n),n}const r=Array.isArray(n)?[...n]:{...n};for(const[e,t]of this)r[e]=t.#le(r[e]);return this.#se.set(r),this.#re.set(r),r}#oe=!1;#ce(e,t){const[n,r]=this.#ee?.(e,t)||[e,t];return this.#se.get()===n&&this.#r.get()===r?[n,r]:(this.#se.set(n),this.#r.set(r),this.#ae(n,r))}#ae(e,t){this.#oe=!1;let n=e;if(e&&"object"==typeof e){let r=Array.isArray(e)?[...e]:{...e},s=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},i=!1;for(const[n,o]of this){const a=e[n],l=t?.[n],[c,u]=o.#ce(a,l);a!==c&&(r[n]=c,i=!0),l!==u&&(s[n]=u,i=!0)}i&&(t=s,n=e=r,this.#se.set(e),this.#r.set(s))}return this.#ne||(this.#ne=!0,this.#re.set(n)),[e,t]}validate(e){if(!Array.isArray(e))return Promise.all([this.#K.get(),this.#z(),this.#H()]).then((e=>{const t=e.flat();return t.length?t:null}));const t=[this.validate().then((t=>t?.length?[{path:[...e],store:this,errors:t}]:[]))];for(const[n,r]of this)t.push(r.validate([...e,n]));return Promise.all(t).then((e=>e.flat()))}}class G extends Y{get kind(){return"object"}#ue;*[Symbol.iterator](){yield*Object.entries(this.#ue)}child(e){return this.#ue[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:i}={}){const o=Object.entries(e.type);super(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:i,size:o.length,setValue:e=>"object"==typeof e?e:null,setState:e=>"object"==typeof e?e:null,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const a=Object.create(null),l={parent:this,onUpdate:(e,t,n)=>{n===this.#ue[t]&&(this.value={...this.value,[t]:e})},onUpdateState:(e,t,n)=>{n===this.#ue[t]&&(this.state={...this.state,[t]:e})}};for(const[e,t]of o)a[e]=z(t,{...l,index:e});this.#ue=a}}D=G;class Q extends Y{#fe=()=>{throw new Error};#ue;get children(){return[...this.#ue.get()]}*[Symbol.iterator](){return yield*[...this.#ue.get().entries()]}child(e){const t=this.#ue.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(t,{parent:n,onUpdate:r,onUpdateState:s,index:i,new:o}={}){const a=new e.Signal.State([]),l=e=>{const t=Array.isArray(e)&&e.length||0,n=[...a.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#fe(e));n.length=t,r!==t&&a.set(n)};super(t,{index:i,new:o,parent:n,size:new e.Signal.Computed((()=>a.get().length)),state:[],setValue:e=>Array.isArray(e)?e:null==e?null:[e],setState:e=>Array.isArray(e)?e:null==e?null:[e],convert(e,t){const n=Array.isArray(e)?e:null==e?null:[e];return l(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t,n)=>{l(e),r?.(e,t,n)},onUpdateState:s}),this.#ue=a;const c={parent:this,onUpdate:(e,t,n)=>{if(a.get()[t]!==n)return;const r=[...this.value||[]];r.length<t&&(r.length=t),r[t]=e,this.value=r},onUpdateState:(e,t,n)=>{if(a.get()[t]!==n)return;const r=[...this.state||[]];r.length<t&&(r.length=t),r[t]=e,this.state=r}};this.#fe=(e,n)=>{const r=z(t,{...c,index:e,new:n});return r.index=e,r}}insert(e,t=null,n){const r=this.value||[];if(!Array.isArray(r))return!1;const s=[...this.#ue.get()],i=Math.max(0,Math.min(Math.floor(e),s.length)),o=this.#fe(i,n);o.new=!0,s.splice(i,0,o);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(i,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(i,0,{}),this.state=e}return this.#ue.set(s),this.value=a,!0}add(e=null){return this.insert(this.#ue.get().length,e)}remove(e){const t=this.value;if(!Array.isArray(t))return;const n=[...this.#ue.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;const i=[...t],[o]=i.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.#ue.set(n),this.value=i,o}move(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#ue.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let i=Math.min(e,t),o=Math.max(e,t);for(let e=i;e<=o;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.#ue.set(r),this.value=a,!0}exchange(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#ue.get()],s=r[e],i=r[t];if(!s||!i)return!1;r[t]=s,r[e]=i,s.index=t,i.index=e;const o=[...n],a=o[e],l=o[t];o[t]=a,o[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.#ue.set(r),this.value=o,!0}}function Z(e){if(!e?.length)return[];const t=[];let n=[],r=Object.create(null),s=!1;for(const t of e){if("string"==typeof t)continue;const e=t.template;if(!e)continue;s=!0;const n=X(t);r[e]={params:t.params,children:n?[n]:[]}}function i(e){e.length&&t.push({type:"divergent",children:e.map((([e,t])=>{const n=X(t);return n?"string"!=typeof n&&"fragment"===n.type?[n,e]:[{children:[n]},e]:[{children:[]},e]}))})}for(const r of e){if("string"==typeof r){i(n),n=[],t.push(r);continue}if(r.template){i(n),n=[];continue}if(n.length&&r.else){const e=r.if||null;n.push([e,r]),e||(i(n),n=[]);continue}i(n),n=[];const e=r.if;if(e){n.push([e,r]);continue}const s=X(r);s&&t.push(s)}return i(n),s?[{type:"fragment",templates:r,children:t}]:t}function X(e){let t=function(e){const t=e.fragment;if(t&&"string"==typeof t)return{type:"template",template:t,attrs:e.attrs,children:[]};const n=function({text:e,html:t}){return null!=e?{type:"content",value:e}:null!=t?{type:"content",value:t,html:!0}:void 0}(e),r=n?[n]:Z(e.children);return!e.name||t?n||{type:"fragment",children:r}:{name:e.name,is:e.is,attrs:e.attrs,events:e.events,classes:e.classes,styles:e.styles,enhancements:e.enhancements,bind:e.bind,comment:e.comment,children:r}}(e),n=e.vars;n.length&&t&&"string"!=typeof t&&(t.vars?t.vars=[...n,...t.vars]:t?t.vars=n:t={type:"fragment",vars:n,children:[]},n=null);const r=e.enum,s=e.value;return r&&(t={type:"enum",value:r,vars:n,children:t?[t]:[]},n=null),s&&(t={type:"value",name:s,vars:n,children:t?[t]:[]},n=null),n?.length&&(t={type:"fragment",vars:n,children:t?[t]:[]}),t}!function(e){W=e}(Q);const J=/^([+-]?(\d(_?\d)*(\.(\d(_?\d)*)?)?|\.\d(_?\d)*)(?:e[+-]?\d(_?\d)*)|0(b[01](?:_?[01])*|o[0-7](?:_?[0-7])*|x[\dA-F](?:_?[\dA-F])*))$/is;const ee={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class te extends Error{constructor(e,...t){const n=ee[e];super("function"==typeof n?n(...t):n),this.code=e}}const ne=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,re=/^~(?<enhancement>[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_\d\.]*)(?:(?<decorator>[:@!])(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*))?$/u,se=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function ie(e,t){const n=e[t];if(n)return n;const r={attrs:Object.create(null),events:Object.create(null)};return e[t]=r,r}function oe(e,t){const n=e.replace(/$\s+|\s+$/gs,"");if("null"===n)return{value:null};if("true"===n)return{value:!0};if("false"===n)return{value:!1};const r=function(e){return J.test(e)?Number(e.replaceAll("_","")):NaN}(n);return Number.isNaN(r)?se.test(n)?{name:n}:{calc:t(e)}:{value:r}}function ae(e,t,n,r,s){const{attrs:i,events:o,classes:a,styles:l,vars:c,params:u,enhancements:f}=e;return function(d,h){const p=d.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"),g=(ne.exec(p)||re.exec(p))?.groups;if(!g)throw new te("ATTR",d);const{name:m,enhancement:b}=g,v=g.decorator?.toLowerCase();if(b){if(":"===v)ie(f,b).attrs[m]=h?oe(h,t):{name:m};else if("@"===v)ie(f,b).events[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m};else if("!"===v){if("bind"===m)ie(f,b).bind=h||!0}else ie(f,b).value=oe(h,t);return}if(!v)return void(i[m]={value:h});if(":"===v)return void(i[m]=h?oe(h,t):{name:m});if("."===v)return void(a[m]=h?oe(h,t):{name:m});if("style:"===v)return void(l[m]=oe(h,t));if("@"===v)return void(o[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m});if("+"===v)return void c.push({...h?oe(h,n):{value:void 0},variable:m,init:!0});if("*"===v)return void c.push({...oe(h,t),variable:m,init:!1});if("?"===v)return void(u[m]=oe(h,t));if("!"!==v)return;switch(m.toString()){case"fragment":e.fragment=h||!0;break;case"else":e.else=!0;break;case"enum":e.enum=h?oe(h,t):{value:!0};break;case"if":e.if=oe(h,t);break;case"text":e.text=oe(h,t);break;case"html":s&&(e.html=oe(h,t));break;case"template":e.template=h;break;case"bind":e.bind=h||!0;break;case"value":e.value=h;break;case"comment":e.comment=h}}}function le(e,t){return{name:e,is:t,children:[],attrs:Object.create(null),events:Object.create(null),classes:Object.create(null),styles:Object.create(null),vars:[],params:Object.create(null),enhancements:Object.create(null)}}var ce={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};const ue=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function fe(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function de(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function he(...e){console.error(new te(...e))}function pe(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in ce?ce[t]:(he("ENTITY",e),e)}var ge=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new te("CALC")},createInit:n=t,createEvent:r=()=>{throw new te("EVENT")},simpleTag:s=new Set,enableHTML:i=!1}={}){const o=[],a={children:o},l=[];let c=null,u=a;function f(){c=l.pop()||null,u=c||a}function d(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&u.children.push(e)}let h={},p=0;function g(t){if(t<=p)return;d(e.substring(p,t).replace(/&#?\w+;/g,pe)),p=t}for(;;){const m=e.indexOf("<",p);if(m<0){const $=e.substring(p);$.match(/^\s*$/)||d($);break}m>p&&g(m);const b=e.charAt(m+1);if("!"===b){let j=m+2,L=">";if("--"===e.slice(m+2,m+4)&&(j+=4,L="--\x3e"),p=e.indexOf(L,j),p<0)break;p++;continue}if("/"===b){p=e.indexOf(">",m+3);let T=e.substring(m+2,p);if(p<0?(T=e.substring(m+2).replace(/[\s<].*/,""),he("UNCOMPLETED",T,c?.name),p=m+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),he("UNCOMPLETED",T),p=m+1+T.length),c){const M=c.name;if(M===T)f();else{if(M.toLowerCase()!=T.toLowerCase())throw new te("CLOSE",T,c.name);f()}}p++;continue}function v(t){let n=p+1;if(p=e.indexOf(t,n),p<0)throw new te("QUOTE",t);const r=e.slice(n,p).replace(/&#?\w+;/g,pe);return p++,r}function y(){let t=e.charAt(p);for(;t<=" "||"€"===t;t=e.charAt(++p));return t}function w(){let t=p,n=e.charAt(p);for(;fe(n);)p++,n=e.charAt(p);return e.slice(t,p)}p=m+1;let x=e.charAt(p);switch(x){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case">":case"/":throw new te("SYMBOL",x);case"":throw new te("EOF")}const S=w(),O=ue.exec(S)?.groups;if(!O)throw new te("TAG",S);l.push(c),c=le(O.name,O.is),u.children.push(c),u=c;const E=ae(c,t,n,r,i);let C=!0,A=!1;e:for(;C;){let N=y();switch(N){case"":he("EOF"),p++;break e;case">":p++;break e;case"/":A=!0;break e;case'"':case"'":throw new te("ATTR_VALUE");case"=":throw new te("SYMBOL",N)}const k=w();if(!k){he("EOF"),p++;break e}switch(N=y(),N){case"":he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),A=!0;break e;case"=":p++;break;case"'":case'"':E(k,v(N));continue;default:E(k,"");continue}switch(N=y(),N){case"":E(k,""),he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),A=!0;break e;case"'":case'"':E(k,v(N));continue}E(k,w())}if(A){for(;;){p++;const I=e.charAt(p);if("/"!==I&&!(I<=" "||"€"===I))break}switch(e.charAt(p)){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case"":he("EOF");break;case">":p++;break;default:throw new te("CLOSE_SYMBOL")}f()}else(s.has(S)||de(e,p,S,h))&&f()}return Z(o)}});function me(t){let n=!0;const r=new e.Signal.subtle.Watcher((()=>{n&&(n=!1,queueMicrotask((()=>{n=!0;for(const e of r.getPending())e.get();r.watch()})))})),s=new e.Signal.Computed(t);return r.watch(s),s.get(),()=>{r.unwatch(s)}}function be(e,t,n){let r,s=!1;return me((()=>{const i=e();if(!s)return s=!0,r=i,void(n&&t(i));Object.is(i,r)||(r=i,t(i))}))}const ve=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,ref:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,changed:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,minLength:!0,maxLength:!0,pattern:!0,values:!0,null:!0,index:!0,no:!0,size:!0,error:!0,errors:!0}));function*ye(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of ve)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],yield[`${t}${n}reset`,{exec:()=>e.reset()}],yield[`${t}${n}validate`,{exec:t=>e.validate(t?[]:null)}],e instanceof Q&&(yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}])}function we(e,t,n){for(const[n,r]of t){for(const[t,s]of ye(r,n))e[t]=s;for(const[t,s]of ye(r,n,"$$"))e[t]=s}}const xe={value$:{calc:e=>e?.[_].value},state$:{calc:e=>e?.[_].state}};var Se=Object.getOwnPropertyDescriptors(xe);function Oe(e){if(!e)return!1;const t=e.indexOf("$");return t<0||(e.indexOf("$",t+2)>0||"$"===e[0]&&"_$".includes(e[1]))}function Ee(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class Ce{exec({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#de[e];if("function"!=typeof t?.get)return;return t.get()}return"function"==typeof t?t(this.getters):n}get({name:t,calc:n,value:r}){if("string"==typeof t){const e=this.#de[t];if("function"!=typeof e?.get)return;const{get:n,set:r}=e;return{get:n,set:r}}if("function"==typeof n){const t=new e.Signal.Computed((()=>n(this.getters)));return{get:()=>t.get()}}return{get:()=>r}}watch(e,t){return be((()=>this.exec(e)),t,!0)}enum(e){const{name:t,calc:n}=e;if("function"==typeof n)return()=>n(this.getters);if("string"==typeof t){const e=this.#de[t];if("function"!=typeof e?.get)return null;const n=e.store;return n instanceof Y?n:e.get}return this.store}getStore(e){if(!e)return null;const t=this.#de[!0===e?"":e];return t?.get&&t.store||null}bind(e,t,n){const r=this.#de[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?ve.has(t)?be((()=>s[t]),n,!0):void 0:"value"===t?be((()=>r.get()),n,!0):void 0}bindAll(e){const t=this.#de[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>be(e,t,!0)}}return Object.fromEntries([...ve].map((e=>[`$${e}`,t=>be((()=>n[e]),t,!0)])))}getBindAll(e){const t=this.#de[!0===e?"":e];if(!t?.get)return{};const{store:n}=t;if(!n){const{get:e,set:n}=t;return{$value:{get:e,set:n}}}return Object.fromEntries([...ve].map((e=>[`$${e}`,"value"===e||"state"===e?{get:()=>n[e],set:t=>{n[e]=t}}:{get:()=>n[e]}])))}bindSet(e,t){const n=this.#de[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#de[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)},$reset:e=>{n.reset()},$validate:e=>{n.validate(e?[]:null)}}}getEvent({name:e,event:t}){if("function"==typeof t)return t;const n=this.#de[e];if(!n)return null;const{exec:r,calc:s}=n;return"function"==typeof r?r:"function"==typeof s?s:null}constructor(e,t){if(this.store=e,t instanceof Ce){this.#he=t.#he;const e=this.#pe;for(const[n,r]of Object.entries(t.#pe))e[n]=r;const n=this.#ge;for(const[e,r]of Object.entries(t.#ge))n[e]=r}else we(this.#pe,e),this.#he=function(e){const t=Object.create(null,Se);if(!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!Oe(n))continue;if(!r||"object"!=typeof r)continue;if(r instanceof Y){for(const[e,s]of ye(r,n))t[e]=s;continue}const{get:e,set:s,exec:i,calc:o}=r;"function"!=typeof e?"function"!=typeof o?"function"!=typeof i||(t[n]={exec:i}):t[n]={calc:o}:t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#he;#pe=Object.create(null);#ge=Object.create(null);store;#me=null;#s=null;#be=null;get#de(){const e=this.#be;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#pe,...this.#he,...this.#ge})),n=this.store,r=this.#s,s=this.#me;for(const[e,r]of ye(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof Q))return yield[`${n}${r}upMovable`,{get:()=>!1}],void(yield[`${n}${r}downMovable`,{get:()=>!1}]);yield[`${n}${r}upMovable`,{get:()=>{const e=t.index;return"number"==typeof e&&!(e<=0)}}],yield[`${n}${r}downMovable`,{get:()=>{const n=t.index;return"number"==typeof n&&!(n>=e.size-1)}}],yield[`${n}${r}remove`,{exec:()=>e.remove(Number(t.index))}],yield[`${n}${r}upMove`,{exec:()=>{const n=t.index;"number"==typeof n&&(n<=0||e.move(n,n-1))}}],yield[`${n}${r}downMove`,{exec:()=>{const n=t.index;"number"==typeof n&&(n>=e.size-1||e.move(n,n+1))}}]}(r,n))t[e]=s;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};return this.#be=t,t}setStore(e,t,n){const r=new Ce(e,this);return t&&(r.#s=t),we(r.#pe,e),n&&(r.#me=n),r}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new Ce(t,this);return we(n.#pe,t),n}params(t,n,r,s){let i=this.store;if(!0===s)i=r.store;else if(s){const e=r.#de[s],t=e?.get&&e.store;t&&(i=t)}if(0===Object.keys(t).length)return this;const o=new Ce(i,this);o.#s=this.#s,o.#me=this.#me;const a=o.#ge,l=o.#de;for(const[s,i]of Object.entries(t)){const t=s in n?n[s]:null;if(t){const{name:n,calc:i,value:o}=t;if(n){const e=r.#de[n];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ye(e.store,s))a[t]=l[t]=n;continue}if("function"==typeof i){const t=new e.Signal.Computed((()=>i(r.getters)));a[s]=l[s]={get:()=>t.get()};continue}a[s]=l[s]={get:()=>o}}else{const{name:t,calc:n,value:r}=i;if("function"==typeof n){const t=o.getters;o.#ve=null;const r=new e.Signal.Computed((()=>n(t)));a[s]=l[s]={get:()=>r.get()};continue}if(t){const e=l[t];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ye(e.store,s))a[t]=l[t]=n;continue}a[s]=l[s]={get:()=>r}}}return o}setObject(e){const t=new Ce(this.store,this);return t.#me=e,t}set(t){if(!t?.length)return this;const n=new Ce(this.store,this);n.#s=this.#s,n.#me=this.#me;const r=n.#ge,s=n.#de;for(const{variable:i,name:o,calc:a,value:l,init:c}of t)if(c){const t=new e.Signal.State(l);if("function"==typeof a){const e=n.settable;n.#ye=null,t.set(a(e))}else if(o){const e=s[o];if(!e?.get)continue;t.set(e.get())}r[i]=s[i]={get:()=>t.get(),set:e=>{t.set(e)}}}else if("function"!=typeof a)if(o){const e=s[o];if(!e)continue;if(!e.get||!e.store){r[i]=s[i]=e;continue}for(const[t,n]of ye(e.store,i))r[t]=s[t]=n}else r[i]=s[i]={get:()=>l};else{const t=n.getters;n.#ve=null;const o=new e.Signal.Computed((()=>a(t)));r[i]=s[i]={get:()=>o.get()}}return n}#we=null;get all(){const e=this.#we;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc?Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1}):Object.defineProperty(t,e,{value:n.exec,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#we=t,t}#ye=null;get settable(){const e=this.#ye;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#ye=t,t}#ve=null;get getters(){const e=this.#ve;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#ve=t,t}}const Ae={width:"px",height:"px",top:"px",right:"px",bottom:"px",left:"px",border:"px","border-top":"px","border-right":"px","border-left":"px","border-bottom":"px","border-width":"px","border-top-width":"px","border-right-width":"px","border-left-width":"px","border-bottom-width":"px","border-radius":"px","border-top-left-radius":"px","border-top-right-radius":"px","border-bottom-left-radius":"px","border-bottom-right-radius":"px",padding:"px","padding-top":"px","padding-right":"px","padding-left":"px","padding-bottom":"px",margin:"px","margin-top":"px","margin-right":"px","margin-left":"px","margin-bottom":"px"};function $e(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in Ae?`${s}${Ae[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class je{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let i=r.get(s);return i||(i=new Set,r.set(s,i)),i.add(n),()=>{i?.delete(n)}}}const Le={stop(e){e instanceof Event&&e.stopPropagation()},prevent(e){e instanceof Event&&e.preventDefault()},self(e){if(e instanceof Event)return e.target===e.currentTarget},enter(e){if(e instanceof KeyboardEvent)return"Enter"===e.key},tab(e){if(e instanceof KeyboardEvent)return"Tab"===e.key},esc(e){if(e instanceof KeyboardEvent)return"Escape"===e.key},space(e){if(e instanceof KeyboardEvent)return" "===e.key},backspace(e){if(e instanceof KeyboardEvent)return"Backspace"===e.key},delete(e){if(e instanceof KeyboardEvent)return"Delete"===e.key},delBack(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},"del-back"(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},insert(e){if(e instanceof KeyboardEvent)return"Insert"===e.key},repeat(e){if(e instanceof KeyboardEvent)return e.repeat},key(e,t){if(e instanceof KeyboardEvent){const n=e.code.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},main(e){if(e instanceof MouseEvent)return 0===e.button},auxiliary(e){if(e instanceof MouseEvent)return 1===e.button},secondary(e){if(e instanceof MouseEvent)return 2===e.button},left(e){if(e instanceof MouseEvent)return 0===e.button},middle(e){if(e instanceof MouseEvent)return 1===e.button},right(e){if(e instanceof MouseEvent)return 2===e.button},primary(e){if(e instanceof PointerEvent)return e.isPrimary},mouse(e){if(e instanceof PointerEvent)return"mouse"===e.pointerType},pen(e){if(e instanceof PointerEvent)return"pen"===e.pointerType},touch(e){if(e instanceof PointerEvent)return"touch"===e.pointerType},pointer(e,t){if(e instanceof PointerEvent){const n=e.pointerType.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},ctrl(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey},alt(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.altKey},shift(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.shiftKey},meta(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.metaKey},cmd(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey||e.metaKey}};function Te(e,t,n){const r=[];if(t)for(let s=e.shift();s;s=e.shift()){const e=s.indexOf(":"),i=e>=0?s.slice(0,e):s,o=e>=0?s.slice(e+1).split(":"):[],a=i.replace(/^-+/,""),l=(i.length-a.length)%2==1;let c=t[a]||a;if(n)switch(c){case"once":case"passive":case"capture":n[c]=!l;continue}"string"==typeof c&&(c=Le[c]),"function"==typeof c&&r.push([c,o,l])}return r}function Me(e,t,n){return r=>{const s=e.all;for(const[e,t,i]of n)if(e(r,t,s)===i)return;t(r,s)}}function Ne(e){return"number"==typeof e||"bigint"==typeof e?String(e):"boolean"==typeof e?e?"":null:"string"==typeof e?e:null===(e??null)?null:String(e)}function ke(e){return null===(e??null)?"":String(e)}function Ie(e,t){if(e instanceof HTMLInputElement&&"checked"===t)switch(e.type.toLowerCase()){case"checkbox":case"radio":return Boolean}if((e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&"value"===t)return ke;if(e instanceof HTMLDetailsElement&&"open"===t)return Boolean;if(e instanceof HTMLMediaElement){if("muted"===t)return Boolean;if("paused"===t)return Boolean;if("currentTime"===t)return!0;if("playbackRate"===t)return!0;if("volume"===t)return!0}return!1}const Pe={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=ke(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["change",(e,t)=>t.value]}}};function Ue(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watch:s,props:i}=e;return["input","textarea","select"].includes(t.toLowerCase())&&e.relate(r),e.listen("init",(({events:n})=>{const o=Pe[t.toLowerCase()],a=o?.attrs||{},l=o?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,i]=n;r.addEventListener(e,(e=>t(i(e,r))),s)}}if(i)for(const[t,n]of Object.entries(e.attrs))if(s(t,(e=>{if(i.has(t))r[t]=e;else{const n=Ne(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),i.has(t))r[t]=n;else{const e=Ne(n);null!==e&&r.setAttribute(t,e)}else for(const[t,n]of Object.entries(e.attrs)){if(r instanceof HTMLInputElement&&"type"===t.toLocaleLowerCase()){const e=Ne(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=Ie(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let i=Ne(n);null!==i&&r.setAttribute(t,i),s(t,(e=>{const n=Ne(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Be(e){return null===(e??null)?"":String(e)}function qe(e,t,n,r,s){if(!s){const s=e.insertBefore(document.createTextNode(""),t),i=n.watch(r,(e=>s.textContent=Be(e)));return()=>{s.remove(),i()}}const i=e.insertBefore(document.createComment(""),t),o=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=i.nextSibling;e&&e!==o;e=i.nextSibling)e.remove()}const c=n.watch(r,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=i.firstChild)e.insertBefore(t,o)}(Be(t))}));return()=>{c(),l(),i.remove(),o.remove()}}const Re=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function _e(e,t,n,r,s){const i=e.children;if(!i.length)return()=>{};const o=t.insertBefore(document.createComment(""),n);let a=null,l=()=>{};const c=be((()=>i.find((([,e])=>!e||r.exec(e)))||null),(e=>{if(e===a)return;a=e,l(),l=()=>{};const t=e?.[0];t&&(l=s(t.children,t.vars,t.templates))}),!0);let u=!1;return()=>{u||(u=!0,c(),l(),l=()=>{},o.remove())}}function Ve(t,n,r,s,i,o,a,l,c){const u=t.bind,f=[...o,t.name],d=c?.(f);if(c&&!d)return()=>{};const{context:h,handler:p}=function(t,n,r,s){const i="string"==typeof t?t:t.tag,{attrs:o,events:a}="string"!=typeof t&&t||{attrs:null,events:null};let l=!1;const c=new e.Signal.State(!1);let u=!1;const f=new e.Signal.State(!1),d=Object.create(null),h=Object.create(null),p=new Set,g=[],m=new je;return{context:{events:g,props:o?new Set(Object.entries(o).filter((([,e])=>e.isProp)).map((([e])=>e))):null,attrs:h,watch(e,t){if(l)return()=>{};const n=d[e];if(!n)return()=>{};let r=n.get();const s=be((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}),!0);return p.add(s),()=>{p.delete(s),s()}},relate(e){if(!r||!s||l)return()=>{};try{const t=s(r,e);return"function"!=typeof t?()=>{}:(p.add(t),()=>{p.delete(t),t()})}catch{return()=>{}}},get destroyed(){return c.get()},get init(){return f.get()},listen:(e,t)=>m.listen(e,t)},handler:{tag:i,set(t,n){if(o&&!(t in o))return;let r=d[t];if(r)return void r.set(n);const s=new e.Signal.State(n);d[t]=s,Object.defineProperty(h,t,{configurable:!0,enumerable:!0,get:s.get.bind(s)})},addEvent(e,t){if("function"!=typeof t)return;const[r,...s]=e.split(".").filter(Boolean),i=a?a[r].filters:{};if(!i)return;const o={},l=Te(s,i,o);g.push([r,Me(n,t,l),o])},destroy(){if(!l){l=!0,c.set(!0);for(const e of p)e();m.emit("destroy")}},mount(){u||(u=!0,f.set(!0),m.emit("init",{events:g}))}}}}(d||t.name,s,s.getStore(u),l),g=d?.attrs,m=g?function(e,t,n,r,s){let i=new Set;for(const[o,a]of Object.entries(r)){if("class"===o||"style"===o)continue;if(o in n){const r=n[o],{name:s,calc:l,value:c}=n[o];if(!s&&!l){e.set(o,c);continue}a.immutable&&e.set(o,t.exec(r)),i.add(t.watch(r,(t=>e.set(o,t))));continue}const r=a.bind;if(!s||!r){e.set(o,a.default);continue}if("string"==typeof r){const n=t.bind(s,r,(t=>e.set(o,t)));n?i.add(n):e.set(o,a.default);continue}if(!Array.isArray(r)){e.set(o,a.default);continue}const[l,c,u]=r;if(!l||"function"!=typeof c)continue;if(!u){const n=!0===s?"":s;i.add(t.watch({name:n},(t=>e.set(o,t)))),e.addEvent(l,((...e)=>{t.all[n]=c(...e)}));continue}const f=t.bind(s,"state",(t=>e.set(o,t)));if(!f)continue;i.add(f);const d=t.bindSet(s,"state");d&&e.addEvent(l,((...e)=>{d(c(...e))}))}return()=>{const e=i;i=new Set;for(const t of e)t()}}(p,s,t.attrs,g,u):function(e,t,n){const r=e.tag;let s=new Set;for(const[i,o]of Object.entries(n)){if("class"===i||"style"===i)continue;const{name:n,calc:a,value:l}=o;if(n||a)if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==i.toLocaleLowerCase())s.add(t.watch(o,(t=>e.set(i,t))));else{const n=t.exec(o);e.set(i,n)}else e.set(i,l)}return()=>{const e=s;s=new Set;for(const t of e)t()}}(p,s,t.attrs);for(const[e,n]of Object.entries(t.events)){const t=s.getEvent(n);t&&p.addEvent(e,t)}const b=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,i]of Object.entries(t.bindAll(n)||{}))"function"==typeof i&&r.add(i((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(p,s,u),v=d?"function"==typeof d.tag?d.tag(h):Ue(h,d.tag,d.is):Ue(h,t.name,t.is),y=Array.isArray(v)?v[0]:v,w=Array.isArray(v)?v[1]:y;n.insertBefore(y,r);const x=w?Ke(t.children||[],w,null,s,i,o,a,l,c):()=>{},S=function(e,t,n,r){if(!(e instanceof Element))return()=>{};r&&(e.className+=" "+t.exec(r));let s=new Set;for(const[r,i]of Object.entries(n))i.value?e.classList.add(r):s.add(be((()=>Boolean(t.exec(i))),(t=>{t?e.classList.add(r):e.classList.remove(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(y,s,t.classes,t.attrs.class),O=function(e,t,n,r){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};if(r){const n=[e.getAttribute("style")||"",t.exec(r)||""].filter(Boolean).join(";");n&&e.setAttribute("style",n)}let s=new Set;for(const[r,i]of Object.entries(n))s.add(be((()=>$e(r,t.exec(i))),(t=>{t?e.style.setProperty(r,...t):e.style.removeProperty(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(y,s,t.styles,t.attrs.style);p.mount();const E=function(t,n,r,s,i,o){let a=new Set;for(const[l,{attrs:c,value:u,events:f,bind:d}]of Object.entries(n)){if(!Re(s,l))continue;const h=s[l];if("function"!=typeof h)continue;let p=!1;const g=new e.Signal.State(!1),m=h?.events,b=[],v=Object.create(null),y=new Set,w=new je;function x(e,t){if("function"!=typeof t)return;const[n,...s]=e.split(".").filter(Boolean),i=m?m[n].filters:{};if(!i)return;const o={},a=Te(s,i,o);b.push([n,Me(r,t,a),o])}function S(){if(!p){p=!0,g.set(!0);for(const e of y)e();w.emit("destroy")}}a.add(S);for(const[E,C]of Object.entries(c)){const A=r.get(C);A&&Object.defineProperty(v,E,{...A,configurable:!0,enumerable:!0})}for(const[$,j]of Object.entries(f)){const L=r.getEvent(j);L&&x($,L)}if(d){for(const[T,M]of Object.entries(r.getBindAll(d)||{}))Object.defineProperty(v,T,{...M,configurable:!0,enumerable:!0});for(const[N,k]of Object.entries(r.bindEvents(d)||{}))x(N,(e=>k(e)))}const O={get value(){return null},events:b,attrs:v,watch(e,t){if(p)return()=>{};let n=v[e];const r=be((()=>v[e]),(r=>{const s=n;n=r,t(r,s,e)}),!0);return y.add(r),()=>{y.delete(r),r()}},get destroyed(){return g.get()},listen:(e,t)=>w.listen(e,t),root:i,slot:o,tag:t};if(u){const I=r.get(u);I&&Object.defineProperty(O,"value",{...I,configurable:!0,enumerable:!0})}h(O)}return()=>{const e=a;a=new Set;for(const t of e)t()}}(p.tag,t.enhancements,s,a,y,w);return()=>{E(),p.destroy(),y.remove(),m(),x(),b(),S(),O()}}function De(e,t,n){if(!n)return t;const r=Object.entries(n);if(!r.length)return t;const s=Object.create(t);for(const[t,n]of r)s[t]=[n,e];return s}function We(t,n,r,s,i,o,a,l,c){if("string"==typeof t){const e=document.createTextNode(t);return n.insertBefore(e,r),()=>e.remove()}const u=s.set(t.vars),f=De(u,i,t.templates);if("divergent"===t.type)return _e(t,n,r,u,((e,t,s)=>{const f=u.set(t),d=De(f,i,s);return Ke(e,n,r,f,d,o,a,l,c)}));if("value"===t.type){const e=u.child(t.name);return e?Ke(t.children,n,r,e,f,o,a,l,c):()=>{}}if("enum"===t.type){const s=u.enum(t.value),i=(e,r)=>Ke(t.children,n,e,r,f,o,a,l,c);return s instanceof Q?function(t,n,r,s,i){const o=t.insertBefore(document.createComment(""),n);let a=new Map;function l(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const c=new e.Signal.State(0),u=be((()=>r.children),(function(e){if(!o.parentNode)return;let n=o.nextSibling;const u=a;a=new Map,c.set(e.length);for(let o of e){const e=u.get(o);if(!e){const e=t.insertBefore(document.createComment(""),n),l=t.insertBefore(document.createComment(""),n),u=i(l,s.setStore(o,r,{get count(){return c.get()},get key(){return o.index},get index(){return o.index},get item(){return o.value}}));a.set(o,[e,l,u]);continue}if(u.delete(o),a.set(o,e),n===e[0]){n=e[1].nextSibling;continue}let l=e[0];for(;l&&l!==e[1];){const e=l;l=l.nextSibling,t.insertBefore(e,n)}t.insertBefore(e[1],n)}l(u)}),!0);return()=>{o.remove(),l(a),u()}}(n,r,s,u,i):s instanceof G?function(e,t,n,r,s){const i=[],o=[...n].map((([e,t],n)=>[e,t,n])),a=o.length;for(const[e,l,c]of o)i.push(s(t,r.setStore(l,n,{get count(){return a},get key(){return e},get index(){return c},get item(){return l.value}})));return()=>{for(const e of i)e()}}(0,r,s,u,i):"function"==typeof s?function(t,n,r,s,i){const o=new e.Signal.Computed((()=>{const e=r();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t,t])):Object.entries(e).map((([e,t],n)=>[t,n,e])):[]})),a=t.insertBefore(document.createComment(""),n);let l=[];function c(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const u=new e.Signal.State(0),f=be((()=>o.get()),(function(n){if(!a.parentNode)return;let r=a.nextSibling;const o=l;l=[],u.set(n.length);for(const[a,c,f]of n){const n=o.findIndex((e=>e[3]===f)),[d]=n>=0?o.splice(n,1):[];if(!d){const n=t.insertBefore(document.createComment(""),r),o=t.insertBefore(document.createComment(""),r),d=new e.Signal.State(a),h=new e.Signal.State(c),p=i(o,s.setObject({get count(){return u.get()},get key(){return f},get item(){return d.get()},get index(){return h.get()}}));l.push([n,o,p,f,d,h]);continue}if(l.push(d),d[4].set(a),d[5].set(c),r===d[0]){r=d[1].nextSibling;continue}let h=d[0];for(;h&&h!==d[1];){const e=h;h=h.nextSibling,t.insertBefore(e,r)}t.insertBefore(d[1],r)}c(o)}),!0);return()=>{a.remove(),c(l),f()}}(n,r,s,u,i):()=>{}}if("content"===t.type)return qe(n,r,u,t.value,t.html);if("template"===t.type){const e=f[t.template];if(!e)return()=>{};const[s,d]=e,h=d.params(s.params,t.attrs,u,t.bind),p=De(h,i,s.templates);return Ke(s.children,n,r,h,p,o,a,l,c)}return"fragment"===t.type?Ke(t.children,n,r,u,f,o,a,l,c):Ve(t,n,r,u,f,o,a,l,c)}function Ke(e,t,n,r,s,i,o,a,l){const c=e.map((e=>We(e,t,n,r,s,i,o,a,l)));let u=!1;return()=>{if(!u){u=!0;for(const e of c)e()}}}e.Layout=ge,e.Store=Y,e.effect=me,e.render=function(e,t,n,{component:r,global:s,relate:i,enhancements:o}={}){return Ke(t,n,null,new Ce(e,s),Object.create(null),[],o||{},"function"==typeof i?i:null,r)},e.watch=be}));
60
+ function(e){const t=Object.create(T);t.value=e;const n=()=>(h(t),t.value);return n[u]=t,n}(r),l=a[u];if(this[M]=l,l.wrapper=this,i){const t=i.equals;t&&(l.equal=t),l.watched=i[e.subtle.watched],l.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return j.call(this[M])}set(t){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(l)throw new Error("Writes to signals not permitted during Watcher callback");L(this[M],t)}};c=M,p=new WeakSet,e.isComputed=e=>r(p,e),e.Computed=class{constructor(t,r){s(this,p),n(this,c);const i=function(e){const t=Object.create(A);t.computation=e;const n=()=>S(t);return n[u]=t,n}(t),o=i[u];if(o.consumerAllowSignalWrites=!0,this[M]=o,o.wrapper=this,r){const t=r.equals;t&&(o.equal=t),o.watched=r[e.subtle.watched],o.unwatched=r[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return S(this[M])}},(t=>{var o,l,c,u;t.untrack=function(e){let t,n=null;try{n=f(null),t=e()}finally{f(n)}return t},t.introspectSources=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(n=t[M].producerNode)?void 0:n.map((e=>e.wrapper)))??[]},t.introspectSinks=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(n=t[M].liveConsumerNode)?void 0:n.map((e=>e.wrapper)))??[]},t.hasSinks=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called hasSinks without a Signal argument");const n=t[M].liveConsumerNode;return!!n&&n.length>0},t.hasSources=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called hasSources without a Computed or Watcher argument");const n=t[M].producerNode;return!!n&&n.length>0};o=M,l=new WeakSet,c=new WeakSet,u=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>r(l,e),t.Watcher=class{constructor(e){s(this,l),s(this,c),n(this,o);let t=Object.create(d);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[M]=t}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");i(this,c,u).call(this,t);const n=this[M];n.dirty=!1;const r=f(n);for(const e of t)h(e[M]);f(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");i(this,c,u).call(this,t);const n=this[M];w(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){v(n.producerNode[e],n.producerIndexOfThis[e]);const t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){const t=n.producerIndexOfThis[e],r=n.producerNode[e];x(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[M].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},t.currentComputed=function(){var e;return null==(e=a)?void 0:e.wrapper},t.watched=Symbol("watched"),t.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(e.Signal||(e.Signal={}));const N=(t,n,r,s)=>{const i=new e.Signal.State("boolean"==typeof n?n:null);let o;if("function"==typeof r)o=new e.Signal.Computed((()=>Boolean(r(t))));else{const t=Boolean(r);o=new e.Signal.Computed((()=>t))}const a=()=>{const e=i.get();return null===e?o.get():e},l=s?new e.Signal.Computed((()=>s.get()||a())):new e.Signal.Computed(a);return[i,l]},k=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,P=e=>e instanceof RegExp?e:null,U=Boolean;function B(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(B).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const q=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(B).filter(U);return t.length?t:null};function R(t,n,r,s){const i=new e.Signal.State(n(r));let o;if("function"==typeof s){const r=s;o=new e.Signal.Computed((()=>n(r(t))))}else{const t=n(s);o=new e.Signal.Computed((()=>t))}const a=new e.Signal.Computed((()=>{const e=i.get();return null===e?o.get():e}));return[i,a]}const _=Symbol();function V(e){const t={[_]:e};for(const[n,r]of e)Object.defineProperty(t,n,{get:()=>r.ref,configurable:!1,enumerable:!0});return Object.defineProperty(t,_,{get:()=>e,configurable:!1,enumerable:!0}),t}let D=null,W=null,K=Object.create(null);function z(e,t){const n=e.type;let r=Y;if(!e.array||W&&t?.parent instanceof W)if("string"==typeof n){const e=K[n];e&&(r=e)}else n&&"object"==typeof n&&D&&(r=D);else W&&(r=W);return new r(e,t)}function H(e){return e?e instanceof Error?e.message:"string"!=typeof e?"":e:""}function F(t,...n){const r=n.flat().filter((e=>"function"==typeof e));if(!r.length)return[()=>Promise.resolve([]),new e.Signal.Computed((()=>[])),()=>{}];const s=new e.Signal.State([]);let i=null;return[function(){i?.abort(),i=new AbortController;const e=i.signal;return s.set([]),Promise.all(r.map((n=>async function(e,n){let r=[];try{r.push(await e(t,n))}catch(e){r.push(e)}const i=r.flat().map(H).filter(Boolean);return!n.aborted&&i.length&&s.set([...s.get(),...i]),i}(n,e)))).then((e=>e.flat()))},new e.Signal.Computed((()=>s.get())),()=>{i?.abort(),s.set([])}]}class Y{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let i=r.get(s);return i||(i=new Set,r.set(s,i)),i.add(n),()=>{i?.delete(n)}}static create(e,t={}){return z({type:e},{...t,parent:null})}static setStore(e,t){return function(e,t){K[e]=t}(e,t)}#t=!1;get null(){return this.#t}get kind(){return""}#n=null;get ref(){return this.#n||V(this)}constructor(t,{null:n,state:r,ref:s,setValue:i,setState:o,convert:a,onUpdate:l,onUpdateState:c,validator:u,validators:f,index:d,size:h,new:p,parent:g,hidden:m,clearable:b,required:v,disabled:y,readonly:w,label:x,description:S,placeholder:O,min:E,max:C,step:A,minLength:$,maxLength:j,pattern:L,values:T}={}){this.schema=t,this.#r.set("object"==typeof r&&r||{});const M=g instanceof Y?g:null;M&&(this.#s=M,this.#i=M.#i),this.#o=t.type,this.#a=t.meta,this.#l=t.component;const U=new e.Signal.State(Boolean(p));this.#c=U;const B=M?new e.Signal.Computed((()=>M.#u.get()||U.get())):new e.Signal.Computed((()=>U.get()));this.#u=B;const _=Boolean(t.immutable),D=!1!==t.creatable;this.#f=_,this.#d=D;const W=t.readonly,K=new e.Signal.State("boolean"==typeof w?w:null);let z;if("function"==typeof W)z=new e.Signal.Computed((()=>Boolean(W(this))));else{const t=Boolean(W);z=new e.Signal.Computed((()=>t))}const G=()=>{if(B.get()?!D:_)return!0;const e=K.get();return null===e?z.get():e},Q=M?M.#h:null;this.#p=K,this.#h=Q?new e.Signal.Computed((()=>Q.get()||G())):new e.Signal.Computed(G),[this.#g,this.#m]=N(this,m,t.hidden,M?M.#m:null),[this.#b,this.#v]=N(this,b,t.clearable,M?M.#v:null),[this.#y,this.#w]=N(this,v,t.required,M?M.#w:null),[this.#x,this.#S]=N(this,y,t.disabled,M?M.#S:null),[this.#O,this.#E]=R(this,k,x,t.label),[this.#C,this.#A]=R(this,k,S,t.description),[this.#$,this.#j]=R(this,k,O,t.placeholder),[this.#L,this.#T]=R(this,I,E,t.min),[this.#M,this.#N]=R(this,I,C,t.max),[this.#k,this.#I]=R(this,I,A,t.step),[this.#P,this.#U]=R(this,I,$,t.minLength),[this.#B,this.#q]=R(this,I,j,t.maxLength),[this.#R,this.#_]=R(this,P,L,t.pattern),[this.#V,this.#D]=R(this,q,T,t.values);const Z=function(t,...n){const r=n.flat().filter((e=>"function"==typeof e));return r.length?new e.Signal.Computed((()=>{const e=[];for(const n of r)try{e.push(n(t))}catch(t){e.push(t)}return e.flat().map(H).filter(Boolean)})):new e.Signal.Computed((()=>[]))}(this,t.validator,u),[X,J,ee]=F(this,t.validators?.change,f?.change),[te,ne,re]=F(this,t.validators?.blur,f?.blur);if(this.listen("change",(()=>{X()})),this.listen("blur",(()=>{te()})),this.#W=function(...t){const n=t.filter(Boolean);return new e.Signal.Computed((()=>n.flatMap((e=>e.get()))))}(Z,J,ne),this.#K=Z,this.#z=X,this.#H=te,this.#F=ee,this.#Y=re,h instanceof e.Signal.State||h instanceof e.Signal.Computed?this.#G=h:this.#G=new e.Signal.State(h||0),n)return this.#t=!0,void(this.#n=V(this));this.#n=s||null,this.#Q=l||null,this.#Z=c||null,this.#X="function"==typeof i?i:null,this.#J="function"==typeof o?o:null,this.#ee="function"==typeof a?a:null,this.#te.set(d??"");for(const[e,n]of Object.entries(t.events||{}))"function"==typeof n&&this.listen(e,n)}#X=null;#J=null;#ee=null;#Q=null;#Z=null;#s=null;#i=this;#o;#a;#l;get store(){return this}get parent(){return this.#s}get root(){return this.#i}get type(){return this.#o}get meta(){return this.#a}get component(){return this.#l}#G;get size(){return this.#G.get()}#te=new e.Signal.State("");get index(){return this.#te.get()}set index(e){this.#te.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#d=!0;get creatable(){return this.#d}#f=!1;get immutable(){return this.#f}#u;#c;get selfNew(){return this.#c.get()}set selfNew(e){this.#c.set(Boolean(e))}get new(){return this.#u.get()}set new(e){this.#c.set(Boolean(e))}#g;#m;get selfHidden(){return this.#g.get()}set selfHidden(e){this.#g.set("boolean"==typeof e?e:null)}get hidden(){return this.#m.get()}set hidden(e){this.#g.set("boolean"==typeof e?e:null)}#b;#v;get selfClearable(){return this.#b.get()}set selfClearable(e){this.#b.set("boolean"==typeof e?e:null)}get clearable(){return this.#v.get()}set clearable(e){this.#b.set("boolean"==typeof e?e:null)}#y;#w;get selfRequired(){return this.#y.get()}set selfRequired(e){this.#y.set("boolean"==typeof e?e:null)}get required(){return this.#w.get()}set required(e){this.#y.set("boolean"==typeof e?e:null)}#x;#S;get selfDisabled(){return this.#x.get()}set selfDisabled(e){this.#x.set("boolean"==typeof e?e:null)}get disabled(){return this.#S.get()}set disabled(e){this.#x.set("boolean"==typeof e?e:null)}#p;#h;get selfReadonly(){return this.#p.get()}set selfReadonly(e){this.#p.set("boolean"==typeof e?e:null)}get readonly(){return this.#h.get()}set readonly(e){this.#p.set("boolean"==typeof e?e:null)}#O;#E;get selfLabel(){return this.#O.get()}set selfLabel(e){this.#O.set(k(e))}get label(){return this.#E.get()}set label(e){this.#O.set(k(e))}#C;#A;get selfDescription(){return this.#C.get()}set selfDescription(e){this.#C.set(k(e))}get description(){return this.#A.get()}set description(e){this.#C.set(k(e))}#$;#j;get selfPlaceholder(){return this.#$.get()}set selfPlaceholder(e){this.#$.set(k(e))}get placeholder(){return this.#j.get()}set placeholder(e){this.#$.set(k(e))}#L;#T;get selfMin(){return this.#L.get()}set selfMin(e){this.#L.set(I(e))}get min(){return this.#T.get()}set min(e){this.#L.set(I(e))}#M;#N;get selfMax(){return this.#M.get()}set selfMax(e){this.#M.set(I(e))}get max(){return this.#N.get()}set max(e){this.#M.set(I(e))}#k;#I;get selfStep(){return this.#k.get()}set selfStep(e){this.#k.set(I(e))}get step(){return this.#I.get()}set step(e){this.#k.set(I(e))}#P;#U;get selfMinLength(){return this.#P.get()}set selfMinLength(e){this.#P.set(I(e))}get minLength(){return this.#U.get()}set minLength(e){this.#P.set(I(e))}#B;#q;get selfMaxLength(){return this.#B.get()}set selfMaxLength(e){this.#B.set(I(e))}get maxLength(){return this.#q.get()}set maxLength(e){this.#B.set(I(e))}#R;#_;get selfPattern(){return this.#R.get()}set selfPattern(e){this.#R.set(P(e))}get pattern(){return this.#_.get()}set pattern(e){this.#R.set(P(e))}#V;#D;get selfValues(){return this.#V.get()}set selfValues(e){this.#V.set(q(e))}get values(){return this.#D.get()}set values(e){this.#V.set(q(e))}#W;#K;#z;#H;#F;#Y;get errors(){return this.#W.get()}get error(){return this.#W.get()[0]}*[Symbol.iterator](){}child(e){return null}#ne=!1;#re=new e.Signal.State(null);#se=new e.Signal.State(this.#re.get());#r=new e.Signal.State(null);get changed(){return this.#se.get()===this.#re.get()}get value(){return this.#se.get()}set value(e){const t=this.#X?.(e),n=void 0===t?e:t;this.#se.set(n),this.#ne||this.#re.set(n),this.#Q?.(n,this.#te.get(),this),this.#ie()}get state(){return this.#r.get()}set state(e){const t=this.#J?.(e),n=void 0===t?e:t;this.#r.set(n),this.#Z?.(n,this.#te.get(),this),this.#ie()}#ie(){this.#oe||(this.#oe=!0,queueMicrotask((()=>{const e=this.#se.get(),t=this.#r.get();this.#ae(e,t)})))}reset(e=this.#re.get()){this.#le(e)}#le(e){const t=this.#X?.(e),n=void 0===t?e:t;if(this.#F(),this.#Y(),this.#ne=!0,!n||"object"!=typeof n){for(const[,e]of this)e.#le(null);return this.#se.set(n),this.#re.set(n),n}const r=Array.isArray(n)?[...n]:{...n};for(const[e,t]of this)r[e]=t.#le(r[e]);return this.#se.set(r),this.#re.set(r),this.#Q?.(r,this.#te.get(),this),r}#oe=!1;#ce(e,t){const[n,r]=this.#ee?.(e,t)||[e,t];return this.#se.get()===n&&this.#r.get()===r?[n,r]:(this.#se.set(n),this.#r.set(r),this.#ae(n,r))}#ae(e,t){this.#oe=!1;let n=e;if(e&&"object"==typeof e){let r=Array.isArray(e)?[...e]:{...e},s=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},i=!1;for(const[n,o]of this){const a=e[n],l=t?.[n],[c,u]=o.#ce(a,l);a!==c&&(r[n]=c,i=!0),l!==u&&(s[n]=u,i=!0)}i&&(t=s,n=e=r,this.#se.set(e),this.#r.set(s))}return this.#ne||(this.#ne=!0,this.#re.set(n)),[e,t]}validate(e){if(!Array.isArray(e))return Promise.all([this.#K.get(),this.#z(),this.#H()]).then((e=>{const t=e.flat();return t.length?t:null}));const t=[this.validate().then((t=>t?.length?[{path:[...e],store:this,errors:t}]:[]))];for(const[n,r]of this)t.push(r.validate([...e,n]));return Promise.all(t).then((e=>e.flat()))}}class G extends Y{get kind(){return"object"}#ue;*[Symbol.iterator](){yield*Object.entries(this.#ue)}child(e){return this.#ue[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:i}={}){const o=Object.entries(e.type);super(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:i,size:o.length,setValue:e=>"object"==typeof e?e:null,setState:e=>"object"==typeof e?e:null,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const a=Object.create(null),l={parent:this,onUpdate:(e,t,n)=>{n===this.#ue[t]&&(this.value={...this.value,[t]:e})},onUpdateState:(e,t,n)=>{n===this.#ue[t]&&(this.state={...this.state,[t]:e})}};for(const[e,t]of o)a[e]=z(t,{...l,index:e});this.#ue=a}}D=G;class Q extends Y{#fe=()=>{throw new Error};#ue;get children(){return[...this.#ue.get()]}*[Symbol.iterator](){return yield*[...this.#ue.get().entries()]}child(e){const t=this.#ue.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(t,{parent:n,onUpdate:r,onUpdateState:s,index:i,new:o}={}){const a=new e.Signal.State([]),l=e=>{const t=Array.isArray(e)&&e.length||0,n=[...a.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#fe(e));n.length=t,r!==t&&a.set(n)};super(t,{index:i,new:o,parent:n,size:new e.Signal.Computed((()=>a.get().length)),state:[],setValue:e=>Array.isArray(e)?e:null==e?null:[e],setState:e=>Array.isArray(e)?e:null==e?null:[e],convert(e,t){const n=Array.isArray(e)?e:null==e?null:[e];return l(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t,n)=>{l(e),r?.(e,t,n)},onUpdateState:s}),this.#ue=a;const c={parent:this,onUpdate:(e,t,n)=>{if(a.get()[t]!==n)return;const r=[...this.value||[]];r.length<t&&(r.length=t),r[t]=e,this.value=r},onUpdateState:(e,t,n)=>{if(a.get()[t]!==n)return;const r=[...this.state||[]];r.length<t&&(r.length=t),r[t]=e,this.state=r}};this.#fe=(e,n)=>{const r=z(t,{...c,index:e,new:n});return r.index=e,r}}insert(e,t=null,n){const r=this.value||[];if(!Array.isArray(r))return!1;const s=[...this.#ue.get()],i=Math.max(0,Math.min(Math.floor(e),s.length)),o=this.#fe(i,n);o.new=!0,s.splice(i,0,o);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(i,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(i,0,{}),this.state=e}return this.#ue.set(s),this.value=a,!0}add(e=null){return this.insert(this.#ue.get().length,e)}remove(e){const t=this.value;if(!Array.isArray(t))return;const n=[...this.#ue.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;const i=[...t],[o]=i.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.#ue.set(n),this.value=i,o}move(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#ue.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let i=Math.min(e,t),o=Math.max(e,t);for(let e=i;e<=o;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.#ue.set(r),this.value=a,!0}exchange(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#ue.get()],s=r[e],i=r[t];if(!s||!i)return!1;r[t]=s,r[e]=i,s.index=t,i.index=e;const o=[...n],a=o[e],l=o[t];o[t]=a,o[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.#ue.set(r),this.value=o,!0}}function Z(e){if(!e?.length)return[];const t=[];let n=[],r=Object.create(null),s=!1;for(const t of e){if("string"==typeof t)continue;const e=t.template;if(!e)continue;s=!0;const n=X(t);r[e]={params:t.params,children:n?[n]:[]}}function i(e){e.length&&t.push({type:"divergent",children:e.map((([e,t])=>{const n=X(t);return n?"string"!=typeof n&&"fragment"===n.type?[n,e]:[{children:[n]},e]:[{children:[]},e]}))})}for(const r of e){if("string"==typeof r){i(n),n=[],t.push(r);continue}if(r.template){i(n),n=[];continue}if(n.length&&r.else){const e=r.if||null;n.push([e,r]),e||(i(n),n=[]);continue}i(n),n=[];const e=r.if;if(e){n.push([e,r]);continue}const s=X(r);s&&t.push(s)}return i(n),s?[{type:"fragment",templates:r,children:t}]:t}function X(e){let t=function(e){const t=e.fragment;if(t&&"string"==typeof t)return{type:"template",template:t,attrs:e.attrs,children:[]};const n=function({text:e,html:t}){return null!=e?{type:"content",value:e}:null!=t?{type:"content",value:t,html:!0}:void 0}(e),r=n?[n]:Z(e.children);return!e.name||t?n||{type:"fragment",children:r}:{name:e.name,is:e.is,attrs:e.attrs,events:e.events,classes:e.classes,styles:e.styles,enhancements:e.enhancements,bind:e.bind,comment:e.comment,children:r}}(e),n=e.vars;n.length&&t&&"string"!=typeof t&&(t.vars?t.vars=[...n,...t.vars]:t?t.vars=n:t={type:"fragment",vars:n,children:[]},n=null);const r=e.enum,s=e.value;return r&&(t={type:"enum",value:r,vars:n,children:t?[t]:[]},n=null),s&&(t={type:"value",name:s,vars:n,children:t?[t]:[]},n=null),n?.length&&(t={type:"fragment",vars:n,children:t?[t]:[]}),t}!function(e){W=e}(Q);const J=/^([+-]?(\d(_?\d)*(\.(\d(_?\d)*)?)?|\.\d(_?\d)*)(?:e[+-]?\d(_?\d)*)|0(b[01](?:_?[01])*|o[0-7](?:_?[0-7])*|x[\dA-F](?:_?[\dA-F])*))$/is;const ee={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class te extends Error{constructor(e,...t){const n=ee[e];super("function"==typeof n?n(...t):n),this.code=e}}const ne=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,re=/^~(?<enhancement>[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_\d\.]*)(?:(?<decorator>[:@!])(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*))?$/u,se=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function ie(e,t){const n=e[t];if(n)return n;const r={attrs:Object.create(null),events:Object.create(null)};return e[t]=r,r}function oe(e,t){const n=e.replace(/$\s+|\s+$/gs,"");if("null"===n)return{value:null};if("true"===n)return{value:!0};if("false"===n)return{value:!1};const r=function(e){return J.test(e)?Number(e.replaceAll("_","")):NaN}(n);return Number.isNaN(r)?se.test(n)?{name:n}:{calc:t(e)}:{value:r}}function ae(e,t,n,r,s){const{attrs:i,events:o,classes:a,styles:l,vars:c,params:u,enhancements:f}=e;return function(d,h){const p=d.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"),g=(ne.exec(p)||re.exec(p))?.groups;if(!g)throw new te("ATTR",d);const{name:m,enhancement:b}=g,v=g.decorator?.toLowerCase();if(b){if(":"===v)ie(f,b).attrs[m]=h?oe(h,t):{name:m};else if("@"===v)ie(f,b).events[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m};else if("!"===v){if("bind"===m)ie(f,b).bind=h||!0}else ie(f,b).value=oe(h,t);return}if(!v)return void(i[m]={value:h});if(":"===v)return void(i[m]=h?oe(h,t):{name:m});if("."===v)return void(a[m]=h?oe(h,t):{name:m});if("style:"===v)return void(l[m]=oe(h,t));if("@"===v)return void(o[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m});if("+"===v)return void c.push({...h?oe(h,n):{value:void 0},variable:m,init:!0});if("*"===v)return void c.push({...oe(h,t),variable:m,init:!1});if("?"===v)return void(u[m]=oe(h,t));if("!"!==v)return;switch(m.toString()){case"fragment":e.fragment=h||!0;break;case"else":e.else=!0;break;case"enum":e.enum=h?oe(h,t):{value:!0};break;case"if":e.if=oe(h,t);break;case"text":e.text=oe(h,t);break;case"html":s&&(e.html=oe(h,t));break;case"template":e.template=h;break;case"bind":e.bind=h||!0;break;case"value":e.value=h;break;case"comment":e.comment=h}}}function le(e,t){return{name:e,is:t,children:[],attrs:Object.create(null),events:Object.create(null),classes:Object.create(null),styles:Object.create(null),vars:[],params:Object.create(null),enhancements:Object.create(null)}}var ce={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};const ue=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function fe(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function de(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function he(...e){console.error(new te(...e))}function pe(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in ce?ce[t]:(he("ENTITY",e),e)}var ge=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new te("CALC")},createInit:n=t,createEvent:r=()=>{throw new te("EVENT")},simpleTag:s=new Set,enableHTML:i=!1}={}){const o=[],a={children:o},l=[];let c=null,u=a;function f(){c=l.pop()||null,u=c||a}function d(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&u.children.push(e)}let h={},p=0;function g(t){if(t<=p)return;d(e.substring(p,t).replace(/&#?\w+;/g,pe)),p=t}for(;;){const m=e.indexOf("<",p);if(m<0){const $=e.substring(p);$.match(/^\s*$/)||d($);break}m>p&&g(m);const b=e.charAt(m+1);if("!"===b){let j=m+2,L=">";if("--"===e.slice(m+2,m+4)&&(j+=4,L="--\x3e"),p=e.indexOf(L,j),p<0)break;p++;continue}if("/"===b){p=e.indexOf(">",m+3);let T=e.substring(m+2,p);if(p<0?(T=e.substring(m+2).replace(/[\s<].*/,""),he("UNCOMPLETED",T,c?.name),p=m+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),he("UNCOMPLETED",T),p=m+1+T.length),c){const M=c.name;if(M===T)f();else{if(M.toLowerCase()!=T.toLowerCase())throw new te("CLOSE",T,c.name);f()}}p++;continue}function v(t){let n=p+1;if(p=e.indexOf(t,n),p<0)throw new te("QUOTE",t);const r=e.slice(n,p).replace(/&#?\w+;/g,pe);return p++,r}function y(){let t=e.charAt(p);for(;t<=" "||"€"===t;t=e.charAt(++p));return t}function w(){let t=p,n=e.charAt(p);for(;fe(n);)p++,n=e.charAt(p);return e.slice(t,p)}p=m+1;let x=e.charAt(p);switch(x){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case">":case"/":throw new te("SYMBOL",x);case"":throw new te("EOF")}const S=w(),O=ue.exec(S)?.groups;if(!O)throw new te("TAG",S);l.push(c),c=le(O.name,O.is),u.children.push(c),u=c;const E=ae(c,t,n,r,i);let C=!0,A=!1;e:for(;C;){let N=y();switch(N){case"":he("EOF"),p++;break e;case">":p++;break e;case"/":A=!0;break e;case'"':case"'":throw new te("ATTR_VALUE");case"=":throw new te("SYMBOL",N)}const k=w();if(!k){he("EOF"),p++;break e}switch(N=y(),N){case"":he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),A=!0;break e;case"=":p++;break;case"'":case'"':E(k,v(N));continue;default:E(k,"");continue}switch(N=y(),N){case"":E(k,""),he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),A=!0;break e;case"'":case'"':E(k,v(N));continue}E(k,w())}if(A){for(;;){p++;const I=e.charAt(p);if("/"!==I&&!(I<=" "||"€"===I))break}switch(e.charAt(p)){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case"":he("EOF");break;case">":p++;break;default:throw new te("CLOSE_SYMBOL")}f()}else(s.has(S)||de(e,p,S,h))&&f()}return Z(o)}});function me(t){let n=!0;const r=new e.Signal.subtle.Watcher((()=>{n&&(n=!1,queueMicrotask((()=>{n=!0;for(const e of r.getPending())e.get();r.watch()})))})),s=new e.Signal.Computed(t);return r.watch(s),s.get(),()=>{r.unwatch(s)}}function be(e,t,n){let r,s=!1;return me((()=>{const i=e();if(!s)return s=!0,r=i,void(n&&t(i));Object.is(i,r)||(r=i,t(i))}))}const ve=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,ref:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,changed:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,minLength:!0,maxLength:!0,pattern:!0,values:!0,null:!0,index:!0,no:!0,size:!0,error:!0,errors:!0}));function*ye(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of ve)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],yield[`${t}${n}reset`,{exec:()=>e.reset()}],yield[`${t}${n}validate`,{exec:t=>e.validate(t?[]:null)}],e instanceof Q&&(yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}])}function we(e,t,n){for(const[n,r]of t){for(const[t,s]of ye(r,n))e[t]=s;for(const[t,s]of ye(r,n,"$$"))e[t]=s}}const xe={value$:{calc:e=>e?.[_].value},state$:{calc:e=>e?.[_].state}};var Se=Object.getOwnPropertyDescriptors(xe);function Oe(e){if(!e)return!1;const t=e.indexOf("$");return t<0||(e.indexOf("$",t+2)>0||"$"===e[0]&&"_$".includes(e[1]))}function Ee(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class Ce{exec({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#de[e];if("function"!=typeof t?.get)return;return t.get()}return"function"==typeof t?t(this.getters):n}get({name:t,calc:n,value:r}){if("string"==typeof t){const e=this.#de[t];if("function"!=typeof e?.get)return;const{get:n,set:r}=e;return{get:n,set:r}}if("function"==typeof n){const t=new e.Signal.Computed((()=>n(this.getters)));return{get:()=>t.get()}}return{get:()=>r}}watch(e,t){return be((()=>this.exec(e)),t,!0)}enum(e){const{name:t,calc:n}=e;if("function"==typeof n)return()=>n(this.getters);if("string"==typeof t){const e=this.#de[t];if("function"!=typeof e?.get)return null;const n=e.store;return n instanceof Y?n:e.get}return this.store}getStore(e){if(!e)return null;const t=this.#de[!0===e?"":e];return t?.get&&t.store||null}bind(e,t,n){const r=this.#de[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?ve.has(t)?be((()=>s[t]),n,!0):void 0:"value"===t?be((()=>r.get()),n,!0):void 0}bindAll(e){const t=this.#de[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>be(e,t,!0)}}return Object.fromEntries([...ve].map((e=>[`$${e}`,t=>be((()=>n[e]),t,!0)])))}getBindAll(e){const t=this.#de[!0===e?"":e];if(!t?.get)return{};const{store:n}=t;if(!n){const{get:e,set:n}=t;return{$value:{get:e,set:n}}}return Object.fromEntries([...ve].map((e=>[`$${e}`,"value"===e||"state"===e?{get:()=>n[e],set:t=>{n[e]=t}}:{get:()=>n[e]}])))}bindSet(e,t){const n=this.#de[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#de[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)},$reset:e=>{n.reset()},$validate:e=>{n.validate(e?[]:null)}}}getEvent({name:e,event:t}){if("function"==typeof t)return t;const n=this.#de[e];if(!n)return null;const{exec:r,calc:s}=n;return"function"==typeof r?r:"function"==typeof s?s:null}constructor(e,t){if(this.store=e,t instanceof Ce){this.#he=t.#he;const e=this.#pe;for(const[n,r]of Object.entries(t.#pe))e[n]=r;const n=this.#ge;for(const[e,r]of Object.entries(t.#ge))n[e]=r}else we(this.#pe,e),this.#he=function(e){const t=Object.create(null,Se);if(!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!Oe(n))continue;if(!r||"object"!=typeof r)continue;if(r instanceof Y){for(const[e,s]of ye(r,n))t[e]=s;continue}const{get:e,set:s,exec:i,calc:o}=r;"function"!=typeof e?"function"!=typeof o?"function"!=typeof i||(t[n]={exec:i}):t[n]={calc:o}:t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#he;#pe=Object.create(null);#ge=Object.create(null);store;#me=null;#s=null;#be=null;get#de(){const e=this.#be;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#pe,...this.#he,...this.#ge})),n=this.store,r=this.#s,s=this.#me;for(const[e,r]of ye(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof Q))return yield[`${n}${r}upMovable`,{get:()=>!1}],void(yield[`${n}${r}downMovable`,{get:()=>!1}]);yield[`${n}${r}upMovable`,{get:()=>{const e=t.index;return"number"==typeof e&&!(e<=0)}}],yield[`${n}${r}downMovable`,{get:()=>{const n=t.index;return"number"==typeof n&&!(n>=e.size-1)}}],yield[`${n}${r}remove`,{exec:()=>e.remove(Number(t.index))}],yield[`${n}${r}upMove`,{exec:()=>{const n=t.index;"number"==typeof n&&(n<=0||e.move(n,n-1))}}],yield[`${n}${r}downMove`,{exec:()=>{const n=t.index;"number"==typeof n&&(n>=e.size-1||e.move(n,n+1))}}]}(r,n))t[e]=s;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};return this.#be=t,t}setStore(e,t,n){const r=new Ce(e,this);return t&&(r.#s=t),we(r.#pe,e),n&&(r.#me=n),r}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new Ce(t,this);return we(n.#pe,t),n}params(t,n,r,s){let i=this.store;if(!0===s)i=r.store;else if(s){const e=r.#de[s],t=e?.get&&e.store;t&&(i=t)}if(0===Object.keys(t).length)return this;const o=new Ce(i,this);o.#s=this.#s,o.#me=this.#me;const a=o.#ge,l=o.#de;for(const[s,i]of Object.entries(t)){const t=s in n?n[s]:null;if(t){const{name:n,calc:i,value:o}=t;if(n){const e=r.#de[n];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ye(e.store,s))a[t]=l[t]=n;continue}if("function"==typeof i){const t=new e.Signal.Computed((()=>i(r.getters)));a[s]=l[s]={get:()=>t.get()};continue}a[s]=l[s]={get:()=>o}}else{const{name:t,calc:n,value:r}=i;if("function"==typeof n){const t=o.getters;o.#ve=null;const r=new e.Signal.Computed((()=>n(t)));a[s]=l[s]={get:()=>r.get()};continue}if(t){const e=l[t];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ye(e.store,s))a[t]=l[t]=n;continue}a[s]=l[s]={get:()=>r}}}return o}setObject(e){const t=new Ce(this.store,this);return t.#me=e,t}set(t){if(!t?.length)return this;const n=new Ce(this.store,this);n.#s=this.#s,n.#me=this.#me;const r=n.#ge,s=n.#de;for(const{variable:i,name:o,calc:a,value:l,init:c}of t)if(c){const t=new e.Signal.State(l);if("function"==typeof a){const e=n.settable;n.#ye=null,t.set(a(e))}else if(o){const e=s[o];if(!e?.get)continue;t.set(e.get())}r[i]=s[i]={get:()=>t.get(),set:e=>{t.set(e)}}}else if("function"!=typeof a)if(o){const e=s[o];if(!e)continue;if(!e.get||!e.store){r[i]=s[i]=e;continue}for(const[t,n]of ye(e.store,i))r[t]=s[t]=n}else r[i]=s[i]={get:()=>l};else{const t=n.getters;n.#ve=null;const o=new e.Signal.Computed((()=>a(t)));r[i]=s[i]={get:()=>o.get()}}return n}#we=null;get all(){const e=this.#we;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc?Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1}):Object.defineProperty(t,e,{value:n.exec,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#we=t,t}#ye=null;get settable(){const e=this.#ye;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#ye=t,t}#ve=null;get getters(){const e=this.#ve;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#ve=t,t}}const Ae={width:"px",height:"px",top:"px",right:"px",bottom:"px",left:"px",border:"px","border-top":"px","border-right":"px","border-left":"px","border-bottom":"px","border-width":"px","border-top-width":"px","border-right-width":"px","border-left-width":"px","border-bottom-width":"px","border-radius":"px","border-top-left-radius":"px","border-top-right-radius":"px","border-bottom-left-radius":"px","border-bottom-right-radius":"px",padding:"px","padding-top":"px","padding-right":"px","padding-left":"px","padding-bottom":"px",margin:"px","margin-top":"px","margin-right":"px","margin-left":"px","margin-bottom":"px"};function $e(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in Ae?`${s}${Ae[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class je{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let i=r.get(s);return i||(i=new Set,r.set(s,i)),i.add(n),()=>{i?.delete(n)}}}const Le={stop(e){e instanceof Event&&e.stopPropagation()},prevent(e){e instanceof Event&&e.preventDefault()},self(e){if(e instanceof Event)return e.target===e.currentTarget},enter(e){if(e instanceof KeyboardEvent)return"Enter"===e.key},tab(e){if(e instanceof KeyboardEvent)return"Tab"===e.key},esc(e){if(e instanceof KeyboardEvent)return"Escape"===e.key},space(e){if(e instanceof KeyboardEvent)return" "===e.key},backspace(e){if(e instanceof KeyboardEvent)return"Backspace"===e.key},delete(e){if(e instanceof KeyboardEvent)return"Delete"===e.key},delBack(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},"del-back"(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},insert(e){if(e instanceof KeyboardEvent)return"Insert"===e.key},repeat(e){if(e instanceof KeyboardEvent)return e.repeat},key(e,t){if(e instanceof KeyboardEvent){const n=e.code.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},main(e){if(e instanceof MouseEvent)return 0===e.button},auxiliary(e){if(e instanceof MouseEvent)return 1===e.button},secondary(e){if(e instanceof MouseEvent)return 2===e.button},left(e){if(e instanceof MouseEvent)return 0===e.button},middle(e){if(e instanceof MouseEvent)return 1===e.button},right(e){if(e instanceof MouseEvent)return 2===e.button},primary(e){if(e instanceof PointerEvent)return e.isPrimary},mouse(e){if(e instanceof PointerEvent)return"mouse"===e.pointerType},pen(e){if(e instanceof PointerEvent)return"pen"===e.pointerType},touch(e){if(e instanceof PointerEvent)return"touch"===e.pointerType},pointer(e,t){if(e instanceof PointerEvent){const n=e.pointerType.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},ctrl(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey},alt(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.altKey},shift(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.shiftKey},meta(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.metaKey},cmd(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey||e.metaKey}};function Te(e,t,n){const r=[];if(t)for(let s=e.shift();s;s=e.shift()){const e=s.indexOf(":"),i=e>=0?s.slice(0,e):s,o=e>=0?s.slice(e+1).split(":"):[],a=i.replace(/^-+/,""),l=(i.length-a.length)%2==1;let c=t[a]||a;if(n)switch(c){case"once":case"passive":case"capture":n[c]=!l;continue}"string"==typeof c&&(c=Le[c]),"function"==typeof c&&r.push([c,o,l])}return r}function Me(e,t,n){return r=>{const s=e.all;for(const[e,t,i]of n)if(e(r,t,s)===i)return;t(r,s)}}function Ne(e){return"number"==typeof e||"bigint"==typeof e?String(e):"boolean"==typeof e?e?"":null:"string"==typeof e?e:null===(e??null)?null:String(e)}function ke(e){return null===(e??null)?"":String(e)}function Ie(e,t){if(e instanceof HTMLInputElement&&"checked"===t)switch(e.type.toLowerCase()){case"checkbox":case"radio":return Boolean}if((e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&"value"===t)return ke;if(e instanceof HTMLDetailsElement&&"open"===t)return Boolean;if(e instanceof HTMLMediaElement){if("muted"===t)return Boolean;if("paused"===t)return Boolean;if("currentTime"===t)return!0;if("playbackRate"===t)return!0;if("volume"===t)return!0}return!1}const Pe={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=ke(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["change",(e,t)=>t.value]}}};function Ue(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watch:s,props:i}=e;return["input","textarea","select"].includes(t.toLowerCase())&&e.relate(r),e.listen("init",(({events:n})=>{const o=Pe[t.toLowerCase()],a=o?.attrs||{},l=o?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,i]=n;r.addEventListener(e,(e=>t(i(e,r))),s)}}if(i)for(const[t,n]of Object.entries(e.attrs))if(s(t,(e=>{if(i.has(t))r[t]=e;else{const n=Ne(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),i.has(t))r[t]=n;else{const e=Ne(n);null!==e&&r.setAttribute(t,e)}else for(const[t,n]of Object.entries(e.attrs)){if(r instanceof HTMLInputElement&&"type"===t.toLocaleLowerCase()){const e=Ne(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=Ie(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let i=Ne(n);null!==i&&r.setAttribute(t,i),s(t,(e=>{const n=Ne(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Be(e){return null===(e??null)?"":String(e)}function qe(e,t,n,r,s){if(!s){const s=e.insertBefore(document.createTextNode(""),t),i=n.watch(r,(e=>s.textContent=Be(e)));return()=>{s.remove(),i()}}const i=e.insertBefore(document.createComment(""),t),o=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=i.nextSibling;e&&e!==o;e=i.nextSibling)e.remove()}const c=n.watch(r,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=i.firstChild)e.insertBefore(t,o)}(Be(t))}));return()=>{c(),l(),i.remove(),o.remove()}}const Re=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function _e(e,t,n,r,s){const i=e.children;if(!i.length)return()=>{};const o=t.insertBefore(document.createComment(""),n);let a=null,l=()=>{};const c=be((()=>i.find((([,e])=>!e||r.exec(e)))||null),(e=>{if(e===a)return;a=e,l(),l=()=>{};const t=e?.[0];t&&(l=s(t.children,t.vars,t.templates))}),!0);let u=!1;return()=>{u||(u=!0,c(),l(),l=()=>{},o.remove())}}function Ve(t,n,r,s,i,o,a,l,c){const u=t.bind,f=[...o,t.name],d=c?.(f);if(c&&!d)return()=>{};const{context:h,handler:p}=function(t,n,r,s){const i="string"==typeof t?t:t.tag,{attrs:o,events:a}="string"!=typeof t&&t||{attrs:null,events:null};let l=!1;const c=new e.Signal.State(!1);let u=!1;const f=new e.Signal.State(!1),d=Object.create(null),h=Object.create(null),p=new Set,g=[],m=new je;return{context:{events:g,props:o?new Set(Object.entries(o).filter((([,e])=>e.isProp)).map((([e])=>e))):null,attrs:h,watch(e,t){if(l)return()=>{};const n=d[e];if(!n)return()=>{};let r=n.get();const s=be((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}),!0);return p.add(s),()=>{p.delete(s),s()}},relate(e){if(!r||!s||l)return()=>{};try{const t=s(r,e);return"function"!=typeof t?()=>{}:(p.add(t),()=>{p.delete(t),t()})}catch{return()=>{}}},get destroyed(){return c.get()},get init(){return f.get()},listen:(e,t)=>m.listen(e,t)},handler:{tag:i,set(t,n){if(o&&!(t in o))return;let r=d[t];if(r)return void r.set(n);const s=new e.Signal.State(n);d[t]=s,Object.defineProperty(h,t,{configurable:!0,enumerable:!0,get:s.get.bind(s)})},addEvent(e,t){if("function"!=typeof t)return;const[r,...s]=e.split(".").filter(Boolean),i=a?a[r].filters:{};if(!i)return;const o={},l=Te(s,i,o);g.push([r,Me(n,t,l),o])},destroy(){if(!l){l=!0,c.set(!0);for(const e of p)e();m.emit("destroy")}},mount(){u||(u=!0,f.set(!0),m.emit("init",{events:g}))}}}}(d||t.name,s,s.getStore(u),l),g=d?.attrs,m=g?function(e,t,n,r,s){let i=new Set;for(const[o,a]of Object.entries(r)){if("class"===o||"style"===o)continue;if(o in n){const r=n[o],{name:s,calc:l,value:c}=n[o];if(!s&&!l){e.set(o,c);continue}a.immutable&&e.set(o,t.exec(r)),i.add(t.watch(r,(t=>e.set(o,t))));continue}const r=a.bind;if(!s||!r){e.set(o,a.default);continue}if("string"==typeof r){const n=t.bind(s,r,(t=>e.set(o,t)));n?i.add(n):e.set(o,a.default);continue}if(!Array.isArray(r)){e.set(o,a.default);continue}const[l,c,u]=r;if(!l||"function"!=typeof c)continue;if(!u){const n=!0===s?"":s;i.add(t.watch({name:n},(t=>e.set(o,t)))),e.addEvent(l,((...e)=>{t.all[n]=c(...e)}));continue}const f=t.bind(s,"state",(t=>e.set(o,t)));if(!f)continue;i.add(f);const d=t.bindSet(s,"state");d&&e.addEvent(l,((...e)=>{d(c(...e))}))}return()=>{const e=i;i=new Set;for(const t of e)t()}}(p,s,t.attrs,g,u):function(e,t,n){const r=e.tag;let s=new Set;for(const[i,o]of Object.entries(n)){if("class"===i||"style"===i)continue;const{name:n,calc:a,value:l}=o;if(n||a)if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==i.toLocaleLowerCase())s.add(t.watch(o,(t=>e.set(i,t))));else{const n=t.exec(o);e.set(i,n)}else e.set(i,l)}return()=>{const e=s;s=new Set;for(const t of e)t()}}(p,s,t.attrs);for(const[e,n]of Object.entries(t.events)){const t=s.getEvent(n);t&&p.addEvent(e,t)}const b=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,i]of Object.entries(t.bindAll(n)||{}))"function"==typeof i&&r.add(i((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(p,s,u),v=d?"function"==typeof d.tag?d.tag(h):Ue(h,d.tag,d.is):Ue(h,t.name,t.is),y=Array.isArray(v)?v[0]:v,w=Array.isArray(v)?v[1]:y;n.insertBefore(y,r);const x=w?Ke(t.children||[],w,null,s,i,o,a,l,c):()=>{},S=function(e,t,n,r){if(!(e instanceof Element))return()=>{};r&&(e.className+=" "+t.exec(r));let s=new Set;for(const[r,i]of Object.entries(n))i.value?e.classList.add(r):s.add(be((()=>Boolean(t.exec(i))),(t=>{t?e.classList.add(r):e.classList.remove(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(y,s,t.classes,t.attrs.class),O=function(e,t,n,r){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};if(r){const n=[e.getAttribute("style")||"",t.exec(r)||""].filter(Boolean).join(";");n&&e.setAttribute("style",n)}let s=new Set;for(const[r,i]of Object.entries(n))s.add(be((()=>$e(r,t.exec(i))),(t=>{t?e.style.setProperty(r,...t):e.style.removeProperty(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(y,s,t.styles,t.attrs.style);p.mount();const E=function(t,n,r,s,i,o){let a=new Set;for(const[l,{attrs:c,value:u,events:f,bind:d}]of Object.entries(n)){if(!Re(s,l))continue;const h=s[l];if("function"!=typeof h)continue;let p=!1;const g=new e.Signal.State(!1),m=h?.events,b=[],v=Object.create(null),y=new Set,w=new je;function x(e,t){if("function"!=typeof t)return;const[n,...s]=e.split(".").filter(Boolean),i=m?m[n].filters:{};if(!i)return;const o={},a=Te(s,i,o);b.push([n,Me(r,t,a),o])}function S(){if(!p){p=!0,g.set(!0);for(const e of y)e();w.emit("destroy")}}a.add(S);for(const[E,C]of Object.entries(c)){const A=r.get(C);A&&Object.defineProperty(v,E,{...A,configurable:!0,enumerable:!0})}for(const[$,j]of Object.entries(f)){const L=r.getEvent(j);L&&x($,L)}if(d){for(const[T,M]of Object.entries(r.getBindAll(d)||{}))Object.defineProperty(v,T,{...M,configurable:!0,enumerable:!0});for(const[N,k]of Object.entries(r.bindEvents(d)||{}))x(N,(e=>k(e)))}const O={get value(){return null},events:b,attrs:v,watch(e,t){if(p)return()=>{};let n=v[e];const r=be((()=>v[e]),(r=>{const s=n;n=r,t(r,s,e)}),!0);return y.add(r),()=>{y.delete(r),r()}},get destroyed(){return g.get()},listen:(e,t)=>w.listen(e,t),root:i,slot:o,tag:t};if(u){const I=r.get(u);I&&Object.defineProperty(O,"value",{...I,configurable:!0,enumerable:!0})}h(O)}return()=>{const e=a;a=new Set;for(const t of e)t()}}(p.tag,t.enhancements,s,a,y,w);return()=>{E(),p.destroy(),y.remove(),m(),x(),b(),S(),O()}}function De(e,t,n){if(!n)return t;const r=Object.entries(n);if(!r.length)return t;const s=Object.create(t);for(const[t,n]of r)s[t]=[n,e];return s}function We(t,n,r,s,i,o,a,l,c){if("string"==typeof t){const e=document.createTextNode(t);return n.insertBefore(e,r),()=>e.remove()}const u=s.set(t.vars),f=De(u,i,t.templates);if("divergent"===t.type)return _e(t,n,r,u,((e,t,s)=>{const f=u.set(t),d=De(f,i,s);return Ke(e,n,r,f,d,o,a,l,c)}));if("value"===t.type){const e=u.child(t.name);return e?Ke(t.children,n,r,e,f,o,a,l,c):()=>{}}if("enum"===t.type){const s=u.enum(t.value),i=(e,r)=>Ke(t.children,n,e,r,f,o,a,l,c);return s instanceof Q?function(t,n,r,s,i){const o=t.insertBefore(document.createComment(""),n);let a=new Map;function l(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const c=new e.Signal.State(0),u=be((()=>r.children),(function(e){if(!o.parentNode)return;let n=o.nextSibling;const u=a;a=new Map,c.set(e.length);for(let o of e){const e=u.get(o);if(!e){const e=t.insertBefore(document.createComment(""),n),l=t.insertBefore(document.createComment(""),n),u=i(l,s.setStore(o,r,{get count(){return c.get()},get key(){return o.index},get index(){return o.index},get item(){return o.value}}));a.set(o,[e,l,u]);continue}if(u.delete(o),a.set(o,e),n===e[0]){n=e[1].nextSibling;continue}let l=e[0];for(;l&&l!==e[1];){const e=l;l=l.nextSibling,t.insertBefore(e,n)}t.insertBefore(e[1],n)}l(u)}),!0);return()=>{o.remove(),l(a),u()}}(n,r,s,u,i):s instanceof G?function(e,t,n,r,s){const i=[],o=[...n].map((([e,t],n)=>[e,t,n])),a=o.length;for(const[e,l,c]of o)i.push(s(t,r.setStore(l,n,{get count(){return a},get key(){return e},get index(){return c},get item(){return l.value}})));return()=>{for(const e of i)e()}}(0,r,s,u,i):"function"==typeof s?function(t,n,r,s,i){const o=new e.Signal.Computed((()=>{const e=r();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t,t])):Object.entries(e).map((([e,t],n)=>[t,n,e])):[]})),a=t.insertBefore(document.createComment(""),n);let l=[];function c(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const u=new e.Signal.State(0),f=be((()=>o.get()),(function(n){if(!a.parentNode)return;let r=a.nextSibling;const o=l;l=[],u.set(n.length);for(const[a,c,f]of n){const n=o.findIndex((e=>e[3]===f)),[d]=n>=0?o.splice(n,1):[];if(!d){const n=t.insertBefore(document.createComment(""),r),o=t.insertBefore(document.createComment(""),r),d=new e.Signal.State(a),h=new e.Signal.State(c),p=i(o,s.setObject({get count(){return u.get()},get key(){return f},get item(){return d.get()},get index(){return h.get()}}));l.push([n,o,p,f,d,h]);continue}if(l.push(d),d[4].set(a),d[5].set(c),r===d[0]){r=d[1].nextSibling;continue}let h=d[0];for(;h&&h!==d[1];){const e=h;h=h.nextSibling,t.insertBefore(e,r)}t.insertBefore(d[1],r)}c(o)}),!0);return()=>{a.remove(),c(l),f()}}(n,r,s,u,i):()=>{}}if("content"===t.type)return qe(n,r,u,t.value,t.html);if("template"===t.type){const e=f[t.template];if(!e)return()=>{};const[s,d]=e,h=d.params(s.params,t.attrs,u,t.bind),p=De(h,i,s.templates);return Ke(s.children,n,r,h,p,o,a,l,c)}return"fragment"===t.type?Ke(t.children,n,r,u,f,o,a,l,c):Ve(t,n,r,u,f,o,a,l,c)}function Ke(e,t,n,r,s,i,o,a,l){const c=e.map((e=>We(e,t,n,r,s,i,o,a,l)));let u=!1;return()=>{if(!u){u=!0;for(const e of c)e()}}}e.Layout=ge,e.Store=Y,e.effect=me,e.render=function(e,t,n,{component:r,global:s,relate:i,enhancements:o}={}){return Ke(t,n,null,new Ce(e,s),Object.create(null),[],o||{},"function"==typeof i?i:null,r)},e.watch=be}));
package/index.min.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @neeloong/form v0.12.0
2
+ * @neeloong/form v0.12.1
3
3
  * (c) 2024-2025 Fierflame
4
4
  * @license Apache-2.0
5
5
  */
@@ -57,4 +57,4 @@ function(){throw new Error};function $(){return d(this),this.value}function j(e,
57
57
  * Use of this source code is governed by an MIT-style license that can be
58
58
  * found in the LICENSE file at https://angular.io/license
59
59
  */
60
- function(e){const t=Object.create(L);t.value=e;const n=()=>(d(t),t.value);return n[c]=t,n}(n),a=i[c];if(this[T]=a,a.wrapper=this,s){const t=s.equals;t&&(a.equal=t),a.watched=s[e.subtle.watched],a.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return $.call(this[T])}set(t){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(a)throw new Error("Writes to signals not permitted during Watcher callback");j(this[T],t)}};h=T,p=new WeakSet,e.isComputed=e=>n(p,e),e.Computed=class{constructor(n,s){r(this,p),t(this,h);const o=function(e){const t=Object.create(C);t.computation=e;const n=()=>x(t);return n[c]=t,n}(n),i=o[c];if(i.consumerAllowSignalWrites=!0,this[T]=i,i.wrapper=this,s){const t=s.equals;t&&(i.equal=t),i.watched=s[e.subtle.watched],i.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return x(this[T])}},(o=>{var a,l,c,h;o.untrack=function(e){let t,n=null;try{n=u(null),t=e()}finally{u(n)}return t},o.introspectSources=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(n=t[T].producerNode)?void 0:n.map((e=>e.wrapper)))??[]},o.introspectSinks=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(n=t[T].liveConsumerNode)?void 0:n.map((e=>e.wrapper)))??[]},o.hasSinks=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called hasSinks without a Signal argument");const n=t[T].liveConsumerNode;return!!n&&n.length>0},o.hasSources=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called hasSources without a Computed or Watcher argument");const n=t[T].producerNode;return!!n&&n.length>0};a=T,l=new WeakSet,c=new WeakSet,h=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>n(l,e),o.Watcher=class{constructor(e){r(this,l),r(this,c),t(this,a);let n=Object.create(f);n.wrapper=this,n.consumerMarkedDirty=e,n.consumerIsAlwaysLive=!0,n.consumerAllowSignalWrites=!1,n.producerNode=[],this[T]=n}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[T];n.dirty=!1;const r=u(n);for(const e of t)d(e[T]);u(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[T];y(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){b(n.producerNode[e],n.producerIndexOfThis[e]);const t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){const t=n.producerIndexOfThis[e],r=n.producerNode[e];w(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[T].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},o.currentComputed=function(){var e;return null==(e=i)?void 0:e.wrapper},o.watched=Symbol("watched"),o.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(M||(M={}));const N=(e,t,n,r)=>{const s=new M.State("boolean"==typeof t?t:null);let o;if("function"==typeof n)o=new M.Computed((()=>Boolean(n(e))));else{const e=Boolean(n);o=new M.Computed((()=>e))}const i=()=>{const e=s.get();return null===e?o.get():e},a=r?new M.Computed((()=>r.get()||i())):new M.Computed(i);return[s,a]},k=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,P=e=>e instanceof RegExp?e:null,U=Boolean;function B(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(B).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const q=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(B).filter(U);return t.length?t:null};function R(e,t,n,r){const s=new M.State(t(n));let o;if("function"==typeof r){const n=r;o=new M.Computed((()=>t(n(e))))}else{const e=t(r);o=new M.Computed((()=>e))}const i=new M.Computed((()=>{const e=s.get();return null===e?o.get():e}));return[s,i]}const _=Symbol();function V(e){const t={[_]:e};for(const[n,r]of e)Object.defineProperty(t,n,{get:()=>r.ref,configurable:!1,enumerable:!0});return Object.defineProperty(t,_,{get:()=>e,configurable:!1,enumerable:!0}),t}let D=null,W=null,K=Object.create(null);function z(e,t){const n=e.type;let r=Y;if(!e.array||W&&t?.parent instanceof W)if("string"==typeof n){const e=K[n];e&&(r=e)}else n&&"object"==typeof n&&D&&(r=D);else W&&(r=W);return new r(e,t)}function H(e){return e?e instanceof Error?e.message:"string"!=typeof e?"":e:""}function F(e,...t){const n=t.flat().filter((e=>"function"==typeof e));if(!n.length)return[()=>Promise.resolve([]),new M.Computed((()=>[])),()=>{}];const r=new M.State([]);let s=null;return[function(){s?.abort(),s=new AbortController;const t=s.signal;return r.set([]),Promise.all(n.map((n=>async function(t,n){let s=[];try{s.push(await t(e,n))}catch(e){s.push(e)}const o=s.flat().map(H).filter(Boolean);return!n.aborted&&o.length&&r.set([...r.get(),...o]),o}(n,t)))).then((e=>e.flat()))},new M.Computed((()=>r.get())),()=>{s?.abort(),r.set([])}]}class Y{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}static create(e,t={}){return z({type:e},{...t,parent:null})}static setStore(e,t){return function(e,t){K[e]=t}(e,t)}#t=!1;get null(){return this.#t}get kind(){return""}#n=null;get ref(){return this.#n||V(this)}constructor(e,{null:t,state:n,ref:r,setValue:s,setState:o,convert:i,onUpdate:a,onUpdateState:l,validator:c,validators:u,index:f,size:d,new:h,parent:p,hidden:g,clearable:m,required:b,disabled:v,readonly:y,label:w,description:x,placeholder:O,min:S,max:E,step:C,minLength:A,maxLength:$,pattern:j,values:L}={}){this.schema=e,this.#r.set("object"==typeof n&&n||{});const T=p instanceof Y?p:null;T&&(this.#s=T,this.#o=T.#o),this.#i=e.type,this.#a=e.meta,this.#l=e.component;const U=new M.State(Boolean(h));this.#c=U;const B=T?new M.Computed((()=>T.#u.get()||U.get())):new M.Computed((()=>U.get()));this.#u=B;const _=Boolean(e.immutable),D=!1!==e.creatable;this.#f=_,this.#d=D;const W=e.readonly,K=new M.State("boolean"==typeof y?y:null);let z;if("function"==typeof W)z=new M.Computed((()=>Boolean(W(this))));else{const e=Boolean(W);z=new M.Computed((()=>e))}const G=()=>{if(B.get()?!D:_)return!0;const e=K.get();return null===e?z.get():e},Q=T?T.#h:null;this.#p=K,this.#h=Q?new M.Computed((()=>Q.get()||G())):new M.Computed(G),[this.#g,this.#m]=N(this,g,e.hidden,T?T.#m:null),[this.#b,this.#v]=N(this,m,e.clearable,T?T.#v:null),[this.#y,this.#w]=N(this,b,e.required,T?T.#w:null),[this.#x,this.#O]=N(this,v,e.disabled,T?T.#O:null),[this.#S,this.#E]=R(this,k,w,e.label),[this.#C,this.#A]=R(this,k,x,e.description),[this.#$,this.#j]=R(this,k,O,e.placeholder),[this.#L,this.#T]=R(this,I,S,e.min),[this.#M,this.#N]=R(this,I,E,e.max),[this.#k,this.#I]=R(this,I,C,e.step),[this.#P,this.#U]=R(this,I,A,e.minLength),[this.#B,this.#q]=R(this,I,$,e.maxLength),[this.#R,this.#_]=R(this,P,j,e.pattern),[this.#V,this.#D]=R(this,q,L,e.values);const Z=function(e,...t){const n=t.flat().filter((e=>"function"==typeof e));return n.length?new M.Computed((()=>{const t=[];for(const r of n)try{t.push(r(e))}catch(e){t.push(e)}return t.flat().map(H).filter(Boolean)})):new M.Computed((()=>[]))}(this,e.validator,c),[X,J,ee]=F(this,e.validators?.change,u?.change),[te,ne,re]=F(this,e.validators?.blur,u?.blur);if(this.listen("change",(()=>{X()})),this.listen("blur",(()=>{te()})),this.#W=function(...e){const t=e.filter(Boolean);return new M.Computed((()=>t.flatMap((e=>e.get()))))}(Z,J,ne),this.#K=Z,this.#z=X,this.#H=te,this.#F=ee,this.#Y=re,d instanceof M.State||d instanceof M.Computed?this.#G=d:this.#G=new M.State(d||0),t)return this.#t=!0,void(this.#n=V(this));this.#n=r||null,this.#Q=a||null,this.#Z=l||null,this.#X="function"==typeof s?s:null,this.#J="function"==typeof o?o:null,this.#ee="function"==typeof i?i:null,this.#te.set(f??"");for(const[t,n]of Object.entries(e.events||{}))"function"==typeof n&&this.listen(t,n)}#X=null;#J=null;#ee=null;#Q=null;#Z=null;#s=null;#o=this;#i;#a;#l;get store(){return this}get parent(){return this.#s}get root(){return this.#o}get type(){return this.#i}get meta(){return this.#a}get component(){return this.#l}#G;get size(){return this.#G.get()}#te=new M.State("");get index(){return this.#te.get()}set index(e){this.#te.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#d=!0;get creatable(){return this.#d}#f=!1;get immutable(){return this.#f}#u;#c;get selfNew(){return this.#c.get()}set selfNew(e){this.#c.set(Boolean(e))}get new(){return this.#u.get()}set new(e){this.#c.set(Boolean(e))}#g;#m;get selfHidden(){return this.#g.get()}set selfHidden(e){this.#g.set("boolean"==typeof e?e:null)}get hidden(){return this.#m.get()}set hidden(e){this.#g.set("boolean"==typeof e?e:null)}#b;#v;get selfClearable(){return this.#b.get()}set selfClearable(e){this.#b.set("boolean"==typeof e?e:null)}get clearable(){return this.#v.get()}set clearable(e){this.#b.set("boolean"==typeof e?e:null)}#y;#w;get selfRequired(){return this.#y.get()}set selfRequired(e){this.#y.set("boolean"==typeof e?e:null)}get required(){return this.#w.get()}set required(e){this.#y.set("boolean"==typeof e?e:null)}#x;#O;get selfDisabled(){return this.#x.get()}set selfDisabled(e){this.#x.set("boolean"==typeof e?e:null)}get disabled(){return this.#O.get()}set disabled(e){this.#x.set("boolean"==typeof e?e:null)}#p;#h;get selfReadonly(){return this.#p.get()}set selfReadonly(e){this.#p.set("boolean"==typeof e?e:null)}get readonly(){return this.#h.get()}set readonly(e){this.#p.set("boolean"==typeof e?e:null)}#S;#E;get selfLabel(){return this.#S.get()}set selfLabel(e){this.#S.set(k(e))}get label(){return this.#E.get()}set label(e){this.#S.set(k(e))}#C;#A;get selfDescription(){return this.#C.get()}set selfDescription(e){this.#C.set(k(e))}get description(){return this.#A.get()}set description(e){this.#C.set(k(e))}#$;#j;get selfPlaceholder(){return this.#$.get()}set selfPlaceholder(e){this.#$.set(k(e))}get placeholder(){return this.#j.get()}set placeholder(e){this.#$.set(k(e))}#L;#T;get selfMin(){return this.#L.get()}set selfMin(e){this.#L.set(I(e))}get min(){return this.#T.get()}set min(e){this.#L.set(I(e))}#M;#N;get selfMax(){return this.#M.get()}set selfMax(e){this.#M.set(I(e))}get max(){return this.#N.get()}set max(e){this.#M.set(I(e))}#k;#I;get selfStep(){return this.#k.get()}set selfStep(e){this.#k.set(I(e))}get step(){return this.#I.get()}set step(e){this.#k.set(I(e))}#P;#U;get selfMinLength(){return this.#P.get()}set selfMinLength(e){this.#P.set(I(e))}get minLength(){return this.#U.get()}set minLength(e){this.#P.set(I(e))}#B;#q;get selfMaxLength(){return this.#B.get()}set selfMaxLength(e){this.#B.set(I(e))}get maxLength(){return this.#q.get()}set maxLength(e){this.#B.set(I(e))}#R;#_;get selfPattern(){return this.#R.get()}set selfPattern(e){this.#R.set(P(e))}get pattern(){return this.#_.get()}set pattern(e){this.#R.set(P(e))}#V;#D;get selfValues(){return this.#V.get()}set selfValues(e){this.#V.set(q(e))}get values(){return this.#D.get()}set values(e){this.#V.set(q(e))}#W;#K;#z;#H;#F;#Y;get errors(){return this.#W.get()}get error(){return this.#W.get()[0]}*[Symbol.iterator](){}child(e){return null}#ne=!1;#re=new M.State(null);#se=new M.State(this.#re.get());#r=new M.State(null);get changed(){return this.#se.get()===this.#re.get()}get value(){return this.#se.get()}set value(e){const t=this.#X?.(e),n=void 0===t?e:t;this.#se.set(n),this.#ne||this.#re.set(n),this.#Q?.(n,this.#te.get(),this),this.#oe()}get state(){return this.#r.get()}set state(e){const t=this.#J?.(e),n=void 0===t?e:t;this.#r.set(n),this.#Z?.(n,this.#te.get(),this),this.#oe()}#oe(){this.#ie||(this.#ie=!0,queueMicrotask((()=>{const e=this.#se.get(),t=this.#r.get();this.#ae(e,t)})))}reset(e=this.#re.get()){this.#le(e)}#le(e){const t=this.#X?.(e),n=void 0===t?e:t;if(this.#F(),this.#Y(),this.#ne=!0,!n||"object"!=typeof n){for(const[,e]of this)e.#le(null);return this.#se.set(n),this.#re.set(n),n}const r=Array.isArray(n)?[...n]:{...n};for(const[e,t]of this)r[e]=t.#le(r[e]);return this.#se.set(r),this.#re.set(r),r}#ie=!1;#ce(e,t){const[n,r]=this.#ee?.(e,t)||[e,t];return this.#se.get()===n&&this.#r.get()===r?[n,r]:(this.#se.set(n),this.#r.set(r),this.#ae(n,r))}#ae(e,t){this.#ie=!1;let n=e;if(e&&"object"==typeof e){let r=Array.isArray(e)?[...e]:{...e},s=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},o=!1;for(const[n,i]of this){const a=e[n],l=t?.[n],[c,u]=i.#ce(a,l);a!==c&&(r[n]=c,o=!0),l!==u&&(s[n]=u,o=!0)}o&&(t=s,n=e=r,this.#se.set(e),this.#r.set(s))}return this.#ne||(this.#ne=!0,this.#re.set(n)),[e,t]}validate(e){if(!Array.isArray(e))return Promise.all([this.#K.get(),this.#z(),this.#H()]).then((e=>{const t=e.flat();return t.length?t:null}));const t=[this.validate().then((t=>t?.length?[{path:[...e],store:this,errors:t}]:[]))];for(const[n,r]of this)t.push(r.validate([...e,n]));return Promise.all(t).then((e=>e.flat()))}}class G extends Y{get kind(){return"object"}#ue;*[Symbol.iterator](){yield*Object.entries(this.#ue)}child(e){return this.#ue[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o}={}){const i=Object.entries(e.type);super(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o,size:i.length,setValue:e=>"object"==typeof e?e:null,setState:e=>"object"==typeof e?e:null,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const a=Object.create(null),l={parent:this,onUpdate:(e,t,n)=>{n===this.#ue[t]&&(this.value={...this.value,[t]:e})},onUpdateState:(e,t,n)=>{n===this.#ue[t]&&(this.state={...this.state,[t]:e})}};for(const[e,t]of i)a[e]=z(t,{...l,index:e});this.#ue=a}}D=G;class Q extends Y{#fe=()=>{throw new Error};#ue;get children(){return[...this.#ue.get()]}*[Symbol.iterator](){return yield*[...this.#ue.get().entries()]}child(e){const t=this.#ue.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(e,{parent:t,onUpdate:n,onUpdateState:r,index:s,new:o}={}){const i=new M.State([]),a=e=>{const t=Array.isArray(e)&&e.length||0,n=[...i.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#fe(e));n.length=t,r!==t&&i.set(n)};super(e,{index:s,new:o,parent:t,size:new M.Computed((()=>i.get().length)),state:[],setValue:e=>Array.isArray(e)?e:null==e?null:[e],setState:e=>Array.isArray(e)?e:null==e?null:[e],convert(e,t){const n=Array.isArray(e)?e:null==e?null:[e];return a(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t,r)=>{a(e),n?.(e,t,r)},onUpdateState:r}),this.#ue=i;const l={parent:this,onUpdate:(e,t,n)=>{if(i.get()[t]!==n)return;const r=[...this.value||[]];r.length<t&&(r.length=t),r[t]=e,this.value=r},onUpdateState:(e,t,n)=>{if(i.get()[t]!==n)return;const r=[...this.state||[]];r.length<t&&(r.length=t),r[t]=e,this.state=r}};this.#fe=(t,n)=>{const r=z(e,{...l,index:t,new:n});return r.index=t,r}}insert(e,t=null,n){const r=this.value||[];if(!Array.isArray(r))return!1;const s=[...this.#ue.get()],o=Math.max(0,Math.min(Math.floor(e),s.length)),i=this.#fe(o,n);i.new=!0,s.splice(o,0,i);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(o,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(o,0,{}),this.state=e}return this.#ue.set(s),this.value=a,!0}add(e=null){return this.insert(this.#ue.get().length,e)}remove(e){const t=this.value;if(!Array.isArray(t))return;const n=[...this.#ue.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;const o=[...t],[i]=o.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.#ue.set(n),this.value=o,i}move(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#ue.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let o=Math.min(e,t),i=Math.max(e,t);for(let e=o;e<=i;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.#ue.set(r),this.value=a,!0}exchange(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#ue.get()],s=r[e],o=r[t];if(!s||!o)return!1;r[t]=s,r[e]=o,s.index=t,o.index=e;const i=[...n],a=i[e],l=i[t];i[t]=a,i[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.#ue.set(r),this.value=i,!0}}function Z(e){if(!e?.length)return[];const t=[];let n=[],r=Object.create(null),s=!1;for(const t of e){if("string"==typeof t)continue;const e=t.template;if(!e)continue;s=!0;const n=X(t);r[e]={params:t.params,children:n?[n]:[]}}function o(e){e.length&&t.push({type:"divergent",children:e.map((([e,t])=>{const n=X(t);return n?"string"!=typeof n&&"fragment"===n.type?[n,e]:[{children:[n]},e]:[{children:[]},e]}))})}for(const r of e){if("string"==typeof r){o(n),n=[],t.push(r);continue}if(r.template){o(n),n=[];continue}if(n.length&&r.else){const e=r.if||null;n.push([e,r]),e||(o(n),n=[]);continue}o(n),n=[];const e=r.if;if(e){n.push([e,r]);continue}const s=X(r);s&&t.push(s)}return o(n),s?[{type:"fragment",templates:r,children:t}]:t}function X(e){let t=function(e){const t=e.fragment;if(t&&"string"==typeof t)return{type:"template",template:t,attrs:e.attrs,children:[]};const n=function({text:e,html:t}){return null!=e?{type:"content",value:e}:null!=t?{type:"content",value:t,html:!0}:void 0}(e),r=n?[n]:Z(e.children);return!e.name||t?n||{type:"fragment",children:r}:{name:e.name,is:e.is,attrs:e.attrs,events:e.events,classes:e.classes,styles:e.styles,enhancements:e.enhancements,bind:e.bind,comment:e.comment,children:r}}(e),n=e.vars;n.length&&t&&"string"!=typeof t&&(t.vars?t.vars=[...n,...t.vars]:t?t.vars=n:t={type:"fragment",vars:n,children:[]},n=null);const r=e.enum,s=e.value;return r&&(t={type:"enum",value:r,vars:n,children:t?[t]:[]},n=null),s&&(t={type:"value",name:s,vars:n,children:t?[t]:[]},n=null),n?.length&&(t={type:"fragment",vars:n,children:t?[t]:[]}),t}!function(e){W=e}(Q);const J=/^([+-]?(\d(_?\d)*(\.(\d(_?\d)*)?)?|\.\d(_?\d)*)(?:e[+-]?\d(_?\d)*)|0(b[01](?:_?[01])*|o[0-7](?:_?[0-7])*|x[\dA-F](?:_?[\dA-F])*))$/is;const ee={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class te extends Error{constructor(e,...t){const n=ee[e];super("function"==typeof n?n(...t):n),this.code=e}}const ne=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,re=/^~(?<enhancement>[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_\d\.]*)(?:(?<decorator>[:@!])(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*))?$/u,se=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function oe(e,t){const n=e[t];if(n)return n;const r={attrs:Object.create(null),events:Object.create(null)};return e[t]=r,r}function ie(e,t){const n=e.replace(/$\s+|\s+$/gs,"");if("null"===n)return{value:null};if("true"===n)return{value:!0};if("false"===n)return{value:!1};const r=function(e){return J.test(e)?Number(e.replaceAll("_","")):NaN}(n);return Number.isNaN(r)?se.test(n)?{name:n}:{calc:t(e)}:{value:r}}function ae(e,t,n,r,s){const{attrs:o,events:i,classes:a,styles:l,vars:c,params:u,enhancements:f}=e;return function(d,h){const p=d.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"),g=(ne.exec(p)||re.exec(p))?.groups;if(!g)throw new te("ATTR",d);const{name:m,enhancement:b}=g,v=g.decorator?.toLowerCase();if(b){if(":"===v)oe(f,b).attrs[m]=h?ie(h,t):{name:m};else if("@"===v)oe(f,b).events[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m};else if("!"===v){if("bind"===m)oe(f,b).bind=h||!0}else oe(f,b).value=ie(h,t);return}if(!v)return void(o[m]={value:h});if(":"===v)return void(o[m]=h?ie(h,t):{name:m});if("."===v)return void(a[m]=h?ie(h,t):{name:m});if("style:"===v)return void(l[m]=ie(h,t));if("@"===v)return void(i[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m});if("+"===v)return void c.push({...h?ie(h,n):{value:void 0},variable:m,init:!0});if("*"===v)return void c.push({...ie(h,t),variable:m,init:!1});if("?"===v)return void(u[m]=ie(h,t));if("!"!==v)return;switch(m.toString()){case"fragment":e.fragment=h||!0;break;case"else":e.else=!0;break;case"enum":e.enum=h?ie(h,t):{value:!0};break;case"if":e.if=ie(h,t);break;case"text":e.text=ie(h,t);break;case"html":s&&(e.html=ie(h,t));break;case"template":e.template=h;break;case"bind":e.bind=h||!0;break;case"value":e.value=h;break;case"comment":e.comment=h}}}function le(e,t){return{name:e,is:t,children:[],attrs:Object.create(null),events:Object.create(null),classes:Object.create(null),styles:Object.create(null),vars:[],params:Object.create(null),enhancements:Object.create(null)}}var ce={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};const ue=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function fe(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function de(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function he(...e){console.error(new te(...e))}function pe(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in ce?ce[t]:(he("ENTITY",e),e)}var ge=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new te("CALC")},createInit:n=t,createEvent:r=()=>{throw new te("EVENT")},simpleTag:s=new Set,enableHTML:o=!1}={}){const i=[],a={children:i},l=[];let c=null,u=a;function f(){c=l.pop()||null,u=c||a}function d(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&u.children.push(e)}let h={},p=0;function g(t){if(t<=p)return;d(e.substring(p,t).replace(/&#?\w+;/g,pe)),p=t}for(;;){const m=e.indexOf("<",p);if(m<0){const $=e.substring(p);$.match(/^\s*$/)||d($);break}m>p&&g(m);const b=e.charAt(m+1);if("!"===b){let j=m+2,L=">";if("--"===e.slice(m+2,m+4)&&(j+=4,L="--\x3e"),p=e.indexOf(L,j),p<0)break;p++;continue}if("/"===b){p=e.indexOf(">",m+3);let T=e.substring(m+2,p);if(p<0?(T=e.substring(m+2).replace(/[\s<].*/,""),he("UNCOMPLETED",T,c?.name),p=m+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),he("UNCOMPLETED",T),p=m+1+T.length),c){const M=c.name;if(M===T)f();else{if(M.toLowerCase()!=T.toLowerCase())throw new te("CLOSE",T,c.name);f()}}p++;continue}function v(t){let n=p+1;if(p=e.indexOf(t,n),p<0)throw new te("QUOTE",t);const r=e.slice(n,p).replace(/&#?\w+;/g,pe);return p++,r}function y(){let t=e.charAt(p);for(;t<=" "||"€"===t;t=e.charAt(++p));return t}function w(){let t=p,n=e.charAt(p);for(;fe(n);)p++,n=e.charAt(p);return e.slice(t,p)}p=m+1;let x=e.charAt(p);switch(x){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case">":case"/":throw new te("SYMBOL",x);case"":throw new te("EOF")}const O=w(),S=ue.exec(O)?.groups;if(!S)throw new te("TAG",O);l.push(c),c=le(S.name,S.is),u.children.push(c),u=c;const E=ae(c,t,n,r,o);let C=!0,A=!1;e:for(;C;){let N=y();switch(N){case"":he("EOF"),p++;break e;case">":p++;break e;case"/":A=!0;break e;case'"':case"'":throw new te("ATTR_VALUE");case"=":throw new te("SYMBOL",N)}const k=w();if(!k){he("EOF"),p++;break e}switch(N=y(),N){case"":he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),A=!0;break e;case"=":p++;break;case"'":case'"':E(k,v(N));continue;default:E(k,"");continue}switch(N=y(),N){case"":E(k,""),he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),A=!0;break e;case"'":case'"':E(k,v(N));continue}E(k,w())}if(A){for(;;){p++;const I=e.charAt(p);if("/"!==I&&!(I<=" "||"€"===I))break}switch(e.charAt(p)){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case"":he("EOF");break;case">":p++;break;default:throw new te("CLOSE_SYMBOL")}f()}else(s.has(O)||de(e,p,O,h))&&f()}return Z(i)}});function me(e){let t=!0;const n=new M.subtle.Watcher((()=>{t&&(t=!1,queueMicrotask((()=>{t=!0;for(const e of n.getPending())e.get();n.watch()})))})),r=new M.Computed(e);return n.watch(r),r.get(),()=>{n.unwatch(r)}}function be(e,t,n){let r,s=!1;return me((()=>{const o=e();if(!s)return s=!0,r=o,void(n&&t(o));Object.is(o,r)||(r=o,t(o))}))}const ve=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,ref:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,changed:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,minLength:!0,maxLength:!0,pattern:!0,values:!0,null:!0,index:!0,no:!0,size:!0,error:!0,errors:!0}));function*ye(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of ve)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],yield[`${t}${n}reset`,{exec:()=>e.reset()}],yield[`${t}${n}validate`,{exec:t=>e.validate(t?[]:null)}],e instanceof Q&&(yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}])}function we(e,t,n){for(const[n,r]of t){for(const[t,s]of ye(r,n))e[t]=s;for(const[t,s]of ye(r,n,"$$"))e[t]=s}}const xe={value$:{calc:e=>e?.[_].value},state$:{calc:e=>e?.[_].state}};var Oe=Object.getOwnPropertyDescriptors(xe);function Se(e){if(!e)return!1;const t=e.indexOf("$");return t<0||(e.indexOf("$",t+2)>0||"$"===e[0]&&"_$".includes(e[1]))}function Ee(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class Ce{exec({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#de[e];if("function"!=typeof t?.get)return;return t.get()}return"function"==typeof t?t(this.getters):n}get({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#de[e];if("function"!=typeof t?.get)return;const{get:n,set:r}=t;return{get:n,set:r}}if("function"==typeof t){const e=new M.Computed((()=>t(this.getters)));return{get:()=>e.get()}}return{get:()=>n}}watch(e,t){return be((()=>this.exec(e)),t,!0)}enum(e){const{name:t,calc:n}=e;if("function"==typeof n)return()=>n(this.getters);if("string"==typeof t){const e=this.#de[t];if("function"!=typeof e?.get)return null;const n=e.store;return n instanceof Y?n:e.get}return this.store}getStore(e){if(!e)return null;const t=this.#de[!0===e?"":e];return t?.get&&t.store||null}bind(e,t,n){const r=this.#de[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?ve.has(t)?be((()=>s[t]),n,!0):void 0:"value"===t?be((()=>r.get()),n,!0):void 0}bindAll(e){const t=this.#de[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>be(e,t,!0)}}return Object.fromEntries([...ve].map((e=>[`$${e}`,t=>be((()=>n[e]),t,!0)])))}getBindAll(e){const t=this.#de[!0===e?"":e];if(!t?.get)return{};const{store:n}=t;if(!n){const{get:e,set:n}=t;return{$value:{get:e,set:n}}}return Object.fromEntries([...ve].map((e=>[`$${e}`,"value"===e||"state"===e?{get:()=>n[e],set:t=>{n[e]=t}}:{get:()=>n[e]}])))}bindSet(e,t){const n=this.#de[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#de[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)},$reset:e=>{n.reset()},$validate:e=>{n.validate(e?[]:null)}}}getEvent({name:e,event:t}){if("function"==typeof t)return t;const n=this.#de[e];if(!n)return null;const{exec:r,calc:s}=n;return"function"==typeof r?r:"function"==typeof s?s:null}constructor(e,t){if(this.store=e,t instanceof Ce){this.#he=t.#he;const e=this.#pe;for(const[n,r]of Object.entries(t.#pe))e[n]=r;const n=this.#ge;for(const[e,r]of Object.entries(t.#ge))n[e]=r}else we(this.#pe,e),this.#he=function(e){const t=Object.create(null,Oe);if(!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!Se(n))continue;if(!r||"object"!=typeof r)continue;if(r instanceof Y){for(const[e,s]of ye(r,n))t[e]=s;continue}const{get:e,set:s,exec:o,calc:i}=r;"function"!=typeof e?"function"!=typeof i?"function"!=typeof o||(t[n]={exec:o}):t[n]={calc:i}:t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#he;#pe=Object.create(null);#ge=Object.create(null);store;#me=null;#s=null;#be=null;get#de(){const e=this.#be;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#pe,...this.#he,...this.#ge})),n=this.store,r=this.#s,s=this.#me;for(const[e,r]of ye(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof Q))return yield[`${n}${r}upMovable`,{get:()=>!1}],void(yield[`${n}${r}downMovable`,{get:()=>!1}]);yield[`${n}${r}upMovable`,{get:()=>{const e=t.index;return"number"==typeof e&&!(e<=0)}}],yield[`${n}${r}downMovable`,{get:()=>{const n=t.index;return"number"==typeof n&&!(n>=e.size-1)}}],yield[`${n}${r}remove`,{exec:()=>e.remove(Number(t.index))}],yield[`${n}${r}upMove`,{exec:()=>{const n=t.index;"number"==typeof n&&(n<=0||e.move(n,n-1))}}],yield[`${n}${r}downMove`,{exec:()=>{const n=t.index;"number"==typeof n&&(n>=e.size-1||e.move(n,n+1))}}]}(r,n))t[e]=s;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};return this.#be=t,t}setStore(e,t,n){const r=new Ce(e,this);return t&&(r.#s=t),we(r.#pe,e),n&&(r.#me=n),r}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new Ce(t,this);return we(n.#pe,t),n}params(e,t,n,r){let s=this.store;if(!0===r)s=n.store;else if(r){const e=n.#de[r],t=e?.get&&e.store;t&&(s=t)}if(0===Object.keys(e).length)return this;const o=new Ce(s,this);o.#s=this.#s,o.#me=this.#me;const i=o.#ge,a=o.#de;for(const[r,s]of Object.entries(e)){const e=r in t?t[r]:null;if(e){const{name:t,calc:s,value:o}=e;if(t){const e=n.#de[t];if(!e?.get)continue;if(!e.store){i[r]=a[r]=e;continue}for(const[t,n]of ye(e.store,r))i[t]=a[t]=n;continue}if("function"==typeof s){const e=new M.Computed((()=>s(n.getters)));i[r]=a[r]={get:()=>e.get()};continue}i[r]=a[r]={get:()=>o}}else{const{name:e,calc:t,value:n}=s;if("function"==typeof t){const e=o.getters;o.#ve=null;const n=new M.Computed((()=>t(e)));i[r]=a[r]={get:()=>n.get()};continue}if(e){const t=a[e];if(!t?.get)continue;if(!t.store){i[r]=a[r]=t;continue}for(const[e,n]of ye(t.store,r))i[e]=a[e]=n;continue}i[r]=a[r]={get:()=>n}}}return o}setObject(e){const t=new Ce(this.store,this);return t.#me=e,t}set(e){if(!e?.length)return this;const t=new Ce(this.store,this);t.#s=this.#s,t.#me=this.#me;const n=t.#ge,r=t.#de;for(const{variable:s,name:o,calc:i,value:a,init:l}of e)if(l){const e=new M.State(a);if("function"==typeof i){const n=t.settable;t.#ye=null,e.set(i(n))}else if(o){const t=r[o];if(!t?.get)continue;e.set(t.get())}n[s]=r[s]={get:()=>e.get(),set:t=>{e.set(t)}}}else if("function"!=typeof i)if(o){const e=r[o];if(!e)continue;if(!e.get||!e.store){n[s]=r[s]=e;continue}for(const[t,o]of ye(e.store,s))n[t]=r[t]=o}else n[s]=r[s]={get:()=>a};else{const e=t.getters;t.#ve=null;const o=new M.Computed((()=>i(e)));n[s]=r[s]={get:()=>o.get()}}return t}#we=null;get all(){const e=this.#we;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc?Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1}):Object.defineProperty(t,e,{value:n.exec,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#we=t,t}#ye=null;get settable(){const e=this.#ye;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#ye=t,t}#ve=null;get getters(){const e=this.#ve;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#ve=t,t}}const Ae={width:"px",height:"px",top:"px",right:"px",bottom:"px",left:"px",border:"px","border-top":"px","border-right":"px","border-left":"px","border-bottom":"px","border-width":"px","border-top-width":"px","border-right-width":"px","border-left-width":"px","border-bottom-width":"px","border-radius":"px","border-top-left-radius":"px","border-top-right-radius":"px","border-bottom-left-radius":"px","border-bottom-right-radius":"px",padding:"px","padding-top":"px","padding-right":"px","padding-left":"px","padding-bottom":"px",margin:"px","margin-top":"px","margin-right":"px","margin-left":"px","margin-bottom":"px"};function $e(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in Ae?`${s}${Ae[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class je{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}}const Le={stop(e){e instanceof Event&&e.stopPropagation()},prevent(e){e instanceof Event&&e.preventDefault()},self(e){if(e instanceof Event)return e.target===e.currentTarget},enter(e){if(e instanceof KeyboardEvent)return"Enter"===e.key},tab(e){if(e instanceof KeyboardEvent)return"Tab"===e.key},esc(e){if(e instanceof KeyboardEvent)return"Escape"===e.key},space(e){if(e instanceof KeyboardEvent)return" "===e.key},backspace(e){if(e instanceof KeyboardEvent)return"Backspace"===e.key},delete(e){if(e instanceof KeyboardEvent)return"Delete"===e.key},delBack(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},"del-back"(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},insert(e){if(e instanceof KeyboardEvent)return"Insert"===e.key},repeat(e){if(e instanceof KeyboardEvent)return e.repeat},key(e,t){if(e instanceof KeyboardEvent){const n=e.code.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},main(e){if(e instanceof MouseEvent)return 0===e.button},auxiliary(e){if(e instanceof MouseEvent)return 1===e.button},secondary(e){if(e instanceof MouseEvent)return 2===e.button},left(e){if(e instanceof MouseEvent)return 0===e.button},middle(e){if(e instanceof MouseEvent)return 1===e.button},right(e){if(e instanceof MouseEvent)return 2===e.button},primary(e){if(e instanceof PointerEvent)return e.isPrimary},mouse(e){if(e instanceof PointerEvent)return"mouse"===e.pointerType},pen(e){if(e instanceof PointerEvent)return"pen"===e.pointerType},touch(e){if(e instanceof PointerEvent)return"touch"===e.pointerType},pointer(e,t){if(e instanceof PointerEvent){const n=e.pointerType.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},ctrl(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey},alt(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.altKey},shift(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.shiftKey},meta(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.metaKey},cmd(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey||e.metaKey}};function Te(e,t,n){const r=[];if(t)for(let s=e.shift();s;s=e.shift()){const e=s.indexOf(":"),o=e>=0?s.slice(0,e):s,i=e>=0?s.slice(e+1).split(":"):[],a=o.replace(/^-+/,""),l=(o.length-a.length)%2==1;let c=t[a]||a;if(n)switch(c){case"once":case"passive":case"capture":n[c]=!l;continue}"string"==typeof c&&(c=Le[c]),"function"==typeof c&&r.push([c,i,l])}return r}function Me(e,t,n){return r=>{const s=e.all;for(const[e,t,o]of n)if(e(r,t,s)===o)return;t(r,s)}}function Ne(e){return"number"==typeof e||"bigint"==typeof e?String(e):"boolean"==typeof e?e?"":null:"string"==typeof e?e:null===(e??null)?null:String(e)}function ke(e){return null===(e??null)?"":String(e)}function Ie(e,t){if(e instanceof HTMLInputElement&&"checked"===t)switch(e.type.toLowerCase()){case"checkbox":case"radio":return Boolean}if((e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&"value"===t)return ke;if(e instanceof HTMLDetailsElement&&"open"===t)return Boolean;if(e instanceof HTMLMediaElement){if("muted"===t)return Boolean;if("paused"===t)return Boolean;if("currentTime"===t)return!0;if("playbackRate"===t)return!0;if("volume"===t)return!0}return!1}const Pe={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=ke(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["change",(e,t)=>t.value]}}};function Ue(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watch:s,props:o}=e;return["input","textarea","select"].includes(t.toLowerCase())&&e.relate(r),e.listen("init",(({events:n})=>{const i=Pe[t.toLowerCase()],a=i?.attrs||{},l=i?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,o]=n;r.addEventListener(e,(e=>t(o(e,r))),s)}}if(o)for(const[t,n]of Object.entries(e.attrs))if(s(t,(e=>{if(o.has(t))r[t]=e;else{const n=Ne(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),o.has(t))r[t]=n;else{const e=Ne(n);null!==e&&r.setAttribute(t,e)}else for(const[t,n]of Object.entries(e.attrs)){if(r instanceof HTMLInputElement&&"type"===t.toLocaleLowerCase()){const e=Ne(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=Ie(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let o=Ne(n);null!==o&&r.setAttribute(t,o),s(t,(e=>{const n=Ne(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Be(e){return null===(e??null)?"":String(e)}function qe(e,t,n,r,s){if(!s){const s=e.insertBefore(document.createTextNode(""),t),o=n.watch(r,(e=>s.textContent=Be(e)));return()=>{s.remove(),o()}}const o=e.insertBefore(document.createComment(""),t),i=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=o.nextSibling;e&&e!==i;e=o.nextSibling)e.remove()}const c=n.watch(r,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=o.firstChild)e.insertBefore(t,i)}(Be(t))}));return()=>{c(),l(),o.remove(),i.remove()}}const Re=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function _e(e,t,n,r,s){const o=e.children;if(!o.length)return()=>{};const i=t.insertBefore(document.createComment(""),n);let a=null,l=()=>{};const c=be((()=>o.find((([,e])=>!e||r.exec(e)))||null),(e=>{if(e===a)return;a=e,l(),l=()=>{};const t=e?.[0];t&&(l=s(t.children,t.vars,t.templates))}),!0);let u=!1;return()=>{u||(u=!0,c(),l(),l=()=>{},i.remove())}}function Ve(e,t,n,r,s,o,i,a,l){const c=e.bind,u=[...o,e.name],f=l?.(u);if(l&&!f)return()=>{};const{context:d,handler:h}=function(e,t,n,r){const s="string"==typeof e?e:e.tag,{attrs:o,events:i}="string"!=typeof e&&e||{attrs:null,events:null};let a=!1;const l=new M.State(!1);let c=!1;const u=new M.State(!1),f=Object.create(null),d=Object.create(null),h=new Set,p=[],g=new je;return{context:{events:p,props:o?new Set(Object.entries(o).filter((([,e])=>e.isProp)).map((([e])=>e))):null,attrs:d,watch(e,t){if(a)return()=>{};const n=f[e];if(!n)return()=>{};let r=n.get();const s=be((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}),!0);return h.add(s),()=>{h.delete(s),s()}},relate(e){if(!n||!r||a)return()=>{};try{const t=r(n,e);return"function"!=typeof t?()=>{}:(h.add(t),()=>{h.delete(t),t()})}catch{return()=>{}}},get destroyed(){return l.get()},get init(){return u.get()},listen:(e,t)=>g.listen(e,t)},handler:{tag:s,set(e,t){if(o&&!(e in o))return;let n=f[e];if(n)return void n.set(t);const r=new M.State(t);f[e]=r,Object.defineProperty(d,e,{configurable:!0,enumerable:!0,get:r.get.bind(r)})},addEvent(e,n){if("function"!=typeof n)return;const[r,...s]=e.split(".").filter(Boolean),o=i?i[r].filters:{};if(!o)return;const a={},l=Te(s,o,a);p.push([r,Me(t,n,l),a])},destroy(){if(!a){a=!0,l.set(!0);for(const e of h)e();g.emit("destroy")}},mount(){c||(c=!0,u.set(!0),g.emit("init",{events:p}))}}}}(f||e.name,r,r.getStore(c),a),p=f?.attrs,g=p?function(e,t,n,r,s){let o=new Set;for(const[i,a]of Object.entries(r)){if("class"===i||"style"===i)continue;if(i in n){const r=n[i],{name:s,calc:l,value:c}=n[i];if(!s&&!l){e.set(i,c);continue}a.immutable&&e.set(i,t.exec(r)),o.add(t.watch(r,(t=>e.set(i,t))));continue}const r=a.bind;if(!s||!r){e.set(i,a.default);continue}if("string"==typeof r){const n=t.bind(s,r,(t=>e.set(i,t)));n?o.add(n):e.set(i,a.default);continue}if(!Array.isArray(r)){e.set(i,a.default);continue}const[l,c,u]=r;if(!l||"function"!=typeof c)continue;if(!u){const n=!0===s?"":s;o.add(t.watch({name:n},(t=>e.set(i,t)))),e.addEvent(l,((...e)=>{t.all[n]=c(...e)}));continue}const f=t.bind(s,"state",(t=>e.set(i,t)));if(!f)continue;o.add(f);const d=t.bindSet(s,"state");d&&e.addEvent(l,((...e)=>{d(c(...e))}))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(h,r,e.attrs,p,c):function(e,t,n){const r=e.tag;let s=new Set;for(const[o,i]of Object.entries(n)){if("class"===o||"style"===o)continue;const{name:n,calc:a,value:l}=i;if(n||a)if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==o.toLocaleLowerCase())s.add(t.watch(i,(t=>e.set(o,t))));else{const n=t.exec(i);e.set(o,n)}else e.set(o,l)}return()=>{const e=s;s=new Set;for(const t of e)t()}}(h,r,e.attrs);for(const[t,n]of Object.entries(e.events)){const e=r.getEvent(n);e&&h.addEvent(t,e)}const m=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,o]of Object.entries(t.bindAll(n)||{}))"function"==typeof o&&r.add(o((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(h,r,c),b=f?"function"==typeof f.tag?f.tag(d):Ue(d,f.tag,f.is):Ue(d,e.name,e.is),v=Array.isArray(b)?b[0]:b,y=Array.isArray(b)?b[1]:v;t.insertBefore(v,n);const w=y?Ke(e.children||[],y,null,r,s,o,i,a,l):()=>{},x=function(e,t,n,r){if(!(e instanceof Element))return()=>{};r&&(e.className+=" "+t.exec(r));let s=new Set;for(const[r,o]of Object.entries(n))o.value?e.classList.add(r):s.add(be((()=>Boolean(t.exec(o))),(t=>{t?e.classList.add(r):e.classList.remove(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(v,r,e.classes,e.attrs.class),O=function(e,t,n,r){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};if(r){const n=[e.getAttribute("style")||"",t.exec(r)||""].filter(Boolean).join(";");n&&e.setAttribute("style",n)}let s=new Set;for(const[r,o]of Object.entries(n))s.add(be((()=>$e(r,t.exec(o))),(t=>{t?e.style.setProperty(r,...t):e.style.removeProperty(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(v,r,e.styles,e.attrs.style);h.mount();const S=function(e,t,n,r,s,o){let i=new Set;for(const[a,{attrs:l,value:c,events:u,bind:f}]of Object.entries(t)){if(!Re(r,a))continue;const d=r[a];if("function"!=typeof d)continue;let h=!1;const p=new M.State(!1),g=d?.events,m=[],b=Object.create(null),v=new Set,y=new je;function w(e,t){if("function"!=typeof t)return;const[r,...s]=e.split(".").filter(Boolean),o=g?g[r].filters:{};if(!o)return;const i={},a=Te(s,o,i);m.push([r,Me(n,t,a),i])}function x(){if(!h){h=!0,p.set(!0);for(const e of v)e();y.emit("destroy")}}i.add(x);for(const[S,E]of Object.entries(l)){const C=n.get(E);C&&Object.defineProperty(b,S,{...C,configurable:!0,enumerable:!0})}for(const[A,$]of Object.entries(u)){const j=n.getEvent($);j&&w(A,j)}if(f){for(const[L,T]of Object.entries(n.getBindAll(f)||{}))Object.defineProperty(b,L,{...T,configurable:!0,enumerable:!0});for(const[N,k]of Object.entries(n.bindEvents(f)||{}))w(N,(e=>k(e)))}const O={get value(){return null},events:m,attrs:b,watch(e,t){if(h)return()=>{};let n=b[e];const r=be((()=>b[e]),(r=>{const s=n;n=r,t(r,s,e)}),!0);return v.add(r),()=>{v.delete(r),r()}},get destroyed(){return p.get()},listen:(e,t)=>y.listen(e,t),root:s,slot:o,tag:e};if(c){const I=n.get(c);I&&Object.defineProperty(O,"value",{...I,configurable:!0,enumerable:!0})}d(O)}return()=>{const e=i;i=new Set;for(const t of e)t()}}(h.tag,e.enhancements,r,i,v,y);return()=>{S(),h.destroy(),v.remove(),g(),w(),m(),x(),O()}}function De(e,t,n){if(!n)return t;const r=Object.entries(n);if(!r.length)return t;const s=Object.create(t);for(const[t,n]of r)s[t]=[n,e];return s}function We(e,t,n,r,s,o,i,a,l){if("string"==typeof e){const r=document.createTextNode(e);return t.insertBefore(r,n),()=>r.remove()}const c=r.set(e.vars),u=De(c,s,e.templates);if("divergent"===e.type)return _e(e,t,n,c,((e,r,u)=>{const f=c.set(r),d=De(f,s,u);return Ke(e,t,n,f,d,o,i,a,l)}));if("value"===e.type){const r=c.child(e.name);return r?Ke(e.children,t,n,r,u,o,i,a,l):()=>{}}if("enum"===e.type){const r=c.enum(e.value),s=(n,r)=>Ke(e.children,t,n,r,u,o,i,a,l);return r instanceof Q?function(e,t,n,r,s){const o=e.insertBefore(document.createComment(""),t);let i=new Map;function a(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const l=new M.State(0),c=be((()=>n.children),(function(t){if(!o.parentNode)return;let c=o.nextSibling;const u=i;i=new Map,l.set(t.length);for(let o of t){const t=u.get(o);if(!t){const t=e.insertBefore(document.createComment(""),c),a=e.insertBefore(document.createComment(""),c),u=s(a,r.setStore(o,n,{get count(){return l.get()},get key(){return o.index},get index(){return o.index},get item(){return o.value}}));i.set(o,[t,a,u]);continue}if(u.delete(o),i.set(o,t),c===t[0]){c=t[1].nextSibling;continue}let a=t[0];for(;a&&a!==t[1];){const t=a;a=a.nextSibling,e.insertBefore(t,c)}e.insertBefore(t[1],c)}a(u)}),!0);return()=>{o.remove(),a(i),c()}}(t,n,r,c,s):r instanceof G?function(e,t,n,r,s){const o=[],i=[...n].map((([e,t],n)=>[e,t,n])),a=i.length;for(const[e,l,c]of i)o.push(s(t,r.setStore(l,n,{get count(){return a},get key(){return e},get index(){return c},get item(){return l.value}})));return()=>{for(const e of o)e()}}(0,n,r,c,s):"function"==typeof r?function(e,t,n,r,s){const o=new M.Computed((()=>{const e=n();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t,t])):Object.entries(e).map((([e,t],n)=>[t,n,e])):[]})),i=e.insertBefore(document.createComment(""),t);let a=[];function l(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const c=new M.State(0),u=be((()=>o.get()),(function(t){if(!i.parentNode)return;let n=i.nextSibling;const o=a;a=[],c.set(t.length);for(const[i,l,u]of t){const t=o.findIndex((e=>e[3]===u)),[f]=t>=0?o.splice(t,1):[];if(!f){const t=e.insertBefore(document.createComment(""),n),o=e.insertBefore(document.createComment(""),n),f=new M.State(i),d=new M.State(l),h=s(o,r.setObject({get count(){return c.get()},get key(){return u},get item(){return f.get()},get index(){return d.get()}}));a.push([t,o,h,u,f,d]);continue}if(a.push(f),f[4].set(i),f[5].set(l),n===f[0]){n=f[1].nextSibling;continue}let d=f[0];for(;d&&d!==f[1];){const t=d;d=d.nextSibling,e.insertBefore(t,n)}e.insertBefore(f[1],n)}l(o)}),!0);return()=>{i.remove(),l(a),u()}}(t,n,r,c,s):()=>{}}if("content"===e.type)return qe(t,n,c,e.value,e.html);if("template"===e.type){const r=u[e.template];if(!r)return()=>{};const[f,d]=r,h=d.params(f.params,e.attrs,c,e.bind),p=De(h,s,f.templates);return Ke(f.children,t,n,h,p,o,i,a,l)}return"fragment"===e.type?Ke(e.children,t,n,c,u,o,i,a,l):Ve(e,t,n,c,u,o,i,a,l)}function Ke(e,t,n,r,s,o,i,a,l){const c=e.map((e=>We(e,t,n,r,s,o,i,a,l)));let u=!1;return()=>{if(!u){u=!0;for(const e of c)e()}}}function ze(e,t,n,{component:r,global:s,relate:o,enhancements:i}={}){return Ke(t,n,null,new Ce(e,s),Object.create(null),[],i||{},"function"==typeof o?o:null,r)}export{ge as Layout,M as Signal,Y as Store,me as effect,ze as render,be as watch};
60
+ function(e){const t=Object.create(L);t.value=e;const n=()=>(d(t),t.value);return n[c]=t,n}(n),a=i[c];if(this[T]=a,a.wrapper=this,s){const t=s.equals;t&&(a.equal=t),a.watched=s[e.subtle.watched],a.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return $.call(this[T])}set(t){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(a)throw new Error("Writes to signals not permitted during Watcher callback");j(this[T],t)}};h=T,p=new WeakSet,e.isComputed=e=>n(p,e),e.Computed=class{constructor(n,s){r(this,p),t(this,h);const o=function(e){const t=Object.create(C);t.computation=e;const n=()=>x(t);return n[c]=t,n}(n),i=o[c];if(i.consumerAllowSignalWrites=!0,this[T]=i,i.wrapper=this,s){const t=s.equals;t&&(i.equal=t),i.watched=s[e.subtle.watched],i.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return x(this[T])}},(o=>{var a,l,c,h;o.untrack=function(e){let t,n=null;try{n=u(null),t=e()}finally{u(n)}return t},o.introspectSources=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(n=t[T].producerNode)?void 0:n.map((e=>e.wrapper)))??[]},o.introspectSinks=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(n=t[T].liveConsumerNode)?void 0:n.map((e=>e.wrapper)))??[]},o.hasSinks=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called hasSinks without a Signal argument");const n=t[T].liveConsumerNode;return!!n&&n.length>0},o.hasSources=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called hasSources without a Computed or Watcher argument");const n=t[T].producerNode;return!!n&&n.length>0};a=T,l=new WeakSet,c=new WeakSet,h=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>n(l,e),o.Watcher=class{constructor(e){r(this,l),r(this,c),t(this,a);let n=Object.create(f);n.wrapper=this,n.consumerMarkedDirty=e,n.consumerIsAlwaysLive=!0,n.consumerAllowSignalWrites=!1,n.producerNode=[],this[T]=n}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[T];n.dirty=!1;const r=u(n);for(const e of t)d(e[T]);u(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[T];y(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){b(n.producerNode[e],n.producerIndexOfThis[e]);const t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){const t=n.producerIndexOfThis[e],r=n.producerNode[e];w(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[T].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},o.currentComputed=function(){var e;return null==(e=i)?void 0:e.wrapper},o.watched=Symbol("watched"),o.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(M||(M={}));const N=(e,t,n,r)=>{const s=new M.State("boolean"==typeof t?t:null);let o;if("function"==typeof n)o=new M.Computed((()=>Boolean(n(e))));else{const e=Boolean(n);o=new M.Computed((()=>e))}const i=()=>{const e=s.get();return null===e?o.get():e},a=r?new M.Computed((()=>r.get()||i())):new M.Computed(i);return[s,a]},k=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,P=e=>e instanceof RegExp?e:null,U=Boolean;function B(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(B).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const q=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(B).filter(U);return t.length?t:null};function R(e,t,n,r){const s=new M.State(t(n));let o;if("function"==typeof r){const n=r;o=new M.Computed((()=>t(n(e))))}else{const e=t(r);o=new M.Computed((()=>e))}const i=new M.Computed((()=>{const e=s.get();return null===e?o.get():e}));return[s,i]}const _=Symbol();function V(e){const t={[_]:e};for(const[n,r]of e)Object.defineProperty(t,n,{get:()=>r.ref,configurable:!1,enumerable:!0});return Object.defineProperty(t,_,{get:()=>e,configurable:!1,enumerable:!0}),t}let D=null,W=null,K=Object.create(null);function z(e,t){const n=e.type;let r=Y;if(!e.array||W&&t?.parent instanceof W)if("string"==typeof n){const e=K[n];e&&(r=e)}else n&&"object"==typeof n&&D&&(r=D);else W&&(r=W);return new r(e,t)}function H(e){return e?e instanceof Error?e.message:"string"!=typeof e?"":e:""}function F(e,...t){const n=t.flat().filter((e=>"function"==typeof e));if(!n.length)return[()=>Promise.resolve([]),new M.Computed((()=>[])),()=>{}];const r=new M.State([]);let s=null;return[function(){s?.abort(),s=new AbortController;const t=s.signal;return r.set([]),Promise.all(n.map((n=>async function(t,n){let s=[];try{s.push(await t(e,n))}catch(e){s.push(e)}const o=s.flat().map(H).filter(Boolean);return!n.aborted&&o.length&&r.set([...r.get(),...o]),o}(n,t)))).then((e=>e.flat()))},new M.Computed((()=>r.get())),()=>{s?.abort(),r.set([])}]}class Y{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}static create(e,t={}){return z({type:e},{...t,parent:null})}static setStore(e,t){return function(e,t){K[e]=t}(e,t)}#t=!1;get null(){return this.#t}get kind(){return""}#n=null;get ref(){return this.#n||V(this)}constructor(e,{null:t,state:n,ref:r,setValue:s,setState:o,convert:i,onUpdate:a,onUpdateState:l,validator:c,validators:u,index:f,size:d,new:h,parent:p,hidden:g,clearable:m,required:b,disabled:v,readonly:y,label:w,description:x,placeholder:O,min:S,max:E,step:C,minLength:A,maxLength:$,pattern:j,values:L}={}){this.schema=e,this.#r.set("object"==typeof n&&n||{});const T=p instanceof Y?p:null;T&&(this.#s=T,this.#o=T.#o),this.#i=e.type,this.#a=e.meta,this.#l=e.component;const U=new M.State(Boolean(h));this.#c=U;const B=T?new M.Computed((()=>T.#u.get()||U.get())):new M.Computed((()=>U.get()));this.#u=B;const _=Boolean(e.immutable),D=!1!==e.creatable;this.#f=_,this.#d=D;const W=e.readonly,K=new M.State("boolean"==typeof y?y:null);let z;if("function"==typeof W)z=new M.Computed((()=>Boolean(W(this))));else{const e=Boolean(W);z=new M.Computed((()=>e))}const G=()=>{if(B.get()?!D:_)return!0;const e=K.get();return null===e?z.get():e},Q=T?T.#h:null;this.#p=K,this.#h=Q?new M.Computed((()=>Q.get()||G())):new M.Computed(G),[this.#g,this.#m]=N(this,g,e.hidden,T?T.#m:null),[this.#b,this.#v]=N(this,m,e.clearable,T?T.#v:null),[this.#y,this.#w]=N(this,b,e.required,T?T.#w:null),[this.#x,this.#O]=N(this,v,e.disabled,T?T.#O:null),[this.#S,this.#E]=R(this,k,w,e.label),[this.#C,this.#A]=R(this,k,x,e.description),[this.#$,this.#j]=R(this,k,O,e.placeholder),[this.#L,this.#T]=R(this,I,S,e.min),[this.#M,this.#N]=R(this,I,E,e.max),[this.#k,this.#I]=R(this,I,C,e.step),[this.#P,this.#U]=R(this,I,A,e.minLength),[this.#B,this.#q]=R(this,I,$,e.maxLength),[this.#R,this.#_]=R(this,P,j,e.pattern),[this.#V,this.#D]=R(this,q,L,e.values);const Z=function(e,...t){const n=t.flat().filter((e=>"function"==typeof e));return n.length?new M.Computed((()=>{const t=[];for(const r of n)try{t.push(r(e))}catch(e){t.push(e)}return t.flat().map(H).filter(Boolean)})):new M.Computed((()=>[]))}(this,e.validator,c),[X,J,ee]=F(this,e.validators?.change,u?.change),[te,ne,re]=F(this,e.validators?.blur,u?.blur);if(this.listen("change",(()=>{X()})),this.listen("blur",(()=>{te()})),this.#W=function(...e){const t=e.filter(Boolean);return new M.Computed((()=>t.flatMap((e=>e.get()))))}(Z,J,ne),this.#K=Z,this.#z=X,this.#H=te,this.#F=ee,this.#Y=re,d instanceof M.State||d instanceof M.Computed?this.#G=d:this.#G=new M.State(d||0),t)return this.#t=!0,void(this.#n=V(this));this.#n=r||null,this.#Q=a||null,this.#Z=l||null,this.#X="function"==typeof s?s:null,this.#J="function"==typeof o?o:null,this.#ee="function"==typeof i?i:null,this.#te.set(f??"");for(const[t,n]of Object.entries(e.events||{}))"function"==typeof n&&this.listen(t,n)}#X=null;#J=null;#ee=null;#Q=null;#Z=null;#s=null;#o=this;#i;#a;#l;get store(){return this}get parent(){return this.#s}get root(){return this.#o}get type(){return this.#i}get meta(){return this.#a}get component(){return this.#l}#G;get size(){return this.#G.get()}#te=new M.State("");get index(){return this.#te.get()}set index(e){this.#te.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#d=!0;get creatable(){return this.#d}#f=!1;get immutable(){return this.#f}#u;#c;get selfNew(){return this.#c.get()}set selfNew(e){this.#c.set(Boolean(e))}get new(){return this.#u.get()}set new(e){this.#c.set(Boolean(e))}#g;#m;get selfHidden(){return this.#g.get()}set selfHidden(e){this.#g.set("boolean"==typeof e?e:null)}get hidden(){return this.#m.get()}set hidden(e){this.#g.set("boolean"==typeof e?e:null)}#b;#v;get selfClearable(){return this.#b.get()}set selfClearable(e){this.#b.set("boolean"==typeof e?e:null)}get clearable(){return this.#v.get()}set clearable(e){this.#b.set("boolean"==typeof e?e:null)}#y;#w;get selfRequired(){return this.#y.get()}set selfRequired(e){this.#y.set("boolean"==typeof e?e:null)}get required(){return this.#w.get()}set required(e){this.#y.set("boolean"==typeof e?e:null)}#x;#O;get selfDisabled(){return this.#x.get()}set selfDisabled(e){this.#x.set("boolean"==typeof e?e:null)}get disabled(){return this.#O.get()}set disabled(e){this.#x.set("boolean"==typeof e?e:null)}#p;#h;get selfReadonly(){return this.#p.get()}set selfReadonly(e){this.#p.set("boolean"==typeof e?e:null)}get readonly(){return this.#h.get()}set readonly(e){this.#p.set("boolean"==typeof e?e:null)}#S;#E;get selfLabel(){return this.#S.get()}set selfLabel(e){this.#S.set(k(e))}get label(){return this.#E.get()}set label(e){this.#S.set(k(e))}#C;#A;get selfDescription(){return this.#C.get()}set selfDescription(e){this.#C.set(k(e))}get description(){return this.#A.get()}set description(e){this.#C.set(k(e))}#$;#j;get selfPlaceholder(){return this.#$.get()}set selfPlaceholder(e){this.#$.set(k(e))}get placeholder(){return this.#j.get()}set placeholder(e){this.#$.set(k(e))}#L;#T;get selfMin(){return this.#L.get()}set selfMin(e){this.#L.set(I(e))}get min(){return this.#T.get()}set min(e){this.#L.set(I(e))}#M;#N;get selfMax(){return this.#M.get()}set selfMax(e){this.#M.set(I(e))}get max(){return this.#N.get()}set max(e){this.#M.set(I(e))}#k;#I;get selfStep(){return this.#k.get()}set selfStep(e){this.#k.set(I(e))}get step(){return this.#I.get()}set step(e){this.#k.set(I(e))}#P;#U;get selfMinLength(){return this.#P.get()}set selfMinLength(e){this.#P.set(I(e))}get minLength(){return this.#U.get()}set minLength(e){this.#P.set(I(e))}#B;#q;get selfMaxLength(){return this.#B.get()}set selfMaxLength(e){this.#B.set(I(e))}get maxLength(){return this.#q.get()}set maxLength(e){this.#B.set(I(e))}#R;#_;get selfPattern(){return this.#R.get()}set selfPattern(e){this.#R.set(P(e))}get pattern(){return this.#_.get()}set pattern(e){this.#R.set(P(e))}#V;#D;get selfValues(){return this.#V.get()}set selfValues(e){this.#V.set(q(e))}get values(){return this.#D.get()}set values(e){this.#V.set(q(e))}#W;#K;#z;#H;#F;#Y;get errors(){return this.#W.get()}get error(){return this.#W.get()[0]}*[Symbol.iterator](){}child(e){return null}#ne=!1;#re=new M.State(null);#se=new M.State(this.#re.get());#r=new M.State(null);get changed(){return this.#se.get()===this.#re.get()}get value(){return this.#se.get()}set value(e){const t=this.#X?.(e),n=void 0===t?e:t;this.#se.set(n),this.#ne||this.#re.set(n),this.#Q?.(n,this.#te.get(),this),this.#oe()}get state(){return this.#r.get()}set state(e){const t=this.#J?.(e),n=void 0===t?e:t;this.#r.set(n),this.#Z?.(n,this.#te.get(),this),this.#oe()}#oe(){this.#ie||(this.#ie=!0,queueMicrotask((()=>{const e=this.#se.get(),t=this.#r.get();this.#ae(e,t)})))}reset(e=this.#re.get()){this.#le(e)}#le(e){const t=this.#X?.(e),n=void 0===t?e:t;if(this.#F(),this.#Y(),this.#ne=!0,!n||"object"!=typeof n){for(const[,e]of this)e.#le(null);return this.#se.set(n),this.#re.set(n),n}const r=Array.isArray(n)?[...n]:{...n};for(const[e,t]of this)r[e]=t.#le(r[e]);return this.#se.set(r),this.#re.set(r),this.#Q?.(r,this.#te.get(),this),r}#ie=!1;#ce(e,t){const[n,r]=this.#ee?.(e,t)||[e,t];return this.#se.get()===n&&this.#r.get()===r?[n,r]:(this.#se.set(n),this.#r.set(r),this.#ae(n,r))}#ae(e,t){this.#ie=!1;let n=e;if(e&&"object"==typeof e){let r=Array.isArray(e)?[...e]:{...e},s=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},o=!1;for(const[n,i]of this){const a=e[n],l=t?.[n],[c,u]=i.#ce(a,l);a!==c&&(r[n]=c,o=!0),l!==u&&(s[n]=u,o=!0)}o&&(t=s,n=e=r,this.#se.set(e),this.#r.set(s))}return this.#ne||(this.#ne=!0,this.#re.set(n)),[e,t]}validate(e){if(!Array.isArray(e))return Promise.all([this.#K.get(),this.#z(),this.#H()]).then((e=>{const t=e.flat();return t.length?t:null}));const t=[this.validate().then((t=>t?.length?[{path:[...e],store:this,errors:t}]:[]))];for(const[n,r]of this)t.push(r.validate([...e,n]));return Promise.all(t).then((e=>e.flat()))}}class G extends Y{get kind(){return"object"}#ue;*[Symbol.iterator](){yield*Object.entries(this.#ue)}child(e){return this.#ue[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o}={}){const i=Object.entries(e.type);super(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o,size:i.length,setValue:e=>"object"==typeof e?e:null,setState:e=>"object"==typeof e?e:null,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const a=Object.create(null),l={parent:this,onUpdate:(e,t,n)=>{n===this.#ue[t]&&(this.value={...this.value,[t]:e})},onUpdateState:(e,t,n)=>{n===this.#ue[t]&&(this.state={...this.state,[t]:e})}};for(const[e,t]of i)a[e]=z(t,{...l,index:e});this.#ue=a}}D=G;class Q extends Y{#fe=()=>{throw new Error};#ue;get children(){return[...this.#ue.get()]}*[Symbol.iterator](){return yield*[...this.#ue.get().entries()]}child(e){const t=this.#ue.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(e,{parent:t,onUpdate:n,onUpdateState:r,index:s,new:o}={}){const i=new M.State([]),a=e=>{const t=Array.isArray(e)&&e.length||0,n=[...i.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#fe(e));n.length=t,r!==t&&i.set(n)};super(e,{index:s,new:o,parent:t,size:new M.Computed((()=>i.get().length)),state:[],setValue:e=>Array.isArray(e)?e:null==e?null:[e],setState:e=>Array.isArray(e)?e:null==e?null:[e],convert(e,t){const n=Array.isArray(e)?e:null==e?null:[e];return a(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t,r)=>{a(e),n?.(e,t,r)},onUpdateState:r}),this.#ue=i;const l={parent:this,onUpdate:(e,t,n)=>{if(i.get()[t]!==n)return;const r=[...this.value||[]];r.length<t&&(r.length=t),r[t]=e,this.value=r},onUpdateState:(e,t,n)=>{if(i.get()[t]!==n)return;const r=[...this.state||[]];r.length<t&&(r.length=t),r[t]=e,this.state=r}};this.#fe=(t,n)=>{const r=z(e,{...l,index:t,new:n});return r.index=t,r}}insert(e,t=null,n){const r=this.value||[];if(!Array.isArray(r))return!1;const s=[...this.#ue.get()],o=Math.max(0,Math.min(Math.floor(e),s.length)),i=this.#fe(o,n);i.new=!0,s.splice(o,0,i);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(o,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(o,0,{}),this.state=e}return this.#ue.set(s),this.value=a,!0}add(e=null){return this.insert(this.#ue.get().length,e)}remove(e){const t=this.value;if(!Array.isArray(t))return;const n=[...this.#ue.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;const o=[...t],[i]=o.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.#ue.set(n),this.value=o,i}move(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#ue.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let o=Math.min(e,t),i=Math.max(e,t);for(let e=o;e<=i;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.#ue.set(r),this.value=a,!0}exchange(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#ue.get()],s=r[e],o=r[t];if(!s||!o)return!1;r[t]=s,r[e]=o,s.index=t,o.index=e;const i=[...n],a=i[e],l=i[t];i[t]=a,i[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.#ue.set(r),this.value=i,!0}}function Z(e){if(!e?.length)return[];const t=[];let n=[],r=Object.create(null),s=!1;for(const t of e){if("string"==typeof t)continue;const e=t.template;if(!e)continue;s=!0;const n=X(t);r[e]={params:t.params,children:n?[n]:[]}}function o(e){e.length&&t.push({type:"divergent",children:e.map((([e,t])=>{const n=X(t);return n?"string"!=typeof n&&"fragment"===n.type?[n,e]:[{children:[n]},e]:[{children:[]},e]}))})}for(const r of e){if("string"==typeof r){o(n),n=[],t.push(r);continue}if(r.template){o(n),n=[];continue}if(n.length&&r.else){const e=r.if||null;n.push([e,r]),e||(o(n),n=[]);continue}o(n),n=[];const e=r.if;if(e){n.push([e,r]);continue}const s=X(r);s&&t.push(s)}return o(n),s?[{type:"fragment",templates:r,children:t}]:t}function X(e){let t=function(e){const t=e.fragment;if(t&&"string"==typeof t)return{type:"template",template:t,attrs:e.attrs,children:[]};const n=function({text:e,html:t}){return null!=e?{type:"content",value:e}:null!=t?{type:"content",value:t,html:!0}:void 0}(e),r=n?[n]:Z(e.children);return!e.name||t?n||{type:"fragment",children:r}:{name:e.name,is:e.is,attrs:e.attrs,events:e.events,classes:e.classes,styles:e.styles,enhancements:e.enhancements,bind:e.bind,comment:e.comment,children:r}}(e),n=e.vars;n.length&&t&&"string"!=typeof t&&(t.vars?t.vars=[...n,...t.vars]:t?t.vars=n:t={type:"fragment",vars:n,children:[]},n=null);const r=e.enum,s=e.value;return r&&(t={type:"enum",value:r,vars:n,children:t?[t]:[]},n=null),s&&(t={type:"value",name:s,vars:n,children:t?[t]:[]},n=null),n?.length&&(t={type:"fragment",vars:n,children:t?[t]:[]}),t}!function(e){W=e}(Q);const J=/^([+-]?(\d(_?\d)*(\.(\d(_?\d)*)?)?|\.\d(_?\d)*)(?:e[+-]?\d(_?\d)*)|0(b[01](?:_?[01])*|o[0-7](?:_?[0-7])*|x[\dA-F](?:_?[\dA-F])*))$/is;const ee={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class te extends Error{constructor(e,...t){const n=ee[e];super("function"==typeof n?n(...t):n),this.code=e}}const ne=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,re=/^~(?<enhancement>[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_\d\.]*)(?:(?<decorator>[:@!])(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*))?$/u,se=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function oe(e,t){const n=e[t];if(n)return n;const r={attrs:Object.create(null),events:Object.create(null)};return e[t]=r,r}function ie(e,t){const n=e.replace(/$\s+|\s+$/gs,"");if("null"===n)return{value:null};if("true"===n)return{value:!0};if("false"===n)return{value:!1};const r=function(e){return J.test(e)?Number(e.replaceAll("_","")):NaN}(n);return Number.isNaN(r)?se.test(n)?{name:n}:{calc:t(e)}:{value:r}}function ae(e,t,n,r,s){const{attrs:o,events:i,classes:a,styles:l,vars:c,params:u,enhancements:f}=e;return function(d,h){const p=d.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"),g=(ne.exec(p)||re.exec(p))?.groups;if(!g)throw new te("ATTR",d);const{name:m,enhancement:b}=g,v=g.decorator?.toLowerCase();if(b){if(":"===v)oe(f,b).attrs[m]=h?ie(h,t):{name:m};else if("@"===v)oe(f,b).events[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m};else if("!"===v){if("bind"===m)oe(f,b).bind=h||!0}else oe(f,b).value=ie(h,t);return}if(!v)return void(o[m]={value:h});if(":"===v)return void(o[m]=h?ie(h,t):{name:m});if("."===v)return void(a[m]=h?ie(h,t):{name:m});if("style:"===v)return void(l[m]=ie(h,t));if("@"===v)return void(i[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m});if("+"===v)return void c.push({...h?ie(h,n):{value:void 0},variable:m,init:!0});if("*"===v)return void c.push({...ie(h,t),variable:m,init:!1});if("?"===v)return void(u[m]=ie(h,t));if("!"!==v)return;switch(m.toString()){case"fragment":e.fragment=h||!0;break;case"else":e.else=!0;break;case"enum":e.enum=h?ie(h,t):{value:!0};break;case"if":e.if=ie(h,t);break;case"text":e.text=ie(h,t);break;case"html":s&&(e.html=ie(h,t));break;case"template":e.template=h;break;case"bind":e.bind=h||!0;break;case"value":e.value=h;break;case"comment":e.comment=h}}}function le(e,t){return{name:e,is:t,children:[],attrs:Object.create(null),events:Object.create(null),classes:Object.create(null),styles:Object.create(null),vars:[],params:Object.create(null),enhancements:Object.create(null)}}var ce={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};const ue=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function fe(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function de(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function he(...e){console.error(new te(...e))}function pe(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in ce?ce[t]:(he("ENTITY",e),e)}var ge=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new te("CALC")},createInit:n=t,createEvent:r=()=>{throw new te("EVENT")},simpleTag:s=new Set,enableHTML:o=!1}={}){const i=[],a={children:i},l=[];let c=null,u=a;function f(){c=l.pop()||null,u=c||a}function d(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&u.children.push(e)}let h={},p=0;function g(t){if(t<=p)return;d(e.substring(p,t).replace(/&#?\w+;/g,pe)),p=t}for(;;){const m=e.indexOf("<",p);if(m<0){const $=e.substring(p);$.match(/^\s*$/)||d($);break}m>p&&g(m);const b=e.charAt(m+1);if("!"===b){let j=m+2,L=">";if("--"===e.slice(m+2,m+4)&&(j+=4,L="--\x3e"),p=e.indexOf(L,j),p<0)break;p++;continue}if("/"===b){p=e.indexOf(">",m+3);let T=e.substring(m+2,p);if(p<0?(T=e.substring(m+2).replace(/[\s<].*/,""),he("UNCOMPLETED",T,c?.name),p=m+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),he("UNCOMPLETED",T),p=m+1+T.length),c){const M=c.name;if(M===T)f();else{if(M.toLowerCase()!=T.toLowerCase())throw new te("CLOSE",T,c.name);f()}}p++;continue}function v(t){let n=p+1;if(p=e.indexOf(t,n),p<0)throw new te("QUOTE",t);const r=e.slice(n,p).replace(/&#?\w+;/g,pe);return p++,r}function y(){let t=e.charAt(p);for(;t<=" "||"€"===t;t=e.charAt(++p));return t}function w(){let t=p,n=e.charAt(p);for(;fe(n);)p++,n=e.charAt(p);return e.slice(t,p)}p=m+1;let x=e.charAt(p);switch(x){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case">":case"/":throw new te("SYMBOL",x);case"":throw new te("EOF")}const O=w(),S=ue.exec(O)?.groups;if(!S)throw new te("TAG",O);l.push(c),c=le(S.name,S.is),u.children.push(c),u=c;const E=ae(c,t,n,r,o);let C=!0,A=!1;e:for(;C;){let N=y();switch(N){case"":he("EOF"),p++;break e;case">":p++;break e;case"/":A=!0;break e;case'"':case"'":throw new te("ATTR_VALUE");case"=":throw new te("SYMBOL",N)}const k=w();if(!k){he("EOF"),p++;break e}switch(N=y(),N){case"":he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),A=!0;break e;case"=":p++;break;case"'":case'"':E(k,v(N));continue;default:E(k,"");continue}switch(N=y(),N){case"":E(k,""),he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),A=!0;break e;case"'":case'"':E(k,v(N));continue}E(k,w())}if(A){for(;;){p++;const I=e.charAt(p);if("/"!==I&&!(I<=" "||"€"===I))break}switch(e.charAt(p)){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case"":he("EOF");break;case">":p++;break;default:throw new te("CLOSE_SYMBOL")}f()}else(s.has(O)||de(e,p,O,h))&&f()}return Z(i)}});function me(e){let t=!0;const n=new M.subtle.Watcher((()=>{t&&(t=!1,queueMicrotask((()=>{t=!0;for(const e of n.getPending())e.get();n.watch()})))})),r=new M.Computed(e);return n.watch(r),r.get(),()=>{n.unwatch(r)}}function be(e,t,n){let r,s=!1;return me((()=>{const o=e();if(!s)return s=!0,r=o,void(n&&t(o));Object.is(o,r)||(r=o,t(o))}))}const ve=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,ref:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,changed:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,minLength:!0,maxLength:!0,pattern:!0,values:!0,null:!0,index:!0,no:!0,size:!0,error:!0,errors:!0}));function*ye(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of ve)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],yield[`${t}${n}reset`,{exec:()=>e.reset()}],yield[`${t}${n}validate`,{exec:t=>e.validate(t?[]:null)}],e instanceof Q&&(yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}])}function we(e,t,n){for(const[n,r]of t){for(const[t,s]of ye(r,n))e[t]=s;for(const[t,s]of ye(r,n,"$$"))e[t]=s}}const xe={value$:{calc:e=>e?.[_].value},state$:{calc:e=>e?.[_].state}};var Oe=Object.getOwnPropertyDescriptors(xe);function Se(e){if(!e)return!1;const t=e.indexOf("$");return t<0||(e.indexOf("$",t+2)>0||"$"===e[0]&&"_$".includes(e[1]))}function Ee(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class Ce{exec({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#de[e];if("function"!=typeof t?.get)return;return t.get()}return"function"==typeof t?t(this.getters):n}get({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#de[e];if("function"!=typeof t?.get)return;const{get:n,set:r}=t;return{get:n,set:r}}if("function"==typeof t){const e=new M.Computed((()=>t(this.getters)));return{get:()=>e.get()}}return{get:()=>n}}watch(e,t){return be((()=>this.exec(e)),t,!0)}enum(e){const{name:t,calc:n}=e;if("function"==typeof n)return()=>n(this.getters);if("string"==typeof t){const e=this.#de[t];if("function"!=typeof e?.get)return null;const n=e.store;return n instanceof Y?n:e.get}return this.store}getStore(e){if(!e)return null;const t=this.#de[!0===e?"":e];return t?.get&&t.store||null}bind(e,t,n){const r=this.#de[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?ve.has(t)?be((()=>s[t]),n,!0):void 0:"value"===t?be((()=>r.get()),n,!0):void 0}bindAll(e){const t=this.#de[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>be(e,t,!0)}}return Object.fromEntries([...ve].map((e=>[`$${e}`,t=>be((()=>n[e]),t,!0)])))}getBindAll(e){const t=this.#de[!0===e?"":e];if(!t?.get)return{};const{store:n}=t;if(!n){const{get:e,set:n}=t;return{$value:{get:e,set:n}}}return Object.fromEntries([...ve].map((e=>[`$${e}`,"value"===e||"state"===e?{get:()=>n[e],set:t=>{n[e]=t}}:{get:()=>n[e]}])))}bindSet(e,t){const n=this.#de[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#de[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)},$reset:e=>{n.reset()},$validate:e=>{n.validate(e?[]:null)}}}getEvent({name:e,event:t}){if("function"==typeof t)return t;const n=this.#de[e];if(!n)return null;const{exec:r,calc:s}=n;return"function"==typeof r?r:"function"==typeof s?s:null}constructor(e,t){if(this.store=e,t instanceof Ce){this.#he=t.#he;const e=this.#pe;for(const[n,r]of Object.entries(t.#pe))e[n]=r;const n=this.#ge;for(const[e,r]of Object.entries(t.#ge))n[e]=r}else we(this.#pe,e),this.#he=function(e){const t=Object.create(null,Oe);if(!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!Se(n))continue;if(!r||"object"!=typeof r)continue;if(r instanceof Y){for(const[e,s]of ye(r,n))t[e]=s;continue}const{get:e,set:s,exec:o,calc:i}=r;"function"!=typeof e?"function"!=typeof i?"function"!=typeof o||(t[n]={exec:o}):t[n]={calc:i}:t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#he;#pe=Object.create(null);#ge=Object.create(null);store;#me=null;#s=null;#be=null;get#de(){const e=this.#be;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#pe,...this.#he,...this.#ge})),n=this.store,r=this.#s,s=this.#me;for(const[e,r]of ye(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof Q))return yield[`${n}${r}upMovable`,{get:()=>!1}],void(yield[`${n}${r}downMovable`,{get:()=>!1}]);yield[`${n}${r}upMovable`,{get:()=>{const e=t.index;return"number"==typeof e&&!(e<=0)}}],yield[`${n}${r}downMovable`,{get:()=>{const n=t.index;return"number"==typeof n&&!(n>=e.size-1)}}],yield[`${n}${r}remove`,{exec:()=>e.remove(Number(t.index))}],yield[`${n}${r}upMove`,{exec:()=>{const n=t.index;"number"==typeof n&&(n<=0||e.move(n,n-1))}}],yield[`${n}${r}downMove`,{exec:()=>{const n=t.index;"number"==typeof n&&(n>=e.size-1||e.move(n,n+1))}}]}(r,n))t[e]=s;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};return this.#be=t,t}setStore(e,t,n){const r=new Ce(e,this);return t&&(r.#s=t),we(r.#pe,e),n&&(r.#me=n),r}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new Ce(t,this);return we(n.#pe,t),n}params(e,t,n,r){let s=this.store;if(!0===r)s=n.store;else if(r){const e=n.#de[r],t=e?.get&&e.store;t&&(s=t)}if(0===Object.keys(e).length)return this;const o=new Ce(s,this);o.#s=this.#s,o.#me=this.#me;const i=o.#ge,a=o.#de;for(const[r,s]of Object.entries(e)){const e=r in t?t[r]:null;if(e){const{name:t,calc:s,value:o}=e;if(t){const e=n.#de[t];if(!e?.get)continue;if(!e.store){i[r]=a[r]=e;continue}for(const[t,n]of ye(e.store,r))i[t]=a[t]=n;continue}if("function"==typeof s){const e=new M.Computed((()=>s(n.getters)));i[r]=a[r]={get:()=>e.get()};continue}i[r]=a[r]={get:()=>o}}else{const{name:e,calc:t,value:n}=s;if("function"==typeof t){const e=o.getters;o.#ve=null;const n=new M.Computed((()=>t(e)));i[r]=a[r]={get:()=>n.get()};continue}if(e){const t=a[e];if(!t?.get)continue;if(!t.store){i[r]=a[r]=t;continue}for(const[e,n]of ye(t.store,r))i[e]=a[e]=n;continue}i[r]=a[r]={get:()=>n}}}return o}setObject(e){const t=new Ce(this.store,this);return t.#me=e,t}set(e){if(!e?.length)return this;const t=new Ce(this.store,this);t.#s=this.#s,t.#me=this.#me;const n=t.#ge,r=t.#de;for(const{variable:s,name:o,calc:i,value:a,init:l}of e)if(l){const e=new M.State(a);if("function"==typeof i){const n=t.settable;t.#ye=null,e.set(i(n))}else if(o){const t=r[o];if(!t?.get)continue;e.set(t.get())}n[s]=r[s]={get:()=>e.get(),set:t=>{e.set(t)}}}else if("function"!=typeof i)if(o){const e=r[o];if(!e)continue;if(!e.get||!e.store){n[s]=r[s]=e;continue}for(const[t,o]of ye(e.store,s))n[t]=r[t]=o}else n[s]=r[s]={get:()=>a};else{const e=t.getters;t.#ve=null;const o=new M.Computed((()=>i(e)));n[s]=r[s]={get:()=>o.get()}}return t}#we=null;get all(){const e=this.#we;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc?Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1}):Object.defineProperty(t,e,{value:n.exec,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#we=t,t}#ye=null;get settable(){const e=this.#ye;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#ye=t,t}#ve=null;get getters(){const e=this.#ve;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#de))n.get?Object.defineProperty(t,e,{get:n.get,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#ve=t,t}}const Ae={width:"px",height:"px",top:"px",right:"px",bottom:"px",left:"px",border:"px","border-top":"px","border-right":"px","border-left":"px","border-bottom":"px","border-width":"px","border-top-width":"px","border-right-width":"px","border-left-width":"px","border-bottom-width":"px","border-radius":"px","border-top-left-radius":"px","border-top-right-radius":"px","border-bottom-left-radius":"px","border-bottom-right-radius":"px",padding:"px","padding-top":"px","padding-right":"px","padding-left":"px","padding-bottom":"px",margin:"px","margin-top":"px","margin-right":"px","margin-left":"px","margin-bottom":"px"};function $e(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in Ae?`${s}${Ae[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class je{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}}const Le={stop(e){e instanceof Event&&e.stopPropagation()},prevent(e){e instanceof Event&&e.preventDefault()},self(e){if(e instanceof Event)return e.target===e.currentTarget},enter(e){if(e instanceof KeyboardEvent)return"Enter"===e.key},tab(e){if(e instanceof KeyboardEvent)return"Tab"===e.key},esc(e){if(e instanceof KeyboardEvent)return"Escape"===e.key},space(e){if(e instanceof KeyboardEvent)return" "===e.key},backspace(e){if(e instanceof KeyboardEvent)return"Backspace"===e.key},delete(e){if(e instanceof KeyboardEvent)return"Delete"===e.key},delBack(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},"del-back"(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},insert(e){if(e instanceof KeyboardEvent)return"Insert"===e.key},repeat(e){if(e instanceof KeyboardEvent)return e.repeat},key(e,t){if(e instanceof KeyboardEvent){const n=e.code.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},main(e){if(e instanceof MouseEvent)return 0===e.button},auxiliary(e){if(e instanceof MouseEvent)return 1===e.button},secondary(e){if(e instanceof MouseEvent)return 2===e.button},left(e){if(e instanceof MouseEvent)return 0===e.button},middle(e){if(e instanceof MouseEvent)return 1===e.button},right(e){if(e instanceof MouseEvent)return 2===e.button},primary(e){if(e instanceof PointerEvent)return e.isPrimary},mouse(e){if(e instanceof PointerEvent)return"mouse"===e.pointerType},pen(e){if(e instanceof PointerEvent)return"pen"===e.pointerType},touch(e){if(e instanceof PointerEvent)return"touch"===e.pointerType},pointer(e,t){if(e instanceof PointerEvent){const n=e.pointerType.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},ctrl(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey},alt(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.altKey},shift(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.shiftKey},meta(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.metaKey},cmd(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey||e.metaKey}};function Te(e,t,n){const r=[];if(t)for(let s=e.shift();s;s=e.shift()){const e=s.indexOf(":"),o=e>=0?s.slice(0,e):s,i=e>=0?s.slice(e+1).split(":"):[],a=o.replace(/^-+/,""),l=(o.length-a.length)%2==1;let c=t[a]||a;if(n)switch(c){case"once":case"passive":case"capture":n[c]=!l;continue}"string"==typeof c&&(c=Le[c]),"function"==typeof c&&r.push([c,i,l])}return r}function Me(e,t,n){return r=>{const s=e.all;for(const[e,t,o]of n)if(e(r,t,s)===o)return;t(r,s)}}function Ne(e){return"number"==typeof e||"bigint"==typeof e?String(e):"boolean"==typeof e?e?"":null:"string"==typeof e?e:null===(e??null)?null:String(e)}function ke(e){return null===(e??null)?"":String(e)}function Ie(e,t){if(e instanceof HTMLInputElement&&"checked"===t)switch(e.type.toLowerCase()){case"checkbox":case"radio":return Boolean}if((e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&"value"===t)return ke;if(e instanceof HTMLDetailsElement&&"open"===t)return Boolean;if(e instanceof HTMLMediaElement){if("muted"===t)return Boolean;if("paused"===t)return Boolean;if("currentTime"===t)return!0;if("playbackRate"===t)return!0;if("volume"===t)return!0}return!1}const Pe={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=ke(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["change",(e,t)=>t.value]}}};function Ue(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watch:s,props:o}=e;return["input","textarea","select"].includes(t.toLowerCase())&&e.relate(r),e.listen("init",(({events:n})=>{const i=Pe[t.toLowerCase()],a=i?.attrs||{},l=i?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,o]=n;r.addEventListener(e,(e=>t(o(e,r))),s)}}if(o)for(const[t,n]of Object.entries(e.attrs))if(s(t,(e=>{if(o.has(t))r[t]=e;else{const n=Ne(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),o.has(t))r[t]=n;else{const e=Ne(n);null!==e&&r.setAttribute(t,e)}else for(const[t,n]of Object.entries(e.attrs)){if(r instanceof HTMLInputElement&&"type"===t.toLocaleLowerCase()){const e=Ne(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=Ie(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let o=Ne(n);null!==o&&r.setAttribute(t,o),s(t,(e=>{const n=Ne(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Be(e){return null===(e??null)?"":String(e)}function qe(e,t,n,r,s){if(!s){const s=e.insertBefore(document.createTextNode(""),t),o=n.watch(r,(e=>s.textContent=Be(e)));return()=>{s.remove(),o()}}const o=e.insertBefore(document.createComment(""),t),i=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=o.nextSibling;e&&e!==i;e=o.nextSibling)e.remove()}const c=n.watch(r,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=o.firstChild)e.insertBefore(t,i)}(Be(t))}));return()=>{c(),l(),o.remove(),i.remove()}}const Re=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function _e(e,t,n,r,s){const o=e.children;if(!o.length)return()=>{};const i=t.insertBefore(document.createComment(""),n);let a=null,l=()=>{};const c=be((()=>o.find((([,e])=>!e||r.exec(e)))||null),(e=>{if(e===a)return;a=e,l(),l=()=>{};const t=e?.[0];t&&(l=s(t.children,t.vars,t.templates))}),!0);let u=!1;return()=>{u||(u=!0,c(),l(),l=()=>{},i.remove())}}function Ve(e,t,n,r,s,o,i,a,l){const c=e.bind,u=[...o,e.name],f=l?.(u);if(l&&!f)return()=>{};const{context:d,handler:h}=function(e,t,n,r){const s="string"==typeof e?e:e.tag,{attrs:o,events:i}="string"!=typeof e&&e||{attrs:null,events:null};let a=!1;const l=new M.State(!1);let c=!1;const u=new M.State(!1),f=Object.create(null),d=Object.create(null),h=new Set,p=[],g=new je;return{context:{events:p,props:o?new Set(Object.entries(o).filter((([,e])=>e.isProp)).map((([e])=>e))):null,attrs:d,watch(e,t){if(a)return()=>{};const n=f[e];if(!n)return()=>{};let r=n.get();const s=be((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}),!0);return h.add(s),()=>{h.delete(s),s()}},relate(e){if(!n||!r||a)return()=>{};try{const t=r(n,e);return"function"!=typeof t?()=>{}:(h.add(t),()=>{h.delete(t),t()})}catch{return()=>{}}},get destroyed(){return l.get()},get init(){return u.get()},listen:(e,t)=>g.listen(e,t)},handler:{tag:s,set(e,t){if(o&&!(e in o))return;let n=f[e];if(n)return void n.set(t);const r=new M.State(t);f[e]=r,Object.defineProperty(d,e,{configurable:!0,enumerable:!0,get:r.get.bind(r)})},addEvent(e,n){if("function"!=typeof n)return;const[r,...s]=e.split(".").filter(Boolean),o=i?i[r].filters:{};if(!o)return;const a={},l=Te(s,o,a);p.push([r,Me(t,n,l),a])},destroy(){if(!a){a=!0,l.set(!0);for(const e of h)e();g.emit("destroy")}},mount(){c||(c=!0,u.set(!0),g.emit("init",{events:p}))}}}}(f||e.name,r,r.getStore(c),a),p=f?.attrs,g=p?function(e,t,n,r,s){let o=new Set;for(const[i,a]of Object.entries(r)){if("class"===i||"style"===i)continue;if(i in n){const r=n[i],{name:s,calc:l,value:c}=n[i];if(!s&&!l){e.set(i,c);continue}a.immutable&&e.set(i,t.exec(r)),o.add(t.watch(r,(t=>e.set(i,t))));continue}const r=a.bind;if(!s||!r){e.set(i,a.default);continue}if("string"==typeof r){const n=t.bind(s,r,(t=>e.set(i,t)));n?o.add(n):e.set(i,a.default);continue}if(!Array.isArray(r)){e.set(i,a.default);continue}const[l,c,u]=r;if(!l||"function"!=typeof c)continue;if(!u){const n=!0===s?"":s;o.add(t.watch({name:n},(t=>e.set(i,t)))),e.addEvent(l,((...e)=>{t.all[n]=c(...e)}));continue}const f=t.bind(s,"state",(t=>e.set(i,t)));if(!f)continue;o.add(f);const d=t.bindSet(s,"state");d&&e.addEvent(l,((...e)=>{d(c(...e))}))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(h,r,e.attrs,p,c):function(e,t,n){const r=e.tag;let s=new Set;for(const[o,i]of Object.entries(n)){if("class"===o||"style"===o)continue;const{name:n,calc:a,value:l}=i;if(n||a)if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==o.toLocaleLowerCase())s.add(t.watch(i,(t=>e.set(o,t))));else{const n=t.exec(i);e.set(o,n)}else e.set(o,l)}return()=>{const e=s;s=new Set;for(const t of e)t()}}(h,r,e.attrs);for(const[t,n]of Object.entries(e.events)){const e=r.getEvent(n);e&&h.addEvent(t,e)}const m=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,o]of Object.entries(t.bindAll(n)||{}))"function"==typeof o&&r.add(o((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(h,r,c),b=f?"function"==typeof f.tag?f.tag(d):Ue(d,f.tag,f.is):Ue(d,e.name,e.is),v=Array.isArray(b)?b[0]:b,y=Array.isArray(b)?b[1]:v;t.insertBefore(v,n);const w=y?Ke(e.children||[],y,null,r,s,o,i,a,l):()=>{},x=function(e,t,n,r){if(!(e instanceof Element))return()=>{};r&&(e.className+=" "+t.exec(r));let s=new Set;for(const[r,o]of Object.entries(n))o.value?e.classList.add(r):s.add(be((()=>Boolean(t.exec(o))),(t=>{t?e.classList.add(r):e.classList.remove(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(v,r,e.classes,e.attrs.class),O=function(e,t,n,r){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};if(r){const n=[e.getAttribute("style")||"",t.exec(r)||""].filter(Boolean).join(";");n&&e.setAttribute("style",n)}let s=new Set;for(const[r,o]of Object.entries(n))s.add(be((()=>$e(r,t.exec(o))),(t=>{t?e.style.setProperty(r,...t):e.style.removeProperty(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(v,r,e.styles,e.attrs.style);h.mount();const S=function(e,t,n,r,s,o){let i=new Set;for(const[a,{attrs:l,value:c,events:u,bind:f}]of Object.entries(t)){if(!Re(r,a))continue;const d=r[a];if("function"!=typeof d)continue;let h=!1;const p=new M.State(!1),g=d?.events,m=[],b=Object.create(null),v=new Set,y=new je;function w(e,t){if("function"!=typeof t)return;const[r,...s]=e.split(".").filter(Boolean),o=g?g[r].filters:{};if(!o)return;const i={},a=Te(s,o,i);m.push([r,Me(n,t,a),i])}function x(){if(!h){h=!0,p.set(!0);for(const e of v)e();y.emit("destroy")}}i.add(x);for(const[S,E]of Object.entries(l)){const C=n.get(E);C&&Object.defineProperty(b,S,{...C,configurable:!0,enumerable:!0})}for(const[A,$]of Object.entries(u)){const j=n.getEvent($);j&&w(A,j)}if(f){for(const[L,T]of Object.entries(n.getBindAll(f)||{}))Object.defineProperty(b,L,{...T,configurable:!0,enumerable:!0});for(const[N,k]of Object.entries(n.bindEvents(f)||{}))w(N,(e=>k(e)))}const O={get value(){return null},events:m,attrs:b,watch(e,t){if(h)return()=>{};let n=b[e];const r=be((()=>b[e]),(r=>{const s=n;n=r,t(r,s,e)}),!0);return v.add(r),()=>{v.delete(r),r()}},get destroyed(){return p.get()},listen:(e,t)=>y.listen(e,t),root:s,slot:o,tag:e};if(c){const I=n.get(c);I&&Object.defineProperty(O,"value",{...I,configurable:!0,enumerable:!0})}d(O)}return()=>{const e=i;i=new Set;for(const t of e)t()}}(h.tag,e.enhancements,r,i,v,y);return()=>{S(),h.destroy(),v.remove(),g(),w(),m(),x(),O()}}function De(e,t,n){if(!n)return t;const r=Object.entries(n);if(!r.length)return t;const s=Object.create(t);for(const[t,n]of r)s[t]=[n,e];return s}function We(e,t,n,r,s,o,i,a,l){if("string"==typeof e){const r=document.createTextNode(e);return t.insertBefore(r,n),()=>r.remove()}const c=r.set(e.vars),u=De(c,s,e.templates);if("divergent"===e.type)return _e(e,t,n,c,((e,r,u)=>{const f=c.set(r),d=De(f,s,u);return Ke(e,t,n,f,d,o,i,a,l)}));if("value"===e.type){const r=c.child(e.name);return r?Ke(e.children,t,n,r,u,o,i,a,l):()=>{}}if("enum"===e.type){const r=c.enum(e.value),s=(n,r)=>Ke(e.children,t,n,r,u,o,i,a,l);return r instanceof Q?function(e,t,n,r,s){const o=e.insertBefore(document.createComment(""),t);let i=new Map;function a(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const l=new M.State(0),c=be((()=>n.children),(function(t){if(!o.parentNode)return;let c=o.nextSibling;const u=i;i=new Map,l.set(t.length);for(let o of t){const t=u.get(o);if(!t){const t=e.insertBefore(document.createComment(""),c),a=e.insertBefore(document.createComment(""),c),u=s(a,r.setStore(o,n,{get count(){return l.get()},get key(){return o.index},get index(){return o.index},get item(){return o.value}}));i.set(o,[t,a,u]);continue}if(u.delete(o),i.set(o,t),c===t[0]){c=t[1].nextSibling;continue}let a=t[0];for(;a&&a!==t[1];){const t=a;a=a.nextSibling,e.insertBefore(t,c)}e.insertBefore(t[1],c)}a(u)}),!0);return()=>{o.remove(),a(i),c()}}(t,n,r,c,s):r instanceof G?function(e,t,n,r,s){const o=[],i=[...n].map((([e,t],n)=>[e,t,n])),a=i.length;for(const[e,l,c]of i)o.push(s(t,r.setStore(l,n,{get count(){return a},get key(){return e},get index(){return c},get item(){return l.value}})));return()=>{for(const e of o)e()}}(0,n,r,c,s):"function"==typeof r?function(e,t,n,r,s){const o=new M.Computed((()=>{const e=n();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t,t])):Object.entries(e).map((([e,t],n)=>[t,n,e])):[]})),i=e.insertBefore(document.createComment(""),t);let a=[];function l(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const c=new M.State(0),u=be((()=>o.get()),(function(t){if(!i.parentNode)return;let n=i.nextSibling;const o=a;a=[],c.set(t.length);for(const[i,l,u]of t){const t=o.findIndex((e=>e[3]===u)),[f]=t>=0?o.splice(t,1):[];if(!f){const t=e.insertBefore(document.createComment(""),n),o=e.insertBefore(document.createComment(""),n),f=new M.State(i),d=new M.State(l),h=s(o,r.setObject({get count(){return c.get()},get key(){return u},get item(){return f.get()},get index(){return d.get()}}));a.push([t,o,h,u,f,d]);continue}if(a.push(f),f[4].set(i),f[5].set(l),n===f[0]){n=f[1].nextSibling;continue}let d=f[0];for(;d&&d!==f[1];){const t=d;d=d.nextSibling,e.insertBefore(t,n)}e.insertBefore(f[1],n)}l(o)}),!0);return()=>{i.remove(),l(a),u()}}(t,n,r,c,s):()=>{}}if("content"===e.type)return qe(t,n,c,e.value,e.html);if("template"===e.type){const r=u[e.template];if(!r)return()=>{};const[f,d]=r,h=d.params(f.params,e.attrs,c,e.bind),p=De(h,s,f.templates);return Ke(f.children,t,n,h,p,o,i,a,l)}return"fragment"===e.type?Ke(e.children,t,n,c,u,o,i,a,l):Ve(e,t,n,c,u,o,i,a,l)}function Ke(e,t,n,r,s,o,i,a,l){const c=e.map((e=>We(e,t,n,r,s,o,i,a,l)));let u=!1;return()=>{if(!u){u=!0;for(const e of c)e()}}}function ze(e,t,n,{component:r,global:s,relate:o,enhancements:i}={}){return Ke(t,n,null,new Ce(e,s),Object.create(null),[],i||{},"function"==typeof o?o:null,r)}export{ge as Layout,M as Signal,Y as Store,me as effect,ze as render,be as watch};
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @neeloong/form v0.12.0
2
+ * @neeloong/form v0.12.1
3
3
  * (c) 2024-2025 Fierflame
4
4
  * @license Apache-2.0
5
5
  */
@@ -819,6 +819,7 @@ class Store {
819
819
  }
820
820
  this.#value.set(newValues);
821
821
  this.#initValue.set(newValues);
822
+ this.#onUpdate?.(newValues, this.#index.get(), this);
822
823
  return newValues;
823
824
  }
824
825
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neeloong/form",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "from",