@neeloong/form 0.5.0 → 0.6.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 +4 -4
- package/index.js +34 -21
- package/index.min.js +2 -2
- package/index.min.mjs +2 -2
- package/index.mjs +34 -21
- package/package.json +1 -1
package/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.6.0
|
|
3
3
|
* (c) 2024-2025 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { Signal } from 'signal-polyfill';
|
|
7
8
|
export { Signal } from 'signal-polyfill';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -234,7 +235,7 @@ declare class Store<T = any> {
|
|
|
234
235
|
* @param {*} [options.parent]
|
|
235
236
|
* @param {*} [options.state]
|
|
236
237
|
* @param {number | string | null} [options.index]
|
|
237
|
-
* @param {number} [options.length]
|
|
238
|
+
* @param {number | Signal.State<number> | Signal.Computed<number>} [options.length]
|
|
238
239
|
* @param {boolean} [options.null]
|
|
239
240
|
* @param {boolean} [options.new]
|
|
240
241
|
* @param {boolean} [options.hidden]
|
|
@@ -261,7 +262,7 @@ declare class Store<T = any> {
|
|
|
261
262
|
parent?: any;
|
|
262
263
|
state?: any;
|
|
263
264
|
index?: string | number | null | undefined;
|
|
264
|
-
length?: number | undefined;
|
|
265
|
+
length?: number | Signal.State<number> | Signal.Computed<number> | undefined;
|
|
265
266
|
null?: boolean | undefined;
|
|
266
267
|
new?: boolean | undefined;
|
|
267
268
|
hidden?: boolean | undefined;
|
|
@@ -306,7 +307,6 @@ declare class Store<T = any> {
|
|
|
306
307
|
get type(): any;
|
|
307
308
|
get meta(): any;
|
|
308
309
|
get component(): any;
|
|
309
|
-
set length(v: number);
|
|
310
310
|
get length(): number;
|
|
311
311
|
set index(v: string | number);
|
|
312
312
|
get index(): string | number;
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.6.0
|
|
3
3
|
* (c) 2024-2025 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
@@ -747,7 +747,7 @@
|
|
|
747
747
|
* @param {*} [options.parent]
|
|
748
748
|
* @param {*} [options.state]
|
|
749
749
|
* @param {number | string | null} [options.index]
|
|
750
|
-
* @param {number} [options.length]
|
|
750
|
+
* @param {number | Signal.State<number> | Signal.Computed<number>} [options.length]
|
|
751
751
|
* @param {boolean} [options.null]
|
|
752
752
|
* @param {boolean} [options.new]
|
|
753
753
|
* @param {boolean} [options.hidden]
|
|
@@ -837,6 +837,12 @@
|
|
|
837
837
|
// @ts-ignore
|
|
838
838
|
[this.#selfValues, this.#values] = createState(this, values, values$1, schema.values);
|
|
839
839
|
|
|
840
|
+
if (length instanceof exports.Signal.State || length instanceof exports.Signal.Computed) {
|
|
841
|
+
this.#length = length;
|
|
842
|
+
} else {
|
|
843
|
+
this.#length = new exports.Signal.State(length || 0);
|
|
844
|
+
}
|
|
845
|
+
|
|
840
846
|
if (isNull) {
|
|
841
847
|
this.#null = true;
|
|
842
848
|
return;
|
|
@@ -846,7 +852,6 @@
|
|
|
846
852
|
this.#setValue = typeof setValue === 'function' ? setValue : null;
|
|
847
853
|
this.#setState = typeof setState === 'function' ? setState : null;
|
|
848
854
|
this.#convert = typeof convert === 'function' ? convert : null;
|
|
849
|
-
this.#length.set(length || 0);
|
|
850
855
|
this.#index.set(index ?? '');
|
|
851
856
|
|
|
852
857
|
for (const [k, f] of Object.entries(schema.events || {})) {
|
|
@@ -885,9 +890,9 @@
|
|
|
885
890
|
get meta() { return this.#meta; }
|
|
886
891
|
get component() { return this.#component; }
|
|
887
892
|
|
|
888
|
-
|
|
893
|
+
/** @type {Signal.State<number> | Signal.Computed<number>} */
|
|
894
|
+
#length;
|
|
889
895
|
get length() { return this.#length.get(); }
|
|
890
|
-
set length(v) { this.#length.set(v); }
|
|
891
896
|
#index = new exports.Signal.State(/** @type {string | number} */(''));
|
|
892
897
|
get index() { return this.#index.get(); }
|
|
893
898
|
set index(v) { this.#index.set(v); }
|
|
@@ -1188,8 +1193,10 @@
|
|
|
1188
1193
|
* @param {(value: any, index: any) => void} [options.onUpdateState]
|
|
1189
1194
|
*/
|
|
1190
1195
|
constructor(schema,{ parent, index, new: isNew, onUpdate, onUpdateState } = {}) {
|
|
1196
|
+
const childrenTypes = Object.entries(schema.type);
|
|
1191
1197
|
super(schema, {
|
|
1192
1198
|
parent, index, new: isNew, onUpdate, onUpdateState,
|
|
1199
|
+
length: childrenTypes.length,
|
|
1193
1200
|
setValue(v) {
|
|
1194
1201
|
if (typeof v !== 'object') { return {}; }
|
|
1195
1202
|
return v;
|
|
@@ -1218,7 +1225,7 @@
|
|
|
1218
1225
|
}
|
|
1219
1226
|
};
|
|
1220
1227
|
|
|
1221
|
-
for (const [index, field] of
|
|
1228
|
+
for (const [index, field] of childrenTypes) {
|
|
1222
1229
|
let child;
|
|
1223
1230
|
if (typeof field.type === 'string') {
|
|
1224
1231
|
if (field.array) {
|
|
@@ -1244,7 +1251,8 @@
|
|
|
1244
1251
|
class ArrayStore extends Store {
|
|
1245
1252
|
/** @type {(index: number, isNew?: boolean) => Store} */
|
|
1246
1253
|
#create = () => {throw new Error}
|
|
1247
|
-
|
|
1254
|
+
/** @type {Signal.State<Store[]>} */
|
|
1255
|
+
#children
|
|
1248
1256
|
get children() { return [...this.#children.get()]; }
|
|
1249
1257
|
*[Symbol.iterator]() { return yield*[...this.#children.get().entries()]; }
|
|
1250
1258
|
/**
|
|
@@ -1270,11 +1278,12 @@
|
|
|
1270
1278
|
* @param {(value: any, index: any) => void} [options.onUpdateState]
|
|
1271
1279
|
*/
|
|
1272
1280
|
constructor(schema, { parent, onUpdate, onUpdateState, index, new: isNew} = {}) {
|
|
1281
|
+
const childrenState = new exports.Signal.State(/** @type {Store[]} */([]));
|
|
1273
1282
|
// @ts-ignore
|
|
1274
1283
|
const updateChildren = (list) => {
|
|
1275
1284
|
if (this.destroyed) { return; }
|
|
1276
1285
|
const length = Array.isArray(list) && list.length || 0;
|
|
1277
|
-
const children = [...
|
|
1286
|
+
const children = [...childrenState.get()];
|
|
1278
1287
|
const oldLength = children.length;
|
|
1279
1288
|
for (let i = children.length; i < length; i++) {
|
|
1280
1289
|
children.push(this.#create(i));
|
|
@@ -1283,13 +1292,13 @@
|
|
|
1283
1292
|
schema.destroy();
|
|
1284
1293
|
}
|
|
1285
1294
|
if (oldLength !== length) {
|
|
1286
|
-
|
|
1287
|
-
this.#children.set(children);
|
|
1295
|
+
childrenState.set(children);
|
|
1288
1296
|
}
|
|
1289
1297
|
|
|
1290
1298
|
};
|
|
1291
1299
|
super(schema, {
|
|
1292
1300
|
index, new: isNew, parent,
|
|
1301
|
+
length: new exports.Signal.Computed(() => childrenState.get().length),
|
|
1293
1302
|
state: [],
|
|
1294
1303
|
setValue(v) { return Array.isArray(v) ? v : v == null ? [] : [v] },
|
|
1295
1304
|
setState(v) { return Array.isArray(v) ? v : v == null ? [] : [v] },
|
|
@@ -1307,6 +1316,7 @@
|
|
|
1307
1316
|
},
|
|
1308
1317
|
onUpdateState,
|
|
1309
1318
|
});
|
|
1319
|
+
this.#children = childrenState;
|
|
1310
1320
|
const childCommonOptions = {
|
|
1311
1321
|
parent: this,
|
|
1312
1322
|
/** @param {*} value @param {*} index */
|
|
@@ -1373,7 +1383,6 @@
|
|
|
1373
1383
|
this.state = sta;
|
|
1374
1384
|
}
|
|
1375
1385
|
this.value = val;
|
|
1376
|
-
this.length = children.length;
|
|
1377
1386
|
this.#children.set(children);
|
|
1378
1387
|
return true;
|
|
1379
1388
|
}
|
|
@@ -1411,7 +1420,6 @@
|
|
|
1411
1420
|
this.state = sta;
|
|
1412
1421
|
}
|
|
1413
1422
|
this.value = val;
|
|
1414
|
-
this.length = children.length;
|
|
1415
1423
|
this.#children.set(children);
|
|
1416
1424
|
return value;
|
|
1417
1425
|
|
|
@@ -2511,23 +2519,28 @@
|
|
|
2511
2519
|
|
|
2512
2520
|
/** @import { ValueDefine, ExecDefine, CalcDefine } from './index.mjs' */
|
|
2513
2521
|
|
|
2522
|
+
|
|
2523
|
+
/**
|
|
2524
|
+
*
|
|
2525
|
+
* @param {string} key
|
|
2526
|
+
*/
|
|
2527
|
+
function testKey(key) {
|
|
2528
|
+
if (!key) { return false; }
|
|
2529
|
+
const index = key.indexOf('$');
|
|
2530
|
+
if (index < 0) { return true; }
|
|
2531
|
+
if (key.indexOf('$', index + 2) > 0) { return true; }
|
|
2532
|
+
if (key[0] !== '$') { return false;}
|
|
2533
|
+
return '_$'.includes(key[1]);
|
|
2534
|
+
}
|
|
2514
2535
|
/**
|
|
2515
2536
|
* @param {Record<string, Store | {get?(): any; set?(v: any): void; exec?(...p: any[]): any; calc?(...p: any[]): any }>?} [global]
|
|
2516
2537
|
*/
|
|
2517
2538
|
function toGlobal(global) {
|
|
2518
2539
|
/** @type {Record<string, ValueDefine | ExecDefine | CalcDefine>} */
|
|
2519
2540
|
const items = Object.create(null);
|
|
2520
|
-
items.$$size = { calc(v) {
|
|
2521
|
-
if (!v) { return 0; }
|
|
2522
|
-
if (Array.isArray(v)) { return v.length; }
|
|
2523
|
-
if (v instanceof Map) { return v.size; }
|
|
2524
|
-
if (v instanceof Set) { return v.size; }
|
|
2525
|
-
return Object.keys(v).length;
|
|
2526
|
-
} };
|
|
2527
|
-
|
|
2528
2541
|
if (!global || typeof global !== 'object') { return items; }
|
|
2529
2542
|
for (const [key, value] of Object.entries(global)) {
|
|
2530
|
-
if (!key
|
|
2543
|
+
if (!testKey(key)) { continue; }
|
|
2531
2544
|
if (!value || typeof value !== 'object') { continue; }
|
|
2532
2545
|
if (value instanceof Store) {
|
|
2533
2546
|
for (const [k, v] of toItem(value, key)) {
|
package/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.6.0
|
|
3
3
|
* (c) 2024-2025 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
@@ -57,4 +57,4 @@ function(){throw new Error};function $(){return h(this),this.value}function T(e,
|
|
|
57
57
|
* Use of this source code is governed by an MIT-style license that can be
|
|
58
58
|
* found in the LICENSE file at https://angular.io/license
|
|
59
59
|
*/
|
|
60
|
-
function(e){const t=Object.create(N);t.value=e;const n=()=>(h(t),t.value);return n[u]=t,n}(r),l=a[u];if(this[k]=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 $.call(this[k])}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");T(this[k],t)}};c=k,p=new WeakSet,e.isComputed=e=>r(p,e),e.Computed=class{constructor(t,r){s(this,p),n(this,c);const o=function(e){const t=Object.create(A);t.computation=e;const n=()=>S(t);return n[u]=t,n}(t),i=o[u];if(i.consumerAllowSignalWrites=!0,this[k]=i,i.wrapper=this,r){const t=r.equals;t&&(i.equal=t),i.watched=r[e.subtle.watched],i.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[k])}},(t=>{var i,l,c,u;t.untrack=function(e){let t,n=null;try{n=f(null),t=e()}finally{f(n)}return t},t.introspectSources=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(n=t[k].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[k].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[k].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[k].producerNode;return!!n&&n.length>0};i=k,l=new WeakSet,c=new WeakSet,u=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>r(l,e),t.Watcher=class{constructor(e){s(this,l),s(this,c),n(this,i);let t=Object.create(d);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[k]=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[k];n.dirty=!1;const r=f(n);for(const e of t)h(e[k]);f(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[k];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[k].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 M=(t,n,r,s)=>{const o=new e.Signal.State("boolean"==typeof n?n:null);let i;if("function"==typeof r)i=new e.Signal.Computed((()=>Boolean(r(t,t.root))));else{const t=Boolean(r);i=new e.Signal.Computed((()=>t))}const a=()=>{const e=o.get();return null===e?i.get():e},l=s?new e.Signal.Computed((()=>s.get()||a())):new e.Signal.Computed(a);return[o,l]},L=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,U=Boolean;function q(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(q).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const P=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(q).filter(U);return t.length?t:null};function B(t,n,r,s){const o=new e.Signal.State(n(r));let i;if("function"==typeof s){const r=s;i=new e.Signal.Computed((()=>n(r(t,t.root))))}else{const t=n(s);i=new e.Signal.Computed((()=>t))}const a=new e.Signal.Computed((()=>{const e=o.get();return null===e?i.get():e}));return[o,a]}class R{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}static create(e,t={}){return new V({type:e},{...t,parent:null})}#t=!1;get null(){return this.#t}get kind(){return""}constructor(t,{null:n,state:r,setValue:s,setState:o,convert:i,onUpdate:a,onUpdateState:l,index:c,length:u,new:f,parent:d,hidden:h,clearable:p,required:g,disabled:m,readonly:y,label:b,description:v,placeholder:w,min:x,max:S,step:O,values:E}){this.schema=t,this.#n.set("object"==typeof r&&r||{});const C=d instanceof R?d:null;C&&(this.#r=C,this.#s=C.#s),this.#o=t.type,this.#i=t.meta,this.#a=t.component;const A=new e.Signal.State(Boolean(f));this.#l=A;const j=C?new e.Signal.Computed((()=>C.#c.get()||A.get())):new e.Signal.Computed((()=>A.get()));this.#c=j;const $=Boolean(t.immutable),T=!1!==t.creatable;this.#u=$,this.#f=T;const N=t.readonly,k=new e.Signal.State("boolean"==typeof y?y:null);let U;if("function"==typeof N)U=new e.Signal.Computed((()=>Boolean(N(this,this.root))));else{const t=Boolean(N);U=new e.Signal.Computed((()=>t))}const q=()=>{if(j.get()?!T:$)return!0;const e=k.get();return null===e?U.get():e},V=C?C.#d:null;if(this.#h=k,this.#d=V?new e.Signal.Computed((()=>V.get()||q())):new e.Signal.Computed(q),[this.#p,this.#g]=M(this,h,t.hidden,C?C.#g:null),[this.#m,this.#y]=M(this,p,t.clearable,C?C.#y:null),[this.#b,this.#v]=M(this,g,t.required,C?C.#v:null),[this.#w,this.#x]=M(this,m,t.disabled,C?C.#x:null),[this.#S,this.#O]=B(this,L,b,t.label),[this.#E,this.#C]=B(this,L,v,t.description),[this.#A,this.#j]=B(this,L,w,t.placeholder),[this.#$,this.#T]=B(this,I,x,t.min),[this.#N,this.#k]=B(this,I,S,t.max),[this.#M,this.#L]=B(this,I,O,t.step),[this.#I,this.#U]=B(this,P,E,t.values),n)this.#t=!0;else{this.#q=a||null,this.#P=l||null,this.#B="function"==typeof s?s:null,this.#R="function"==typeof o?o:null,this.#V="function"==typeof i?i:null,this.#D.set(u||0),this.#W.set(c??"");for(const[e,n]of Object.entries(t.events||{}))"function"==typeof n&&this.listen(e,n)}}#_=!1;#B=null;#R=null;#V=null;#q=null;#P=null;#r=null;#s=this;#o;#i;#a;get store(){return this}get parent(){return this.#r}get root(){return this.#s}get type(){return this.#o}get meta(){return this.#i}get component(){return this.#a}#D=new e.Signal.State(0);get length(){return this.#D.get()}set length(e){this.#D.set(e)}#W=new e.Signal.State("");get index(){return this.#W.get()}set index(e){this.#W.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#f=!0;get creatable(){return this.#f}#u=!1;get immutable(){return this.#u}#c;#l;get selfNew(){return this.#l.get()}set selfNew(e){this.#l.set(Boolean(e))}get new(){return this.#c.get()}set new(e){this.#l.set(Boolean(e))}#p;#g;get selfHidden(){return this.#p.get()}set selfHidden(e){this.#p.set("boolean"==typeof e?e:null)}get hidden(){return this.#g.get()}set hidden(e){this.#p.set("boolean"==typeof e?e:null)}#m;#y;get selfClearable(){return this.#m.get()}set selfClearable(e){this.#m.set("boolean"==typeof e?e:null)}get clearable(){return this.#y.get()}set clearable(e){this.#m.set("boolean"==typeof e?e:null)}#b;#v;get selfRequired(){return this.#b.get()}set selfRequired(e){this.#b.set("boolean"==typeof e?e:null)}get required(){return this.#v.get()}set required(e){this.#b.set("boolean"==typeof e?e:null)}#w;#x;get selfDisabled(){return this.#w.get()}set selfDisabled(e){this.#w.set("boolean"==typeof e?e:null)}get disabled(){return this.#x.get()}set disabled(e){this.#w.set("boolean"==typeof e?e:null)}#h;#d;get selfReadonly(){return this.#h.get()}set selfReadonly(e){this.#h.set("boolean"==typeof e?e:null)}get readonly(){return this.#d.get()}set readonly(e){this.#h.set("boolean"==typeof e?e:null)}#S;#O;get selfLabel(){return this.#S.get()}set selfLabel(e){this.#S.set(L(e))}get label(){return this.#O.get()}set label(e){this.#S.set(L(e))}#E;#C;get selfDescription(){return this.#E.get()}set selfDescription(e){this.#E.set(L(e))}get description(){return this.#C.get()}set description(e){this.#E.set(L(e))}#A;#j;get selfPlaceholder(){return this.#A.get()}set selfPlaceholder(e){this.#A.set(L(e))}get placeholder(){return this.#j.get()}set placeholder(e){this.#A.set(L(e))}#$;#T;get selfMin(){return this.#$.get()}set selfMin(e){this.#$.set(I(e))}get min(){return this.#T.get()}set min(e){this.#$.set(I(e))}#N;#k;get selfMax(){return this.#N.get()}set selfMax(e){this.#N.set(I(e))}get max(){return this.#k.get()}set max(e){this.#N.set(I(e))}#M;#L;get selfStep(){return this.#M.get()}set selfStep(e){this.#M.set(I(e))}get step(){return this.#L.get()}set step(e){this.#M.set(I(e))}#I;#U;get selfValues(){return this.#I.get()}set selfValues(e){this.#I.set(P(e))}get values(){return this.#U.get()}set values(e){this.#I.set(P(e))}*[Symbol.iterator](){}child(e){return null}#K=!1;#H=null;#z=this.#H;#Y=new e.Signal.State(this.#H);#n=new e.Signal.State(null);#F=this.#n.get();get changed(){return this.#Y.get()===this.#z}get saved(){return this.#Y.get()===this.#H}get value(){return this.#Y.get()}set value(e){if(this.#_)return;const t=this.#B?.(e)||e;this.#Y.set(t),this.#K||(this.#K=!0,this.#H=e),this.#q?.(this.#Y.get(),this.#W.get()),this.#G()}get state(){return this.#n.get()}set state(e){if(this.#_)return;const t=this.#R?.(e)||e;this.#n.set(t),this.#K=!0,this.#P?.(this.#n.get(),this.#W.get()),this.#G()}#G(){this.#Q||(this.#Q=!0,queueMicrotask((()=>{const e=this.#Y.get(),t=this.#n.get();return this.#Z(e,t)})))}#Q=!1;#X(e,t){if(this.#_)return e;const[n,r]=this.#V?.(e,t)||[e,t];return this.#Y.get()===n&&this.#n.get()===r?[n,r]:(this.#Y.set(n),this.#n.set(r),this.#K||(this.#K=!0,this.#H=n),this.#Z(n,r))}#Z(e,t){if(this.#_)return[e,t];if(this.#Q=!1,e&&"object"==typeof e){let n=Array.isArray(e)?[...e]:{...e},r=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},s=!1;for(const[o,i]of this){const a=e[o],l=t?.[o],[c,u]=i.#X(a,l);a!==c&&(n[o]=c,s=!0),l!==u&&(r[o]=u,s=!0)}s&&(e=n,t=r,this.#Y.set(e),this.#n.set(r))}return this.#z===e&&this.#F===t||(this.#z=e,this.#F=t),[e,t]}get destroyed(){return this.#_}destroy(){if(!this.#_){this.#_=!0;for(const[,e]of this)e.destroy()}}}class V extends R{get kind(){return"object"}#J;*[Symbol.iterator](){yield*Object.entries(this.#J)}child(e){return this.#J[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o}={}){super(e,{parent:t,index:n,new:r,onUpdate:s,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 i=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.type)){let e;e="string"==typeof n.type?n.array?new D(n,{...a,index:t}):new R(n,{...a,index:t}):n.array?new D(n,{...a,index:t}):new V(n,{...a,index:t}),i[t]=e}this.#J=i}}class D extends R{#ee=()=>{throw new Error};#J=new e.Signal.State([]);get children(){return[...this.#J.get()]}*[Symbol.iterator](){return yield*[...this.#J.get().entries()]}child(e){const t=this.#J.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(e,{parent:t,onUpdate:n,onUpdateState:r,index:s,new:o}={}){const i=e=>{if(this.destroyed)return;const t=Array.isArray(e)&&e.length||0,n=[...this.#J.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#ee(e));for(const e of n.splice(t))e.destroy();r!==t&&(this.length=n.length,this.#J.set(n))};super(e,{index:s,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 i(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t)=>{i(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.#ee=(t,n)=>{const r=new R(e,{...a,index:t,new:n});return r.index=t,r};else{if(!e.type||"object"!=typeof e.type||Array.isArray(e.type))throw new Error;this.#ee=(t,n)=>{const r=new V(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 s=[...this.#J.get()],o=Math.max(0,Math.min(Math.floor(e),s.length)),i=this.#ee(o,n);i.new=!0,s.splice(o,0,i);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(o,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(o,0,{}),this.state=e}return this.value=a,this.length=s.length,this.#J.set(s),!0}add(e){return this.insert(this.#J.get().length,e)}remove(e){if(this.destroyed)return;const t=this.value;if(!Array.isArray(t))return;const n=[...this.#J.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;s.destroy();const o=[...t],[i]=o.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.value=o,this.length=n.length,this.#J.set(n),i}move(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#J.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let o=Math.min(e,t),i=Math.max(e,t);for(let e=o;e<=i;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.value=a,this.#J.set(r),!0}exchange(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#J.get()],s=r[e],o=r[t];if(!s||!o)return!1;r[t]=s,r[e]=o,s.index=t,o.index=e;const i=[...n],a=i[e],l=i[t];i[t]=a,i[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.value=i,this.#J.set(r),!0}}const W={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class _ extends Error{constructor(e,...t){const n=W[e];super("function"==typeof n?n(...t):n),this.code=e}}const K=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,H=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function z(e,t,n){const{attrs:r,directives:s,events:o,classes:i,styles:a,vars:l,aliases:c,params:u}=e;return function(e,f){const d=K.exec(e.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"))?.groups;if(!d)throw new _("ATTR",e);const{name:h}=d,p=d.decorator?.toLowerCase();if(p){if(":"===p)r[h]=H.test(f)?{name:f}:t(f);else if("."===p)i[h]=!f||(H.test(f)?f:t(f));else if("style:"===p)a[h]=H.test(f)?f:t(f);else if("@"===p)o[h]=H.test(f)?f:n(f);else if("+"===p)l[h]=f?H.test(f)?f:t(f):"";else if("*"===p)c[h]=H.test(f)?f:t(f);else if("?"===p)u[h]=H.test(f)?f:t(f);else if("!"===p){const e=h.toString();switch(e){case"fragment":s.fragment=f||!0;break;case"else":s.else=!0;break;case"enum":s.enum=!f||(H.test(f)?f:t(f));break;case"if":case"text":case"html":s[e]=H.test(f)?f:t(f);break;case"template":s.template=f;break;case"bind":s.bind=f||!0;break;case"value":s.value=f;break;case"comment":s.comment=f}}}else r[h]=f}}function Y(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),params:Object.create(null)}}var F={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 G=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function Q(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function Z(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function X(...e){console.error(new _(...e))}function J(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in F?F[t]:(X("ENTITY",e),e)}function ee(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function*te(e,t=0){const{attrs:n,events:r,directives:s,children:o,is:i,name:a,params:l,classes:c,styles:u,aliases:f,vars:d}=e,h=t>0?"".padEnd(t,"\t"):"";yield h,yield*["<",a||"-"],i&&(yield*["|",i]);for(const[e,t]of Object.entries(l)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" ?",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}for(const[e,t]of Object.entries(s)){if(!1===t||null==t)continue;const n="function"==typeof t?String(t):t;yield*[" !",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}for(const[e,t]of Object.entries(f)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" *",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}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,ee),'"'])}for(const[e,t]of Object.entries(n)){if(null==t)continue;if("string"==typeof t){yield*[" ",e],t&&(yield*['="',t.replace(/[<&"]/g,ee),'"']);continue}const n="function"==typeof t?String(t):"object"==typeof t?t.name:t;n&&"string"==typeof n&&(yield*[" :",e,'="',n.replace(/[<&"]/g,ee)||"",'"'])}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,ee),'"'])}for(const[e,t]of Object.entries(c)){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,ee),'"'])}for(const[e,t]of Object.entries(u)){if(null==t)continue;const n="function"==typeof t?String(t):t;n&&"string"==typeof n&&(yield*[" style:",e,'="',n.replace(/[<&"]/g,ee),'"'])}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,ee).replace(/]]>/g,"]]>")],yield*["</",a,">"],void(t>=0&&(yield"\n"))}yield">",t>=0&&(yield"\n"),yield*ne(o,t>=0?t+1:-1),yield*[h,"</",a,">"],t>=0&&(yield"\n")}function*ne(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,ee).replace(/]]>/g,"]]>");n&&(e=e.replace(/(?<=^|\n)/g,n)),yield e,t>=0&&(yield"\n")}else yield*te(r,t)}var re=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new _("CALC")},createEvent:n=()=>{throw new _("EVENT")},simpleTag:r=new Set}={}){const s=[],o={children:s},i=[];let a=null,l=o;function c(){a=i.pop()||null,l=a||o}function u(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&l.children.push(e)}let f={},d=0;function h(t){if(t<=d)return;u(e.substring(d,t).replace(/&#?\w+;/g,J)),d=t}for(;;){const p=e.indexOf("<",d);if(p<0){const E=e.substring(d);E.match(/^\s*$/)||u(E);break}if(p>d&&h(p),"/"===e.charAt(p+1)){d=e.indexOf(">",p+3);let C=e.substring(p+2,d);if(d<0?(C=e.substring(p+2).replace(/[\s<].*/,""),X("UNCOMPLETED",C,a?.name),d=p+1+C.length):C.match(/\s</)&&(C=C.replace(/[\s<].*/,""),X("UNCOMPLETED",C),d=p+1+C.length),a){const A=a.name;if(A===C)c();else{if(A.toLowerCase()!=C.toLowerCase())throw new _("CLOSE",C,a.name);c()}}d++;continue}function g(t){let n=d+1;if(d=e.indexOf(t,n),d<0)throw new _("QUOTE",t);const r=e.slice(n,d).replace(/&#?\w+;/g,J);return d++,r}function m(){let t=e.charAt(d);for(;t<=" "||""===t;t=e.charAt(++d));return t}function y(){let t=d,n=e.charAt(d);for(;Q(n);)d++,n=e.charAt(d);return e.slice(t,d)}d=p+1;let b=e.charAt(d);switch(b){case"=":throw new _("EQUAL");case'"':case"'":throw new _("ATTR_VALUE");case">":case"/":throw new _("SYMBOL",b);case"":throw new _("EOF")}const v=y(),w=G.exec(v)?.groups;if(!w)throw new _("TAG",v);i.push(a),a=Y(w.name,w.is),l.children.push(a),l=a;const x=z(a,t,n);let S=!0,O=!1;e:for(;S;){let j=m();switch(j){case"":X("EOF"),d++;break e;case">":d++;break e;case"/":O=!0;break e;case'"':case"'":throw new _("ATTR_VALUE");case"=":throw new _("SYMBOL",j)}const $=y();if(!$){X("EOF"),d++;break e}switch(j=m(),j){case"":X("EOF"),d++;break e;case">":x($,""),d++;break e;case"/":x($,""),O=!0;break e;case"=":d++;break;case"'":case'"':x($,g(j));continue;default:x($,"");continue}switch(j=m(),j){case"":x($,""),X("EOF"),d++;break e;case">":x($,""),d++;break e;case"/":x($,""),O=!0;break e;case"'":case'"':x($,g(j));continue}x($,y())}if(O){for(;;){d++;const T=e.charAt(d);if("/"!==T&&!(T<=" "||""===T))break}switch(e.charAt(d)){case"=":throw new _("EQUAL");case'"':case"'":throw new _("ATTR_VALUE");case"":X("EOF");break;case">":d++;break;default:throw new _("CLOSE_SYMBOL")}c()}else(r.has(v)||Z(e,d,v,f))&&c()}return s},stringify:function(e,t){const n=t?0:-1;return Array.isArray(e)?[...ne(e,n)].join(""):[te(e,n)].join()}});let se=!0;const oe=new e.Signal.subtle.Watcher((()=>{se&&(se=!1,queueMicrotask(ie))}));function ie(){se=!0;for(const e of oe.getPending())e.get();oe.watch()}function ae(t,n){let r,s=!1;const o=new e.Signal.Computed((()=>{const e=t();s&&Object.is(e,r)||(r=e,s=!0,n(e))}));return oe.watch(o),o.get(),()=>{oe.unwatch(o)}}const le=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,values:!0,null:!0,index:!0,no:!0,length:!0}));function*ce(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of le)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],e instanceof D&&(yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}])}function ue(e,t,n){for(const[n,r]of t){for(const[t,s]of ce(r,n))e[t]=s;for(const[t,s]of ce(r,n,"$$"))e[t]=s}}function fe(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class de{exec(e){if("string"==typeof e){const t=this.#te[e];if("function"!=typeof t?.get)return;return t.get()}if("function"==typeof e)return e(this.getters)}watch(e,t){return ae((()=>this.exec(e)),t)}enum(e){if(!e)return!0;if(!0===e)return this.store;if("function"==typeof e)return()=>e(this.getters);if("string"!=typeof e)return null;const t=this.#te[e];if("function"!=typeof t?.get)return null;const n=t.store;return n instanceof R?n:t.get}bind(e,t,n){const r=this.#te[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?le.has(t)?ae((()=>s[t]),n):void 0:"value"===t?ae((()=>r.get()),n):void 0}bindAll(e){const t=this.#te[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>ae(e,t)}}return Object.fromEntries([...le].map((e=>[`$${e}`,t=>ae((()=>n[e]),t)])))}bindSet(e,t){const n=this.#te[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#te[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)}}}getEvent(e){if("function"==typeof e)return e;const t=this.#te[e];if(!t)return null;const{exec:n,calc:r}=t;return"function"==typeof n?n:"function"==typeof r?r:null}constructor(e,t){if(this.store=e,t instanceof de){this.#ne=t.#ne;const e=this.#re;for(const[n,r]of Object.entries(t.#re))e[n]=r;const n=this.#se;for(const[e,r]of Object.entries(t.#se))n[e]=r}else ue(this.#re,e),this.#ne=function(e){const t=Object.create(null);if(t.$$size={calc:e=>e?Array.isArray(e)?e.length:e instanceof Map||e instanceof Set?e.size:Object.keys(e).length:0},!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!n||n.includes("$"))continue;if(!r||"object"!=typeof r)continue;if(r instanceof R){for(const[e,s]of ce(r,n))t[e]=s;continue}const{get:e,set:s,exec:o,calc:i}=r;"function"!=typeof e?"function"!=typeof i?"function"!=typeof o||(t[n]={exec:o}):t[n]={calc:i}:t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#ne;#re=Object.create(null);#se=Object.create(null);store;#oe=null;#r=null;#ie=null;get#te(){const e=this.#ie;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#re,...this.#ne,...this.#se})),n=this.store,r=this.#r,s=this.#oe;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};else{for(const[e,r]of ce(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof D))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]=s}return this.#ie=t,t}setStore(e,t){const n=new de(e,this);return t&&(n.#r=t),ue(n.#re,e),n}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new de(t,this);return ue(n.#re,t),n}params({params:t},{attrs:n},r,s){let o=this.store;if(!0===s)o=r.store;else if(s){const e=r.#te[s],t=e?.get&&e.store;t&&(o=t)}if(0===Object.keys(t).length)return this;const i=new de(o,this);i.#r=this.#r,i.#oe=this.#oe;const a=i.#se,l=i.#te;for(const[s,o]of Object.entries(t)){const t=s in n?n[s]:null;if("string"!=typeof t){if(t&&"object"==typeof t){const e=r.#te[t.name];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ce(e.store,s))a[t]=l[t]=n;continue}if("function"==typeof t){const n=new e.Signal.Computed((()=>t(r.getters)));a[s]=l[s]={get:()=>n.get()};continue}if("function"==typeof o){const t=i.getters;i.#ae=null;const n=new e.Signal.Computed((()=>o(t)));a[s]=l[s]={get:()=>n.get()};continue}{const e=l[o];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ce(e.store,s))a[t]=l[t]=n;continue}}a[s]=l[s]={get:()=>t}}return i}setObject(e){const t=new de(this.store,this);return t.#oe=e,t}set(t,n){if(Object.keys(t).length+Object.keys(n).length===0)return this;const r=new de(this.store,this);r.#r=this.#r,r.#oe=this.#oe;const s=r.#se,o=r.#te;for(const[n,i]of Object.entries(t)){if("function"==typeof i){const t=r.getters;r.#ae=null;const a=new e.Signal.Computed((()=>i(t)));s[n]=o[n]={get:()=>a.get()};continue}const t=o[i];if(t)if(t.get&&t.store)for(const[e,r]of ce(t.store,n))s[e]=o[e]=r;else s[n]=o[n]=t}for(const[t,i]of Object.entries(n)){const n=new e.Signal.State(null);if("function"==typeof i){const e=r.settable;r.#le=null,n.set(i(e))}else if(i&&"string"==typeof i){const e=o[i];if(!e?.get)continue;n.set(e.get())}s[t]=o[t]={get:()=>n.get(),set:e=>{n.set(e)}}}return r}#ce=null;get all(){const e=this.#ce;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 fe(this.store,t),this.#ce=t,t}#le=null;get settable(){const e=this.#le;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 fe(this.store,t),this.#le=t,t}#ae=null;get getters(){const e=this.#ae;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 fe(this.store,t),this.#ae=t,t}}const he={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 pe(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in he?`${s}${he[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class ge{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}}const me={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 ye(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 be(e){return null===(e??null)?"":String(e)}function ve(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 be;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 we={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=be(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=be(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=be(e)}},events:{$value:["change",(e,t)=>t.value]}}};function xe(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watchAttr:s,props:o}=e;return e.listen("init",(({events:n})=>{const i=we[t.toLowerCase()],a=i?.attrs||{},l=i?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,o]=n;r.addEventListener(e,(e=>t(o(e,r))),s)}}if(o)for(const[t,n]of Object.entries(e.tagAttrs))if(s(t,(e=>{if(o.has(t))r[t]=e;else{const n=ye(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),o.has(t))r[t]=n;else{const e=ye(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=ye(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=ve(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let o=ye(n);null!==o&&r.setAttribute(t,o),s(t,(e=>{const n=ye(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Se(e){return null===(e??null)?"":String(e)}function Oe(e,t,n,{text:r,html:s}){if(null!=r){const s=e.insertBefore(document.createTextNode(""),t),o=n.watch(r,(e=>s.textContent=Se(e)));return()=>{s.remove(),o()}}if(null==s)return;const o=e.insertBefore(document.createComment(""),t),i=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=o.nextSibling;e&&e!==i;e=o.nextSibling)e.remove()}const c=n.watch(s,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=o.firstChild)e.insertBefore(t,i)}(Se(t))}));return()=>{c(),l(),o.remove(),i.remove()}}function Ee(e,t,n,r,s,o){let i=new Set,a=[],l=Object.create(s);for(const t of e){if("string"==typeof t)continue;const e=t.directives.template;e&&(l[e]=[t,r])}function c(e){if(!e.length||!i)return;const s=t.insertBefore(document.createComment(""),n);let a=-1,c=()=>{};i.add((()=>{c(),c=()=>{},s.remove()})),i.add(ae((()=>e.findIndex((([e])=>null===e||r.exec(e)))),(t=>{t!==a&&(a=t,c(),c=()=>{},function(t){const n=e[t]?.[1];n&&(c=o(n,l))}(a))})))}for(const r of e){if("string"==typeof r){c(a),a=[];const e=document.createTextNode(r);t.insertBefore(e,n),i.add((()=>e.remove()));continue}if(r.directives.template){c(a),a=[];continue}if(a.length&&r.directives.else){const e=r.directives.if||null;a.push([e,r]),e||(c(a),a=[]);continue}c(a),a=[];const e=r.directives.if;e?a.push([e,r]):i.add(o(r,l))}return()=>{if(!i)return;const e=i;i=null;for(const t of e)t()}}function Ce(t,n,r,s,o,i,a){s=s.set(t.aliases,t.vars);const l=t.directives.bind,c=t.directives.fragment;if(c&&"string"==typeof c){const e=o[c];if(!e)return()=>{};const[u,f]=e,d=f.params(u,t,s,l);return Ae(u,n,r,d,o,i,a)}if(!t.name||t.directives.fragment)return Oe(n,r,s,t.directives)||Ee(t.children||[],n,r,s,o,((e,t)=>Ae(e,n,r,s,t,i,a)));const u=[...i,t.name],f=a?.(u);if(a&&!f)return()=>{};const{context:d,handler:h}=function(t,n){const r="string"==typeof t?t:t.tag,{attrs:s,events:o}="string"!=typeof t&&t||{attrs:null,events:null};let i=!1;const a=new e.Signal.State(!1);let l=!1;const c=new e.Signal.State(!1),u=Object.create(null),f=Object.create(null),d=new Set,h=[],p=new ge,g={events:h,props:s?new Set(Object.entries(s).filter((([,e])=>e.isProp)).map((([e])=>e))):null,tagAttrs:f,watchAttr(e,t){if(i)return()=>{};const n=u[e];if(!n)return()=>{};let r=n.get();const s=ae((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}));return d.add(s),()=>{d.delete(s),s()}},get destroyed(){return a.get()},get init(){return c.get()},listen:(e,t)=>p.listen(e,t)},m={tag:r,set(t,n){if(s&&!(t in s))return;let r=u[t];if(r)return void r.set(n);const o=new e.Signal.State(n);u[t]=o,Object.defineProperty(f,t,{configurable:!0,enumerable:!0,get:o.get.bind(o)})},addEvent(e,t){if("function"!=typeof t)return;const[r,...s]=e.split(".").filter(Boolean),i=o?o[r].filters:{};if(!i)return;const a={},l=[];if(i)for(let e=s.shift();e;e=s.shift()){const t=e.indexOf(":"),n=t>=0?e.slice(0,t):e,r=t>=0?e.slice(t+1).split(":"):[],s=n.replace(/^-+/,""),o=(n.length-s.length)%2==1;let c=i[s]||s;switch(c){case"once":a.once=!o;break;case"passive":a.passive=!o;break;case"capture":a.capture=!o;break;default:"string"==typeof c&&(c=me[c])}"function"==typeof c&&l.push([c,r,o])}h.push([r,e=>{const r=n.all;for(const[t,n,s]of l)if(t(e,n,r)===s)return;t(e,r)},a])},destroy(){if(!i){i=!0,a.set(!0);for(const e of d)e();p.emit("destroy")}},mount(){l||(l=!0,c.set(!0),p.emit("init",{events:h}))}};return{context:g,handler:m}}(f||t.name,s),p=f?.attrs,g=p?function(e,t,n,r,s){let o=new Set;for(const[i,a]of Object.entries(r)){const r=n[i];if(i in n){if("function"!=typeof r&&"object"!=typeof r){e.set(i,r);continue}const n="function"==typeof r?r:r.name;if(a.immutable){e.set(i,t.exec(n));continue}o.add(t.watch(n,(t=>e.set(i,t))));continue}const l=a.bind;if(!s||!l){e.set(i,a.default);continue}if("string"==typeof l){const n=t.bind(s,l,(t=>e.set(i,t)));n?o.add(n):e.set(i,a.default);continue}if(!Array.isArray(l)){e.set(i,a.default);continue}const[c,u,f]=l;if(!c||"function"!=typeof u)continue;if(!f){const n=!0===s?"":s;o.add(t.watch(n,(t=>e.set(i,t)))),e.addEvent(c,((...e)=>{t.all[n]=u(...e)}));continue}const d=t.bind(s,"state",(t=>e.set(i,t)));if(!d)continue;o.add(d);const h=t.bindSet(s,"state");h&&e.addEvent(c,((...e)=>{h(u(...e))}))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(h,s,t.attrs,p,l):function(e,t,n){const r=e.tag;let s=new Set;for(const[o,i]of Object.entries(n)){if("function"!=typeof i&&"object"!=typeof i){e.set(o,i);continue}const n="function"==typeof i?i:i.name;if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==o.toLocaleLowerCase())s.add(t.watch(n,(t=>e.set(o,t))));else{const r=t.exec(n);e.set(o,r)}}return()=>{const e=s;s=new Set;for(const t of e)t()}}(h,s,t.attrs);for(const[e,n]of Object.entries(t.events)){const t=s.getEvent(n);t&&h.addEvent(e,t)}const m=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,o]of Object.entries(t.bindAll(n)||{}))"function"==typeof o&&r.add(o((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(h,s,l),y=f?"function"==typeof f.tag?f.tag(d):xe(d,f.tag,f.is):xe(d,t.name,t.is),b=Array.isArray(y)?y[0]:y,v=Array.isArray(y)?y[1]:b;n.insertBefore(b,r);const w=v?Oe(v,null,s,t.directives)||Ee(t.children||[],v,null,s,o,((e,t)=>Ae(e,v,null,s,t,i,a))):()=>{};return function(e,t,n){if(!(e instanceof Element))return()=>{};let r=new Set;for(const[s,o]of Object.entries(t))o&&(!0!==o?r.add(ae((()=>Boolean(n.exec(o))),(t=>{t?e.classList.add(s):e.classList.remove(s)}))):e.classList.add(s))}(b,t.classes,s),function(e,t,n){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};let r=new Set;for(const[s,o]of Object.entries(t))r.add(ae((()=>pe(s,n.exec(o))),(t=>{t?e.style.setProperty(s,...t):e.style.removeProperty(s)})))}(b,t.styles,s),h.mount(),()=>{b.remove(),h.destroy(),g(),w(),m()}}function Ae(t,n,r,s,o,i,a){const{directives:l}=t,c=s.child(l.value);if(!c)return()=>{};const u=c.enum(l.enum),f=(e,r)=>Ce(t,n,e,r,o,i,a);return!0===u?f(r,c):u instanceof D?function(e,t,n,r,s){const o=e.insertBefore(document.createComment(""),t);let i=new Map;function a(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const l=ae((()=>n.children),(function(t){if(!o.parentNode)return;let l=o.nextSibling;const c=i;i=new Map;for(let o of t){const t=c.get(o);if(!t){const t=e.insertBefore(document.createComment(""),l),a=e.insertBefore(document.createComment(""),l),c=s(a,r.setStore(o,n));i.set(o,[t,a,c]);continue}if(c.delete(o),i.set(o,t),l===t[0]){l=t[1].nextSibling;continue}let a=t[0];for(;a&&a!==t[1];){const t=a;a=a.nextSibling,e.insertBefore(t,l)}e.insertBefore(t[1],l)}a(c)}));return()=>{o.remove(),a(i),l()}}(n,r,u,c,f):u instanceof V?function(e,t,n,r,s){const o=[];for(const[e,i]of[...n])o.push(s(t,r.setStore(i,n)));return()=>{for(const e of o)e()}}(0,r,u,c,f):"function"==typeof u?function(t,n,r,s,o){const i=new e.Signal.Computed((()=>{const e=r();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t,t])):Object.entries(e).map((([e,t],n)=>[t,n,e])):[]})),a=t.insertBefore(document.createComment(""),n);let l=[];function c(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const u=ae((()=>i.get()),(function(n){if(!a.parentNode)return;let r=a.nextSibling;const i=l;l=[];for(const[a,c,u]of n){const n=i.findIndex((e=>e[3]===u)),[f]=n>=0?i.splice(n,1):[];if(!f){const n=t.insertBefore(document.createComment(""),r),i=t.insertBefore(document.createComment(""),r),f=new e.Signal.State(a),d=new e.Signal.State(c),h=o(i,s.setObject({get key(){return u},get value(){return f.get()},get index(){return d.get()}}));l.push([n,i,h,u,f,d]);continue}if(l.push(f),f[4].set(a),f[5].set(c),r===f[0]){r=f[1].nextSibling;continue}let d=f[0];for(;d&&d!==f[1];){const e=d;d=d.nextSibling,t.insertBefore(e,r)}t.insertBefore(f[1],r)}c(i)}));return()=>{a.remove(),c(l),u()}}(n,r,u,c,f):()=>{}}e.Layout=re,e.Store=R,e.render=function(e,t,n,r,s){const o=[r,s],i=o.find((e=>"function"==typeof e)),a=o.find((e=>"object"==typeof e)),l=new de(e,a),c=Object.create(null);return Ee(t,n,null,l,c,((e,t)=>Ae(e,n,null,l,t,[],i)))}}));
|
|
60
|
+
function(e){const t=Object.create(N);t.value=e;const n=()=>(h(t),t.value);return n[u]=t,n}(r),l=a[u];if(this[k]=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 $.call(this[k])}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");T(this[k],t)}};c=k,p=new WeakSet,e.isComputed=e=>r(p,e),e.Computed=class{constructor(t,r){s(this,p),n(this,c);const o=function(e){const t=Object.create(A);t.computation=e;const n=()=>S(t);return n[u]=t,n}(t),i=o[u];if(i.consumerAllowSignalWrites=!0,this[k]=i,i.wrapper=this,r){const t=r.equals;t&&(i.equal=t),i.watched=r[e.subtle.watched],i.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[k])}},(t=>{var i,l,c,u;t.untrack=function(e){let t,n=null;try{n=f(null),t=e()}finally{f(n)}return t},t.introspectSources=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(n=t[k].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[k].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[k].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[k].producerNode;return!!n&&n.length>0};i=k,l=new WeakSet,c=new WeakSet,u=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>r(l,e),t.Watcher=class{constructor(e){s(this,l),s(this,c),n(this,i);let t=Object.create(d);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[k]=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[k];n.dirty=!1;const r=f(n);for(const e of t)h(e[k]);f(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[k];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[k].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 M=(t,n,r,s)=>{const o=new e.Signal.State("boolean"==typeof n?n:null);let i;if("function"==typeof r)i=new e.Signal.Computed((()=>Boolean(r(t,t.root))));else{const t=Boolean(r);i=new e.Signal.Computed((()=>t))}const a=()=>{const e=o.get();return null===e?i.get():e},l=s?new e.Signal.Computed((()=>s.get()||a())):new e.Signal.Computed(a);return[o,l]},L=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,U=Boolean;function q(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(q).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const P=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(q).filter(U);return t.length?t:null};function B(t,n,r,s){const o=new e.Signal.State(n(r));let i;if("function"==typeof s){const r=s;i=new e.Signal.Computed((()=>n(r(t,t.root))))}else{const t=n(s);i=new e.Signal.Computed((()=>t))}const a=new e.Signal.Computed((()=>{const e=o.get();return null===e?i.get():e}));return[o,a]}class R{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}static create(e,t={}){return new V({type:e},{...t,parent:null})}#t=!1;get null(){return this.#t}get kind(){return""}constructor(t,{null:n,state:r,setValue:s,setState:o,convert:i,onUpdate:a,onUpdateState:l,index:c,length:u,new:f,parent:d,hidden:h,clearable:p,required:g,disabled:m,readonly:y,label:b,description:v,placeholder:w,min:x,max:S,step:O,values:E}){this.schema=t,this.#n.set("object"==typeof r&&r||{});const C=d instanceof R?d:null;C&&(this.#r=C,this.#s=C.#s),this.#o=t.type,this.#i=t.meta,this.#a=t.component;const A=new e.Signal.State(Boolean(f));this.#l=A;const j=C?new e.Signal.Computed((()=>C.#c.get()||A.get())):new e.Signal.Computed((()=>A.get()));this.#c=j;const $=Boolean(t.immutable),T=!1!==t.creatable;this.#u=$,this.#f=T;const N=t.readonly,k=new e.Signal.State("boolean"==typeof y?y:null);let U;if("function"==typeof N)U=new e.Signal.Computed((()=>Boolean(N(this,this.root))));else{const t=Boolean(N);U=new e.Signal.Computed((()=>t))}const q=()=>{if(j.get()?!T:$)return!0;const e=k.get();return null===e?U.get():e},V=C?C.#d:null;if(this.#h=k,this.#d=V?new e.Signal.Computed((()=>V.get()||q())):new e.Signal.Computed(q),[this.#p,this.#g]=M(this,h,t.hidden,C?C.#g:null),[this.#m,this.#y]=M(this,p,t.clearable,C?C.#y:null),[this.#b,this.#v]=M(this,g,t.required,C?C.#v:null),[this.#w,this.#x]=M(this,m,t.disabled,C?C.#x:null),[this.#S,this.#O]=B(this,L,b,t.label),[this.#E,this.#C]=B(this,L,v,t.description),[this.#A,this.#j]=B(this,L,w,t.placeholder),[this.#$,this.#T]=B(this,I,x,t.min),[this.#N,this.#k]=B(this,I,S,t.max),[this.#M,this.#L]=B(this,I,O,t.step),[this.#I,this.#U]=B(this,P,E,t.values),u instanceof e.Signal.State||u instanceof e.Signal.Computed?this.#q=u:this.#q=new e.Signal.State(u||0),n)this.#t=!0;else{this.#P=a||null,this.#B=l||null,this.#R="function"==typeof s?s:null,this.#V="function"==typeof o?o:null,this.#D="function"==typeof i?i:null,this.#W.set(c??"");for(const[e,n]of Object.entries(t.events||{}))"function"==typeof n&&this.listen(e,n)}}#_=!1;#R=null;#V=null;#D=null;#P=null;#B=null;#r=null;#s=this;#o;#i;#a;get store(){return this}get parent(){return this.#r}get root(){return this.#s}get type(){return this.#o}get meta(){return this.#i}get component(){return this.#a}#q;get length(){return this.#q.get()}#W=new e.Signal.State("");get index(){return this.#W.get()}set index(e){this.#W.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#f=!0;get creatable(){return this.#f}#u=!1;get immutable(){return this.#u}#c;#l;get selfNew(){return this.#l.get()}set selfNew(e){this.#l.set(Boolean(e))}get new(){return this.#c.get()}set new(e){this.#l.set(Boolean(e))}#p;#g;get selfHidden(){return this.#p.get()}set selfHidden(e){this.#p.set("boolean"==typeof e?e:null)}get hidden(){return this.#g.get()}set hidden(e){this.#p.set("boolean"==typeof e?e:null)}#m;#y;get selfClearable(){return this.#m.get()}set selfClearable(e){this.#m.set("boolean"==typeof e?e:null)}get clearable(){return this.#y.get()}set clearable(e){this.#m.set("boolean"==typeof e?e:null)}#b;#v;get selfRequired(){return this.#b.get()}set selfRequired(e){this.#b.set("boolean"==typeof e?e:null)}get required(){return this.#v.get()}set required(e){this.#b.set("boolean"==typeof e?e:null)}#w;#x;get selfDisabled(){return this.#w.get()}set selfDisabled(e){this.#w.set("boolean"==typeof e?e:null)}get disabled(){return this.#x.get()}set disabled(e){this.#w.set("boolean"==typeof e?e:null)}#h;#d;get selfReadonly(){return this.#h.get()}set selfReadonly(e){this.#h.set("boolean"==typeof e?e:null)}get readonly(){return this.#d.get()}set readonly(e){this.#h.set("boolean"==typeof e?e:null)}#S;#O;get selfLabel(){return this.#S.get()}set selfLabel(e){this.#S.set(L(e))}get label(){return this.#O.get()}set label(e){this.#S.set(L(e))}#E;#C;get selfDescription(){return this.#E.get()}set selfDescription(e){this.#E.set(L(e))}get description(){return this.#C.get()}set description(e){this.#E.set(L(e))}#A;#j;get selfPlaceholder(){return this.#A.get()}set selfPlaceholder(e){this.#A.set(L(e))}get placeholder(){return this.#j.get()}set placeholder(e){this.#A.set(L(e))}#$;#T;get selfMin(){return this.#$.get()}set selfMin(e){this.#$.set(I(e))}get min(){return this.#T.get()}set min(e){this.#$.set(I(e))}#N;#k;get selfMax(){return this.#N.get()}set selfMax(e){this.#N.set(I(e))}get max(){return this.#k.get()}set max(e){this.#N.set(I(e))}#M;#L;get selfStep(){return this.#M.get()}set selfStep(e){this.#M.set(I(e))}get step(){return this.#L.get()}set step(e){this.#M.set(I(e))}#I;#U;get selfValues(){return this.#I.get()}set selfValues(e){this.#I.set(P(e))}get values(){return this.#U.get()}set values(e){this.#I.set(P(e))}*[Symbol.iterator](){}child(e){return null}#K=!1;#H=null;#Y=this.#H;#z=new e.Signal.State(this.#H);#n=new e.Signal.State(null);#F=this.#n.get();get changed(){return this.#z.get()===this.#Y}get saved(){return this.#z.get()===this.#H}get value(){return this.#z.get()}set value(e){if(this.#_)return;const t=this.#R?.(e)||e;this.#z.set(t),this.#K||(this.#K=!0,this.#H=e),this.#P?.(this.#z.get(),this.#W.get()),this.#G()}get state(){return this.#n.get()}set state(e){if(this.#_)return;const t=this.#V?.(e)||e;this.#n.set(t),this.#K=!0,this.#B?.(this.#n.get(),this.#W.get()),this.#G()}#G(){this.#Q||(this.#Q=!0,queueMicrotask((()=>{const e=this.#z.get(),t=this.#n.get();return this.#Z(e,t)})))}#Q=!1;#X(e,t){if(this.#_)return e;const[n,r]=this.#D?.(e,t)||[e,t];return this.#z.get()===n&&this.#n.get()===r?[n,r]:(this.#z.set(n),this.#n.set(r),this.#K||(this.#K=!0,this.#H=n),this.#Z(n,r))}#Z(e,t){if(this.#_)return[e,t];if(this.#Q=!1,e&&"object"==typeof e){let n=Array.isArray(e)?[...e]:{...e},r=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},s=!1;for(const[o,i]of this){const a=e[o],l=t?.[o],[c,u]=i.#X(a,l);a!==c&&(n[o]=c,s=!0),l!==u&&(r[o]=u,s=!0)}s&&(e=n,t=r,this.#z.set(e),this.#n.set(r))}return this.#Y===e&&this.#F===t||(this.#Y=e,this.#F=t),[e,t]}get destroyed(){return this.#_}destroy(){if(!this.#_){this.#_=!0;for(const[,e]of this)e.destroy()}}}class V extends R{get kind(){return"object"}#J;*[Symbol.iterator](){yield*Object.entries(this.#J)}child(e){return this.#J[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o}={}){const i=Object.entries(e.type);super(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o,length:i.length,setValue:e=>"object"!=typeof e?{}:e,setState:e=>"object"!=typeof e?{}:e,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const a=Object.create(null),l={parent:this,onUpdate:(e,t)=>{this.value={...this.value,[t]:e}},onUpdateState:(e,t)=>{this.state={...this.state,[t]:e}}};for(const[e,t]of i){let n;n="string"==typeof t.type?t.array?new D(t,{...l,index:e}):new R(t,{...l,index:e}):t.array?new D(t,{...l,index:e}):new V(t,{...l,index:e}),a[e]=n}this.#J=a}}class D extends R{#ee=()=>{throw new Error};#J;get children(){return[...this.#J.get()]}*[Symbol.iterator](){return yield*[...this.#J.get().entries()]}child(e){const t=this.#J.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(t,{parent:n,onUpdate:r,onUpdateState:s,index:o,new:i}={}){const a=new e.Signal.State([]),l=e=>{if(this.destroyed)return;const t=Array.isArray(e)&&e.length||0,n=[...a.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#ee(e));for(const e of n.splice(t))e.destroy();r!==t&&a.set(n)};super(t,{index:o,new:i,parent:n,length:new e.Signal.Computed((()=>a.get().length)),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 l(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t)=>{l(e),r?.(e,t)},onUpdateState:s}),this.#J=a;const c={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 t.type)this.#ee=(e,n)=>{const r=new R(t,{...c,index:e,new:n});return r.index=e,r};else{if(!t.type||"object"!=typeof t.type||Array.isArray(t.type))throw new Error;this.#ee=(e,n)=>{const r=new V(t,{...c,index:e,new:n});return r.index=e,r}}}insert(e,t,n){if(this.destroyed)return!1;const r=this.value;if(!Array.isArray(r))return!1;const s=[...this.#J.get()],o=Math.max(0,Math.min(Math.floor(e),s.length)),i=this.#ee(o,n);i.new=!0,s.splice(o,0,i);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(o,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(o,0,{}),this.state=e}return this.value=a,this.#J.set(s),!0}add(e){return this.insert(this.#J.get().length,e)}remove(e){if(this.destroyed)return;const t=this.value;if(!Array.isArray(t))return;const n=[...this.#J.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;s.destroy();const o=[...t],[i]=o.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.value=o,this.#J.set(n),i}move(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#J.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let o=Math.min(e,t),i=Math.max(e,t);for(let e=o;e<=i;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.value=a,this.#J.set(r),!0}exchange(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#J.get()],s=r[e],o=r[t];if(!s||!o)return!1;r[t]=s,r[e]=o,s.index=t,o.index=e;const i=[...n],a=i[e],l=i[t];i[t]=a,i[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.value=i,this.#J.set(r),!0}}const W={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class _ extends Error{constructor(e,...t){const n=W[e];super("function"==typeof n?n(...t):n),this.code=e}}const K=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,H=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function Y(e,t,n){const{attrs:r,directives:s,events:o,classes:i,styles:a,vars:l,aliases:c,params:u}=e;return function(e,f){const d=K.exec(e.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"))?.groups;if(!d)throw new _("ATTR",e);const{name:h}=d,p=d.decorator?.toLowerCase();if(p){if(":"===p)r[h]=H.test(f)?{name:f}:t(f);else if("."===p)i[h]=!f||(H.test(f)?f:t(f));else if("style:"===p)a[h]=H.test(f)?f:t(f);else if("@"===p)o[h]=H.test(f)?f:n(f);else if("+"===p)l[h]=f?H.test(f)?f:t(f):"";else if("*"===p)c[h]=H.test(f)?f:t(f);else if("?"===p)u[h]=H.test(f)?f:t(f);else if("!"===p){const e=h.toString();switch(e){case"fragment":s.fragment=f||!0;break;case"else":s.else=!0;break;case"enum":s.enum=!f||(H.test(f)?f:t(f));break;case"if":case"text":case"html":s[e]=H.test(f)?f:t(f);break;case"template":s.template=f;break;case"bind":s.bind=f||!0;break;case"value":s.value=f;break;case"comment":s.comment=f}}}else r[h]=f}}function z(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),params:Object.create(null)}}var F={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 G=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function Q(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function Z(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function X(...e){console.error(new _(...e))}function J(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in F?F[t]:(X("ENTITY",e),e)}function ee(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function*te(e,t=0){const{attrs:n,events:r,directives:s,children:o,is:i,name:a,params:l,classes:c,styles:u,aliases:f,vars:d}=e,h=t>0?"".padEnd(t,"\t"):"";yield h,yield*["<",a||"-"],i&&(yield*["|",i]);for(const[e,t]of Object.entries(l)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" ?",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}for(const[e,t]of Object.entries(s)){if(!1===t||null==t)continue;const n="function"==typeof t?String(t):t;yield*[" !",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}for(const[e,t]of Object.entries(f)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" *",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}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,ee),'"'])}for(const[e,t]of Object.entries(n)){if(null==t)continue;if("string"==typeof t){yield*[" ",e],t&&(yield*['="',t.replace(/[<&"]/g,ee),'"']);continue}const n="function"==typeof t?String(t):"object"==typeof t?t.name:t;n&&"string"==typeof n&&(yield*[" :",e,'="',n.replace(/[<&"]/g,ee)||"",'"'])}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,ee),'"'])}for(const[e,t]of Object.entries(c)){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,ee),'"'])}for(const[e,t]of Object.entries(u)){if(null==t)continue;const n="function"==typeof t?String(t):t;n&&"string"==typeof n&&(yield*[" style:",e,'="',n.replace(/[<&"]/g,ee),'"'])}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,ee).replace(/]]>/g,"]]>")],yield*["</",a,">"],void(t>=0&&(yield"\n"))}yield">",t>=0&&(yield"\n"),yield*ne(o,t>=0?t+1:-1),yield*[h,"</",a,">"],t>=0&&(yield"\n")}function*ne(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,ee).replace(/]]>/g,"]]>");n&&(e=e.replace(/(?<=^|\n)/g,n)),yield e,t>=0&&(yield"\n")}else yield*te(r,t)}var re=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new _("CALC")},createEvent:n=()=>{throw new _("EVENT")},simpleTag:r=new Set}={}){const s=[],o={children:s},i=[];let a=null,l=o;function c(){a=i.pop()||null,l=a||o}function u(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&l.children.push(e)}let f={},d=0;function h(t){if(t<=d)return;u(e.substring(d,t).replace(/&#?\w+;/g,J)),d=t}for(;;){const p=e.indexOf("<",d);if(p<0){const E=e.substring(d);E.match(/^\s*$/)||u(E);break}if(p>d&&h(p),"/"===e.charAt(p+1)){d=e.indexOf(">",p+3);let C=e.substring(p+2,d);if(d<0?(C=e.substring(p+2).replace(/[\s<].*/,""),X("UNCOMPLETED",C,a?.name),d=p+1+C.length):C.match(/\s</)&&(C=C.replace(/[\s<].*/,""),X("UNCOMPLETED",C),d=p+1+C.length),a){const A=a.name;if(A===C)c();else{if(A.toLowerCase()!=C.toLowerCase())throw new _("CLOSE",C,a.name);c()}}d++;continue}function g(t){let n=d+1;if(d=e.indexOf(t,n),d<0)throw new _("QUOTE",t);const r=e.slice(n,d).replace(/&#?\w+;/g,J);return d++,r}function m(){let t=e.charAt(d);for(;t<=" "||""===t;t=e.charAt(++d));return t}function y(){let t=d,n=e.charAt(d);for(;Q(n);)d++,n=e.charAt(d);return e.slice(t,d)}d=p+1;let b=e.charAt(d);switch(b){case"=":throw new _("EQUAL");case'"':case"'":throw new _("ATTR_VALUE");case">":case"/":throw new _("SYMBOL",b);case"":throw new _("EOF")}const v=y(),w=G.exec(v)?.groups;if(!w)throw new _("TAG",v);i.push(a),a=z(w.name,w.is),l.children.push(a),l=a;const x=Y(a,t,n);let S=!0,O=!1;e:for(;S;){let j=m();switch(j){case"":X("EOF"),d++;break e;case">":d++;break e;case"/":O=!0;break e;case'"':case"'":throw new _("ATTR_VALUE");case"=":throw new _("SYMBOL",j)}const $=y();if(!$){X("EOF"),d++;break e}switch(j=m(),j){case"":X("EOF"),d++;break e;case">":x($,""),d++;break e;case"/":x($,""),O=!0;break e;case"=":d++;break;case"'":case'"':x($,g(j));continue;default:x($,"");continue}switch(j=m(),j){case"":x($,""),X("EOF"),d++;break e;case">":x($,""),d++;break e;case"/":x($,""),O=!0;break e;case"'":case'"':x($,g(j));continue}x($,y())}if(O){for(;;){d++;const T=e.charAt(d);if("/"!==T&&!(T<=" "||""===T))break}switch(e.charAt(d)){case"=":throw new _("EQUAL");case'"':case"'":throw new _("ATTR_VALUE");case"":X("EOF");break;case">":d++;break;default:throw new _("CLOSE_SYMBOL")}c()}else(r.has(v)||Z(e,d,v,f))&&c()}return s},stringify:function(e,t){const n=t?0:-1;return Array.isArray(e)?[...ne(e,n)].join(""):[te(e,n)].join()}});let se=!0;const oe=new e.Signal.subtle.Watcher((()=>{se&&(se=!1,queueMicrotask(ie))}));function ie(){se=!0;for(const e of oe.getPending())e.get();oe.watch()}function ae(t,n){let r,s=!1;const o=new e.Signal.Computed((()=>{const e=t();s&&Object.is(e,r)||(r=e,s=!0,n(e))}));return oe.watch(o),o.get(),()=>{oe.unwatch(o)}}const le=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,values:!0,null:!0,index:!0,no:!0,length:!0}));function*ce(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of le)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],e instanceof D&&(yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}])}function ue(e,t,n){for(const[n,r]of t){for(const[t,s]of ce(r,n))e[t]=s;for(const[t,s]of ce(r,n,"$$"))e[t]=s}}function fe(e){if(!e)return!1;const t=e.indexOf("$");return t<0||(e.indexOf("$",t+2)>0||"$"===e[0]&&"_$".includes(e[1]))}function de(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class he{exec(e){if("string"==typeof e){const t=this.#te[e];if("function"!=typeof t?.get)return;return t.get()}if("function"==typeof e)return e(this.getters)}watch(e,t){return ae((()=>this.exec(e)),t)}enum(e){if(!e)return!0;if(!0===e)return this.store;if("function"==typeof e)return()=>e(this.getters);if("string"!=typeof e)return null;const t=this.#te[e];if("function"!=typeof t?.get)return null;const n=t.store;return n instanceof R?n:t.get}bind(e,t,n){const r=this.#te[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?le.has(t)?ae((()=>s[t]),n):void 0:"value"===t?ae((()=>r.get()),n):void 0}bindAll(e){const t=this.#te[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>ae(e,t)}}return Object.fromEntries([...le].map((e=>[`$${e}`,t=>ae((()=>n[e]),t)])))}bindSet(e,t){const n=this.#te[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#te[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)}}}getEvent(e){if("function"==typeof e)return e;const t=this.#te[e];if(!t)return null;const{exec:n,calc:r}=t;return"function"==typeof n?n:"function"==typeof r?r:null}constructor(e,t){if(this.store=e,t instanceof he){this.#ne=t.#ne;const e=this.#re;for(const[n,r]of Object.entries(t.#re))e[n]=r;const n=this.#se;for(const[e,r]of Object.entries(t.#se))n[e]=r}else ue(this.#re,e),this.#ne=function(e){const t=Object.create(null);if(!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!fe(n))continue;if(!r||"object"!=typeof r)continue;if(r instanceof R){for(const[e,s]of ce(r,n))t[e]=s;continue}const{get:e,set:s,exec:o,calc:i}=r;"function"!=typeof e?"function"!=typeof i?"function"!=typeof o||(t[n]={exec:o}):t[n]={calc:i}:t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#ne;#re=Object.create(null);#se=Object.create(null);store;#oe=null;#r=null;#ie=null;get#te(){const e=this.#ie;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#re,...this.#ne,...this.#se})),n=this.store,r=this.#r,s=this.#oe;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};else{for(const[e,r]of ce(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof D))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]=s}return this.#ie=t,t}setStore(e,t){const n=new he(e,this);return t&&(n.#r=t),ue(n.#re,e),n}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new he(t,this);return ue(n.#re,t),n}params({params:t},{attrs:n},r,s){let o=this.store;if(!0===s)o=r.store;else if(s){const e=r.#te[s],t=e?.get&&e.store;t&&(o=t)}if(0===Object.keys(t).length)return this;const i=new he(o,this);i.#r=this.#r,i.#oe=this.#oe;const a=i.#se,l=i.#te;for(const[s,o]of Object.entries(t)){const t=s in n?n[s]:null;if("string"!=typeof t){if(t&&"object"==typeof t){const e=r.#te[t.name];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ce(e.store,s))a[t]=l[t]=n;continue}if("function"==typeof t){const n=new e.Signal.Computed((()=>t(r.getters)));a[s]=l[s]={get:()=>n.get()};continue}if("function"==typeof o){const t=i.getters;i.#ae=null;const n=new e.Signal.Computed((()=>o(t)));a[s]=l[s]={get:()=>n.get()};continue}{const e=l[o];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ce(e.store,s))a[t]=l[t]=n;continue}}a[s]=l[s]={get:()=>t}}return i}setObject(e){const t=new he(this.store,this);return t.#oe=e,t}set(t,n){if(Object.keys(t).length+Object.keys(n).length===0)return this;const r=new he(this.store,this);r.#r=this.#r,r.#oe=this.#oe;const s=r.#se,o=r.#te;for(const[n,i]of Object.entries(t)){if("function"==typeof i){const t=r.getters;r.#ae=null;const a=new e.Signal.Computed((()=>i(t)));s[n]=o[n]={get:()=>a.get()};continue}const t=o[i];if(t)if(t.get&&t.store)for(const[e,r]of ce(t.store,n))s[e]=o[e]=r;else s[n]=o[n]=t}for(const[t,i]of Object.entries(n)){const n=new e.Signal.State(null);if("function"==typeof i){const e=r.settable;r.#le=null,n.set(i(e))}else if(i&&"string"==typeof i){const e=o[i];if(!e?.get)continue;n.set(e.get())}s[t]=o[t]={get:()=>n.get(),set:e=>{n.set(e)}}}return r}#ce=null;get all(){const e=this.#ce;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 de(this.store,t),this.#ce=t,t}#le=null;get settable(){const e=this.#le;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 de(this.store,t),this.#le=t,t}#ae=null;get getters(){const e=this.#ae;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 de(this.store,t),this.#ae=t,t}}const pe={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 ge(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in pe?`${s}${pe[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class me{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}}const ye={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 be(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 ve(e){return null===(e??null)?"":String(e)}function we(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 ve;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 xe={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=ve(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ve(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ve(e)}},events:{$value:["change",(e,t)=>t.value]}}};function Se(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watchAttr:s,props:o}=e;return e.listen("init",(({events:n})=>{const i=xe[t.toLowerCase()],a=i?.attrs||{},l=i?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,o]=n;r.addEventListener(e,(e=>t(o(e,r))),s)}}if(o)for(const[t,n]of Object.entries(e.tagAttrs))if(s(t,(e=>{if(o.has(t))r[t]=e;else{const n=be(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),o.has(t))r[t]=n;else{const e=be(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=be(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=we(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let o=be(n);null!==o&&r.setAttribute(t,o),s(t,(e=>{const n=be(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Oe(e){return null===(e??null)?"":String(e)}function Ee(e,t,n,{text:r,html:s}){if(null!=r){const s=e.insertBefore(document.createTextNode(""),t),o=n.watch(r,(e=>s.textContent=Oe(e)));return()=>{s.remove(),o()}}if(null==s)return;const o=e.insertBefore(document.createComment(""),t),i=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=o.nextSibling;e&&e!==i;e=o.nextSibling)e.remove()}const c=n.watch(s,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=o.firstChild)e.insertBefore(t,i)}(Oe(t))}));return()=>{c(),l(),o.remove(),i.remove()}}function Ce(e,t,n,r,s,o){let i=new Set,a=[],l=Object.create(s);for(const t of e){if("string"==typeof t)continue;const e=t.directives.template;e&&(l[e]=[t,r])}function c(e){if(!e.length||!i)return;const s=t.insertBefore(document.createComment(""),n);let a=-1,c=()=>{};i.add((()=>{c(),c=()=>{},s.remove()})),i.add(ae((()=>e.findIndex((([e])=>null===e||r.exec(e)))),(t=>{t!==a&&(a=t,c(),c=()=>{},function(t){const n=e[t]?.[1];n&&(c=o(n,l))}(a))})))}for(const r of e){if("string"==typeof r){c(a),a=[];const e=document.createTextNode(r);t.insertBefore(e,n),i.add((()=>e.remove()));continue}if(r.directives.template){c(a),a=[];continue}if(a.length&&r.directives.else){const e=r.directives.if||null;a.push([e,r]),e||(c(a),a=[]);continue}c(a),a=[];const e=r.directives.if;e?a.push([e,r]):i.add(o(r,l))}return()=>{if(!i)return;const e=i;i=null;for(const t of e)t()}}function Ae(t,n,r,s,o,i,a){s=s.set(t.aliases,t.vars);const l=t.directives.bind,c=t.directives.fragment;if(c&&"string"==typeof c){const e=o[c];if(!e)return()=>{};const[u,f]=e,d=f.params(u,t,s,l);return je(u,n,r,d,o,i,a)}if(!t.name||t.directives.fragment)return Ee(n,r,s,t.directives)||Ce(t.children||[],n,r,s,o,((e,t)=>je(e,n,r,s,t,i,a)));const u=[...i,t.name],f=a?.(u);if(a&&!f)return()=>{};const{context:d,handler:h}=function(t,n){const r="string"==typeof t?t:t.tag,{attrs:s,events:o}="string"!=typeof t&&t||{attrs:null,events:null};let i=!1;const a=new e.Signal.State(!1);let l=!1;const c=new e.Signal.State(!1),u=Object.create(null),f=Object.create(null),d=new Set,h=[],p=new me,g={events:h,props:s?new Set(Object.entries(s).filter((([,e])=>e.isProp)).map((([e])=>e))):null,tagAttrs:f,watchAttr(e,t){if(i)return()=>{};const n=u[e];if(!n)return()=>{};let r=n.get();const s=ae((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}));return d.add(s),()=>{d.delete(s),s()}},get destroyed(){return a.get()},get init(){return c.get()},listen:(e,t)=>p.listen(e,t)},m={tag:r,set(t,n){if(s&&!(t in s))return;let r=u[t];if(r)return void r.set(n);const o=new e.Signal.State(n);u[t]=o,Object.defineProperty(f,t,{configurable:!0,enumerable:!0,get:o.get.bind(o)})},addEvent(e,t){if("function"!=typeof t)return;const[r,...s]=e.split(".").filter(Boolean),i=o?o[r].filters:{};if(!i)return;const a={},l=[];if(i)for(let e=s.shift();e;e=s.shift()){const t=e.indexOf(":"),n=t>=0?e.slice(0,t):e,r=t>=0?e.slice(t+1).split(":"):[],s=n.replace(/^-+/,""),o=(n.length-s.length)%2==1;let c=i[s]||s;switch(c){case"once":a.once=!o;break;case"passive":a.passive=!o;break;case"capture":a.capture=!o;break;default:"string"==typeof c&&(c=ye[c])}"function"==typeof c&&l.push([c,r,o])}h.push([r,e=>{const r=n.all;for(const[t,n,s]of l)if(t(e,n,r)===s)return;t(e,r)},a])},destroy(){if(!i){i=!0,a.set(!0);for(const e of d)e();p.emit("destroy")}},mount(){l||(l=!0,c.set(!0),p.emit("init",{events:h}))}};return{context:g,handler:m}}(f||t.name,s),p=f?.attrs,g=p?function(e,t,n,r,s){let o=new Set;for(const[i,a]of Object.entries(r)){const r=n[i];if(i in n){if("function"!=typeof r&&"object"!=typeof r){e.set(i,r);continue}const n="function"==typeof r?r:r.name;if(a.immutable){e.set(i,t.exec(n));continue}o.add(t.watch(n,(t=>e.set(i,t))));continue}const l=a.bind;if(!s||!l){e.set(i,a.default);continue}if("string"==typeof l){const n=t.bind(s,l,(t=>e.set(i,t)));n?o.add(n):e.set(i,a.default);continue}if(!Array.isArray(l)){e.set(i,a.default);continue}const[c,u,f]=l;if(!c||"function"!=typeof u)continue;if(!f){const n=!0===s?"":s;o.add(t.watch(n,(t=>e.set(i,t)))),e.addEvent(c,((...e)=>{t.all[n]=u(...e)}));continue}const d=t.bind(s,"state",(t=>e.set(i,t)));if(!d)continue;o.add(d);const h=t.bindSet(s,"state");h&&e.addEvent(c,((...e)=>{h(u(...e))}))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(h,s,t.attrs,p,l):function(e,t,n){const r=e.tag;let s=new Set;for(const[o,i]of Object.entries(n)){if("function"!=typeof i&&"object"!=typeof i){e.set(o,i);continue}const n="function"==typeof i?i:i.name;if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==o.toLocaleLowerCase())s.add(t.watch(n,(t=>e.set(o,t))));else{const r=t.exec(n);e.set(o,r)}}return()=>{const e=s;s=new Set;for(const t of e)t()}}(h,s,t.attrs);for(const[e,n]of Object.entries(t.events)){const t=s.getEvent(n);t&&h.addEvent(e,t)}const m=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,o]of Object.entries(t.bindAll(n)||{}))"function"==typeof o&&r.add(o((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(h,s,l),y=f?"function"==typeof f.tag?f.tag(d):Se(d,f.tag,f.is):Se(d,t.name,t.is),b=Array.isArray(y)?y[0]:y,v=Array.isArray(y)?y[1]:b;n.insertBefore(b,r);const w=v?Ee(v,null,s,t.directives)||Ce(t.children||[],v,null,s,o,((e,t)=>je(e,v,null,s,t,i,a))):()=>{};return function(e,t,n){if(!(e instanceof Element))return()=>{};let r=new Set;for(const[s,o]of Object.entries(t))o&&(!0!==o?r.add(ae((()=>Boolean(n.exec(o))),(t=>{t?e.classList.add(s):e.classList.remove(s)}))):e.classList.add(s))}(b,t.classes,s),function(e,t,n){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};let r=new Set;for(const[s,o]of Object.entries(t))r.add(ae((()=>ge(s,n.exec(o))),(t=>{t?e.style.setProperty(s,...t):e.style.removeProperty(s)})))}(b,t.styles,s),h.mount(),()=>{b.remove(),h.destroy(),g(),w(),m()}}function je(t,n,r,s,o,i,a){const{directives:l}=t,c=s.child(l.value);if(!c)return()=>{};const u=c.enum(l.enum),f=(e,r)=>Ae(t,n,e,r,o,i,a);return!0===u?f(r,c):u instanceof D?function(e,t,n,r,s){const o=e.insertBefore(document.createComment(""),t);let i=new Map;function a(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const l=ae((()=>n.children),(function(t){if(!o.parentNode)return;let l=o.nextSibling;const c=i;i=new Map;for(let o of t){const t=c.get(o);if(!t){const t=e.insertBefore(document.createComment(""),l),a=e.insertBefore(document.createComment(""),l),c=s(a,r.setStore(o,n));i.set(o,[t,a,c]);continue}if(c.delete(o),i.set(o,t),l===t[0]){l=t[1].nextSibling;continue}let a=t[0];for(;a&&a!==t[1];){const t=a;a=a.nextSibling,e.insertBefore(t,l)}e.insertBefore(t[1],l)}a(c)}));return()=>{o.remove(),a(i),l()}}(n,r,u,c,f):u instanceof V?function(e,t,n,r,s){const o=[];for(const[e,i]of[...n])o.push(s(t,r.setStore(i,n)));return()=>{for(const e of o)e()}}(0,r,u,c,f):"function"==typeof u?function(t,n,r,s,o){const i=new e.Signal.Computed((()=>{const e=r();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t,t])):Object.entries(e).map((([e,t],n)=>[t,n,e])):[]})),a=t.insertBefore(document.createComment(""),n);let l=[];function c(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const u=ae((()=>i.get()),(function(n){if(!a.parentNode)return;let r=a.nextSibling;const i=l;l=[];for(const[a,c,u]of n){const n=i.findIndex((e=>e[3]===u)),[f]=n>=0?i.splice(n,1):[];if(!f){const n=t.insertBefore(document.createComment(""),r),i=t.insertBefore(document.createComment(""),r),f=new e.Signal.State(a),d=new e.Signal.State(c),h=o(i,s.setObject({get key(){return u},get value(){return f.get()},get index(){return d.get()}}));l.push([n,i,h,u,f,d]);continue}if(l.push(f),f[4].set(a),f[5].set(c),r===f[0]){r=f[1].nextSibling;continue}let d=f[0];for(;d&&d!==f[1];){const e=d;d=d.nextSibling,t.insertBefore(e,r)}t.insertBefore(f[1],r)}c(i)}));return()=>{a.remove(),c(l),u()}}(n,r,u,c,f):()=>{}}e.Layout=re,e.Store=R,e.render=function(e,t,n,r,s){const o=[r,s],i=o.find((e=>"function"==typeof e)),a=o.find((e=>"object"==typeof e)),l=new he(e,a),c=Object.create(null);return Ce(t,n,null,l,c,((e,t)=>je(e,n,null,l,t,[],i)))}}));
|
package/index.min.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.6.0
|
|
3
3
|
* (c) 2024-2025 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
@@ -57,4 +57,4 @@ function(){throw new Error};function j(){return d(this),this.value}function $(e,
|
|
|
57
57
|
* Use of this source code is governed by an MIT-style license that can be
|
|
58
58
|
* found in the LICENSE file at https://angular.io/license
|
|
59
59
|
*/
|
|
60
|
-
function(e){const t=Object.create(T);t.value=e;const n=()=>(d(t),t.value);return n[c]=t,n}(n),a=i[c];if(this[N]=a,a.wrapper=this,s){const t=s.equals;t&&(a.equal=t),a.watched=s[e.subtle.watched],a.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return j.call(this[N])}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");$(this[N],t)}};h=N,p=new WeakSet,e.isComputed=e=>n(p,e),e.Computed=class{constructor(n,s){r(this,p),t(this,h);const o=function(e){const t=Object.create(C);t.computation=e;const n=()=>x(t);return n[c]=t,n}(n),i=o[c];if(i.consumerAllowSignalWrites=!0,this[N]=i,i.wrapper=this,s){const t=s.equals;t&&(i.equal=t),i.watched=s[e.subtle.watched],i.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return x(this[N])}},(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[N].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[N].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[N].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[N].producerNode;return!!n&&n.length>0};a=N,l=new WeakSet,c=new WeakSet,h=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>n(l,e),o.Watcher=class{constructor(e){r(this,l),r(this,c),t(this,a);let n=Object.create(f);n.wrapper=this,n.consumerMarkedDirty=e,n.consumerIsAlwaysLive=!0,n.consumerAllowSignalWrites=!1,n.producerNode=[],this[N]=n}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[N];n.dirty=!1;const r=u(n);for(const e of t)d(e[N]);u(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[N];v(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){y(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[N].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},o.currentComputed=function(){var e;return null==(e=i)?void 0:e.wrapper},o.watched=Symbol("watched"),o.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(k||(k={}));const M=(e,t,n,r)=>{const s=new k.State("boolean"==typeof t?t:null);let o;if("function"==typeof n)o=new k.Computed((()=>Boolean(n(e,e.root))));else{const e=Boolean(n);o=new k.Computed((()=>e))}const i=()=>{const e=s.get();return null===e?o.get():e},a=r?new k.Computed((()=>r.get()||i())):new k.Computed(i);return[s,a]},L=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,U=Boolean;function q(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(q).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const P=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(q).filter(U);return t.length?t:null};function B(e,t,n,r){const s=new k.State(t(n));let o;if("function"==typeof r){const n=r;o=new k.Computed((()=>t(n(e,e.root))))}else{const e=t(r);o=new k.Computed((()=>e))}const i=new k.Computed((()=>{const e=s.get();return null===e?o.get():e}));return[s,i]}class R{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}static create(e,t={}){return new V({type:e},{...t,parent:null})}#t=!1;get null(){return this.#t}get kind(){return""}constructor(e,{null:t,state:n,setValue:r,setState:s,convert:o,onUpdate:i,onUpdateState:a,index:l,length:c,new:u,parent:f,hidden:d,clearable:h,required:p,disabled:g,readonly:m,label:y,description:b,placeholder:v,min:w,max:x,step:S,values:O}){this.schema=e,this.#n.set("object"==typeof n&&n||{});const E=f instanceof R?f:null;E&&(this.#r=E,this.#s=E.#s),this.#o=e.type,this.#i=e.meta,this.#a=e.component;const C=new k.State(Boolean(u));this.#l=C;const A=E?new k.Computed((()=>E.#c.get()||C.get())):new k.Computed((()=>C.get()));this.#c=A;const j=Boolean(e.immutable),$=!1!==e.creatable;this.#u=j,this.#f=$;const T=e.readonly,N=new k.State("boolean"==typeof m?m:null);let U;if("function"==typeof T)U=new k.Computed((()=>Boolean(T(this,this.root))));else{const e=Boolean(T);U=new k.Computed((()=>e))}const q=()=>{if(A.get()?!$:j)return!0;const e=N.get();return null===e?U.get():e},V=E?E.#d:null;if(this.#h=N,this.#d=V?new k.Computed((()=>V.get()||q())):new k.Computed(q),[this.#p,this.#g]=M(this,d,e.hidden,E?E.#g:null),[this.#m,this.#y]=M(this,h,e.clearable,E?E.#y:null),[this.#b,this.#v]=M(this,p,e.required,E?E.#v:null),[this.#w,this.#x]=M(this,g,e.disabled,E?E.#x:null),[this.#S,this.#O]=B(this,L,y,e.label),[this.#E,this.#C]=B(this,L,b,e.description),[this.#A,this.#j]=B(this,L,v,e.placeholder),[this.#$,this.#T]=B(this,I,w,e.min),[this.#N,this.#k]=B(this,I,x,e.max),[this.#M,this.#L]=B(this,I,S,e.step),[this.#I,this.#U]=B(this,P,O,e.values),t)this.#t=!0;else{this.#q=i||null,this.#P=a||null,this.#B="function"==typeof r?r:null,this.#R="function"==typeof s?s:null,this.#V="function"==typeof o?o:null,this.#D.set(c||0),this.#W.set(l??"");for(const[t,n]of Object.entries(e.events||{}))"function"==typeof n&&this.listen(t,n)}}#_=!1;#B=null;#R=null;#V=null;#q=null;#P=null;#r=null;#s=this;#o;#i;#a;get store(){return this}get parent(){return this.#r}get root(){return this.#s}get type(){return this.#o}get meta(){return this.#i}get component(){return this.#a}#D=new k.State(0);get length(){return this.#D.get()}set length(e){this.#D.set(e)}#W=new k.State("");get index(){return this.#W.get()}set index(e){this.#W.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#f=!0;get creatable(){return this.#f}#u=!1;get immutable(){return this.#u}#c;#l;get selfNew(){return this.#l.get()}set selfNew(e){this.#l.set(Boolean(e))}get new(){return this.#c.get()}set new(e){this.#l.set(Boolean(e))}#p;#g;get selfHidden(){return this.#p.get()}set selfHidden(e){this.#p.set("boolean"==typeof e?e:null)}get hidden(){return this.#g.get()}set hidden(e){this.#p.set("boolean"==typeof e?e:null)}#m;#y;get selfClearable(){return this.#m.get()}set selfClearable(e){this.#m.set("boolean"==typeof e?e:null)}get clearable(){return this.#y.get()}set clearable(e){this.#m.set("boolean"==typeof e?e:null)}#b;#v;get selfRequired(){return this.#b.get()}set selfRequired(e){this.#b.set("boolean"==typeof e?e:null)}get required(){return this.#v.get()}set required(e){this.#b.set("boolean"==typeof e?e:null)}#w;#x;get selfDisabled(){return this.#w.get()}set selfDisabled(e){this.#w.set("boolean"==typeof e?e:null)}get disabled(){return this.#x.get()}set disabled(e){this.#w.set("boolean"==typeof e?e:null)}#h;#d;get selfReadonly(){return this.#h.get()}set selfReadonly(e){this.#h.set("boolean"==typeof e?e:null)}get readonly(){return this.#d.get()}set readonly(e){this.#h.set("boolean"==typeof e?e:null)}#S;#O;get selfLabel(){return this.#S.get()}set selfLabel(e){this.#S.set(L(e))}get label(){return this.#O.get()}set label(e){this.#S.set(L(e))}#E;#C;get selfDescription(){return this.#E.get()}set selfDescription(e){this.#E.set(L(e))}get description(){return this.#C.get()}set description(e){this.#E.set(L(e))}#A;#j;get selfPlaceholder(){return this.#A.get()}set selfPlaceholder(e){this.#A.set(L(e))}get placeholder(){return this.#j.get()}set placeholder(e){this.#A.set(L(e))}#$;#T;get selfMin(){return this.#$.get()}set selfMin(e){this.#$.set(I(e))}get min(){return this.#T.get()}set min(e){this.#$.set(I(e))}#N;#k;get selfMax(){return this.#N.get()}set selfMax(e){this.#N.set(I(e))}get max(){return this.#k.get()}set max(e){this.#N.set(I(e))}#M;#L;get selfStep(){return this.#M.get()}set selfStep(e){this.#M.set(I(e))}get step(){return this.#L.get()}set step(e){this.#M.set(I(e))}#I;#U;get selfValues(){return this.#I.get()}set selfValues(e){this.#I.set(P(e))}get values(){return this.#U.get()}set values(e){this.#I.set(P(e))}*[Symbol.iterator](){}child(e){return null}#K=!1;#H=null;#z=this.#H;#Y=new k.State(this.#H);#n=new k.State(null);#F=this.#n.get();get changed(){return this.#Y.get()===this.#z}get saved(){return this.#Y.get()===this.#H}get value(){return this.#Y.get()}set value(e){if(this.#_)return;const t=this.#B?.(e)||e;this.#Y.set(t),this.#K||(this.#K=!0,this.#H=e),this.#q?.(this.#Y.get(),this.#W.get()),this.#G()}get state(){return this.#n.get()}set state(e){if(this.#_)return;const t=this.#R?.(e)||e;this.#n.set(t),this.#K=!0,this.#P?.(this.#n.get(),this.#W.get()),this.#G()}#G(){this.#Q||(this.#Q=!0,queueMicrotask((()=>{const e=this.#Y.get(),t=this.#n.get();return this.#Z(e,t)})))}#Q=!1;#X(e,t){if(this.#_)return e;const[n,r]=this.#V?.(e,t)||[e,t];return this.#Y.get()===n&&this.#n.get()===r?[n,r]:(this.#Y.set(n),this.#n.set(r),this.#K||(this.#K=!0,this.#H=n),this.#Z(n,r))}#Z(e,t){if(this.#_)return[e,t];if(this.#Q=!1,e&&"object"==typeof e){let n=Array.isArray(e)?[...e]:{...e},r=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},s=!1;for(const[o,i]of this){const a=e[o],l=t?.[o],[c,u]=i.#X(a,l);a!==c&&(n[o]=c,s=!0),l!==u&&(r[o]=u,s=!0)}s&&(e=n,t=r,this.#Y.set(e),this.#n.set(r))}return this.#z===e&&this.#F===t||(this.#z=e,this.#F=t),[e,t]}get destroyed(){return this.#_}destroy(){if(!this.#_){this.#_=!0;for(const[,e]of this)e.destroy()}}}class V extends R{get kind(){return"object"}#J;*[Symbol.iterator](){yield*Object.entries(this.#J)}child(e){return this.#J[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o}={}){super(e,{parent:t,index:n,new:r,onUpdate:s,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 i=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.type)){let e;e="string"==typeof n.type?n.array?new D(n,{...a,index:t}):new R(n,{...a,index:t}):n.array?new D(n,{...a,index:t}):new V(n,{...a,index:t}),i[t]=e}this.#J=i}}class D extends R{#ee=()=>{throw new Error};#J=new k.State([]);get children(){return[...this.#J.get()]}*[Symbol.iterator](){return yield*[...this.#J.get().entries()]}child(e){const t=this.#J.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(e,{parent:t,onUpdate:n,onUpdateState:r,index:s,new:o}={}){const i=e=>{if(this.destroyed)return;const t=Array.isArray(e)&&e.length||0,n=[...this.#J.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#ee(e));for(const e of n.splice(t))e.destroy();r!==t&&(this.length=n.length,this.#J.set(n))};super(e,{index:s,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 i(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t)=>{i(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.#ee=(t,n)=>{const r=new R(e,{...a,index:t,new:n});return r.index=t,r};else{if(!e.type||"object"!=typeof e.type||Array.isArray(e.type))throw new Error;this.#ee=(t,n)=>{const r=new V(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 s=[...this.#J.get()],o=Math.max(0,Math.min(Math.floor(e),s.length)),i=this.#ee(o,n);i.new=!0,s.splice(o,0,i);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(o,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(o,0,{}),this.state=e}return this.value=a,this.length=s.length,this.#J.set(s),!0}add(e){return this.insert(this.#J.get().length,e)}remove(e){if(this.destroyed)return;const t=this.value;if(!Array.isArray(t))return;const n=[...this.#J.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;s.destroy();const o=[...t],[i]=o.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.value=o,this.length=n.length,this.#J.set(n),i}move(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#J.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let o=Math.min(e,t),i=Math.max(e,t);for(let e=o;e<=i;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.value=a,this.#J.set(r),!0}exchange(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#J.get()],s=r[e],o=r[t];if(!s||!o)return!1;r[t]=s,r[e]=o,s.index=t,o.index=e;const i=[...n],a=i[e],l=i[t];i[t]=a,i[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.value=i,this.#J.set(r),!0}}const W={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class _ extends Error{constructor(e,...t){const n=W[e];super("function"==typeof n?n(...t):n),this.code=e}}const K=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,H=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function z(e,t,n){const{attrs:r,directives:s,events:o,classes:i,styles:a,vars:l,aliases:c,params:u}=e;return function(e,f){const d=K.exec(e.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"))?.groups;if(!d)throw new _("ATTR",e);const{name:h}=d,p=d.decorator?.toLowerCase();if(p){if(":"===p)r[h]=H.test(f)?{name:f}:t(f);else if("."===p)i[h]=!f||(H.test(f)?f:t(f));else if("style:"===p)a[h]=H.test(f)?f:t(f);else if("@"===p)o[h]=H.test(f)?f:n(f);else if("+"===p)l[h]=f?H.test(f)?f:t(f):"";else if("*"===p)c[h]=H.test(f)?f:t(f);else if("?"===p)u[h]=H.test(f)?f:t(f);else if("!"===p){const e=h.toString();switch(e){case"fragment":s.fragment=f||!0;break;case"else":s.else=!0;break;case"enum":s.enum=!f||(H.test(f)?f:t(f));break;case"if":case"text":case"html":s[e]=H.test(f)?f:t(f);break;case"template":s.template=f;break;case"bind":s.bind=f||!0;break;case"value":s.value=f;break;case"comment":s.comment=f}}}else r[h]=f}}function Y(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),params:Object.create(null)}}var F={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 G=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function Q(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function Z(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function X(...e){console.error(new _(...e))}function J(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in F?F[t]:(X("ENTITY",e),e)}function ee(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function*te(e,t=0){const{attrs:n,events:r,directives:s,children:o,is:i,name:a,params:l,classes:c,styles:u,aliases:f,vars:d}=e,h=t>0?"".padEnd(t,"\t"):"";yield h,yield*["<",a||"-"],i&&(yield*["|",i]);for(const[e,t]of Object.entries(l)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" ?",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}for(const[e,t]of Object.entries(s)){if(!1===t||null==t)continue;const n="function"==typeof t?String(t):t;yield*[" !",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}for(const[e,t]of Object.entries(f)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" *",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}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,ee),'"'])}for(const[e,t]of Object.entries(n)){if(null==t)continue;if("string"==typeof t){yield*[" ",e],t&&(yield*['="',t.replace(/[<&"]/g,ee),'"']);continue}const n="function"==typeof t?String(t):"object"==typeof t?t.name:t;n&&"string"==typeof n&&(yield*[" :",e,'="',n.replace(/[<&"]/g,ee)||"",'"'])}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,ee),'"'])}for(const[e,t]of Object.entries(c)){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,ee),'"'])}for(const[e,t]of Object.entries(u)){if(null==t)continue;const n="function"==typeof t?String(t):t;n&&"string"==typeof n&&(yield*[" style:",e,'="',n.replace(/[<&"]/g,ee),'"'])}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,ee).replace(/]]>/g,"]]>")],yield*["</",a,">"],void(t>=0&&(yield"\n"))}yield">",t>=0&&(yield"\n"),yield*ne(o,t>=0?t+1:-1),yield*[h,"</",a,">"],t>=0&&(yield"\n")}function*ne(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,ee).replace(/]]>/g,"]]>");n&&(e=e.replace(/(?<=^|\n)/g,n)),yield e,t>=0&&(yield"\n")}else yield*te(r,t)}var re=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new _("CALC")},createEvent:n=()=>{throw new _("EVENT")},simpleTag:r=new Set}={}){const s=[],o={children:s},i=[];let a=null,l=o;function c(){a=i.pop()||null,l=a||o}function u(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&l.children.push(e)}let f={},d=0;function h(t){if(t<=d)return;u(e.substring(d,t).replace(/&#?\w+;/g,J)),d=t}for(;;){const p=e.indexOf("<",d);if(p<0){const E=e.substring(d);E.match(/^\s*$/)||u(E);break}if(p>d&&h(p),"/"===e.charAt(p+1)){d=e.indexOf(">",p+3);let C=e.substring(p+2,d);if(d<0?(C=e.substring(p+2).replace(/[\s<].*/,""),X("UNCOMPLETED",C,a?.name),d=p+1+C.length):C.match(/\s</)&&(C=C.replace(/[\s<].*/,""),X("UNCOMPLETED",C),d=p+1+C.length),a){const A=a.name;if(A===C)c();else{if(A.toLowerCase()!=C.toLowerCase())throw new _("CLOSE",C,a.name);c()}}d++;continue}function g(t){let n=d+1;if(d=e.indexOf(t,n),d<0)throw new _("QUOTE",t);const r=e.slice(n,d).replace(/&#?\w+;/g,J);return d++,r}function m(){let t=e.charAt(d);for(;t<=" "||""===t;t=e.charAt(++d));return t}function y(){let t=d,n=e.charAt(d);for(;Q(n);)d++,n=e.charAt(d);return e.slice(t,d)}d=p+1;let b=e.charAt(d);switch(b){case"=":throw new _("EQUAL");case'"':case"'":throw new _("ATTR_VALUE");case">":case"/":throw new _("SYMBOL",b);case"":throw new _("EOF")}const v=y(),w=G.exec(v)?.groups;if(!w)throw new _("TAG",v);i.push(a),a=Y(w.name,w.is),l.children.push(a),l=a;const x=z(a,t,n);let S=!0,O=!1;e:for(;S;){let j=m();switch(j){case"":X("EOF"),d++;break e;case">":d++;break e;case"/":O=!0;break e;case'"':case"'":throw new _("ATTR_VALUE");case"=":throw new _("SYMBOL",j)}const $=y();if(!$){X("EOF"),d++;break e}switch(j=m(),j){case"":X("EOF"),d++;break e;case">":x($,""),d++;break e;case"/":x($,""),O=!0;break e;case"=":d++;break;case"'":case'"':x($,g(j));continue;default:x($,"");continue}switch(j=m(),j){case"":x($,""),X("EOF"),d++;break e;case">":x($,""),d++;break e;case"/":x($,""),O=!0;break e;case"'":case'"':x($,g(j));continue}x($,y())}if(O){for(;;){d++;const T=e.charAt(d);if("/"!==T&&!(T<=" "||""===T))break}switch(e.charAt(d)){case"=":throw new _("EQUAL");case'"':case"'":throw new _("ATTR_VALUE");case"":X("EOF");break;case">":d++;break;default:throw new _("CLOSE_SYMBOL")}c()}else(r.has(v)||Z(e,d,v,f))&&c()}return s},stringify:function(e,t){const n=t?0:-1;return Array.isArray(e)?[...ne(e,n)].join(""):[te(e,n)].join()}});let se=!0;const oe=new k.subtle.Watcher((()=>{se&&(se=!1,queueMicrotask(ie))}));function ie(){se=!0;for(const e of oe.getPending())e.get();oe.watch()}function ae(e,t){let n,r=!1;const s=new k.Computed((()=>{const s=e();r&&Object.is(s,n)||(n=s,r=!0,t(s))}));return oe.watch(s),s.get(),()=>{oe.unwatch(s)}}const le=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,values:!0,null:!0,index:!0,no:!0,length:!0}));function*ce(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of le)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],e instanceof D&&(yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}])}function ue(e,t,n){for(const[n,r]of t){for(const[t,s]of ce(r,n))e[t]=s;for(const[t,s]of ce(r,n,"$$"))e[t]=s}}function fe(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class de{exec(e){if("string"==typeof e){const t=this.#te[e];if("function"!=typeof t?.get)return;return t.get()}if("function"==typeof e)return e(this.getters)}watch(e,t){return ae((()=>this.exec(e)),t)}enum(e){if(!e)return!0;if(!0===e)return this.store;if("function"==typeof e)return()=>e(this.getters);if("string"!=typeof e)return null;const t=this.#te[e];if("function"!=typeof t?.get)return null;const n=t.store;return n instanceof R?n:t.get}bind(e,t,n){const r=this.#te[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?le.has(t)?ae((()=>s[t]),n):void 0:"value"===t?ae((()=>r.get()),n):void 0}bindAll(e){const t=this.#te[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>ae(e,t)}}return Object.fromEntries([...le].map((e=>[`$${e}`,t=>ae((()=>n[e]),t)])))}bindSet(e,t){const n=this.#te[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#te[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)}}}getEvent(e){if("function"==typeof e)return e;const t=this.#te[e];if(!t)return null;const{exec:n,calc:r}=t;return"function"==typeof n?n:"function"==typeof r?r:null}constructor(e,t){if(this.store=e,t instanceof de){this.#ne=t.#ne;const e=this.#re;for(const[n,r]of Object.entries(t.#re))e[n]=r;const n=this.#se;for(const[e,r]of Object.entries(t.#se))n[e]=r}else ue(this.#re,e),this.#ne=function(e){const t=Object.create(null);if(t.$$size={calc:e=>e?Array.isArray(e)?e.length:e instanceof Map||e instanceof Set?e.size:Object.keys(e).length:0},!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!n||n.includes("$"))continue;if(!r||"object"!=typeof r)continue;if(r instanceof R){for(const[e,s]of ce(r,n))t[e]=s;continue}const{get:e,set:s,exec:o,calc:i}=r;"function"!=typeof e?"function"!=typeof i?"function"!=typeof o||(t[n]={exec:o}):t[n]={calc:i}:t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#ne;#re=Object.create(null);#se=Object.create(null);store;#oe=null;#r=null;#ie=null;get#te(){const e=this.#ie;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#re,...this.#ne,...this.#se})),n=this.store,r=this.#r,s=this.#oe;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};else{for(const[e,r]of ce(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof D))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]=s}return this.#ie=t,t}setStore(e,t){const n=new de(e,this);return t&&(n.#r=t),ue(n.#re,e),n}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new de(t,this);return ue(n.#re,t),n}params({params:e},{attrs:t},n,r){let s=this.store;if(!0===r)s=n.store;else if(r){const e=n.#te[r],t=e?.get&&e.store;t&&(s=t)}if(0===Object.keys(e).length)return this;const o=new de(s,this);o.#r=this.#r,o.#oe=this.#oe;const i=o.#se,a=o.#te;for(const[r,s]of Object.entries(e)){const e=r in t?t[r]:null;if("string"!=typeof e){if(e&&"object"==typeof e){const t=n.#te[e.name];if(!t?.get)continue;if(!t.store){i[r]=a[r]=t;continue}for(const[e,n]of ce(t.store,r))i[e]=a[e]=n;continue}if("function"==typeof e){const t=new k.Computed((()=>e(n.getters)));i[r]=a[r]={get:()=>t.get()};continue}if("function"==typeof s){const e=o.getters;o.#ae=null;const t=new k.Computed((()=>s(e)));i[r]=a[r]={get:()=>t.get()};continue}{const e=a[s];if(!e?.get)continue;if(!e.store){i[r]=a[r]=e;continue}for(const[t,n]of ce(e.store,r))i[t]=a[t]=n;continue}}i[r]=a[r]={get:()=>e}}return o}setObject(e){const t=new de(this.store,this);return t.#oe=e,t}set(e,t){if(Object.keys(e).length+Object.keys(t).length===0)return this;const n=new de(this.store,this);n.#r=this.#r,n.#oe=this.#oe;const r=n.#se,s=n.#te;for(const[t,o]of Object.entries(e)){if("function"==typeof o){const e=n.getters;n.#ae=null;const i=new k.Computed((()=>o(e)));r[t]=s[t]={get:()=>i.get()};continue}const e=s[o];if(e)if(e.get&&e.store)for(const[n,o]of ce(e.store,t))r[n]=s[n]=o;else r[t]=s[t]=e}for(const[e,o]of Object.entries(t)){const t=new k.State(null);if("function"==typeof o){const e=n.settable;n.#le=null,t.set(o(e))}else if(o&&"string"==typeof o){const e=s[o];if(!e?.get)continue;t.set(e.get())}r[e]=s[e]={get:()=>t.get(),set:e=>{t.set(e)}}}return n}#ce=null;get all(){const e=this.#ce;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 fe(this.store,t),this.#ce=t,t}#le=null;get settable(){const e=this.#le;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 fe(this.store,t),this.#le=t,t}#ae=null;get getters(){const e=this.#ae;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 fe(this.store,t),this.#ae=t,t}}const he={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 pe(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in he?`${s}${he[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class ge{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}}const me={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 ye(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 be(e){return null===(e??null)?"":String(e)}function ve(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 be;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 we={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=be(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=be(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=be(e)}},events:{$value:["change",(e,t)=>t.value]}}};function xe(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watchAttr:s,props:o}=e;return e.listen("init",(({events:n})=>{const i=we[t.toLowerCase()],a=i?.attrs||{},l=i?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,o]=n;r.addEventListener(e,(e=>t(o(e,r))),s)}}if(o)for(const[t,n]of Object.entries(e.tagAttrs))if(s(t,(e=>{if(o.has(t))r[t]=e;else{const n=ye(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),o.has(t))r[t]=n;else{const e=ye(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=ye(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=ve(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let o=ye(n);null!==o&&r.setAttribute(t,o),s(t,(e=>{const n=ye(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Se(e){return null===(e??null)?"":String(e)}function Oe(e,t,n,{text:r,html:s}){if(null!=r){const s=e.insertBefore(document.createTextNode(""),t),o=n.watch(r,(e=>s.textContent=Se(e)));return()=>{s.remove(),o()}}if(null==s)return;const o=e.insertBefore(document.createComment(""),t),i=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=o.nextSibling;e&&e!==i;e=o.nextSibling)e.remove()}const c=n.watch(s,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=o.firstChild)e.insertBefore(t,i)}(Se(t))}));return()=>{c(),l(),o.remove(),i.remove()}}function Ee(e,t,n,r,s,o){let i=new Set,a=[],l=Object.create(s);for(const t of e){if("string"==typeof t)continue;const e=t.directives.template;e&&(l[e]=[t,r])}function c(e){if(!e.length||!i)return;const s=t.insertBefore(document.createComment(""),n);let a=-1,c=()=>{};i.add((()=>{c(),c=()=>{},s.remove()})),i.add(ae((()=>e.findIndex((([e])=>null===e||r.exec(e)))),(t=>{t!==a&&(a=t,c(),c=()=>{},function(t){const n=e[t]?.[1];n&&(c=o(n,l))}(a))})))}for(const r of e){if("string"==typeof r){c(a),a=[];const e=document.createTextNode(r);t.insertBefore(e,n),i.add((()=>e.remove()));continue}if(r.directives.template){c(a),a=[];continue}if(a.length&&r.directives.else){const e=r.directives.if||null;a.push([e,r]),e||(c(a),a=[]);continue}c(a),a=[];const e=r.directives.if;e?a.push([e,r]):i.add(o(r,l))}return()=>{if(!i)return;const e=i;i=null;for(const t of e)t()}}function Ce(e,t,n,r,s,o,i){r=r.set(e.aliases,e.vars);const a=e.directives.bind,l=e.directives.fragment;if(l&&"string"==typeof l){const c=s[l];if(!c)return()=>{};const[u,f]=c,d=f.params(u,e,r,a);return Ae(u,t,n,d,s,o,i)}if(!e.name||e.directives.fragment)return Oe(t,n,r,e.directives)||Ee(e.children||[],t,n,r,s,((e,s)=>Ae(e,t,n,r,s,o,i)));const c=[...o,e.name],u=i?.(c);if(i&&!u)return()=>{};const{context:f,handler:d}=function(e,t){const n="string"==typeof e?e:e.tag,{attrs:r,events:s}="string"!=typeof e&&e||{attrs:null,events:null};let o=!1;const i=new k.State(!1);let a=!1;const l=new k.State(!1),c=Object.create(null),u=Object.create(null),f=new Set,d=[],h=new ge,p={events:d,props:r?new Set(Object.entries(r).filter((([,e])=>e.isProp)).map((([e])=>e))):null,tagAttrs:u,watchAttr(e,t){if(o)return()=>{};const n=c[e];if(!n)return()=>{};let r=n.get();const s=ae((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}));return f.add(s),()=>{f.delete(s),s()}},get destroyed(){return i.get()},get init(){return l.get()},listen:(e,t)=>h.listen(e,t)},g={tag:n,set(e,t){if(r&&!(e in r))return;let n=c[e];if(n)return void n.set(t);const s=new k.State(t);c[e]=s,Object.defineProperty(u,e,{configurable:!0,enumerable:!0,get:s.get.bind(s)})},addEvent(e,n){if("function"!=typeof n)return;const[r,...o]=e.split(".").filter(Boolean),i=s?s[r].filters:{};if(!i)return;const a={},l=[];if(i)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(":"):[],s=n.replace(/^-+/,""),o=(n.length-s.length)%2==1;let c=i[s]||s;switch(c){case"once":a.once=!o;break;case"passive":a.passive=!o;break;case"capture":a.capture=!o;break;default:"string"==typeof c&&(c=me[c])}"function"==typeof c&&l.push([c,r,o])}d.push([r,e=>{const r=t.all;for(const[t,n,s]of l)if(t(e,n,r)===s)return;n(e,r)},a])},destroy(){if(!o){o=!0,i.set(!0);for(const e of f)e();h.emit("destroy")}},mount(){a||(a=!0,l.set(!0),h.emit("init",{events:d}))}};return{context:p,handler:g}}(u||e.name,r),h=u?.attrs,p=h?function(e,t,n,r,s){let o=new Set;for(const[i,a]of Object.entries(r)){const r=n[i];if(i in n){if("function"!=typeof r&&"object"!=typeof r){e.set(i,r);continue}const n="function"==typeof r?r:r.name;if(a.immutable){e.set(i,t.exec(n));continue}o.add(t.watch(n,(t=>e.set(i,t))));continue}const l=a.bind;if(!s||!l){e.set(i,a.default);continue}if("string"==typeof l){const n=t.bind(s,l,(t=>e.set(i,t)));n?o.add(n):e.set(i,a.default);continue}if(!Array.isArray(l)){e.set(i,a.default);continue}const[c,u,f]=l;if(!c||"function"!=typeof u)continue;if(!f){const n=!0===s?"":s;o.add(t.watch(n,(t=>e.set(i,t)))),e.addEvent(c,((...e)=>{t.all[n]=u(...e)}));continue}const d=t.bind(s,"state",(t=>e.set(i,t)));if(!d)continue;o.add(d);const h=t.bindSet(s,"state");h&&e.addEvent(c,((...e)=>{h(u(...e))}))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(d,r,e.attrs,h,a):function(e,t,n){const r=e.tag;let s=new Set;for(const[o,i]of Object.entries(n)){if("function"!=typeof i&&"object"!=typeof i){e.set(o,i);continue}const n="function"==typeof i?i:i.name;if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==o.toLocaleLowerCase())s.add(t.watch(n,(t=>e.set(o,t))));else{const r=t.exec(n);e.set(o,r)}}return()=>{const e=s;s=new Set;for(const t of e)t()}}(d,r,e.attrs);for(const[t,n]of Object.entries(e.events)){const e=r.getEvent(n);e&&d.addEvent(t,e)}const g=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,o]of Object.entries(t.bindAll(n)||{}))"function"==typeof o&&r.add(o((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(d,r,a),m=u?"function"==typeof u.tag?u.tag(f):xe(f,u.tag,u.is):xe(f,e.name,e.is),y=Array.isArray(m)?m[0]:m,b=Array.isArray(m)?m[1]:y;t.insertBefore(y,n);const v=b?Oe(b,null,r,e.directives)||Ee(e.children||[],b,null,r,s,((e,t)=>Ae(e,b,null,r,t,o,i))):()=>{};return function(e,t,n){if(!(e instanceof Element))return()=>{};let r=new Set;for(const[s,o]of Object.entries(t))o&&(!0!==o?r.add(ae((()=>Boolean(n.exec(o))),(t=>{t?e.classList.add(s):e.classList.remove(s)}))):e.classList.add(s))}(y,e.classes,r),function(e,t,n){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};let r=new Set;for(const[s,o]of Object.entries(t))r.add(ae((()=>pe(s,n.exec(o))),(t=>{t?e.style.setProperty(s,...t):e.style.removeProperty(s)})))}(y,e.styles,r),d.mount(),()=>{y.remove(),d.destroy(),p(),v(),g()}}function Ae(e,t,n,r,s,o,i){const{directives:a}=e,l=r.child(a.value);if(!l)return()=>{};const c=l.enum(a.enum),u=(n,r)=>Ce(e,t,n,r,s,o,i);return!0===c?u(n,l):c instanceof D?function(e,t,n,r,s){const o=e.insertBefore(document.createComment(""),t);let i=new Map;function a(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const l=ae((()=>n.children),(function(t){if(!o.parentNode)return;let l=o.nextSibling;const c=i;i=new Map;for(let o of t){const t=c.get(o);if(!t){const t=e.insertBefore(document.createComment(""),l),a=e.insertBefore(document.createComment(""),l),c=s(a,r.setStore(o,n));i.set(o,[t,a,c]);continue}if(c.delete(o),i.set(o,t),l===t[0]){l=t[1].nextSibling;continue}let a=t[0];for(;a&&a!==t[1];){const t=a;a=a.nextSibling,e.insertBefore(t,l)}e.insertBefore(t[1],l)}a(c)}));return()=>{o.remove(),a(i),l()}}(t,n,c,l,u):c instanceof V?function(e,t,n,r,s){const o=[];for(const[e,i]of[...n])o.push(s(t,r.setStore(i,n)));return()=>{for(const e of o)e()}}(0,n,c,l,u):"function"==typeof c?function(e,t,n,r,s){const o=new k.Computed((()=>{const e=n();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t,t])):Object.entries(e).map((([e,t],n)=>[t,n,e])):[]})),i=e.insertBefore(document.createComment(""),t);let a=[];function l(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const c=ae((()=>o.get()),(function(t){if(!i.parentNode)return;let n=i.nextSibling;const o=a;a=[];for(const[i,l,c]of t){const t=o.findIndex((e=>e[3]===c)),[u]=t>=0?o.splice(t,1):[];if(!u){const t=e.insertBefore(document.createComment(""),n),o=e.insertBefore(document.createComment(""),n),u=new k.State(i),f=new k.State(l),d=s(o,r.setObject({get key(){return c},get value(){return u.get()},get index(){return f.get()}}));a.push([t,o,d,c,u,f]);continue}if(a.push(u),u[4].set(i),u[5].set(l),n===u[0]){n=u[1].nextSibling;continue}let f=u[0];for(;f&&f!==u[1];){const t=f;f=f.nextSibling,e.insertBefore(t,n)}e.insertBefore(u[1],n)}l(o)}));return()=>{i.remove(),l(a),c()}}(t,n,c,l,u):()=>{}}function je(e,t,n,r,s){const o=[r,s],i=o.find((e=>"function"==typeof e)),a=o.find((e=>"object"==typeof e)),l=new de(e,a),c=Object.create(null);return Ee(t,n,null,l,c,((e,t)=>Ae(e,n,null,l,t,[],i)))}export{re as Layout,k as Signal,R as Store,je as render};
|
|
60
|
+
function(e){const t=Object.create(T);t.value=e;const n=()=>(d(t),t.value);return n[c]=t,n}(n),a=i[c];if(this[N]=a,a.wrapper=this,s){const t=s.equals;t&&(a.equal=t),a.watched=s[e.subtle.watched],a.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return j.call(this[N])}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");$(this[N],t)}};h=N,p=new WeakSet,e.isComputed=e=>n(p,e),e.Computed=class{constructor(n,s){r(this,p),t(this,h);const o=function(e){const t=Object.create(C);t.computation=e;const n=()=>x(t);return n[c]=t,n}(n),i=o[c];if(i.consumerAllowSignalWrites=!0,this[N]=i,i.wrapper=this,s){const t=s.equals;t&&(i.equal=t),i.watched=s[e.subtle.watched],i.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return x(this[N])}},(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[N].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[N].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[N].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[N].producerNode;return!!n&&n.length>0};a=N,l=new WeakSet,c=new WeakSet,h=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>n(l,e),o.Watcher=class{constructor(e){r(this,l),r(this,c),t(this,a);let n=Object.create(f);n.wrapper=this,n.consumerMarkedDirty=e,n.consumerIsAlwaysLive=!0,n.consumerAllowSignalWrites=!1,n.producerNode=[],this[N]=n}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[N];n.dirty=!1;const r=u(n);for(const e of t)d(e[N]);u(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[N];v(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){y(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[N].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},o.currentComputed=function(){var e;return null==(e=i)?void 0:e.wrapper},o.watched=Symbol("watched"),o.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(k||(k={}));const M=(e,t,n,r)=>{const s=new k.State("boolean"==typeof t?t:null);let o;if("function"==typeof n)o=new k.Computed((()=>Boolean(n(e,e.root))));else{const e=Boolean(n);o=new k.Computed((()=>e))}const i=()=>{const e=s.get();return null===e?o.get():e},a=r?new k.Computed((()=>r.get()||i())):new k.Computed(i);return[s,a]},L=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,U=Boolean;function q(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(q).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const P=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(q).filter(U);return t.length?t:null};function B(e,t,n,r){const s=new k.State(t(n));let o;if("function"==typeof r){const n=r;o=new k.Computed((()=>t(n(e,e.root))))}else{const e=t(r);o=new k.Computed((()=>e))}const i=new k.Computed((()=>{const e=s.get();return null===e?o.get():e}));return[s,i]}class R{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}static create(e,t={}){return new V({type:e},{...t,parent:null})}#t=!1;get null(){return this.#t}get kind(){return""}constructor(e,{null:t,state:n,setValue:r,setState:s,convert:o,onUpdate:i,onUpdateState:a,index:l,length:c,new:u,parent:f,hidden:d,clearable:h,required:p,disabled:g,readonly:m,label:y,description:b,placeholder:v,min:w,max:x,step:S,values:O}){this.schema=e,this.#n.set("object"==typeof n&&n||{});const E=f instanceof R?f:null;E&&(this.#r=E,this.#s=E.#s),this.#o=e.type,this.#i=e.meta,this.#a=e.component;const C=new k.State(Boolean(u));this.#l=C;const A=E?new k.Computed((()=>E.#c.get()||C.get())):new k.Computed((()=>C.get()));this.#c=A;const j=Boolean(e.immutable),$=!1!==e.creatable;this.#u=j,this.#f=$;const T=e.readonly,N=new k.State("boolean"==typeof m?m:null);let U;if("function"==typeof T)U=new k.Computed((()=>Boolean(T(this,this.root))));else{const e=Boolean(T);U=new k.Computed((()=>e))}const q=()=>{if(A.get()?!$:j)return!0;const e=N.get();return null===e?U.get():e},V=E?E.#d:null;if(this.#h=N,this.#d=V?new k.Computed((()=>V.get()||q())):new k.Computed(q),[this.#p,this.#g]=M(this,d,e.hidden,E?E.#g:null),[this.#m,this.#y]=M(this,h,e.clearable,E?E.#y:null),[this.#b,this.#v]=M(this,p,e.required,E?E.#v:null),[this.#w,this.#x]=M(this,g,e.disabled,E?E.#x:null),[this.#S,this.#O]=B(this,L,y,e.label),[this.#E,this.#C]=B(this,L,b,e.description),[this.#A,this.#j]=B(this,L,v,e.placeholder),[this.#$,this.#T]=B(this,I,w,e.min),[this.#N,this.#k]=B(this,I,x,e.max),[this.#M,this.#L]=B(this,I,S,e.step),[this.#I,this.#U]=B(this,P,O,e.values),c instanceof k.State||c instanceof k.Computed?this.#q=c:this.#q=new k.State(c||0),t)this.#t=!0;else{this.#P=i||null,this.#B=a||null,this.#R="function"==typeof r?r:null,this.#V="function"==typeof s?s:null,this.#D="function"==typeof o?o:null,this.#W.set(l??"");for(const[t,n]of Object.entries(e.events||{}))"function"==typeof n&&this.listen(t,n)}}#_=!1;#R=null;#V=null;#D=null;#P=null;#B=null;#r=null;#s=this;#o;#i;#a;get store(){return this}get parent(){return this.#r}get root(){return this.#s}get type(){return this.#o}get meta(){return this.#i}get component(){return this.#a}#q;get length(){return this.#q.get()}#W=new k.State("");get index(){return this.#W.get()}set index(e){this.#W.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#f=!0;get creatable(){return this.#f}#u=!1;get immutable(){return this.#u}#c;#l;get selfNew(){return this.#l.get()}set selfNew(e){this.#l.set(Boolean(e))}get new(){return this.#c.get()}set new(e){this.#l.set(Boolean(e))}#p;#g;get selfHidden(){return this.#p.get()}set selfHidden(e){this.#p.set("boolean"==typeof e?e:null)}get hidden(){return this.#g.get()}set hidden(e){this.#p.set("boolean"==typeof e?e:null)}#m;#y;get selfClearable(){return this.#m.get()}set selfClearable(e){this.#m.set("boolean"==typeof e?e:null)}get clearable(){return this.#y.get()}set clearable(e){this.#m.set("boolean"==typeof e?e:null)}#b;#v;get selfRequired(){return this.#b.get()}set selfRequired(e){this.#b.set("boolean"==typeof e?e:null)}get required(){return this.#v.get()}set required(e){this.#b.set("boolean"==typeof e?e:null)}#w;#x;get selfDisabled(){return this.#w.get()}set selfDisabled(e){this.#w.set("boolean"==typeof e?e:null)}get disabled(){return this.#x.get()}set disabled(e){this.#w.set("boolean"==typeof e?e:null)}#h;#d;get selfReadonly(){return this.#h.get()}set selfReadonly(e){this.#h.set("boolean"==typeof e?e:null)}get readonly(){return this.#d.get()}set readonly(e){this.#h.set("boolean"==typeof e?e:null)}#S;#O;get selfLabel(){return this.#S.get()}set selfLabel(e){this.#S.set(L(e))}get label(){return this.#O.get()}set label(e){this.#S.set(L(e))}#E;#C;get selfDescription(){return this.#E.get()}set selfDescription(e){this.#E.set(L(e))}get description(){return this.#C.get()}set description(e){this.#E.set(L(e))}#A;#j;get selfPlaceholder(){return this.#A.get()}set selfPlaceholder(e){this.#A.set(L(e))}get placeholder(){return this.#j.get()}set placeholder(e){this.#A.set(L(e))}#$;#T;get selfMin(){return this.#$.get()}set selfMin(e){this.#$.set(I(e))}get min(){return this.#T.get()}set min(e){this.#$.set(I(e))}#N;#k;get selfMax(){return this.#N.get()}set selfMax(e){this.#N.set(I(e))}get max(){return this.#k.get()}set max(e){this.#N.set(I(e))}#M;#L;get selfStep(){return this.#M.get()}set selfStep(e){this.#M.set(I(e))}get step(){return this.#L.get()}set step(e){this.#M.set(I(e))}#I;#U;get selfValues(){return this.#I.get()}set selfValues(e){this.#I.set(P(e))}get values(){return this.#U.get()}set values(e){this.#I.set(P(e))}*[Symbol.iterator](){}child(e){return null}#K=!1;#H=null;#Y=this.#H;#z=new k.State(this.#H);#n=new k.State(null);#F=this.#n.get();get changed(){return this.#z.get()===this.#Y}get saved(){return this.#z.get()===this.#H}get value(){return this.#z.get()}set value(e){if(this.#_)return;const t=this.#R?.(e)||e;this.#z.set(t),this.#K||(this.#K=!0,this.#H=e),this.#P?.(this.#z.get(),this.#W.get()),this.#G()}get state(){return this.#n.get()}set state(e){if(this.#_)return;const t=this.#V?.(e)||e;this.#n.set(t),this.#K=!0,this.#B?.(this.#n.get(),this.#W.get()),this.#G()}#G(){this.#Q||(this.#Q=!0,queueMicrotask((()=>{const e=this.#z.get(),t=this.#n.get();return this.#Z(e,t)})))}#Q=!1;#X(e,t){if(this.#_)return e;const[n,r]=this.#D?.(e,t)||[e,t];return this.#z.get()===n&&this.#n.get()===r?[n,r]:(this.#z.set(n),this.#n.set(r),this.#K||(this.#K=!0,this.#H=n),this.#Z(n,r))}#Z(e,t){if(this.#_)return[e,t];if(this.#Q=!1,e&&"object"==typeof e){let n=Array.isArray(e)?[...e]:{...e},r=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},s=!1;for(const[o,i]of this){const a=e[o],l=t?.[o],[c,u]=i.#X(a,l);a!==c&&(n[o]=c,s=!0),l!==u&&(r[o]=u,s=!0)}s&&(e=n,t=r,this.#z.set(e),this.#n.set(r))}return this.#Y===e&&this.#F===t||(this.#Y=e,this.#F=t),[e,t]}get destroyed(){return this.#_}destroy(){if(!this.#_){this.#_=!0;for(const[,e]of this)e.destroy()}}}class V extends R{get kind(){return"object"}#J;*[Symbol.iterator](){yield*Object.entries(this.#J)}child(e){return this.#J[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o}={}){const i=Object.entries(e.type);super(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o,length:i.length,setValue:e=>"object"!=typeof e?{}:e,setState:e=>"object"!=typeof e?{}:e,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const a=Object.create(null),l={parent:this,onUpdate:(e,t)=>{this.value={...this.value,[t]:e}},onUpdateState:(e,t)=>{this.state={...this.state,[t]:e}}};for(const[e,t]of i){let n;n="string"==typeof t.type?t.array?new D(t,{...l,index:e}):new R(t,{...l,index:e}):t.array?new D(t,{...l,index:e}):new V(t,{...l,index:e}),a[e]=n}this.#J=a}}class D extends R{#ee=()=>{throw new Error};#J;get children(){return[...this.#J.get()]}*[Symbol.iterator](){return yield*[...this.#J.get().entries()]}child(e){const t=this.#J.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(e,{parent:t,onUpdate:n,onUpdateState:r,index:s,new:o}={}){const i=new k.State([]),a=e=>{if(this.destroyed)return;const t=Array.isArray(e)&&e.length||0,n=[...i.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#ee(e));for(const e of n.splice(t))e.destroy();r!==t&&i.set(n)};super(e,{index:s,new:o,parent:t,length:new k.Computed((()=>i.get().length)),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 a(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t)=>{a(e),n?.(e,t)},onUpdateState:r}),this.#J=i;const l={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.#ee=(t,n)=>{const r=new R(e,{...l,index:t,new:n});return r.index=t,r};else{if(!e.type||"object"!=typeof e.type||Array.isArray(e.type))throw new Error;this.#ee=(t,n)=>{const r=new V(e,{...l,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 s=[...this.#J.get()],o=Math.max(0,Math.min(Math.floor(e),s.length)),i=this.#ee(o,n);i.new=!0,s.splice(o,0,i);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(o,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(o,0,{}),this.state=e}return this.value=a,this.#J.set(s),!0}add(e){return this.insert(this.#J.get().length,e)}remove(e){if(this.destroyed)return;const t=this.value;if(!Array.isArray(t))return;const n=[...this.#J.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;s.destroy();const o=[...t],[i]=o.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.value=o,this.#J.set(n),i}move(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#J.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let o=Math.min(e,t),i=Math.max(e,t);for(let e=o;e<=i;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.value=a,this.#J.set(r),!0}exchange(e,t){if(this.destroyed)return!1;const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#J.get()],s=r[e],o=r[t];if(!s||!o)return!1;r[t]=s,r[e]=o,s.index=t,o.index=e;const i=[...n],a=i[e],l=i[t];i[t]=a,i[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.value=i,this.#J.set(r),!0}}const W={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class _ extends Error{constructor(e,...t){const n=W[e];super("function"==typeof n?n(...t):n),this.code=e}}const K=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,H=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function Y(e,t,n){const{attrs:r,directives:s,events:o,classes:i,styles:a,vars:l,aliases:c,params:u}=e;return function(e,f){const d=K.exec(e.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"))?.groups;if(!d)throw new _("ATTR",e);const{name:h}=d,p=d.decorator?.toLowerCase();if(p){if(":"===p)r[h]=H.test(f)?{name:f}:t(f);else if("."===p)i[h]=!f||(H.test(f)?f:t(f));else if("style:"===p)a[h]=H.test(f)?f:t(f);else if("@"===p)o[h]=H.test(f)?f:n(f);else if("+"===p)l[h]=f?H.test(f)?f:t(f):"";else if("*"===p)c[h]=H.test(f)?f:t(f);else if("?"===p)u[h]=H.test(f)?f:t(f);else if("!"===p){const e=h.toString();switch(e){case"fragment":s.fragment=f||!0;break;case"else":s.else=!0;break;case"enum":s.enum=!f||(H.test(f)?f:t(f));break;case"if":case"text":case"html":s[e]=H.test(f)?f:t(f);break;case"template":s.template=f;break;case"bind":s.bind=f||!0;break;case"value":s.value=f;break;case"comment":s.comment=f}}}else r[h]=f}}function z(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),params:Object.create(null)}}var F={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 G=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function Q(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function Z(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function X(...e){console.error(new _(...e))}function J(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in F?F[t]:(X("ENTITY",e),e)}function ee(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function*te(e,t=0){const{attrs:n,events:r,directives:s,children:o,is:i,name:a,params:l,classes:c,styles:u,aliases:f,vars:d}=e,h=t>0?"".padEnd(t,"\t"):"";yield h,yield*["<",a||"-"],i&&(yield*["|",i]);for(const[e,t]of Object.entries(l)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" ?",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}for(const[e,t]of Object.entries(s)){if(!1===t||null==t)continue;const n="function"==typeof t?String(t):t;yield*[" !",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}for(const[e,t]of Object.entries(f)){if(null==t)continue;const n="function"==typeof t?String(t):t;yield*[" *",e],n&&"string"==typeof n&&(yield*['="',n.replace(/[<&"]/g,ee),'"'])}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,ee),'"'])}for(const[e,t]of Object.entries(n)){if(null==t)continue;if("string"==typeof t){yield*[" ",e],t&&(yield*['="',t.replace(/[<&"]/g,ee),'"']);continue}const n="function"==typeof t?String(t):"object"==typeof t?t.name:t;n&&"string"==typeof n&&(yield*[" :",e,'="',n.replace(/[<&"]/g,ee)||"",'"'])}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,ee),'"'])}for(const[e,t]of Object.entries(c)){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,ee),'"'])}for(const[e,t]of Object.entries(u)){if(null==t)continue;const n="function"==typeof t?String(t):t;n&&"string"==typeof n&&(yield*[" style:",e,'="',n.replace(/[<&"]/g,ee),'"'])}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,ee).replace(/]]>/g,"]]>")],yield*["</",a,">"],void(t>=0&&(yield"\n"))}yield">",t>=0&&(yield"\n"),yield*ne(o,t>=0?t+1:-1),yield*[h,"</",a,">"],t>=0&&(yield"\n")}function*ne(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,ee).replace(/]]>/g,"]]>");n&&(e=e.replace(/(?<=^|\n)/g,n)),yield e,t>=0&&(yield"\n")}else yield*te(r,t)}var re=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new _("CALC")},createEvent:n=()=>{throw new _("EVENT")},simpleTag:r=new Set}={}){const s=[],o={children:s},i=[];let a=null,l=o;function c(){a=i.pop()||null,l=a||o}function u(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&l.children.push(e)}let f={},d=0;function h(t){if(t<=d)return;u(e.substring(d,t).replace(/&#?\w+;/g,J)),d=t}for(;;){const p=e.indexOf("<",d);if(p<0){const E=e.substring(d);E.match(/^\s*$/)||u(E);break}if(p>d&&h(p),"/"===e.charAt(p+1)){d=e.indexOf(">",p+3);let C=e.substring(p+2,d);if(d<0?(C=e.substring(p+2).replace(/[\s<].*/,""),X("UNCOMPLETED",C,a?.name),d=p+1+C.length):C.match(/\s</)&&(C=C.replace(/[\s<].*/,""),X("UNCOMPLETED",C),d=p+1+C.length),a){const A=a.name;if(A===C)c();else{if(A.toLowerCase()!=C.toLowerCase())throw new _("CLOSE",C,a.name);c()}}d++;continue}function g(t){let n=d+1;if(d=e.indexOf(t,n),d<0)throw new _("QUOTE",t);const r=e.slice(n,d).replace(/&#?\w+;/g,J);return d++,r}function m(){let t=e.charAt(d);for(;t<=" "||""===t;t=e.charAt(++d));return t}function y(){let t=d,n=e.charAt(d);for(;Q(n);)d++,n=e.charAt(d);return e.slice(t,d)}d=p+1;let b=e.charAt(d);switch(b){case"=":throw new _("EQUAL");case'"':case"'":throw new _("ATTR_VALUE");case">":case"/":throw new _("SYMBOL",b);case"":throw new _("EOF")}const v=y(),w=G.exec(v)?.groups;if(!w)throw new _("TAG",v);i.push(a),a=z(w.name,w.is),l.children.push(a),l=a;const x=Y(a,t,n);let S=!0,O=!1;e:for(;S;){let j=m();switch(j){case"":X("EOF"),d++;break e;case">":d++;break e;case"/":O=!0;break e;case'"':case"'":throw new _("ATTR_VALUE");case"=":throw new _("SYMBOL",j)}const $=y();if(!$){X("EOF"),d++;break e}switch(j=m(),j){case"":X("EOF"),d++;break e;case">":x($,""),d++;break e;case"/":x($,""),O=!0;break e;case"=":d++;break;case"'":case'"':x($,g(j));continue;default:x($,"");continue}switch(j=m(),j){case"":x($,""),X("EOF"),d++;break e;case">":x($,""),d++;break e;case"/":x($,""),O=!0;break e;case"'":case'"':x($,g(j));continue}x($,y())}if(O){for(;;){d++;const T=e.charAt(d);if("/"!==T&&!(T<=" "||""===T))break}switch(e.charAt(d)){case"=":throw new _("EQUAL");case'"':case"'":throw new _("ATTR_VALUE");case"":X("EOF");break;case">":d++;break;default:throw new _("CLOSE_SYMBOL")}c()}else(r.has(v)||Z(e,d,v,f))&&c()}return s},stringify:function(e,t){const n=t?0:-1;return Array.isArray(e)?[...ne(e,n)].join(""):[te(e,n)].join()}});let se=!0;const oe=new k.subtle.Watcher((()=>{se&&(se=!1,queueMicrotask(ie))}));function ie(){se=!0;for(const e of oe.getPending())e.get();oe.watch()}function ae(e,t){let n,r=!1;const s=new k.Computed((()=>{const s=e();r&&Object.is(s,n)||(n=s,r=!0,t(s))}));return oe.watch(s),s.get(),()=>{oe.unwatch(s)}}const le=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,values:!0,null:!0,index:!0,no:!0,length:!0}));function*ce(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of le)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],e instanceof D&&(yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}])}function ue(e,t,n){for(const[n,r]of t){for(const[t,s]of ce(r,n))e[t]=s;for(const[t,s]of ce(r,n,"$$"))e[t]=s}}function fe(e){if(!e)return!1;const t=e.indexOf("$");return t<0||(e.indexOf("$",t+2)>0||"$"===e[0]&&"_$".includes(e[1]))}function de(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class he{exec(e){if("string"==typeof e){const t=this.#te[e];if("function"!=typeof t?.get)return;return t.get()}if("function"==typeof e)return e(this.getters)}watch(e,t){return ae((()=>this.exec(e)),t)}enum(e){if(!e)return!0;if(!0===e)return this.store;if("function"==typeof e)return()=>e(this.getters);if("string"!=typeof e)return null;const t=this.#te[e];if("function"!=typeof t?.get)return null;const n=t.store;return n instanceof R?n:t.get}bind(e,t,n){const r=this.#te[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?le.has(t)?ae((()=>s[t]),n):void 0:"value"===t?ae((()=>r.get()),n):void 0}bindAll(e){const t=this.#te[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>ae(e,t)}}return Object.fromEntries([...le].map((e=>[`$${e}`,t=>ae((()=>n[e]),t)])))}bindSet(e,t){const n=this.#te[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#te[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)}}}getEvent(e){if("function"==typeof e)return e;const t=this.#te[e];if(!t)return null;const{exec:n,calc:r}=t;return"function"==typeof n?n:"function"==typeof r?r:null}constructor(e,t){if(this.store=e,t instanceof he){this.#ne=t.#ne;const e=this.#re;for(const[n,r]of Object.entries(t.#re))e[n]=r;const n=this.#se;for(const[e,r]of Object.entries(t.#se))n[e]=r}else ue(this.#re,e),this.#ne=function(e){const t=Object.create(null);if(!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!fe(n))continue;if(!r||"object"!=typeof r)continue;if(r instanceof R){for(const[e,s]of ce(r,n))t[e]=s;continue}const{get:e,set:s,exec:o,calc:i}=r;"function"!=typeof e?"function"!=typeof i?"function"!=typeof o||(t[n]={exec:o}):t[n]={calc:i}:t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#ne;#re=Object.create(null);#se=Object.create(null);store;#oe=null;#r=null;#ie=null;get#te(){const e=this.#ie;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#re,...this.#ne,...this.#se})),n=this.store,r=this.#r,s=this.#oe;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};else{for(const[e,r]of ce(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof D))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]=s}return this.#ie=t,t}setStore(e,t){const n=new he(e,this);return t&&(n.#r=t),ue(n.#re,e),n}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new he(t,this);return ue(n.#re,t),n}params({params:e},{attrs:t},n,r){let s=this.store;if(!0===r)s=n.store;else if(r){const e=n.#te[r],t=e?.get&&e.store;t&&(s=t)}if(0===Object.keys(e).length)return this;const o=new he(s,this);o.#r=this.#r,o.#oe=this.#oe;const i=o.#se,a=o.#te;for(const[r,s]of Object.entries(e)){const e=r in t?t[r]:null;if("string"!=typeof e){if(e&&"object"==typeof e){const t=n.#te[e.name];if(!t?.get)continue;if(!t.store){i[r]=a[r]=t;continue}for(const[e,n]of ce(t.store,r))i[e]=a[e]=n;continue}if("function"==typeof e){const t=new k.Computed((()=>e(n.getters)));i[r]=a[r]={get:()=>t.get()};continue}if("function"==typeof s){const e=o.getters;o.#ae=null;const t=new k.Computed((()=>s(e)));i[r]=a[r]={get:()=>t.get()};continue}{const e=a[s];if(!e?.get)continue;if(!e.store){i[r]=a[r]=e;continue}for(const[t,n]of ce(e.store,r))i[t]=a[t]=n;continue}}i[r]=a[r]={get:()=>e}}return o}setObject(e){const t=new he(this.store,this);return t.#oe=e,t}set(e,t){if(Object.keys(e).length+Object.keys(t).length===0)return this;const n=new he(this.store,this);n.#r=this.#r,n.#oe=this.#oe;const r=n.#se,s=n.#te;for(const[t,o]of Object.entries(e)){if("function"==typeof o){const e=n.getters;n.#ae=null;const i=new k.Computed((()=>o(e)));r[t]=s[t]={get:()=>i.get()};continue}const e=s[o];if(e)if(e.get&&e.store)for(const[n,o]of ce(e.store,t))r[n]=s[n]=o;else r[t]=s[t]=e}for(const[e,o]of Object.entries(t)){const t=new k.State(null);if("function"==typeof o){const e=n.settable;n.#le=null,t.set(o(e))}else if(o&&"string"==typeof o){const e=s[o];if(!e?.get)continue;t.set(e.get())}r[e]=s[e]={get:()=>t.get(),set:e=>{t.set(e)}}}return n}#ce=null;get all(){const e=this.#ce;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 de(this.store,t),this.#ce=t,t}#le=null;get settable(){const e=this.#le;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 de(this.store,t),this.#le=t,t}#ae=null;get getters(){const e=this.#ae;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#te))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 de(this.store,t),this.#ae=t,t}}const pe={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 ge(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in pe?`${s}${pe[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class me{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}}const ye={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 be(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 ve(e){return null===(e??null)?"":String(e)}function we(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 ve;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 xe={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=ve(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ve(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ve(e)}},events:{$value:["change",(e,t)=>t.value]}}};function Se(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watchAttr:s,props:o}=e;return e.listen("init",(({events:n})=>{const i=xe[t.toLowerCase()],a=i?.attrs||{},l=i?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,o]=n;r.addEventListener(e,(e=>t(o(e,r))),s)}}if(o)for(const[t,n]of Object.entries(e.tagAttrs))if(s(t,(e=>{if(o.has(t))r[t]=e;else{const n=be(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),o.has(t))r[t]=n;else{const e=be(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=be(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=we(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let o=be(n);null!==o&&r.setAttribute(t,o),s(t,(e=>{const n=be(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Oe(e){return null===(e??null)?"":String(e)}function Ee(e,t,n,{text:r,html:s}){if(null!=r){const s=e.insertBefore(document.createTextNode(""),t),o=n.watch(r,(e=>s.textContent=Oe(e)));return()=>{s.remove(),o()}}if(null==s)return;const o=e.insertBefore(document.createComment(""),t),i=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=o.nextSibling;e&&e!==i;e=o.nextSibling)e.remove()}const c=n.watch(s,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=o.firstChild)e.insertBefore(t,i)}(Oe(t))}));return()=>{c(),l(),o.remove(),i.remove()}}function Ce(e,t,n,r,s,o){let i=new Set,a=[],l=Object.create(s);for(const t of e){if("string"==typeof t)continue;const e=t.directives.template;e&&(l[e]=[t,r])}function c(e){if(!e.length||!i)return;const s=t.insertBefore(document.createComment(""),n);let a=-1,c=()=>{};i.add((()=>{c(),c=()=>{},s.remove()})),i.add(ae((()=>e.findIndex((([e])=>null===e||r.exec(e)))),(t=>{t!==a&&(a=t,c(),c=()=>{},function(t){const n=e[t]?.[1];n&&(c=o(n,l))}(a))})))}for(const r of e){if("string"==typeof r){c(a),a=[];const e=document.createTextNode(r);t.insertBefore(e,n),i.add((()=>e.remove()));continue}if(r.directives.template){c(a),a=[];continue}if(a.length&&r.directives.else){const e=r.directives.if||null;a.push([e,r]),e||(c(a),a=[]);continue}c(a),a=[];const e=r.directives.if;e?a.push([e,r]):i.add(o(r,l))}return()=>{if(!i)return;const e=i;i=null;for(const t of e)t()}}function Ae(e,t,n,r,s,o,i){r=r.set(e.aliases,e.vars);const a=e.directives.bind,l=e.directives.fragment;if(l&&"string"==typeof l){const c=s[l];if(!c)return()=>{};const[u,f]=c,d=f.params(u,e,r,a);return je(u,t,n,d,s,o,i)}if(!e.name||e.directives.fragment)return Ee(t,n,r,e.directives)||Ce(e.children||[],t,n,r,s,((e,s)=>je(e,t,n,r,s,o,i)));const c=[...o,e.name],u=i?.(c);if(i&&!u)return()=>{};const{context:f,handler:d}=function(e,t){const n="string"==typeof e?e:e.tag,{attrs:r,events:s}="string"!=typeof e&&e||{attrs:null,events:null};let o=!1;const i=new k.State(!1);let a=!1;const l=new k.State(!1),c=Object.create(null),u=Object.create(null),f=new Set,d=[],h=new me,p={events:d,props:r?new Set(Object.entries(r).filter((([,e])=>e.isProp)).map((([e])=>e))):null,tagAttrs:u,watchAttr(e,t){if(o)return()=>{};const n=c[e];if(!n)return()=>{};let r=n.get();const s=ae((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}));return f.add(s),()=>{f.delete(s),s()}},get destroyed(){return i.get()},get init(){return l.get()},listen:(e,t)=>h.listen(e,t)},g={tag:n,set(e,t){if(r&&!(e in r))return;let n=c[e];if(n)return void n.set(t);const s=new k.State(t);c[e]=s,Object.defineProperty(u,e,{configurable:!0,enumerable:!0,get:s.get.bind(s)})},addEvent(e,n){if("function"!=typeof n)return;const[r,...o]=e.split(".").filter(Boolean),i=s?s[r].filters:{};if(!i)return;const a={},l=[];if(i)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(":"):[],s=n.replace(/^-+/,""),o=(n.length-s.length)%2==1;let c=i[s]||s;switch(c){case"once":a.once=!o;break;case"passive":a.passive=!o;break;case"capture":a.capture=!o;break;default:"string"==typeof c&&(c=ye[c])}"function"==typeof c&&l.push([c,r,o])}d.push([r,e=>{const r=t.all;for(const[t,n,s]of l)if(t(e,n,r)===s)return;n(e,r)},a])},destroy(){if(!o){o=!0,i.set(!0);for(const e of f)e();h.emit("destroy")}},mount(){a||(a=!0,l.set(!0),h.emit("init",{events:d}))}};return{context:p,handler:g}}(u||e.name,r),h=u?.attrs,p=h?function(e,t,n,r,s){let o=new Set;for(const[i,a]of Object.entries(r)){const r=n[i];if(i in n){if("function"!=typeof r&&"object"!=typeof r){e.set(i,r);continue}const n="function"==typeof r?r:r.name;if(a.immutable){e.set(i,t.exec(n));continue}o.add(t.watch(n,(t=>e.set(i,t))));continue}const l=a.bind;if(!s||!l){e.set(i,a.default);continue}if("string"==typeof l){const n=t.bind(s,l,(t=>e.set(i,t)));n?o.add(n):e.set(i,a.default);continue}if(!Array.isArray(l)){e.set(i,a.default);continue}const[c,u,f]=l;if(!c||"function"!=typeof u)continue;if(!f){const n=!0===s?"":s;o.add(t.watch(n,(t=>e.set(i,t)))),e.addEvent(c,((...e)=>{t.all[n]=u(...e)}));continue}const d=t.bind(s,"state",(t=>e.set(i,t)));if(!d)continue;o.add(d);const h=t.bindSet(s,"state");h&&e.addEvent(c,((...e)=>{h(u(...e))}))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(d,r,e.attrs,h,a):function(e,t,n){const r=e.tag;let s=new Set;for(const[o,i]of Object.entries(n)){if("function"!=typeof i&&"object"!=typeof i){e.set(o,i);continue}const n="function"==typeof i?i:i.name;if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==o.toLocaleLowerCase())s.add(t.watch(n,(t=>e.set(o,t))));else{const r=t.exec(n);e.set(o,r)}}return()=>{const e=s;s=new Set;for(const t of e)t()}}(d,r,e.attrs);for(const[t,n]of Object.entries(e.events)){const e=r.getEvent(n);e&&d.addEvent(t,e)}const g=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,o]of Object.entries(t.bindAll(n)||{}))"function"==typeof o&&r.add(o((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(d,r,a),m=u?"function"==typeof u.tag?u.tag(f):Se(f,u.tag,u.is):Se(f,e.name,e.is),y=Array.isArray(m)?m[0]:m,b=Array.isArray(m)?m[1]:y;t.insertBefore(y,n);const v=b?Ee(b,null,r,e.directives)||Ce(e.children||[],b,null,r,s,((e,t)=>je(e,b,null,r,t,o,i))):()=>{};return function(e,t,n){if(!(e instanceof Element))return()=>{};let r=new Set;for(const[s,o]of Object.entries(t))o&&(!0!==o?r.add(ae((()=>Boolean(n.exec(o))),(t=>{t?e.classList.add(s):e.classList.remove(s)}))):e.classList.add(s))}(y,e.classes,r),function(e,t,n){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};let r=new Set;for(const[s,o]of Object.entries(t))r.add(ae((()=>ge(s,n.exec(o))),(t=>{t?e.style.setProperty(s,...t):e.style.removeProperty(s)})))}(y,e.styles,r),d.mount(),()=>{y.remove(),d.destroy(),p(),v(),g()}}function je(e,t,n,r,s,o,i){const{directives:a}=e,l=r.child(a.value);if(!l)return()=>{};const c=l.enum(a.enum),u=(n,r)=>Ae(e,t,n,r,s,o,i);return!0===c?u(n,l):c instanceof D?function(e,t,n,r,s){const o=e.insertBefore(document.createComment(""),t);let i=new Map;function a(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const l=ae((()=>n.children),(function(t){if(!o.parentNode)return;let l=o.nextSibling;const c=i;i=new Map;for(let o of t){const t=c.get(o);if(!t){const t=e.insertBefore(document.createComment(""),l),a=e.insertBefore(document.createComment(""),l),c=s(a,r.setStore(o,n));i.set(o,[t,a,c]);continue}if(c.delete(o),i.set(o,t),l===t[0]){l=t[1].nextSibling;continue}let a=t[0];for(;a&&a!==t[1];){const t=a;a=a.nextSibling,e.insertBefore(t,l)}e.insertBefore(t[1],l)}a(c)}));return()=>{o.remove(),a(i),l()}}(t,n,c,l,u):c instanceof V?function(e,t,n,r,s){const o=[];for(const[e,i]of[...n])o.push(s(t,r.setStore(i,n)));return()=>{for(const e of o)e()}}(0,n,c,l,u):"function"==typeof c?function(e,t,n,r,s){const o=new k.Computed((()=>{const e=n();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t,t])):Object.entries(e).map((([e,t],n)=>[t,n,e])):[]})),i=e.insertBefore(document.createComment(""),t);let a=[];function l(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const c=ae((()=>o.get()),(function(t){if(!i.parentNode)return;let n=i.nextSibling;const o=a;a=[];for(const[i,l,c]of t){const t=o.findIndex((e=>e[3]===c)),[u]=t>=0?o.splice(t,1):[];if(!u){const t=e.insertBefore(document.createComment(""),n),o=e.insertBefore(document.createComment(""),n),u=new k.State(i),f=new k.State(l),d=s(o,r.setObject({get key(){return c},get value(){return u.get()},get index(){return f.get()}}));a.push([t,o,d,c,u,f]);continue}if(a.push(u),u[4].set(i),u[5].set(l),n===u[0]){n=u[1].nextSibling;continue}let f=u[0];for(;f&&f!==u[1];){const t=f;f=f.nextSibling,e.insertBefore(t,n)}e.insertBefore(u[1],n)}l(o)}));return()=>{i.remove(),l(a),c()}}(t,n,c,l,u):()=>{}}function $e(e,t,n,r,s){const o=[r,s],i=o.find((e=>"function"==typeof e)),a=o.find((e=>"object"==typeof e)),l=new he(e,a),c=Object.create(null);return Ce(t,n,null,l,c,((e,t)=>je(e,n,null,l,t,[],i)))}export{re as Layout,k as Signal,R as Store,$e as render};
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.6.0
|
|
3
3
|
* (c) 2024-2025 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
@@ -169,7 +169,7 @@ class Store {
|
|
|
169
169
|
* @param {*} [options.parent]
|
|
170
170
|
* @param {*} [options.state]
|
|
171
171
|
* @param {number | string | null} [options.index]
|
|
172
|
-
* @param {number} [options.length]
|
|
172
|
+
* @param {number | Signal.State<number> | Signal.Computed<number>} [options.length]
|
|
173
173
|
* @param {boolean} [options.null]
|
|
174
174
|
* @param {boolean} [options.new]
|
|
175
175
|
* @param {boolean} [options.hidden]
|
|
@@ -259,6 +259,12 @@ class Store {
|
|
|
259
259
|
// @ts-ignore
|
|
260
260
|
[this.#selfValues, this.#values] = createState(this, values, values$1, schema.values);
|
|
261
261
|
|
|
262
|
+
if (length instanceof Signal.State || length instanceof Signal.Computed) {
|
|
263
|
+
this.#length = length;
|
|
264
|
+
} else {
|
|
265
|
+
this.#length = new Signal.State(length || 0);
|
|
266
|
+
}
|
|
267
|
+
|
|
262
268
|
if (isNull) {
|
|
263
269
|
this.#null = true;
|
|
264
270
|
return;
|
|
@@ -268,7 +274,6 @@ class Store {
|
|
|
268
274
|
this.#setValue = typeof setValue === 'function' ? setValue : null;
|
|
269
275
|
this.#setState = typeof setState === 'function' ? setState : null;
|
|
270
276
|
this.#convert = typeof convert === 'function' ? convert : null;
|
|
271
|
-
this.#length.set(length || 0);
|
|
272
277
|
this.#index.set(index ?? '');
|
|
273
278
|
|
|
274
279
|
for (const [k, f] of Object.entries(schema.events || {})) {
|
|
@@ -307,9 +312,9 @@ class Store {
|
|
|
307
312
|
get meta() { return this.#meta; }
|
|
308
313
|
get component() { return this.#component; }
|
|
309
314
|
|
|
310
|
-
|
|
315
|
+
/** @type {Signal.State<number> | Signal.Computed<number>} */
|
|
316
|
+
#length;
|
|
311
317
|
get length() { return this.#length.get(); }
|
|
312
|
-
set length(v) { this.#length.set(v); }
|
|
313
318
|
#index = new Signal.State(/** @type {string | number} */(''));
|
|
314
319
|
get index() { return this.#index.get(); }
|
|
315
320
|
set index(v) { this.#index.set(v); }
|
|
@@ -610,8 +615,10 @@ class ObjectStore extends Store {
|
|
|
610
615
|
* @param {(value: any, index: any) => void} [options.onUpdateState]
|
|
611
616
|
*/
|
|
612
617
|
constructor(schema,{ parent, index, new: isNew, onUpdate, onUpdateState } = {}) {
|
|
618
|
+
const childrenTypes = Object.entries(schema.type);
|
|
613
619
|
super(schema, {
|
|
614
620
|
parent, index, new: isNew, onUpdate, onUpdateState,
|
|
621
|
+
length: childrenTypes.length,
|
|
615
622
|
setValue(v) {
|
|
616
623
|
if (typeof v !== 'object') { return {}; }
|
|
617
624
|
return v;
|
|
@@ -640,7 +647,7 @@ class ObjectStore extends Store {
|
|
|
640
647
|
}
|
|
641
648
|
};
|
|
642
649
|
|
|
643
|
-
for (const [index, field] of
|
|
650
|
+
for (const [index, field] of childrenTypes) {
|
|
644
651
|
let child;
|
|
645
652
|
if (typeof field.type === 'string') {
|
|
646
653
|
if (field.array) {
|
|
@@ -666,7 +673,8 @@ class ObjectStore extends Store {
|
|
|
666
673
|
class ArrayStore extends Store {
|
|
667
674
|
/** @type {(index: number, isNew?: boolean) => Store} */
|
|
668
675
|
#create = () => {throw new Error}
|
|
669
|
-
|
|
676
|
+
/** @type {Signal.State<Store[]>} */
|
|
677
|
+
#children
|
|
670
678
|
get children() { return [...this.#children.get()]; }
|
|
671
679
|
*[Symbol.iterator]() { return yield*[...this.#children.get().entries()]; }
|
|
672
680
|
/**
|
|
@@ -692,11 +700,12 @@ class ArrayStore extends Store {
|
|
|
692
700
|
* @param {(value: any, index: any) => void} [options.onUpdateState]
|
|
693
701
|
*/
|
|
694
702
|
constructor(schema, { parent, onUpdate, onUpdateState, index, new: isNew} = {}) {
|
|
703
|
+
const childrenState = new Signal.State(/** @type {Store[]} */([]));
|
|
695
704
|
// @ts-ignore
|
|
696
705
|
const updateChildren = (list) => {
|
|
697
706
|
if (this.destroyed) { return; }
|
|
698
707
|
const length = Array.isArray(list) && list.length || 0;
|
|
699
|
-
const children = [...
|
|
708
|
+
const children = [...childrenState.get()];
|
|
700
709
|
const oldLength = children.length;
|
|
701
710
|
for (let i = children.length; i < length; i++) {
|
|
702
711
|
children.push(this.#create(i));
|
|
@@ -705,13 +714,13 @@ class ArrayStore extends Store {
|
|
|
705
714
|
schema.destroy();
|
|
706
715
|
}
|
|
707
716
|
if (oldLength !== length) {
|
|
708
|
-
|
|
709
|
-
this.#children.set(children);
|
|
717
|
+
childrenState.set(children);
|
|
710
718
|
}
|
|
711
719
|
|
|
712
720
|
};
|
|
713
721
|
super(schema, {
|
|
714
722
|
index, new: isNew, parent,
|
|
723
|
+
length: new Signal.Computed(() => childrenState.get().length),
|
|
715
724
|
state: [],
|
|
716
725
|
setValue(v) { return Array.isArray(v) ? v : v == null ? [] : [v] },
|
|
717
726
|
setState(v) { return Array.isArray(v) ? v : v == null ? [] : [v] },
|
|
@@ -729,6 +738,7 @@ class ArrayStore extends Store {
|
|
|
729
738
|
},
|
|
730
739
|
onUpdateState,
|
|
731
740
|
});
|
|
741
|
+
this.#children = childrenState;
|
|
732
742
|
const childCommonOptions = {
|
|
733
743
|
parent: this,
|
|
734
744
|
/** @param {*} value @param {*} index */
|
|
@@ -795,7 +805,6 @@ class ArrayStore extends Store {
|
|
|
795
805
|
this.state = sta;
|
|
796
806
|
}
|
|
797
807
|
this.value = val;
|
|
798
|
-
this.length = children.length;
|
|
799
808
|
this.#children.set(children);
|
|
800
809
|
return true;
|
|
801
810
|
}
|
|
@@ -833,7 +842,6 @@ class ArrayStore extends Store {
|
|
|
833
842
|
this.state = sta;
|
|
834
843
|
}
|
|
835
844
|
this.value = val;
|
|
836
|
-
this.length = children.length;
|
|
837
845
|
this.#children.set(children);
|
|
838
846
|
return value;
|
|
839
847
|
|
|
@@ -1933,23 +1941,28 @@ function setStore(items, store, parent) {
|
|
|
1933
1941
|
|
|
1934
1942
|
/** @import { ValueDefine, ExecDefine, CalcDefine } from './index.mjs' */
|
|
1935
1943
|
|
|
1944
|
+
|
|
1945
|
+
/**
|
|
1946
|
+
*
|
|
1947
|
+
* @param {string} key
|
|
1948
|
+
*/
|
|
1949
|
+
function testKey(key) {
|
|
1950
|
+
if (!key) { return false; }
|
|
1951
|
+
const index = key.indexOf('$');
|
|
1952
|
+
if (index < 0) { return true; }
|
|
1953
|
+
if (key.indexOf('$', index + 2) > 0) { return true; }
|
|
1954
|
+
if (key[0] !== '$') { return false;}
|
|
1955
|
+
return '_$'.includes(key[1]);
|
|
1956
|
+
}
|
|
1936
1957
|
/**
|
|
1937
1958
|
* @param {Record<string, Store | {get?(): any; set?(v: any): void; exec?(...p: any[]): any; calc?(...p: any[]): any }>?} [global]
|
|
1938
1959
|
*/
|
|
1939
1960
|
function toGlobal(global) {
|
|
1940
1961
|
/** @type {Record<string, ValueDefine | ExecDefine | CalcDefine>} */
|
|
1941
1962
|
const items = Object.create(null);
|
|
1942
|
-
items.$$size = { calc(v) {
|
|
1943
|
-
if (!v) { return 0; }
|
|
1944
|
-
if (Array.isArray(v)) { return v.length; }
|
|
1945
|
-
if (v instanceof Map) { return v.size; }
|
|
1946
|
-
if (v instanceof Set) { return v.size; }
|
|
1947
|
-
return Object.keys(v).length;
|
|
1948
|
-
} };
|
|
1949
|
-
|
|
1950
1963
|
if (!global || typeof global !== 'object') { return items; }
|
|
1951
1964
|
for (const [key, value] of Object.entries(global)) {
|
|
1952
|
-
if (!key
|
|
1965
|
+
if (!testKey(key)) { continue; }
|
|
1953
1966
|
if (!value || typeof value !== 'object') { continue; }
|
|
1954
1967
|
if (value instanceof Store) {
|
|
1955
1968
|
for (const [k, v] of toItem(value, key)) {
|