@neeloong/form 0.1.0
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 +312 -0
- package/index.js +3658 -0
- package/index.min.js +60 -0
- package/index.min.mjs +60 -0
- package/index.mjs +3076 -0
- package/package.json +36 -0
package/index.min.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @neeloong/form v0.1.0
|
|
3
|
+
* (c) 2024-2025 Fierflame
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).neeloongForm={})}(this,(function(e){"use strict";var t=Object.defineProperty,n=(e,n,r)=>(((e,n,r)=>{n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r})(e,"symbol"!=typeof n?n+"":n,r),r),r=(e,t)=>{if(Object(t)!==t)throw TypeError('Cannot use the "in" operator on this value');return e.has(t)},i=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},o=(e,t,n)=>(((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)})(e,t,"access private method"),n);
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10
|
+
*
|
|
11
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
12
|
+
* found in the LICENSE file at https://angular.io/license
|
|
13
|
+
*/
|
|
14
|
+
function s(e,t){return Object.is(e,t)}
|
|
15
|
+
/**
|
|
16
|
+
* @license
|
|
17
|
+
* Copyright Google LLC All Rights Reserved.
|
|
18
|
+
*
|
|
19
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
20
|
+
* found in the LICENSE file at https://angular.io/license
|
|
21
|
+
*/let a=null,l=!1,c=1;const u=Symbol("SIGNAL");function d(e){const t=a;return a=e,t}const f={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function h(e){if(l)throw new Error("undefined"!=typeof ngDevMode&&ngDevMode?"Assertion error: signal read during notification phase":"");if(null===a)return;a.consumerOnSignalRead(e);const t=a.nextProducerIndex++;if(w(a),t<a.producerNode.length&&a.producerNode[t]!==e&&v(a)){b(a.producerNode[t],a.producerIndexOfThis[t])}a.producerNode[t]!==e&&(a.producerNode[t]=e,a.producerIndexOfThis[t]=v(a)?m(e,a,t):0),a.producerLastReadVersion[t]=e.version}function p(e){if(e.dirty||e.lastCleanEpoch!==c){if(!e.producerMustRecompute(e)&&!function(e){w(e);for(let t=0;t<e.producerNode.length;t++){const n=e.producerNode[t],r=e.producerLastReadVersion[t];if(r!==n.version)return!0;if(p(n),r!==n.version)return!0}return!1}(e))return e.dirty=!1,void(e.lastCleanEpoch=c);e.producerRecomputeValue(e),e.dirty=!1,e.lastCleanEpoch=c}}function g(e){if(void 0===e.liveConsumerNode)return;const t=l;l=!0;try{for(const t of e.liveConsumerNode)t.dirty||y(t)}finally{l=t}}function y(e){var t;e.dirty=!0,g(e),null==(t=e.consumerMarkedDirty)||t.call(e.wrapper??e)}function m(e,t,n){var r;if(x(e),w(e),0===e.liveConsumerNode.length){null==(r=e.watched)||r.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)e.producerIndexOfThis[t]=m(e.producerNode[t],e,t)}return e.liveConsumerIndexOfThis.push(n),e.liveConsumerNode.push(t)-1}function b(e,t){var n;if(x(e),w(e),"undefined"!=typeof ngDevMode&&ngDevMode&&t>=e.liveConsumerNode.length)throw new Error(`Assertion error: active consumer index ${t} is out of bounds of ${e.liveConsumerNode.length} consumers)`);if(1===e.liveConsumerNode.length){null==(n=e.unwatched)||n.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)b(e.producerNode[t],e.producerIndexOfThis[t])}const r=e.liveConsumerNode.length-1;if(e.liveConsumerNode[t]=e.liveConsumerNode[r],e.liveConsumerIndexOfThis[t]=e.liveConsumerIndexOfThis[r],e.liveConsumerNode.length--,e.liveConsumerIndexOfThis.length--,t<e.liveConsumerNode.length){const n=e.liveConsumerIndexOfThis[t],r=e.liveConsumerNode[t];w(r),r.producerIndexOfThis[n]=t}}function v(e){var t;return e.consumerIsAlwaysLive||((null==(t=null==e?void 0:e.liveConsumerNode)?void 0:t.length)??0)>0}function w(e){e.producerNode??(e.producerNode=[]),e.producerIndexOfThis??(e.producerIndexOfThis=[]),e.producerLastReadVersion??(e.producerLastReadVersion=[])}function x(e){e.liveConsumerNode??(e.liveConsumerNode=[]),e.liveConsumerIndexOfThis??(e.liveConsumerIndexOfThis=[])}
|
|
22
|
+
/**
|
|
23
|
+
* @license
|
|
24
|
+
* Copyright Google LLC All Rights Reserved.
|
|
25
|
+
*
|
|
26
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
27
|
+
* found in the LICENSE file at https://angular.io/license
|
|
28
|
+
*/function S(e){if(p(e),h(e),e.value===C)throw e.error;return e.value}const E=Symbol("UNSET"),O=Symbol("COMPUTING"),C=Symbol("ERRORED"),$=(()=>({...f,value:E,dirty:!0,error:null,equal:s,producerMustRecompute:e=>e.value===E||e.value===O,producerRecomputeValue(e){if(e.value===O)throw new Error("Detected cycle in computations.");const t=e.value;e.value=O;const n=function(e){return e&&(e.nextProducerIndex=0),d(e)}(e);let r,i=!1;try{r=e.computation.call(e.wrapper);i=t!==E&&t!==C&&e.equal.call(e.wrapper,t,r)}catch(t){r=C,e.error=t}finally{!function(e,t){if(d(t),e&&void 0!==e.producerNode&&void 0!==e.producerIndexOfThis&&void 0!==e.producerLastReadVersion){if(v(e))for(let t=e.nextProducerIndex;t<e.producerNode.length;t++)b(e.producerNode[t],e.producerIndexOfThis[t]);for(;e.producerNode.length>e.nextProducerIndex;)e.producerNode.pop(),e.producerLastReadVersion.pop(),e.producerIndexOfThis.pop()}}(e,n)}i?e.value=t:(e.value=r,e.version++)}}))();let A=
|
|
29
|
+
/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright Google LLC All Rights Reserved.
|
|
32
|
+
*
|
|
33
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
34
|
+
* found in the LICENSE file at https://angular.io/license
|
|
35
|
+
*/
|
|
36
|
+
function(){throw new Error};function T(){return h(this),this.value}function N(e,t){!1===(null==a?void 0:a.consumerAllowSignalWrites)&&A(),e.equal.call(e.wrapper,e.value,t)||(e.value=t,function(e){e.version++,c++,g(e)}
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
* Copyright 2024 Bloomberg Finance L.P.
|
|
40
|
+
*
|
|
41
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
42
|
+
* you may not use this file except in compliance with the License.
|
|
43
|
+
* You may obtain a copy of the License at
|
|
44
|
+
*
|
|
45
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
46
|
+
*
|
|
47
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
48
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
49
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
50
|
+
* See the License for the specific language governing permissions and
|
|
51
|
+
* limitations under the License.
|
|
52
|
+
*/(e))}const j=(()=>({...f,equal:s,value:void 0}))();const I=Symbol("node");e.Signal=void 0,(e=>{var t,s,c,p;t=I,s=new WeakSet,e.isState=e=>r(s,e),e.State=class{constructor(r,o={}){i(this,s),n(this,t);const a=
|
|
53
|
+
/**
|
|
54
|
+
* @license
|
|
55
|
+
* Copyright Google LLC All Rights Reserved.
|
|
56
|
+
*
|
|
57
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
58
|
+
* found in the LICENSE file at https://angular.io/license
|
|
59
|
+
*/
|
|
60
|
+
function(e){const t=Object.create(j);t.value=e;const n=()=>(h(t),t.value);return n[u]=t,n}(r),l=a[u];if(this[I]=l,l.wrapper=this,o){const t=o.equals;t&&(l.equal=t),l.watched=o[e.subtle.watched],l.unwatched=o[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return T.call(this[I])}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");N(this[I],t)}};c=I,p=new WeakSet,e.isComputed=e=>r(p,e),e.Computed=class{constructor(t,r){i(this,p),n(this,c);const o=function(e){const t=Object.create($);t.computation=e;const n=()=>S(t);return n[u]=t,n}(t),s=o[u];if(s.consumerAllowSignalWrites=!0,this[I]=s,s.wrapper=this,r){const t=r.equals;t&&(s.equal=t),s.watched=r[e.subtle.watched],s.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[I])}},(t=>{var s,l,c,u;t.untrack=function(e){let t,n=null;try{n=d(null),t=e()}finally{d(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[I].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[I].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[I].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[I].producerNode;return!!n&&n.length>0};s=I,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){i(this,l),i(this,c),n(this,s);let t=Object.create(f);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[I]=t}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");o(this,c,u).call(this,t);const n=this[I];n.dirty=!1;const r=d(n);for(const e of t)h(e[I]);d(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");o(this,c,u).call(this,t);const n=this[I];w(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];x(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[I].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 k=(t,n,r,i)=>{const o=new e.Signal.State("boolean"==typeof n?n:null),s="function"==typeof r?new e.Signal.Computed((()=>r(t))):r?new e.Signal.Computed((()=>!0)):new e.Signal.Computed((()=>!1)),a=()=>{const e=o.get();return null===e?s.get():e},l=i?new e.Signal.Computed((()=>i.get()||a())):new e.Signal.Computed(a);return[o,l]};class L{static create(e,t={}){return new M({type:null,props:e},{...t,parent:null})}#e=!1;get null(){return this.#e}constructor(t,{null:n,state:r,setValue:i,setState:o,convert:s,onUpdate:a,onUpdateState:l,index:c,length:u,new:d,parent:f,hidden:h,clearable:p,required:g,disabled:y,readonly:m}){this.schema=t,this.#t.set("object"==typeof r&&r||{});const b=f instanceof L?f:null;b&&(this.#n=b,this.#r=b.#r);const v=new e.Signal.State(Boolean(d));this.#i=v;const w=b?new e.Signal.Computed((()=>b.#o.get()||v.get())):new e.Signal.Computed((()=>v.get()));this.#o=w;const x=Boolean(t.immutable),S=!1!==t.creatable;this.#s=x,this.#a=S,this.#l=new e.Signal.Computed((()=>w.get()?S:!x)),[this.#c,this.#u]=k(this,h,t.hidden,b?b.#u:null),[this.#d,this.#f]=k(this,p,t.clearable,b?b.#f:null),[this.#h,this.#p]=k(this,g,t.required,b?b.#p:null),[this.#g,this.#y]=k(this,y,t.disabled,b?b.#y:null),[this.#m,this.#b]=k(this,m,t.readonly,b?b.#b:null),n?this.#e=!0:(this.#v=a||null,this.#w=l||null,this.#x="function"==typeof i?i:null,this.#S="function"==typeof o?o:null,this.#E="function"==typeof s?s:null,this.#O.set(u||0),this.#C.set(c??""))}#$=!1;#x=null;#S=null;#E=null;#v=null;#w=null;#n=null;#r=this;get parent(){return this.#n}get root(){return this.#r}#O=new e.Signal.State(0);get length(){return this.#O.get()}set length(e){this.#O.set(e)}#C=new e.Signal.State("");get index(){return this.#C.get()}set index(e){this.#C.set(e)}get no(){if(this.#e)return"";const e=this.index;return"number"==typeof e?e+1:e}#a=!0;get creatable(){return this.#a}#s=!1;get immutable(){return this.#s}#o;#i;#l;get selfNew(){return this.#i.get()}set selfNew(e){this.#i.set(Boolean(e))}get new(){return this.#o.get()}set new(e){this.#i.set(Boolean(e))}get editable(){return this.#l.get()}#c;#u;get selfHidden(){return this.#c.get()}set selfHidden(e){this.#c.set("boolean"==typeof e?e:null)}get hidden(){return this.#u.get()}set hidden(e){this.#c.set("boolean"==typeof e?e:null)}#d;#f;get selfClearable(){return this.#d.get()}set selfClearable(e){this.#d.set("boolean"==typeof e?e:null)}get clearable(){return this.#f.get()}set clearable(e){this.#d.set("boolean"==typeof e?e:null)}#h;#p;get selfRequired(){return this.#h.get()}set selfRequired(e){this.#h.set("boolean"==typeof e?e:null)}get required(){return this.#p.get()}set required(e){this.#h.set("boolean"==typeof e?e:null)}#g;#y;get selfDisabled(){return this.#g.get()}set selfDisabled(e){this.#g.set("boolean"==typeof e?e:null)}get disabled(){return this.#y.get()}set disabled(e){this.#g.set("boolean"==typeof e?e:null)}#m;#b;get selfReadonly(){return this.#m.get()}set selfReadonly(e){this.#m.set("boolean"==typeof e?e:null)}get readonly(){return this.#b.get()}set readonly(e){this.#m.set("boolean"==typeof e?e:null)}*[Symbol.iterator](){}child(e){return null}#A=!1;#T=null;#N=this.#T;#j=new e.Signal.State(this.#T);#t=new e.Signal.State(null);#I=this.#t.get();get changed(){return this.#j.get()===this.#N}get saved(){return this.#j.get()===this.#T}get value(){return this.#j.get()}set value(e){if(this.#$)return;const t=this.#x?.(e)||e;this.#j.set(t),this.#A||(this.#A=!0,this.#T=e),this.#v?.(this.#j.get(),this.#C.get()),this.#k()}get state(){return this.#t.get()}set state(e){if(this.#$)return;const t=this.#S?.(e)||e;this.#t.set(t),this.#A=!0,this.#w?.(this.#t.get(),this.#C.get()),this.#k()}#k(){this.#L||(this.#L=!0,queueMicrotask((()=>{const e=this.#j.get(),t=this.#t.get();return this.#M(e,t)})))}#L=!1;#U(e,t){if(this.#$)return e;const[n,r]=this.#E?.(e,t)||[e,t];return this.#j.get()===n&&this.#t.get()===r?[n,r]:(this.#j.set(n),this.#t.set(r),this.#A||(this.#A=!0,this.#T=n),this.#M(n,r))}#M(e,t){if(this.#$)return[e,t];if(this.#L=!1,e&&"object"==typeof e){let n=Array.isArray(e)?[...e]:{...e},r=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},i=!1;for(const[o,s]of this){const a=e[o],l=t?.[o],[c,u]=s.#U(a,l);a!==c&&(n[o]=c,i=!0),l!==u&&(r[o]=u,i=!0)}i&&(e=n,t=r,this.#j.set(e),this.#t.set(r))}return this.#N===e&&this.#I===t||(this.#N=e,this.#I=t),[e,t]}get destroyed(){return this.#$}destroy(){if(!this.#$){this.#$=!0;for(const[,e]of this)e.destroy()}}}class M extends L{#q;*[Symbol.iterator](){yield*Object.entries(this.#q)}child(e){return this.#q[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:i,onUpdateState:o}={}){super(e,{parent:t,index:n,new:r,onUpdate:i,onUpdateState:o,setValue:e=>"object"!=typeof e?{}:e,setState:e=>"object"!=typeof e?{}:e,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const s=Object.create(null),a={parent:this,onUpdate:(e,t)=>{this.value={...this.value,[t]:e}},onUpdateState:(e,t)=>{this.state={...this.state,[t]:e}}};for(const[t,n]of Object.entries(e.props||{})){let e;e="string"==typeof n.type?n.array?new U(n,{...a,index:t}):new L(n,{...a,index:t}):n.array?new U(n,{...a,index:t}):new M(n,{...a,index:t}),s[t]=e}this.#q=s}}class U extends L{#R=()=>{throw new Error};#q=new e.Signal.State([]);get children(){return[...this.#q.get()]}*[Symbol.iterator](){return yield*[...this.#q.get().entries()]}child(e){const t=this.#q.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}constructor(e,{parent:t,onUpdate:n,onUpdateState:r,index:i,new:o}={}){const s=e=>{if(this.destroyed)return;const t=Array.isArray(e)&&e.length||0,n=[...this.#q.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#R(e));for(const e of n.splice(t))e.destroy();r!==t&&(this.length=n.length,this.#q.set(n))};super(e,{index:i,new:o,parent:t,state:[],setValue:e=>Array.isArray(e)?e:null==e?[]:[e],setState:e=>Array.isArray(e)?e:null==e?[]:[e],convert(e,t){const n=Array.isArray(e)?e:null==e?[]:[e];return s(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t)=>{s(e),n?.(e,t)},onUpdateState:r});const a={parent:this,onUpdate:(e,t)=>{const n=[...this.value||[]];n.length<t&&(n.length=t),n[t]=e,this.value=n},onUpdateState:(e,t)=>{const n=[...this.state||[]];n.length<t&&(n.length=t),n[t]=e,this.state=n}};if("string"==typeof e.type)this.#R=(t,n)=>{const r=new L(e,{...a,index:t,new:n});return r.index=t,r};else{if(Array.isArray(e.props))throw new Error;this.#R=(t,n)=>{const r=new M(e,{...a,index:t,new:n});return r.index=t,r}}}insert(e,t,n){if(this.destroyed)return!1;const r=this.value;if(!Array.isArray(r))return!1;const i=[...this.#q.get()],o=Math.max(0,Math.min(Math.floor(e),i.length)),s=this.#R(o,n);s.new=!0,i.splice(o,0,s);for(let t=e+1;t<i.length;t++)i[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.value=a,this.length=i.length,this.#q.set(i),!0}add(e){return this.insert(this.#q.get().length,e)}remove(e){if(this.destroyed)return;const t=this.value;if(!Array.isArray(t))return;const n=[...this.#q.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[i]=n.splice(r,1);if(!i)return;for(let t=e;t<n.length;t++)n[t].index=t;i.destroy();const o=[...t],[s]=o.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.value=o,this.length=n.length,this.#q.set(n),s}move(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#q.get()],[i]=r.splice(e,1);if(!i)return!1;r.splice(t,0,i);let o=Math.min(e,t),s=Math.max(e,t);for(let e=o;e<=s;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.value=a,this.#q.set(r),!0}exchange(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#q.get()],i=r[e],o=r[t];if(!i||!o)return!1;r[t]=i,r[e]=o,i.index=t,o.index=e;const s=[...n],a=s[e],l=s[t];s[t]=a,s[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],i=n[t];n[t]=r,n[e]=i,this.state=n}return this.value=s,this.#q.set(r),!0}}const q={CALC:"no `creteCalc` option, no expression parsing support",EVENT:"no `creteEvent`, 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 R extends Error{constructor(e,...t){const n=q[e];super("function"==typeof n?n(...t):n),this.code=e}}const P=/^(?<decorator>[:@!+*\.]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,V=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function B(e,t,n){const{attrs:r,directives:i,events:o,classes:s,styles:a,vars:l,aliases:c}=e;return function(e,u){const d=P.exec(e.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"))?.groups;if(!d)throw new R("ATTR",e);const{name:f}=d,h=d.decorator?.toLowerCase();if(h){if(":"===h)r[f]=V.test(u)?{name:u}:t(u);else if("."===h)s[f]=!u||(V.test(u)?u:t(u));else if("style:"===h)a[f]=V.test(u)?u:t(u);else if("@"===h)o[f]=V.test(u)?u:n(u);else if("+"===h)l[f]=u?V.test(u)?u:t(u):"";else if("*"===h)c[f]=V.test(u)?u:n(u);else if("!"===h){const e=f.toString();switch(e){case"fragment":case"else":case"enum":i[e]=!0;break;case"if":case"text":case"html":i[e]=V.test(u)?u:t(u);break;case"bind":case"value":case"comment":i[e]=u}}}else r[f]=u}}function D(e,t){return{name:e,is:t,children:[],attrs:Object.create(null),events:Object.create(null),directives:Object.create(null),classes:Object.create(null),styles:Object.create(null),vars:Object.create(null),aliases:Object.create(null)}}var W={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 _=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function K(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function H(e,t,n,r){let i=r[n];return null==i&&(i=e.lastIndexOf("</"+n+">"),i<t&&(i=e.lastIndexOf("</"+n)),r[n]=i),i<t}function Y(...e){console.error(new R(...e))}function z(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in W?W[t]:(Y("ENTITY",e),e)}function F(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function*G(e,t=0){const{attrs:n,events:r,directives:i,children:o,is:s,name:a,classes:l,styles:c,aliases:u,vars:d}=e,f=t>0?"".padEnd(t,"\t"):"";yield f,yield*["<",a||"-"],s&&(yield*["|",s]);for(const[e,t]of Object.entries(i)){if(!1===t||null==t)continue;const n="function"==typeof t?String(t):t;yield*[" !",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,F),'"'])}for(const[e,t]of Object.entries(u)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" *",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,F),'"'])}for(const[e,t]of Object.entries(d)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" +",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,F),'"'])}for(const[e,t]of Object.entries(n)){if(null==t)continue;if("string"==typeof t){yield*[" ",e],t&&(yield*['="',t.replace(/[<&"]/g,F),'"']);continue}const n="function"==typeof t?String(t):"object"==typeof t?t.name:t;n&&"string"==typeof n&&(yield*[" :",e,'="',n.replace(/[<&"]/g,F)||"",'"'])}for(const[e,t]of Object.entries(r)){if(null==t)continue;const n="function"==typeof t?String(t):t;n&&"string"==typeof n&&(yield*[" @",e,'="',n.replace(/[<&"]/g,F),'"'])}for(const[e,t]of Object.entries(l)){if(null==t||0==t)continue;const n="function"==typeof t?String(t):t;yield*[" .",e],n&&"string"==typeof n&&(yield*[" .",e,'="',n.replace(/[<&"]/g,F),'"'])}for(const[e,t]of Object.entries(c)){if(null==t)continue;const n="function"==typeof t?String(t):t;n&&"string"==typeof n&&(yield*[" style:",e,'="',n.replace(/[<&"]/g,F),'"'])}if(!o.length)return yield"/>",void(t>=0&&(yield"\n"));if(1===o.length){const[e]=o;if("string"==typeof e&&e.length<80&&!e.includes("\n"))return yield">",yield*[e.replace(/[<&\t]/g,F).replace(/]]>/g,"]]>")],yield*["</",a,">"],void(t>=0&&(yield"\n"))}yield">",t>=0&&(yield"\n"),yield*Q(o,t>=0?t+1:-1),yield*[f,"</",a,">"],t>=0&&(yield"\n")}function*Q(e,t=0){if(!e.length)return"";const n=t>0?"".padEnd(t,"\t"):"";for(const r of e)if("string"==typeof r){let e=r.replace(/[<&\t]/g,F).replace(/]]>/g,"]]>");n&&(e=e.replace(/(?<=^|\n)/g,n)),yield e,t>=0&&(yield"\n")}else yield*G(r,t)}var Z=Object.freeze({__proto__:null,parse:function(e,{creteCalc:t=()=>{throw new R("CALC")},creteEvent:n=()=>{throw new R("EVENT")},simpleTag:r=new Set}={}){const i=[],o={children:i},s=[];let a=null,l=o;function c(){a=s.pop()||null,l=a||o}function u(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&l.children.push(e)}let d={},f=0;function h(t){if(t<=f)return;u(e.substring(f,t).replace(/&#?\w+;/g,z)),f=t}for(;;){const p=e.indexOf("<",f);if(p<0){const O=e.substring(f);O.match(/^\s*$/)||u(O);break}if(p>f&&h(p),"/"===e.charAt(p+1)){f=e.indexOf(">",p+3);let C=e.substring(p+2,f);if(f<0?(C=e.substring(p+2).replace(/[\s<].*/,""),Y("UNCOMPLETED",C,a?.name),f=p+1+C.length):C.match(/\s</)&&(C=C.replace(/[\s<].*/,""),Y("UNCOMPLETED",C),f=p+1+C.length),a){const $=a.name;if($===C)c();else{if($.toLowerCase()!=C.toLowerCase())throw new R("CLOSE",C,a.name);c()}}f++;continue}function g(t){let n=f+1;if(f=e.indexOf(t,n),f<0)throw new R("QUOTE",t);const r=e.slice(n,f).replace(/&#?\w+;/g,z);return f++,r}function y(){let t=e.charAt(f);for(;t<=" "||""===t;t=e.charAt(++f));return t}function m(){let t=f,n=e.charAt(f);for(;K(n);)f++,n=e.charAt(f);return e.slice(t,f)}f=p+1;let b=e.charAt(f);switch(b){case"=":throw new R("EQUAL");case'"':case"'":throw new R("ATTR_VALUE");case">":case"/":throw new R("SYMBOL",b);case"":throw new R("EOF")}const v=m(),w=_.exec(v)?.groups;if(!w)throw new R("TAG",v);s.push(a),a=D(w.name,w.is),l.children.push(a),l=a;const x=B(a,t,n);let S=!0,E=!1;e:for(;S;){let A=y();switch(A){case"":Y("EOF"),f++;break e;case">":f++;break e;case"/":E=!0;break e;case'"':case"'":throw new R("ATTR_VALUE");case"=":throw new R("SYMBOL",A)}const T=m();if(!T){Y("EOF"),f++;break e}switch(A=y(),A){case"":Y("EOF"),f++;break e;case">":x(T,""),f++;break e;case"/":x(T,""),E=!0;break e;case"=":f++;break;case"'":case'"':x(T,g(A));continue;default:x(T,"");continue}switch(A=y(),A){case"":x(T,""),Y("EOF"),f++;break e;case">":x(T,""),f++;break e;case"/":x(T,""),E=!0;break e;case"'":case'"':x(T,g(A));continue}x(T,m())}if(E){for(;;){f++;const N=e.charAt(f);if("/"!==N&&!(N<=" "||""===N))break}switch(e.charAt(f)){case"=":throw new R("EQUAL");case'"':case"'":throw new R("ATTR_VALUE");case"":Y("EOF");break;case">":f++;break;default:throw new R("CLOSE_SYMBOL")}c()}else(r.has(v)||H(e,f,v,d))&&c()}return i},stringify:function(e,t){const n=t?0:-1;return Array.isArray(e)?[...Q(e,n)].join(""):[G(e,n)].join()}});let X=!0;const J=new e.Signal.subtle.Watcher((()=>{X&&(X=!1,queueMicrotask(ee))}));function ee(){X=!0;for(const e of J.getPending())e.get();J.watch()}function te(t,n){let r,i=!1;const o=new e.Signal.Computed((()=>{const e=t();i&&Object.is(e,r)||(r=e,i=!0,n(e))}));return J.watch(o),o.get(),()=>{J.unwatch(o)}}function*ne(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}],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}null`,{get:()=>e.null}],yield[`${t}${n}index`,{get:()=>e.index}],yield[`${t}${n}no`,{get:()=>e.no}],yield[`${t}${n}length`,{get:()=>e.length}],yield[`${t}${n}creatable`,{get:()=>e.creatable}],yield[`${t}${n}immutable`,{get:()=>e.immutable}],yield[`${t}${n}new`,{get:()=>e.new}],yield[`${t}${n}editable`,{get:()=>e.editable}],yield[`${t}${n}hidden`,{get:()=>e.hidden}],yield[`${t}${n}clearable`,{get:()=>e.clearable}],yield[`${t}${n}required`,{get:()=>e.required}],yield[`${t}${n}disabled`,{get:()=>e.disabled}],yield[`${t}${n}readonly`,{get:()=>e.readonly}],e instanceof U&&(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)}])}class re{exec(e){if("string"==typeof e){const t=this.#P[e];if("function"!=typeof t?.get)return;return t.get()}if("function"==typeof e)return e(this.getters)}watch(e,t){return te((()=>this.exec(e)),t)}bind(e,t,n){const r=this.#P[e];if(!r?.get)return;const{store:i}=r;if(i)switch(t){case"value":return te((()=>i.value),n);case"state":return te((()=>i.state),n);case"required":return te((()=>i.required),n);case"clearable":return te((()=>i.clearable),n);case"hidden":return te((()=>i.hidden),n);case"disabled":return te((()=>i.disabled),n);case"readonly":return te((()=>i.readonly||!i.editable),n)}}bindAll(e){const t=this.#P[e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>te(e,t)}}return{$value:e=>te((()=>n.value),e),$state:e=>te((()=>n.state),e),$required:e=>te((()=>n.required),e),$clearable:e=>te((()=>n.clearable),e),$hidden:e=>te((()=>n.hidden),e),$disabled:e=>te((()=>n.disabled),e),$readonly:e=>te((()=>n.readonly||!n.editable),e)}}bindSet(e,t){const n=this.#P[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}}}bindStateAllSet(e){const t=this.#P[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}}}getEvent(e){if("function"==typeof e)return e;const t=this.#P[e];if(!t)return null;const{exec:n,calc:r}=t;return"function"==typeof n?n:"function"==typeof r?r:null}constructor(e){if(e instanceof re){this.#V=e.#V;const t=this.#B;for(const[n,r]of Object.entries(e.#B))t[n]=r;const n=this.#D;for(const[t,r]of Object.entries(e.#D))n[t]=r;return}const t=Object.create(null);if(this.#V=t,e&&"object"==typeof e)for(const[n,r]of Object.entries(e)){if(!n||n.includes("$"))continue;if(!r||"object"!=typeof r)return;if(r instanceof L){for(const[e,i]of ne(r,n))t[e]=i;continue}const{get:e,set:i,exec:o,calc:s}=r;"function"!=typeof e?"function"!=typeof s?"function"!=typeof o||(t[n]={exec:o}):t[n]={calc:s}:t[n]="function"==typeof i?{get:e,set:i}:{get:e}}}#V;#B=Object.create(null);#D=Object.create(null);#W=null;#n=null;#_=null;get#P(){const e=this.#_;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#B,...this.#V,...this.#D})),n=this.#W,r=this.#n;if(n){for(const[e,r]of ne(n))t[e]=r;for(const[e,i]of function*(e,t,n="",r="$"){if(!(e instanceof U))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.length-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.length-1||e.move(n,n+1))}}]}(r,n))t[e]=i}return this.#_=t,t}setValue(e,t){const n=new re(this);if(n.#W=e,t&&(n.#n=t),e instanceof U)return n;const r=n.#B;for(const[t,n]of e){for(const[e,i]of ne(n,t))r[e]=i;for(const[e,i]of ne(n,t,"$$"))r[e]=i}return n}set(t,n){if(Object.keys(t).length+Object.keys(n).length===0)return this;const r=new re(this);r.#W=this.#W,r.#n=this.#n;const i=r.#D,o=r.#P;for(const[n,s]of Object.entries(t)){if("function"==typeof s){const t=r.getters;r.#K=null;const a=new e.Signal.Computed((()=>s(t)));i[n]=o[n]={get:()=>a.get()};continue}const t=o[s];if(t)if(t.get&&t.store)for(const[e,r]of ne(t.store,n))i[e]=o[e]=r;else i[n]=o[n]=t}for(const[t,s]of Object.entries(n)){const n=new e.Signal.State(null);if("function"==typeof s){const e=r.settable;r.#H=null,n.set(s(e))}else if(s&&"string"==typeof s){const e=o[s];if(!e?.get)continue;n.set(e.get())}i[t]=o[t]={get:()=>n.get(),set:e=>{n.set(e)}}}return r}#Y=null;get all(){const e=this.#Y;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#P))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 this.#Y=t,t}#H=null;get settable(){const e=this.#H;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#P))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 this.#H=t,t}#K=null;get getters(){const e=this.#K;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#P))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 this.#K=t,t}}const ie={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 oe(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 i=Array.isArray(t)?t[0]:t;return"number"==typeof i||"bigint"==typeof i?r=i&&e in ie?`${i}${ie[e]}`:`${i}`:"string"==typeof i&&(r=i),r?[r,n?"important":void 0]:null}class se{#z=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#z;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#z,i="number"==typeof e?String(e):e;let o=r.get(i);return o||(o=new Set,r.set(i,o)),o.add(n),()=>{o?.delete(n)}}}const ae={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 le(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 ce(e){return null===(e??null)?"":String(e)}function ue(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 ce;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 de={input:{attrs:{$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=ce(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:{$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ce(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ce(e)}},events:{$value:["change",(e,t)=>t.value]}}};function fe(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watchAttr:i,props:o}=e;return e.listen("init",(({events:n})=>{const s=de[t.toLowerCase()],a=s?.attrs||{},l=s?.events||{};for(const[e,t,i]of n)if("$"!==e[0])r.addEventListener(e,t,i);else{const n=l[e];if(n){const[e,o]=n;r.addEventListener(e,(e=>t(o(e,r))),i)}}if(o)for(const[t,n]of Object.entries(e.tagAttrs))if(i(t,(e=>{if(o.has(t))r[t]=e;else{const n=le(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),o.has(t))r[t]=n;else{const e=le(n);null!==e&&r.setAttribute(t,e)}else for(const[t,n]of Object.entries(e.tagAttrs)){if(r instanceof HTMLInputElement&&"type"===t.toLocaleLowerCase()){const e=le(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),i(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),i(t,(t=>e(t,r))));continue}const e=ue(r,t);if("function"==typeof e){r[t]=e(n),i(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,i(t,(e=>{r[t]=e}));continue}let o=le(n);null!==o&&r.setAttribute(t,o),i(t,(e=>{const n=le(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function he(e){return null===(e??null)?"":String(e)}function pe(e,t,n,{text:r,html:i}){if(null!=r){const i=e.insertBefore(document.createTextNode(""),t),o=n.watch(r,(e=>i.textContent=he(e)));return()=>{i.remove(),o()}}if(null==i)return;const o=e.insertBefore(document.createComment(""),t),s=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=o.nextSibling;e&&e!==s;e=o.nextSibling)e.remove()}const c=n.watch(i,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=o.firstChild)e.insertBefore(t,s)}(he(t))}));return()=>{c(),l(),o.remove(),s.remove()}}function ge(e,t,n,r,i){let o=new Set,s=[];function a(e){if(!e.length||!o)return;const s=t.insertBefore(document.createComment(""),n);let a=-1,l=()=>{};o.add((()=>{l(),l=()=>{},s.remove()})),o.add(te((()=>e.findIndex((([e])=>null===e||r.exec(e)))),(t=>{t!==a&&(a=t,l(),l=()=>{},function(t){const n=e[t]?.[1];n&&(l=i(n))}(a))})))}for(const r of e){if("string"==typeof r){a(s),s=[];const e=document.createTextNode(r);t.insertBefore(e,n),o.add((()=>e.remove()));continue}if(s.length&&r.directives.else){const e=r.directives.if||null;s.push([e,r]),e||(a(s),s=[]);continue}a(s),s=[];const e=r.directives.if;e?s.push([e,r]):o.add(i(r))}return()=>{if(!o)return;const e=o;o=null;for(const t of e)t()}}function ye(e,t,n,r,i,o,s){if(i=i.set(e.aliases,e.vars),!e.name||e.directives.fragment)return function(e,t,n,r,i){return pe(t,n,r,e.directives)||ge(e.children||[],t,n,r,i)}(e,t,n,i,(e=>me(e,t,n,r,i,o,s)));const a=[...o,e.name],l=s?.(a);if(s&&!l)return()=>{};const{context:c,handler:u}=function(e,t){const n="string"==typeof e?e:e.tag,{attrs:r,events:i}="string"!=typeof e&&e||{attrs:null,events:null};let o=!1,s=!1;const a=Object.create(null),l=[],c=new se,u=new se;return{context:{events:l,props:r?new Set(Object.entries(r).filter((([,e])=>e.isProp)).map((([e])=>e))):null,tagAttrs:a,watchAttr:(e,t)=>u.listen(e,t),get destroyed(){return o},get init(){return s},listen:(e,t)=>c.listen(e,t)},handler:{tag:n,set(e,t){if(r&&!(e in r))return;e in a||(a[e]=void 0);const n=a[e];n!==t&&(a[e]=t,u.emit(e,t,n,e))},addEvent(e,n){if("function"!=typeof n)return;const[r,...o]=e.split(".").filter(Boolean),s=i?i[r].filters:{};if(!s)return;const a={},c=[];if(s)for(let e=o.shift();e;e=o.shift()){const t=e.indexOf(":"),n=t>=0?e.slice(0,t):e,r=t>=0?e.slice(t+1).split(":"):[],i=n.replace(/^-+/,""),o=(n.length-i.length)%2==1;let l=s[i]||i;switch(l){case"once":a.once=!o;break;case"passive":a.passive=!o;break;case"capture":a.capture=!o;break;default:"string"==typeof l&&(l=ae[l])}"function"==typeof l&&c.push([l,r,o])}l.push([r,e=>{const r=t.all;for(const[t,n,i]of c)if(t(e,n,r)===i)return;n(e,r)},a])},destroy(){o||(o=!0,c.emit("destroy"))},init(){s||(s=!0,c.emit("init",{events:l}))}}}}(l||e.name,i),d=l?.attrs,f=d?function(e,t,n,r,i){let o=new Set;for(const[s,a]of Object.entries(r)){const r=n[s];if(s in n){if("function"!=typeof r&&"object"!=typeof r){e.set(s,r);continue}const n="function"==typeof r?r:r.name;if(a.immutable){e.set(s,t.exec(n));continue}o.add(t.watch(n,(t=>e.set(s,t))));continue}const l=a.bind;if(!i||!l){e.set(s,a.default);continue}if("string"==typeof l){const n=t.bind(i,l,(t=>e.set(s,t)));n?o.add(n):e.set(s,a.default);continue}if(!Array.isArray(l)){e.set(s,a.default);continue}const[c,u,d]=l;if(!c||"function"!=typeof u)continue;if(!d){o.add(t.watch(i,(t=>e.set(s,t)))),e.addEvent(c,((...e)=>{t.all[i]=u(...e)}));continue}const f=t.bind(i,"state",(t=>e.set(s,t)));if(!f)continue;o.add(f);const h=t.bindSet(i,"state");h&&e.addEvent(c,((...e)=>{h(u(...e))}))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(u,i,e.attrs,d,e.directives.bind):function(e,t,n,r){const i=e.tag;let o=new Set;for(const[r,s]of Object.entries(n)){if("function"!=typeof s&&"object"!=typeof s){e.set(r,s);continue}const n="function"==typeof s?s:s.name;if("string"!=typeof i||"input"!==i.toLocaleLowerCase()||"type"!==r.toLocaleLowerCase())o.add(t.watch(n,(t=>e.set(r,t))));else{const i=t.exec(n);e.set(r,i)}}if(r){for(const[n,i]of Object.entries(t.bindAll(r)||{}))"function"==typeof i&&o.add(i((t=>e.set(n,t))));for(const[n,i]of Object.entries(t.bindStateAllSet(r)||{}))"function"==typeof i&&e.addEvent(n,(e=>i(e)))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(u,i,e.attrs,e.directives.bind);for(const[t,n]of Object.entries(e.events)){const e=i.getEvent(n);e&&u.addEvent(t,e)}const h=l?"function"==typeof l.tag?l.tag(c):fe(c,l.tag,l.is):fe(c,e.name,e.is),p=Array.isArray(h)?h[0]:h,g=Array.isArray(h)&&h[1]||p;t.insertBefore(p,n);const y=pe(g,null,i,e.directives)||ge(e.children||[],g,null,i,(e=>me(e,g,null,r,i,o,s)));return function(e,t,n){if(!(e instanceof Element))return()=>{};let r=new Set;for(const[i,o]of Object.entries(t))o&&(!0!==o?r.add(te((()=>Boolean(n.exec(o))),(t=>{t?e.classList.add(i):e.classList.remove(i)}))):e.classList.add(i))}(p,e.classes,i),function(e,t,n){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};let r=new Set;for(const[i,o]of Object.entries(t))r.add(te((()=>oe(i,n.exec(o))),(t=>{t?e.style.setProperty(i,...t):e.style.removeProperty(i)})))}(p,e.styles,i),u.init(),()=>{p.remove(),u.destroy(),f(),y()}}function me(e,t,n,r,i,o,s){const{directives:a}=e,{value:l}=a;if(l){const e=r.child(l);if(!e)return()=>{};r=e,i=i.setValue(r)}return a.enum?r instanceof U?function(e,t,n,r,i,o){const s=t.insertBefore(document.createComment(""),n);let a=new Map;const l=te((()=>r.children),(function(n){if(!s.parentNode)return;let l=s.nextSibling;const c=a;a=new Map;for(let s of n){const n=c.get(s);if(!n){const n=t.insertBefore(document.createComment(""),l),c=t.insertBefore(document.createComment(""),l),u=o(e,t,c,s,i.setValue(s,r));a.set(s,[n,c,u]);continue}if(c.delete(s),a.set(s,n),l===n[0]){l=n[1].nextSibling;continue}let u=n[0];for(;u&&u!==n[1];){const e=u;u=u.nextSibling,t.insertBefore(e,l)}t.insertBefore(n[1],l)}!function(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}(c)}));return()=>{s.remove(),l()}}(e,t,n,r,i,((e,t,n,r,i)=>ye(e,t,n,r,i,o,s))):()=>{}:ye(e,t,n,r,i,o,s)}e.Layout=Z,e.Store=L,e.render=function(e,t,n,r,i){const o=[r,i],s=o.find((e=>"function"==typeof e)),a=o.find((e=>"object"==typeof e)),l=new re(a).setValue(e);return ge(t,n,null,l,(t=>me(t,n,null,e,l,[],s)))}}));
|
package/index.min.mjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @neeloong/form v0.1.0
|
|
3
|
+
* (c) 2024-2025 Fierflame
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
var e=Object.defineProperty,t=(t,n,r)=>(((t,n,r)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r})(t,"symbol"!=typeof n?n+"":n,r),r),n=(e,t)=>{if(Object(t)!==t)throw TypeError('Cannot use the "in" operator on this value');return e.has(t)},r=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},i=(e,t,n)=>(((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)})(e,t,"access private method"),n);
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright Google LLC All Rights Reserved.
|
|
10
|
+
*
|
|
11
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
12
|
+
* found in the LICENSE file at https://angular.io/license
|
|
13
|
+
*/
|
|
14
|
+
function o(e,t){return Object.is(e,t)}
|
|
15
|
+
/**
|
|
16
|
+
* @license
|
|
17
|
+
* Copyright Google LLC All Rights Reserved.
|
|
18
|
+
*
|
|
19
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
20
|
+
* found in the LICENSE file at https://angular.io/license
|
|
21
|
+
*/let s=null,a=!1,l=1;const c=Symbol("SIGNAL");function u(e){const t=s;return s=e,t}const d={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function f(e){if(a)throw new Error("undefined"!=typeof ngDevMode&&ngDevMode?"Assertion error: signal read during notification phase":"");if(null===s)return;s.consumerOnSignalRead(e);const t=s.nextProducerIndex++;if(v(s),t<s.producerNode.length&&s.producerNode[t]!==e&&b(s)){m(s.producerNode[t],s.producerIndexOfThis[t])}s.producerNode[t]!==e&&(s.producerNode[t]=e,s.producerIndexOfThis[t]=b(s)?y(e,s,t):0),s.producerLastReadVersion[t]=e.version}function h(e){if(e.dirty||e.lastCleanEpoch!==l){if(!e.producerMustRecompute(e)&&!function(e){v(e);for(let t=0;t<e.producerNode.length;t++){const n=e.producerNode[t],r=e.producerLastReadVersion[t];if(r!==n.version)return!0;if(h(n),r!==n.version)return!0}return!1}(e))return e.dirty=!1,void(e.lastCleanEpoch=l);e.producerRecomputeValue(e),e.dirty=!1,e.lastCleanEpoch=l}}function p(e){if(void 0===e.liveConsumerNode)return;const t=a;a=!0;try{for(const t of e.liveConsumerNode)t.dirty||g(t)}finally{a=t}}function g(e){var t;e.dirty=!0,p(e),null==(t=e.consumerMarkedDirty)||t.call(e.wrapper??e)}function y(e,t,n){var r;if(w(e),v(e),0===e.liveConsumerNode.length){null==(r=e.watched)||r.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)e.producerIndexOfThis[t]=y(e.producerNode[t],e,t)}return e.liveConsumerIndexOfThis.push(n),e.liveConsumerNode.push(t)-1}function m(e,t){var n;if(w(e),v(e),"undefined"!=typeof ngDevMode&&ngDevMode&&t>=e.liveConsumerNode.length)throw new Error(`Assertion error: active consumer index ${t} is out of bounds of ${e.liveConsumerNode.length} consumers)`);if(1===e.liveConsumerNode.length){null==(n=e.unwatched)||n.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)m(e.producerNode[t],e.producerIndexOfThis[t])}const r=e.liveConsumerNode.length-1;if(e.liveConsumerNode[t]=e.liveConsumerNode[r],e.liveConsumerIndexOfThis[t]=e.liveConsumerIndexOfThis[r],e.liveConsumerNode.length--,e.liveConsumerIndexOfThis.length--,t<e.liveConsumerNode.length){const n=e.liveConsumerIndexOfThis[t],r=e.liveConsumerNode[t];v(r),r.producerIndexOfThis[n]=t}}function b(e){var t;return e.consumerIsAlwaysLive||((null==(t=null==e?void 0:e.liveConsumerNode)?void 0:t.length)??0)>0}function v(e){e.producerNode??(e.producerNode=[]),e.producerIndexOfThis??(e.producerIndexOfThis=[]),e.producerLastReadVersion??(e.producerLastReadVersion=[])}function w(e){e.liveConsumerNode??(e.liveConsumerNode=[]),e.liveConsumerIndexOfThis??(e.liveConsumerIndexOfThis=[])}
|
|
22
|
+
/**
|
|
23
|
+
* @license
|
|
24
|
+
* Copyright Google LLC All Rights Reserved.
|
|
25
|
+
*
|
|
26
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
27
|
+
* found in the LICENSE file at https://angular.io/license
|
|
28
|
+
*/function x(e){if(h(e),f(e),e.value===S)throw e.error;return e.value}const E=Symbol("UNSET"),O=Symbol("COMPUTING"),S=Symbol("ERRORED"),C=(()=>({...d,value:E,dirty:!0,error:null,equal:o,producerMustRecompute:e=>e.value===E||e.value===O,producerRecomputeValue(e){if(e.value===O)throw new Error("Detected cycle in computations.");const t=e.value;e.value=O;const n=function(e){return e&&(e.nextProducerIndex=0),u(e)}(e);let r,i=!1;try{r=e.computation.call(e.wrapper);i=t!==E&&t!==S&&e.equal.call(e.wrapper,t,r)}catch(t){r=S,e.error=t}finally{!function(e,t){if(u(t),e&&void 0!==e.producerNode&&void 0!==e.producerIndexOfThis&&void 0!==e.producerLastReadVersion){if(b(e))for(let t=e.nextProducerIndex;t<e.producerNode.length;t++)m(e.producerNode[t],e.producerIndexOfThis[t]);for(;e.producerNode.length>e.nextProducerIndex;)e.producerNode.pop(),e.producerLastReadVersion.pop(),e.producerIndexOfThis.pop()}}(e,n)}i?e.value=t:(e.value=r,e.version++)}}))();let $=
|
|
29
|
+
/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright Google LLC All Rights Reserved.
|
|
32
|
+
*
|
|
33
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
34
|
+
* found in the LICENSE file at https://angular.io/license
|
|
35
|
+
*/
|
|
36
|
+
function(){throw new Error};function A(){return f(this),this.value}function T(e,t){!1===(null==s?void 0:s.consumerAllowSignalWrites)&&$(),e.equal.call(e.wrapper,e.value,t)||(e.value=t,function(e){e.version++,l++,p(e)}
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
* Copyright 2024 Bloomberg Finance L.P.
|
|
40
|
+
*
|
|
41
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
42
|
+
* you may not use this file except in compliance with the License.
|
|
43
|
+
* You may obtain a copy of the License at
|
|
44
|
+
*
|
|
45
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
46
|
+
*
|
|
47
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
48
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
49
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
50
|
+
* See the License for the specific language governing permissions and
|
|
51
|
+
* limitations under the License.
|
|
52
|
+
*/(e))}const N=(()=>({...d,equal:o,value:void 0}))();const j=Symbol("node");var I;(e=>{var o,l,h,p;o=j,l=new WeakSet,e.isState=e=>n(l,e),e.State=class{constructor(n,i={}){r(this,l),t(this,o);const s=
|
|
53
|
+
/**
|
|
54
|
+
* @license
|
|
55
|
+
* Copyright Google LLC All Rights Reserved.
|
|
56
|
+
*
|
|
57
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
58
|
+
* found in the LICENSE file at https://angular.io/license
|
|
59
|
+
*/
|
|
60
|
+
function(e){const t=Object.create(N);t.value=e;const n=()=>(f(t),t.value);return n[c]=t,n}(n),a=s[c];if(this[j]=a,a.wrapper=this,i){const t=i.equals;t&&(a.equal=t),a.watched=i[e.subtle.watched],a.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return A.call(this[j])}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");T(this[j],t)}};h=j,p=new WeakSet,e.isComputed=e=>n(p,e),e.Computed=class{constructor(n,i){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),s=o[c];if(s.consumerAllowSignalWrites=!0,this[j]=s,s.wrapper=this,i){const t=i.equals;t&&(s.equal=t),s.watched=i[e.subtle.watched],s.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return x(this[j])}},(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[j].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[j].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[j].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[j].producerNode;return!!n&&n.length>0};a=j,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(d);n.wrapper=this,n.consumerMarkedDirty=e,n.consumerIsAlwaysLive=!0,n.consumerAllowSignalWrites=!1,n.producerNode=[],this[j]=n}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");i(this,c,h).call(this,t);const n=this[j];n.dirty=!1;const r=u(n);for(const e of t)f(e[j]);u(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");i(this,c,h).call(this,t);const n=this[j];v(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){m(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[j].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},o.currentComputed=function(){var e;return null==(e=s)?void 0:e.wrapper},o.watched=Symbol("watched"),o.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(I||(I={}));const k=(e,t,n,r)=>{const i=new I.State("boolean"==typeof t?t:null),o="function"==typeof n?new I.Computed((()=>n(e))):n?new I.Computed((()=>!0)):new I.Computed((()=>!1)),s=()=>{const e=i.get();return null===e?o.get():e},a=r?new I.Computed((()=>r.get()||s())):new I.Computed(s);return[i,a]};class L{static create(e,t={}){return new M({type:null,props:e},{...t,parent:null})}#e=!1;get null(){return this.#e}constructor(e,{null:t,state:n,setValue:r,setState:i,convert:o,onUpdate:s,onUpdateState:a,index:l,length:c,new:u,parent:d,hidden:f,clearable:h,required:p,disabled:g,readonly:y}){this.schema=e,this.#t.set("object"==typeof n&&n||{});const m=d instanceof L?d:null;m&&(this.#n=m,this.#r=m.#r);const b=new I.State(Boolean(u));this.#i=b;const v=m?new I.Computed((()=>m.#o.get()||b.get())):new I.Computed((()=>b.get()));this.#o=v;const w=Boolean(e.immutable),x=!1!==e.creatable;this.#s=w,this.#a=x,this.#l=new I.Computed((()=>v.get()?x:!w)),[this.#c,this.#u]=k(this,f,e.hidden,m?m.#u:null),[this.#d,this.#f]=k(this,h,e.clearable,m?m.#f:null),[this.#h,this.#p]=k(this,p,e.required,m?m.#p:null),[this.#g,this.#y]=k(this,g,e.disabled,m?m.#y:null),[this.#m,this.#b]=k(this,y,e.readonly,m?m.#b:null),t?this.#e=!0:(this.#v=s||null,this.#w=a||null,this.#x="function"==typeof r?r:null,this.#E="function"==typeof i?i:null,this.#O="function"==typeof o?o:null,this.#S.set(c||0),this.#C.set(l??""))}#$=!1;#x=null;#E=null;#O=null;#v=null;#w=null;#n=null;#r=this;get parent(){return this.#n}get root(){return this.#r}#S=new I.State(0);get length(){return this.#S.get()}set length(e){this.#S.set(e)}#C=new I.State("");get index(){return this.#C.get()}set index(e){this.#C.set(e)}get no(){if(this.#e)return"";const e=this.index;return"number"==typeof e?e+1:e}#a=!0;get creatable(){return this.#a}#s=!1;get immutable(){return this.#s}#o;#i;#l;get selfNew(){return this.#i.get()}set selfNew(e){this.#i.set(Boolean(e))}get new(){return this.#o.get()}set new(e){this.#i.set(Boolean(e))}get editable(){return this.#l.get()}#c;#u;get selfHidden(){return this.#c.get()}set selfHidden(e){this.#c.set("boolean"==typeof e?e:null)}get hidden(){return this.#u.get()}set hidden(e){this.#c.set("boolean"==typeof e?e:null)}#d;#f;get selfClearable(){return this.#d.get()}set selfClearable(e){this.#d.set("boolean"==typeof e?e:null)}get clearable(){return this.#f.get()}set clearable(e){this.#d.set("boolean"==typeof e?e:null)}#h;#p;get selfRequired(){return this.#h.get()}set selfRequired(e){this.#h.set("boolean"==typeof e?e:null)}get required(){return this.#p.get()}set required(e){this.#h.set("boolean"==typeof e?e:null)}#g;#y;get selfDisabled(){return this.#g.get()}set selfDisabled(e){this.#g.set("boolean"==typeof e?e:null)}get disabled(){return this.#y.get()}set disabled(e){this.#g.set("boolean"==typeof e?e:null)}#m;#b;get selfReadonly(){return this.#m.get()}set selfReadonly(e){this.#m.set("boolean"==typeof e?e:null)}get readonly(){return this.#b.get()}set readonly(e){this.#m.set("boolean"==typeof e?e:null)}*[Symbol.iterator](){}child(e){return null}#A=!1;#T=null;#N=this.#T;#j=new I.State(this.#T);#t=new I.State(null);#I=this.#t.get();get changed(){return this.#j.get()===this.#N}get saved(){return this.#j.get()===this.#T}get value(){return this.#j.get()}set value(e){if(this.#$)return;const t=this.#x?.(e)||e;this.#j.set(t),this.#A||(this.#A=!0,this.#T=e),this.#v?.(this.#j.get(),this.#C.get()),this.#k()}get state(){return this.#t.get()}set state(e){if(this.#$)return;const t=this.#E?.(e)||e;this.#t.set(t),this.#A=!0,this.#w?.(this.#t.get(),this.#C.get()),this.#k()}#k(){this.#L||(this.#L=!0,queueMicrotask((()=>{const e=this.#j.get(),t=this.#t.get();return this.#M(e,t)})))}#L=!1;#U(e,t){if(this.#$)return e;const[n,r]=this.#O?.(e,t)||[e,t];return this.#j.get()===n&&this.#t.get()===r?[n,r]:(this.#j.set(n),this.#t.set(r),this.#A||(this.#A=!0,this.#T=n),this.#M(n,r))}#M(e,t){if(this.#$)return[e,t];if(this.#L=!1,e&&"object"==typeof e){let n=Array.isArray(e)?[...e]:{...e},r=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},i=!1;for(const[o,s]of this){const a=e[o],l=t?.[o],[c,u]=s.#U(a,l);a!==c&&(n[o]=c,i=!0),l!==u&&(r[o]=u,i=!0)}i&&(e=n,t=r,this.#j.set(e),this.#t.set(r))}return this.#N===e&&this.#I===t||(this.#N=e,this.#I=t),[e,t]}get destroyed(){return this.#$}destroy(){if(!this.#$){this.#$=!0;for(const[,e]of this)e.destroy()}}}class M extends L{#q;*[Symbol.iterator](){yield*Object.entries(this.#q)}child(e){return this.#q[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:i,onUpdateState:o}={}){super(e,{parent:t,index:n,new:r,onUpdate:i,onUpdateState:o,setValue:e=>"object"!=typeof e?{}:e,setState:e=>"object"!=typeof e?{}:e,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const s=Object.create(null),a={parent:this,onUpdate:(e,t)=>{this.value={...this.value,[t]:e}},onUpdateState:(e,t)=>{this.state={...this.state,[t]:e}}};for(const[t,n]of Object.entries(e.props||{})){let e;e="string"==typeof n.type?n.array?new U(n,{...a,index:t}):new L(n,{...a,index:t}):n.array?new U(n,{...a,index:t}):new M(n,{...a,index:t}),s[t]=e}this.#q=s}}class U extends L{#R=()=>{throw new Error};#q=new I.State([]);get children(){return[...this.#q.get()]}*[Symbol.iterator](){return yield*[...this.#q.get().entries()]}child(e){const t=this.#q.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}constructor(e,{parent:t,onUpdate:n,onUpdateState:r,index:i,new:o}={}){const s=e=>{if(this.destroyed)return;const t=Array.isArray(e)&&e.length||0,n=[...this.#q.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#R(e));for(const e of n.splice(t))e.destroy();r!==t&&(this.length=n.length,this.#q.set(n))};super(e,{index:i,new:o,parent:t,state:[],setValue:e=>Array.isArray(e)?e:null==e?[]:[e],setState:e=>Array.isArray(e)?e:null==e?[]:[e],convert(e,t){const n=Array.isArray(e)?e:null==e?[]:[e];return s(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t)=>{s(e),n?.(e,t)},onUpdateState:r});const a={parent:this,onUpdate:(e,t)=>{const n=[...this.value||[]];n.length<t&&(n.length=t),n[t]=e,this.value=n},onUpdateState:(e,t)=>{const n=[...this.state||[]];n.length<t&&(n.length=t),n[t]=e,this.state=n}};if("string"==typeof e.type)this.#R=(t,n)=>{const r=new L(e,{...a,index:t,new:n});return r.index=t,r};else{if(Array.isArray(e.props))throw new Error;this.#R=(t,n)=>{const r=new M(e,{...a,index:t,new:n});return r.index=t,r}}}insert(e,t,n){if(this.destroyed)return!1;const r=this.value;if(!Array.isArray(r))return!1;const i=[...this.#q.get()],o=Math.max(0,Math.min(Math.floor(e),i.length)),s=this.#R(o,n);s.new=!0,i.splice(o,0,s);for(let t=e+1;t<i.length;t++)i[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.value=a,this.length=i.length,this.#q.set(i),!0}add(e){return this.insert(this.#q.get().length,e)}remove(e){if(this.destroyed)return;const t=this.value;if(!Array.isArray(t))return;const n=[...this.#q.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[i]=n.splice(r,1);if(!i)return;for(let t=e;t<n.length;t++)n[t].index=t;i.destroy();const o=[...t],[s]=o.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.value=o,this.length=n.length,this.#q.set(n),s}move(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#q.get()],[i]=r.splice(e,1);if(!i)return!1;r.splice(t,0,i);let o=Math.min(e,t),s=Math.max(e,t);for(let e=o;e<=s;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.value=a,this.#q.set(r),!0}exchange(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#q.get()],i=r[e],o=r[t];if(!i||!o)return!1;r[t]=i,r[e]=o,i.index=t,o.index=e;const s=[...n],a=s[e],l=s[t];s[t]=a,s[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],i=n[t];n[t]=r,n[e]=i,this.state=n}return this.value=s,this.#q.set(r),!0}}const q={CALC:"no `creteCalc` option, no expression parsing support",EVENT:"no `creteEvent`, 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 R extends Error{constructor(e,...t){const n=q[e];super("function"==typeof n?n(...t):n),this.code=e}}const P=/^(?<decorator>[:@!+*\.]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,V=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function B(e,t,n){const{attrs:r,directives:i,events:o,classes:s,styles:a,vars:l,aliases:c}=e;return function(e,u){const d=P.exec(e.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"))?.groups;if(!d)throw new R("ATTR",e);const{name:f}=d,h=d.decorator?.toLowerCase();if(h){if(":"===h)r[f]=V.test(u)?{name:u}:t(u);else if("."===h)s[f]=!u||(V.test(u)?u:t(u));else if("style:"===h)a[f]=V.test(u)?u:t(u);else if("@"===h)o[f]=V.test(u)?u:n(u);else if("+"===h)l[f]=u?V.test(u)?u:t(u):"";else if("*"===h)c[f]=V.test(u)?u:n(u);else if("!"===h){const e=f.toString();switch(e){case"fragment":case"else":case"enum":i[e]=!0;break;case"if":case"text":case"html":i[e]=V.test(u)?u:t(u);break;case"bind":case"value":case"comment":i[e]=u}}}else r[f]=u}}function D(e,t){return{name:e,is:t,children:[],attrs:Object.create(null),events:Object.create(null),directives:Object.create(null),classes:Object.create(null),styles:Object.create(null),vars:Object.create(null),aliases:Object.create(null)}}var W={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 _=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function K(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function H(e,t,n,r){let i=r[n];return null==i&&(i=e.lastIndexOf("</"+n+">"),i<t&&(i=e.lastIndexOf("</"+n)),r[n]=i),i<t}function Y(...e){console.error(new R(...e))}function z(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in W?W[t]:(Y("ENTITY",e),e)}function F(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function*G(e,t=0){const{attrs:n,events:r,directives:i,children:o,is:s,name:a,classes:l,styles:c,aliases:u,vars:d}=e,f=t>0?"".padEnd(t,"\t"):"";yield f,yield*["<",a||"-"],s&&(yield*["|",s]);for(const[e,t]of Object.entries(i)){if(!1===t||null==t)continue;const n="function"==typeof t?String(t):t;yield*[" !",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,F),'"'])}for(const[e,t]of Object.entries(u)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" *",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,F),'"'])}for(const[e,t]of Object.entries(d)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" +",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,F),'"'])}for(const[e,t]of Object.entries(n)){if(null==t)continue;if("string"==typeof t){yield*[" ",e],t&&(yield*['="',t.replace(/[<&"]/g,F),'"']);continue}const n="function"==typeof t?String(t):"object"==typeof t?t.name:t;n&&"string"==typeof n&&(yield*[" :",e,'="',n.replace(/[<&"]/g,F)||"",'"'])}for(const[e,t]of Object.entries(r)){if(null==t)continue;const n="function"==typeof t?String(t):t;n&&"string"==typeof n&&(yield*[" @",e,'="',n.replace(/[<&"]/g,F),'"'])}for(const[e,t]of Object.entries(l)){if(null==t||0==t)continue;const n="function"==typeof t?String(t):t;yield*[" .",e],n&&"string"==typeof n&&(yield*[" .",e,'="',n.replace(/[<&"]/g,F),'"'])}for(const[e,t]of Object.entries(c)){if(null==t)continue;const n="function"==typeof t?String(t):t;n&&"string"==typeof n&&(yield*[" style:",e,'="',n.replace(/[<&"]/g,F),'"'])}if(!o.length)return yield"/>",void(t>=0&&(yield"\n"));if(1===o.length){const[e]=o;if("string"==typeof e&&e.length<80&&!e.includes("\n"))return yield">",yield*[e.replace(/[<&\t]/g,F).replace(/]]>/g,"]]>")],yield*["</",a,">"],void(t>=0&&(yield"\n"))}yield">",t>=0&&(yield"\n"),yield*Q(o,t>=0?t+1:-1),yield*[f,"</",a,">"],t>=0&&(yield"\n")}function*Q(e,t=0){if(!e.length)return"";const n=t>0?"".padEnd(t,"\t"):"";for(const r of e)if("string"==typeof r){let e=r.replace(/[<&\t]/g,F).replace(/]]>/g,"]]>");n&&(e=e.replace(/(?<=^|\n)/g,n)),yield e,t>=0&&(yield"\n")}else yield*G(r,t)}var Z=Object.freeze({__proto__:null,parse:function(e,{creteCalc:t=()=>{throw new R("CALC")},creteEvent:n=()=>{throw new R("EVENT")},simpleTag:r=new Set}={}){const i=[],o={children:i},s=[];let a=null,l=o;function c(){a=s.pop()||null,l=a||o}function u(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&l.children.push(e)}let d={},f=0;function h(t){if(t<=f)return;u(e.substring(f,t).replace(/&#?\w+;/g,z)),f=t}for(;;){const p=e.indexOf("<",f);if(p<0){const S=e.substring(f);S.match(/^\s*$/)||u(S);break}if(p>f&&h(p),"/"===e.charAt(p+1)){f=e.indexOf(">",p+3);let C=e.substring(p+2,f);if(f<0?(C=e.substring(p+2).replace(/[\s<].*/,""),Y("UNCOMPLETED",C,a?.name),f=p+1+C.length):C.match(/\s</)&&(C=C.replace(/[\s<].*/,""),Y("UNCOMPLETED",C),f=p+1+C.length),a){const $=a.name;if($===C)c();else{if($.toLowerCase()!=C.toLowerCase())throw new R("CLOSE",C,a.name);c()}}f++;continue}function g(t){let n=f+1;if(f=e.indexOf(t,n),f<0)throw new R("QUOTE",t);const r=e.slice(n,f).replace(/&#?\w+;/g,z);return f++,r}function y(){let t=e.charAt(f);for(;t<=" "||""===t;t=e.charAt(++f));return t}function m(){let t=f,n=e.charAt(f);for(;K(n);)f++,n=e.charAt(f);return e.slice(t,f)}f=p+1;let b=e.charAt(f);switch(b){case"=":throw new R("EQUAL");case'"':case"'":throw new R("ATTR_VALUE");case">":case"/":throw new R("SYMBOL",b);case"":throw new R("EOF")}const v=m(),w=_.exec(v)?.groups;if(!w)throw new R("TAG",v);s.push(a),a=D(w.name,w.is),l.children.push(a),l=a;const x=B(a,t,n);let E=!0,O=!1;e:for(;E;){let A=y();switch(A){case"":Y("EOF"),f++;break e;case">":f++;break e;case"/":O=!0;break e;case'"':case"'":throw new R("ATTR_VALUE");case"=":throw new R("SYMBOL",A)}const T=m();if(!T){Y("EOF"),f++;break e}switch(A=y(),A){case"":Y("EOF"),f++;break e;case">":x(T,""),f++;break e;case"/":x(T,""),O=!0;break e;case"=":f++;break;case"'":case'"':x(T,g(A));continue;default:x(T,"");continue}switch(A=y(),A){case"":x(T,""),Y("EOF"),f++;break e;case">":x(T,""),f++;break e;case"/":x(T,""),O=!0;break e;case"'":case'"':x(T,g(A));continue}x(T,m())}if(O){for(;;){f++;const N=e.charAt(f);if("/"!==N&&!(N<=" "||""===N))break}switch(e.charAt(f)){case"=":throw new R("EQUAL");case'"':case"'":throw new R("ATTR_VALUE");case"":Y("EOF");break;case">":f++;break;default:throw new R("CLOSE_SYMBOL")}c()}else(r.has(v)||H(e,f,v,d))&&c()}return i},stringify:function(e,t){const n=t?0:-1;return Array.isArray(e)?[...Q(e,n)].join(""):[G(e,n)].join()}});let X=!0;const J=new I.subtle.Watcher((()=>{X&&(X=!1,queueMicrotask(ee))}));function ee(){X=!0;for(const e of J.getPending())e.get();J.watch()}function te(e,t){let n,r=!1;const i=new I.Computed((()=>{const i=e();r&&Object.is(i,n)||(n=i,r=!0,t(i))}));return J.watch(i),i.get(),()=>{J.unwatch(i)}}function*ne(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}],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}null`,{get:()=>e.null}],yield[`${t}${n}index`,{get:()=>e.index}],yield[`${t}${n}no`,{get:()=>e.no}],yield[`${t}${n}length`,{get:()=>e.length}],yield[`${t}${n}creatable`,{get:()=>e.creatable}],yield[`${t}${n}immutable`,{get:()=>e.immutable}],yield[`${t}${n}new`,{get:()=>e.new}],yield[`${t}${n}editable`,{get:()=>e.editable}],yield[`${t}${n}hidden`,{get:()=>e.hidden}],yield[`${t}${n}clearable`,{get:()=>e.clearable}],yield[`${t}${n}required`,{get:()=>e.required}],yield[`${t}${n}disabled`,{get:()=>e.disabled}],yield[`${t}${n}readonly`,{get:()=>e.readonly}],e instanceof U&&(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)}])}class re{exec(e){if("string"==typeof e){const t=this.#P[e];if("function"!=typeof t?.get)return;return t.get()}if("function"==typeof e)return e(this.getters)}watch(e,t){return te((()=>this.exec(e)),t)}bind(e,t,n){const r=this.#P[e];if(!r?.get)return;const{store:i}=r;if(i)switch(t){case"value":return te((()=>i.value),n);case"state":return te((()=>i.state),n);case"required":return te((()=>i.required),n);case"clearable":return te((()=>i.clearable),n);case"hidden":return te((()=>i.hidden),n);case"disabled":return te((()=>i.disabled),n);case"readonly":return te((()=>i.readonly||!i.editable),n)}}bindAll(e){const t=this.#P[e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>te(e,t)}}return{$value:e=>te((()=>n.value),e),$state:e=>te((()=>n.state),e),$required:e=>te((()=>n.required),e),$clearable:e=>te((()=>n.clearable),e),$hidden:e=>te((()=>n.hidden),e),$disabled:e=>te((()=>n.disabled),e),$readonly:e=>te((()=>n.readonly||!n.editable),e)}}bindSet(e,t){const n=this.#P[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}}}bindStateAllSet(e){const t=this.#P[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}}}getEvent(e){if("function"==typeof e)return e;const t=this.#P[e];if(!t)return null;const{exec:n,calc:r}=t;return"function"==typeof n?n:"function"==typeof r?r:null}constructor(e){if(e instanceof re){this.#V=e.#V;const t=this.#B;for(const[n,r]of Object.entries(e.#B))t[n]=r;const n=this.#D;for(const[t,r]of Object.entries(e.#D))n[t]=r;return}const t=Object.create(null);if(this.#V=t,e&&"object"==typeof e)for(const[n,r]of Object.entries(e)){if(!n||n.includes("$"))continue;if(!r||"object"!=typeof r)return;if(r instanceof L){for(const[e,i]of ne(r,n))t[e]=i;continue}const{get:e,set:i,exec:o,calc:s}=r;"function"!=typeof e?"function"!=typeof s?"function"!=typeof o||(t[n]={exec:o}):t[n]={calc:s}:t[n]="function"==typeof i?{get:e,set:i}:{get:e}}}#V;#B=Object.create(null);#D=Object.create(null);#W=null;#n=null;#_=null;get#P(){const e=this.#_;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#B,...this.#V,...this.#D})),n=this.#W,r=this.#n;if(n){for(const[e,r]of ne(n))t[e]=r;for(const[e,i]of function*(e,t,n="",r="$"){if(!(e instanceof U))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.length-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.length-1||e.move(n,n+1))}}]}(r,n))t[e]=i}return this.#_=t,t}setValue(e,t){const n=new re(this);if(n.#W=e,t&&(n.#n=t),e instanceof U)return n;const r=n.#B;for(const[t,n]of e){for(const[e,i]of ne(n,t))r[e]=i;for(const[e,i]of ne(n,t,"$$"))r[e]=i}return n}set(e,t){if(Object.keys(e).length+Object.keys(t).length===0)return this;const n=new re(this);n.#W=this.#W,n.#n=this.#n;const r=n.#D,i=n.#P;for(const[t,o]of Object.entries(e)){if("function"==typeof o){const e=n.getters;n.#K=null;const s=new I.Computed((()=>o(e)));r[t]=i[t]={get:()=>s.get()};continue}const e=i[o];if(e)if(e.get&&e.store)for(const[n,o]of ne(e.store,t))r[n]=i[n]=o;else r[t]=i[t]=e}for(const[e,o]of Object.entries(t)){const t=new I.State(null);if("function"==typeof o){const e=n.settable;n.#H=null,t.set(o(e))}else if(o&&"string"==typeof o){const e=i[o];if(!e?.get)continue;t.set(e.get())}r[e]=i[e]={get:()=>t.get(),set:e=>{t.set(e)}}}return n}#Y=null;get all(){const e=this.#Y;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#P))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 this.#Y=t,t}#H=null;get settable(){const e=this.#H;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#P))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 this.#H=t,t}#K=null;get getters(){const e=this.#K;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#P))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 this.#K=t,t}}const ie={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 oe(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 i=Array.isArray(t)?t[0]:t;return"number"==typeof i||"bigint"==typeof i?r=i&&e in ie?`${i}${ie[e]}`:`${i}`:"string"==typeof i&&(r=i),r?[r,n?"important":void 0]:null}class se{#z=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#z;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#z,i="number"==typeof e?String(e):e;let o=r.get(i);return o||(o=new Set,r.set(i,o)),o.add(n),()=>{o?.delete(n)}}}const ae={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 le(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 ce(e){return null===(e??null)?"":String(e)}function ue(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 ce;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 de={input:{attrs:{$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=ce(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:{$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ce(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ce(e)}},events:{$value:["change",(e,t)=>t.value]}}};function fe(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watchAttr:i,props:o}=e;return e.listen("init",(({events:n})=>{const s=de[t.toLowerCase()],a=s?.attrs||{},l=s?.events||{};for(const[e,t,i]of n)if("$"!==e[0])r.addEventListener(e,t,i);else{const n=l[e];if(n){const[e,o]=n;r.addEventListener(e,(e=>t(o(e,r))),i)}}if(o)for(const[t,n]of Object.entries(e.tagAttrs))if(i(t,(e=>{if(o.has(t))r[t]=e;else{const n=le(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),o.has(t))r[t]=n;else{const e=le(n);null!==e&&r.setAttribute(t,e)}else for(const[t,n]of Object.entries(e.tagAttrs)){if(r instanceof HTMLInputElement&&"type"===t.toLocaleLowerCase()){const e=le(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),i(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),i(t,(t=>e(t,r))));continue}const e=ue(r,t);if("function"==typeof e){r[t]=e(n),i(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,i(t,(e=>{r[t]=e}));continue}let o=le(n);null!==o&&r.setAttribute(t,o),i(t,(e=>{const n=le(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function he(e){return null===(e??null)?"":String(e)}function pe(e,t,n,{text:r,html:i}){if(null!=r){const i=e.insertBefore(document.createTextNode(""),t),o=n.watch(r,(e=>i.textContent=he(e)));return()=>{i.remove(),o()}}if(null==i)return;const o=e.insertBefore(document.createComment(""),t),s=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=o.nextSibling;e&&e!==s;e=o.nextSibling)e.remove()}const c=n.watch(i,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=o.firstChild)e.insertBefore(t,s)}(he(t))}));return()=>{c(),l(),o.remove(),s.remove()}}function ge(e,t,n,r,i){let o=new Set,s=[];function a(e){if(!e.length||!o)return;const s=t.insertBefore(document.createComment(""),n);let a=-1,l=()=>{};o.add((()=>{l(),l=()=>{},s.remove()})),o.add(te((()=>e.findIndex((([e])=>null===e||r.exec(e)))),(t=>{t!==a&&(a=t,l(),l=()=>{},function(t){const n=e[t]?.[1];n&&(l=i(n))}(a))})))}for(const r of e){if("string"==typeof r){a(s),s=[];const e=document.createTextNode(r);t.insertBefore(e,n),o.add((()=>e.remove()));continue}if(s.length&&r.directives.else){const e=r.directives.if||null;s.push([e,r]),e||(a(s),s=[]);continue}a(s),s=[];const e=r.directives.if;e?s.push([e,r]):o.add(i(r))}return()=>{if(!o)return;const e=o;o=null;for(const t of e)t()}}function ye(e,t,n,r,i,o,s){if(i=i.set(e.aliases,e.vars),!e.name||e.directives.fragment)return function(e,t,n,r,i){return pe(t,n,r,e.directives)||ge(e.children||[],t,n,r,i)}(e,t,n,i,(e=>me(e,t,n,r,i,o,s)));const a=[...o,e.name],l=s?.(a);if(s&&!l)return()=>{};const{context:c,handler:u}=function(e,t){const n="string"==typeof e?e:e.tag,{attrs:r,events:i}="string"!=typeof e&&e||{attrs:null,events:null};let o=!1,s=!1;const a=Object.create(null),l=[],c=new se,u=new se;return{context:{events:l,props:r?new Set(Object.entries(r).filter((([,e])=>e.isProp)).map((([e])=>e))):null,tagAttrs:a,watchAttr:(e,t)=>u.listen(e,t),get destroyed(){return o},get init(){return s},listen:(e,t)=>c.listen(e,t)},handler:{tag:n,set(e,t){if(r&&!(e in r))return;e in a||(a[e]=void 0);const n=a[e];n!==t&&(a[e]=t,u.emit(e,t,n,e))},addEvent(e,n){if("function"!=typeof n)return;const[r,...o]=e.split(".").filter(Boolean),s=i?i[r].filters:{};if(!s)return;const a={},c=[];if(s)for(let e=o.shift();e;e=o.shift()){const t=e.indexOf(":"),n=t>=0?e.slice(0,t):e,r=t>=0?e.slice(t+1).split(":"):[],i=n.replace(/^-+/,""),o=(n.length-i.length)%2==1;let l=s[i]||i;switch(l){case"once":a.once=!o;break;case"passive":a.passive=!o;break;case"capture":a.capture=!o;break;default:"string"==typeof l&&(l=ae[l])}"function"==typeof l&&c.push([l,r,o])}l.push([r,e=>{const r=t.all;for(const[t,n,i]of c)if(t(e,n,r)===i)return;n(e,r)},a])},destroy(){o||(o=!0,c.emit("destroy"))},init(){s||(s=!0,c.emit("init",{events:l}))}}}}(l||e.name,i),d=l?.attrs,f=d?function(e,t,n,r,i){let o=new Set;for(const[s,a]of Object.entries(r)){const r=n[s];if(s in n){if("function"!=typeof r&&"object"!=typeof r){e.set(s,r);continue}const n="function"==typeof r?r:r.name;if(a.immutable){e.set(s,t.exec(n));continue}o.add(t.watch(n,(t=>e.set(s,t))));continue}const l=a.bind;if(!i||!l){e.set(s,a.default);continue}if("string"==typeof l){const n=t.bind(i,l,(t=>e.set(s,t)));n?o.add(n):e.set(s,a.default);continue}if(!Array.isArray(l)){e.set(s,a.default);continue}const[c,u,d]=l;if(!c||"function"!=typeof u)continue;if(!d){o.add(t.watch(i,(t=>e.set(s,t)))),e.addEvent(c,((...e)=>{t.all[i]=u(...e)}));continue}const f=t.bind(i,"state",(t=>e.set(s,t)));if(!f)continue;o.add(f);const h=t.bindSet(i,"state");h&&e.addEvent(c,((...e)=>{h(u(...e))}))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(u,i,e.attrs,d,e.directives.bind):function(e,t,n,r){const i=e.tag;let o=new Set;for(const[r,s]of Object.entries(n)){if("function"!=typeof s&&"object"!=typeof s){e.set(r,s);continue}const n="function"==typeof s?s:s.name;if("string"!=typeof i||"input"!==i.toLocaleLowerCase()||"type"!==r.toLocaleLowerCase())o.add(t.watch(n,(t=>e.set(r,t))));else{const i=t.exec(n);e.set(r,i)}}if(r){for(const[n,i]of Object.entries(t.bindAll(r)||{}))"function"==typeof i&&o.add(i((t=>e.set(n,t))));for(const[n,i]of Object.entries(t.bindStateAllSet(r)||{}))"function"==typeof i&&e.addEvent(n,(e=>i(e)))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(u,i,e.attrs,e.directives.bind);for(const[t,n]of Object.entries(e.events)){const e=i.getEvent(n);e&&u.addEvent(t,e)}const h=l?"function"==typeof l.tag?l.tag(c):fe(c,l.tag,l.is):fe(c,e.name,e.is),p=Array.isArray(h)?h[0]:h,g=Array.isArray(h)&&h[1]||p;t.insertBefore(p,n);const y=pe(g,null,i,e.directives)||ge(e.children||[],g,null,i,(e=>me(e,g,null,r,i,o,s)));return function(e,t,n){if(!(e instanceof Element))return()=>{};let r=new Set;for(const[i,o]of Object.entries(t))o&&(!0!==o?r.add(te((()=>Boolean(n.exec(o))),(t=>{t?e.classList.add(i):e.classList.remove(i)}))):e.classList.add(i))}(p,e.classes,i),function(e,t,n){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};let r=new Set;for(const[i,o]of Object.entries(t))r.add(te((()=>oe(i,n.exec(o))),(t=>{t?e.style.setProperty(i,...t):e.style.removeProperty(i)})))}(p,e.styles,i),u.init(),()=>{p.remove(),u.destroy(),f(),y()}}function me(e,t,n,r,i,o,s){const{directives:a}=e,{value:l}=a;if(l){const e=r.child(l);if(!e)return()=>{};r=e,i=i.setValue(r)}return a.enum?r instanceof U?function(e,t,n,r,i,o){const s=t.insertBefore(document.createComment(""),n);let a=new Map;const l=te((()=>r.children),(function(n){if(!s.parentNode)return;let l=s.nextSibling;const c=a;a=new Map;for(let s of n){const n=c.get(s);if(!n){const n=t.insertBefore(document.createComment(""),l),c=t.insertBefore(document.createComment(""),l),u=o(e,t,c,s,i.setValue(s,r));a.set(s,[n,c,u]);continue}if(c.delete(s),a.set(s,n),l===n[0]){l=n[1].nextSibling;continue}let u=n[0];for(;u&&u!==n[1];){const e=u;u=u.nextSibling,t.insertBefore(e,l)}t.insertBefore(n[1],l)}!function(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}(c)}));return()=>{s.remove(),l()}}(e,t,n,r,i,((e,t,n,r,i)=>ye(e,t,n,r,i,o,s))):()=>{}:ye(e,t,n,r,i,o,s)}function be(e,t,n,r,i){const o=[r,i],s=o.find((e=>"function"==typeof e)),a=o.find((e=>"object"==typeof e)),l=new re(a).setValue(e);return ge(t,n,null,l,(t=>me(t,n,null,e,l,[],s)))}export{Z as Layout,I as Signal,L as Store,be as render};
|