@shortfuse/materialdesignweb 0.9.4 → 0.10.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/README.md +51 -39
- package/api/README.md +5 -0
- package/api/css.css-data.json +23 -0
- package/api/custom-elements.json +116343 -0
- package/api/html.html-data.json +2994 -0
- package/bin/mdw-css.js +8 -8
- package/components/BottomSheet.js +2 -2
- package/components/Box.js +2 -2
- package/components/Page.js +3 -0
- package/components/SideSheet.js +2 -2
- package/components/Surface.js +2 -2
- package/core/Composition.js +57 -16
- package/core/CompositionAdapter.js +55 -12
- package/core/CustomElement.js +177 -34
- package/core/customTypes.js +66 -0
- package/core/jsonMergePatch.js +203 -20
- package/core/observe.js +252 -8
- package/dist/CustomElement.min.js +1 -1
- package/dist/CustomElement.min.js.map +3 -3
- package/dist/index.min.js +167 -157
- package/dist/index.min.js.map +4 -4
- package/dist/meta.json +1 -1
- package/loaders/theme.js +4 -1
- package/mixins/{FlexableMixin.js → FlexboxMixin.js} +5 -3
- package/package.json +14 -10
- package/services/theme.js +115 -97
- package/types/components/Page.d.ts.map +1 -1
- package/types/core/Composition.d.ts +5 -1
- package/types/core/Composition.d.ts.map +1 -1
- package/types/core/CompositionAdapter.d.ts +0 -25
- package/types/core/CompositionAdapter.d.ts.map +1 -1
- package/types/core/CustomElement.d.ts +122 -19
- package/types/core/CustomElement.d.ts.map +1 -1
- package/types/core/customTypes.d.ts +8 -0
- package/types/core/customTypes.d.ts.map +1 -1
- package/types/core/jsonMergePatch.d.ts +58 -4
- package/types/core/jsonMergePatch.d.ts.map +1 -1
- package/types/core/observe.d.ts +21 -2
- package/types/core/observe.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/mixins/FlexboxMixin.d.ts +14 -0
- package/types/mixins/FlexboxMixin.d.ts.map +1 -0
- package/types/services/theme.d.ts +6 -0
- package/types/services/theme.d.ts.map +1 -1
- package/types/mixins/FlexableMixin.d.ts +0 -14
- package/types/mixins/FlexableMixin.d.ts.map +0 -1
package/core/observe.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { attrNameFromPropName } from './dom.js';
|
|
2
2
|
import { buildMergePatch, hasMergePatch } from './jsonMergePatch.js';
|
|
3
3
|
|
|
4
|
-
/** @typedef {'string' | 'boolean' | 'map' | 'set' | 'float' | 'integer' | 'number' | 'object' | 'function' | 'array'} ObserverPropertyType */
|
|
4
|
+
/** @typedef {'string' | 'boolean' | 'map' | 'set' | 'float' | 'integer' | 'number' | 'object' | 'function' | 'array' | 'proxy'} ObserverPropertyType */
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @template {ObserverPropertyType} T
|
|
@@ -10,7 +10,7 @@ import { buildMergePatch, hasMergePatch } from './jsonMergePatch.js';
|
|
|
10
10
|
* : T extends 'string' ? string
|
|
11
11
|
* : T extends 'float' | 'integer' | 'number' ? number
|
|
12
12
|
* : T extends 'array' ? any[]
|
|
13
|
-
* : T extends 'object' ? any
|
|
13
|
+
* : T extends 'object' | 'proxy' ? any
|
|
14
14
|
* : T extends 'function' ? (...args:any) => any
|
|
15
15
|
* : unknown
|
|
16
16
|
* )} ParsedObserverPropertyType
|
|
@@ -77,6 +77,7 @@ function emptyFromType(type) {
|
|
|
77
77
|
return new Set();
|
|
78
78
|
case 'array':
|
|
79
79
|
return [];
|
|
80
|
+
case 'proxy':
|
|
80
81
|
case 'object':
|
|
81
82
|
return null;
|
|
82
83
|
default:
|
|
@@ -116,7 +117,7 @@ function buildProxy(proxyTarget, set, deepSet, prefix) {
|
|
|
116
117
|
has(target, p) {
|
|
117
118
|
const value = Reflect.has(target, p);
|
|
118
119
|
if (typeof p !== 'symbol') {
|
|
119
|
-
const arg = prefix ? `${prefix}
|
|
120
|
+
const arg = prefix ? `${prefix}.${p}` : p;
|
|
120
121
|
if (prefix) {
|
|
121
122
|
deepSet.add(arg);
|
|
122
123
|
} else {
|
|
@@ -128,6 +129,158 @@ function buildProxy(proxyTarget, set, deepSet, prefix) {
|
|
|
128
129
|
});
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
/** @type {WeakMap<object, Map<any, any>>} */
|
|
133
|
+
const proxyCache = new WeakMap();
|
|
134
|
+
/** @type {WeakMap<object, { subscribe: (fn: (patch:any) => void) => void, unsubscribe: (fn: (patch:any) => void) => void, emit: (patch:any) => void }>} */
|
|
135
|
+
const proxyEmitters = new WeakMap();
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @param {any} target
|
|
139
|
+
* @return {{ subscribe: (fn: (patch:any) => void) => void, unsubscribe: (fn: (patch:any) => void) => void, emit: (patch:any) => void }|null}
|
|
140
|
+
*/
|
|
141
|
+
function getProxyEmitter(target) {
|
|
142
|
+
if (target == null || typeof target !== 'object') return null;
|
|
143
|
+
/** @type {ReturnType<typeof getProxyEmitter>} */
|
|
144
|
+
let emitter = proxyEmitters.get(target);
|
|
145
|
+
if (!emitter) {
|
|
146
|
+
/** @type {Set<(patch:any) => void>} */
|
|
147
|
+
const subscribers = new Set();
|
|
148
|
+
emitter = {
|
|
149
|
+
/** @param {(patch:any) => void} fn */
|
|
150
|
+
subscribe(fn) { subscribers.add(fn); },
|
|
151
|
+
/** @param {(patch:any) => void} fn */
|
|
152
|
+
unsubscribe(fn) { subscribers.delete(fn); },
|
|
153
|
+
/** @param {any} patch */
|
|
154
|
+
emit(patch) {
|
|
155
|
+
for (const fn of subscribers) {
|
|
156
|
+
fn(patch);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
proxyEmitters.set(target, emitter);
|
|
161
|
+
}
|
|
162
|
+
return emitter;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @param {any} proxy
|
|
167
|
+
* @param {(patch:any) => void} fn
|
|
168
|
+
* @return {() => void}
|
|
169
|
+
*/
|
|
170
|
+
export function subscribeProxy(proxy, fn) {
|
|
171
|
+
const emitter = proxyEmitters.get(proxy) ?? getProxyEmitter(proxy);
|
|
172
|
+
if (!emitter) return () => {};
|
|
173
|
+
emitter.subscribe(fn);
|
|
174
|
+
return () => emitter.unsubscribe(fn);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @param {any} proxy
|
|
179
|
+
* @param {(patch:any) => void} fn
|
|
180
|
+
* @return {void}
|
|
181
|
+
*/
|
|
182
|
+
export function unsubscribeProxy(proxy, fn) {
|
|
183
|
+
const emitter = proxyEmitters.get(proxy);
|
|
184
|
+
if (!emitter) return;
|
|
185
|
+
emitter.unsubscribe(fn);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @param {string[]} path
|
|
190
|
+
* @param {any} value
|
|
191
|
+
* @return {any}
|
|
192
|
+
*/
|
|
193
|
+
function buildPatchFromPath(path, value) {
|
|
194
|
+
/** @type {Record<string, any>} */
|
|
195
|
+
const patch = {};
|
|
196
|
+
/** @type {Record<string, any>} */
|
|
197
|
+
let cursor = patch;
|
|
198
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
199
|
+
cursor[path[i]] = {};
|
|
200
|
+
cursor = cursor[path[i]];
|
|
201
|
+
}
|
|
202
|
+
cursor[path.at(-1)] = value;
|
|
203
|
+
return patch;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @template {Object} T
|
|
208
|
+
* @param {T} target
|
|
209
|
+
* @param {(changes:any) => void} emit
|
|
210
|
+
* @param {string[]} path
|
|
211
|
+
* @param {T} owner
|
|
212
|
+
* @param {ReturnType<typeof getProxyEmitter>|null} emitter
|
|
213
|
+
* @return {T}
|
|
214
|
+
*/
|
|
215
|
+
function createPatchProxy(target, emit, path, owner, emitter) {
|
|
216
|
+
if (target == null || typeof target !== 'object') return target;
|
|
217
|
+
const localEmitter = getProxyEmitter(target);
|
|
218
|
+
if (!emitter) {
|
|
219
|
+
emitter = localEmitter;
|
|
220
|
+
}
|
|
221
|
+
/** @type {Map<any, any>} */
|
|
222
|
+
let cache = proxyCache.get(target);
|
|
223
|
+
if (!cache) {
|
|
224
|
+
cache = new Map();
|
|
225
|
+
proxyCache.set(target, cache);
|
|
226
|
+
}
|
|
227
|
+
if (cache.has(owner)) return cache.get(owner);
|
|
228
|
+
|
|
229
|
+
const proxy = new Proxy(target, {
|
|
230
|
+
get(obj, prop) {
|
|
231
|
+
if (typeof prop === 'symbol') {
|
|
232
|
+
return /** @type {any} */ (obj)[prop];
|
|
233
|
+
}
|
|
234
|
+
const value = /** @type {any} */ (obj)[prop];
|
|
235
|
+
return createPatchProxy(value, emit, path.concat(prop), owner, emitter);
|
|
236
|
+
},
|
|
237
|
+
set(obj, prop, value) {
|
|
238
|
+
/** @type {any} */ (obj)[prop] = value;
|
|
239
|
+
if (typeof prop !== 'symbol') {
|
|
240
|
+
const rootPatch = buildPatchFromPath(path.concat(prop), value);
|
|
241
|
+
emit(rootPatch);
|
|
242
|
+
emitter?.emit(rootPatch);
|
|
243
|
+
if (localEmitter && localEmitter !== emitter) {
|
|
244
|
+
const localPatch = buildPatchFromPath([prop], value);
|
|
245
|
+
localEmitter.emit(localPatch);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return true;
|
|
249
|
+
},
|
|
250
|
+
deleteProperty(obj, prop) {
|
|
251
|
+
if (typeof prop !== 'symbol') {
|
|
252
|
+
const rootPatch = buildPatchFromPath(path.concat(prop), null);
|
|
253
|
+
emit(rootPatch);
|
|
254
|
+
emitter?.emit(rootPatch);
|
|
255
|
+
if (localEmitter && localEmitter !== emitter) {
|
|
256
|
+
const localPatch = buildPatchFromPath([prop], null);
|
|
257
|
+
localEmitter.emit(localPatch);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return Reflect.deleteProperty(obj, prop);
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
proxyCache.set(proxy, cache);
|
|
265
|
+
if (localEmitter) {
|
|
266
|
+
proxyEmitters.set(proxy, localEmitter);
|
|
267
|
+
}
|
|
268
|
+
cache.set(owner, proxy);
|
|
269
|
+
return proxy;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Create a shared proxy with a root emitter for fan-out subscriptions.
|
|
274
|
+
* @template T
|
|
275
|
+
* @param {T} value
|
|
276
|
+
* @return {T}
|
|
277
|
+
*/
|
|
278
|
+
export function createSharedProxy(value) {
|
|
279
|
+
if (value == null || typeof value !== 'object') return value;
|
|
280
|
+
const emitter = getProxyEmitter(value);
|
|
281
|
+
return createPatchProxy(value, () => {}, [], value, emitter);
|
|
282
|
+
}
|
|
283
|
+
|
|
131
284
|
/**
|
|
132
285
|
* @param {ObserverPropertyType} type
|
|
133
286
|
* @return {any}
|
|
@@ -159,6 +312,7 @@ function defaultParserFromType(type) {
|
|
|
159
312
|
return Set;
|
|
160
313
|
case 'object':
|
|
161
314
|
case 'array':
|
|
315
|
+
case 'proxy':
|
|
162
316
|
/**
|
|
163
317
|
* Reflect self
|
|
164
318
|
* @template T
|
|
@@ -324,13 +478,14 @@ export function parseObserverOptions(name, typeOrOptions, object) {
|
|
|
324
478
|
}
|
|
325
479
|
}
|
|
326
480
|
|
|
327
|
-
is ??= (type === 'object')
|
|
481
|
+
is ??= (type === 'object' || type === 'proxy')
|
|
328
482
|
? (a, b) => !hasMergePatch(a, b)
|
|
329
483
|
: ((type === 'array') ? () => false : Object.is);
|
|
330
484
|
|
|
331
485
|
if (diff === undefined) {
|
|
332
|
-
|
|
333
|
-
|
|
486
|
+
diff = ((type === 'object')
|
|
487
|
+
? (a, b) => buildMergePatch(/** @type {any} */ (a), /** @type {any} */ (b))
|
|
488
|
+
: null);
|
|
334
489
|
}
|
|
335
490
|
|
|
336
491
|
return {
|
|
@@ -434,6 +589,26 @@ export function defineObservableProperty(object, key, options) {
|
|
|
434
589
|
const config = /** @type {ObserverConfiguration<T1,T2,C,K>} */ (
|
|
435
590
|
parseObserverOptions(key, options, object));
|
|
436
591
|
|
|
592
|
+
/**
|
|
593
|
+
* @param {any} value
|
|
594
|
+
* @return {any}
|
|
595
|
+
*/
|
|
596
|
+
function wrapProxy(value) {
|
|
597
|
+
if (config.type !== 'proxy') return value;
|
|
598
|
+
if (value == null || typeof value !== 'object') return value;
|
|
599
|
+
const cache = proxyCache.get(value);
|
|
600
|
+
if (cache && cache.has(this)) return cache.get(this);
|
|
601
|
+
// eslint-disable-next-line unicorn/no-this-assignment, @typescript-eslint/no-this-alias
|
|
602
|
+
const owner = this;
|
|
603
|
+
/** @param {any} changes */
|
|
604
|
+
const emit = (changes) => {
|
|
605
|
+
const currentValue = config.values?.get(owner) ?? value;
|
|
606
|
+
config.propChangedCallback?.call(owner, config.key, currentValue, currentValue, changes);
|
|
607
|
+
config.changedCallback?.call(owner, currentValue, currentValue, changes);
|
|
608
|
+
};
|
|
609
|
+
return createPatchProxy(value, emit, [], owner, null);
|
|
610
|
+
}
|
|
611
|
+
|
|
437
612
|
/**
|
|
438
613
|
* @this {C}
|
|
439
614
|
* @return {T2}
|
|
@@ -442,17 +617,49 @@ export function defineObservableProperty(object, key, options) {
|
|
|
442
617
|
return config.values?.has(this) ? config.values.get(this) : config.value;
|
|
443
618
|
}
|
|
444
619
|
|
|
620
|
+
/**
|
|
621
|
+
*
|
|
622
|
+
*/
|
|
623
|
+
function internalGetProxy() {
|
|
624
|
+
if (config.values?.has(this)) {
|
|
625
|
+
return config.values.get(this);
|
|
626
|
+
}
|
|
627
|
+
const proxied = wrapProxy.call(this, config.value);
|
|
628
|
+
if (proxied !== config.value) {
|
|
629
|
+
if (config.values) {
|
|
630
|
+
config.values.set(this, proxied);
|
|
631
|
+
} else {
|
|
632
|
+
config.values = new WeakMap([[this, proxied]]);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return proxied;
|
|
636
|
+
}
|
|
637
|
+
|
|
445
638
|
/**
|
|
446
639
|
* @this {C}
|
|
447
640
|
* @param {T2} value
|
|
448
641
|
* @return {void}
|
|
449
642
|
*/
|
|
450
643
|
function internalSet(value) {
|
|
644
|
+
if (object === this && this?.constructor?.prototype === this) return;
|
|
451
645
|
// @ts-ignore
|
|
452
646
|
const oldValue = this[key];
|
|
453
647
|
detectChange.call(this, config, oldValue, value);
|
|
454
648
|
}
|
|
455
649
|
|
|
650
|
+
/**
|
|
651
|
+
* @this {C}
|
|
652
|
+
* @param {T2} value
|
|
653
|
+
* @return {void}
|
|
654
|
+
*/
|
|
655
|
+
function internalSetProxy(value) {
|
|
656
|
+
if (object === this && this?.constructor?.prototype === this) return;
|
|
657
|
+
// @ts-ignore
|
|
658
|
+
const oldValue = this[key];
|
|
659
|
+
const nextValue = wrapProxy.call(this, value);
|
|
660
|
+
detectChange.call(this, config, oldValue, nextValue);
|
|
661
|
+
}
|
|
662
|
+
|
|
456
663
|
/** @return {void} */
|
|
457
664
|
function onInvalidate() {
|
|
458
665
|
// Current value is now invalidated. Recompute and check if changed
|
|
@@ -483,6 +690,20 @@ export function defineObservableProperty(object, key, options) {
|
|
|
483
690
|
return newValue;
|
|
484
691
|
}
|
|
485
692
|
|
|
693
|
+
/**
|
|
694
|
+
* @this {C}
|
|
695
|
+
* @return {T2}
|
|
696
|
+
*/
|
|
697
|
+
function cachedGetProxy() {
|
|
698
|
+
const newValue = config.get.call(this, this, internalGetProxy.bind(this));
|
|
699
|
+
const resolvedValue = wrapProxy.call(this, newValue);
|
|
700
|
+
// Store computed value internally. Used by onInvalidate to get previous value
|
|
701
|
+
// eslint-disable-next-line no-multi-assign
|
|
702
|
+
const computedValues = (config.computedValues ??= new WeakMap());
|
|
703
|
+
computedValues.set(this, resolvedValue);
|
|
704
|
+
return resolvedValue;
|
|
705
|
+
}
|
|
706
|
+
|
|
486
707
|
/**
|
|
487
708
|
* @this {C}
|
|
488
709
|
* @param {T2} value
|
|
@@ -502,12 +723,35 @@ export function defineObservableProperty(object, key, options) {
|
|
|
502
723
|
detectChange.call(this, config, oldValue, newValue);
|
|
503
724
|
}
|
|
504
725
|
|
|
726
|
+
/**
|
|
727
|
+
* @this {C}
|
|
728
|
+
* @param {T2} value
|
|
729
|
+
* @return {void}
|
|
730
|
+
*/
|
|
731
|
+
function cachedSetProxy(value) {
|
|
732
|
+
if (config.needsSelfInvalidation) {
|
|
733
|
+
config.needsSelfInvalidation.add(this);
|
|
734
|
+
} else {
|
|
735
|
+
config.needsSelfInvalidation = new WeakSet([this]);
|
|
736
|
+
}
|
|
737
|
+
const oldValue = this[key];
|
|
738
|
+
config.set.call(this, value, internalSetProxy.bind(this));
|
|
739
|
+
const newValue = this[key];
|
|
740
|
+
if (!config.needsSelfInvalidation.has(this)) return;
|
|
741
|
+
config.needsSelfInvalidation.delete(this);
|
|
742
|
+
detectChange.call(this, config, oldValue, newValue);
|
|
743
|
+
}
|
|
744
|
+
|
|
505
745
|
/** @type {Partial<PropertyDescriptor>} */
|
|
506
746
|
const descriptor = {
|
|
507
747
|
enumerable: config.enumerable,
|
|
508
748
|
configurable: true,
|
|
509
|
-
get: config.get
|
|
510
|
-
|
|
749
|
+
get: config.get
|
|
750
|
+
? (config.type === 'proxy' ? cachedGetProxy : cachedGet)
|
|
751
|
+
: (config.type === 'proxy' ? internalGetProxy : internalGet),
|
|
752
|
+
set: config.set
|
|
753
|
+
? (config.type === 'proxy' ? cachedSetProxy : cachedSet)
|
|
754
|
+
: (config.type === 'proxy' ? internalSetProxy : internalSet),
|
|
511
755
|
};
|
|
512
756
|
|
|
513
757
|
Object.defineProperty(object, key, descriptor);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Pt,_t;function lt(){return(Pt??=new Text).cloneNode()}function F(){return(_t??=new Comment).cloneNode()}var D=class{constructor(t){this.anchorNode=t.anchorNode,this.metadata=[],this.keys=[],this.needsArrayKeyFastPath=!1,this.composition=t.composition,this.renderOptions=t.renderOptions,this.metadataCache=null,this.queuedElements=[],this.batchStartIndex=null,this.batchEndIndex=null}render(t,e){return this.composition.render(t,e,this.renderOptions)}startBatch(){this.needsArrayKeyFastPath=!0}writeBatch(){var e;if(!this.queuedElements.length)return;(((e=this.metadata[this.batchStartIndex-1])==null?void 0:e.domNode)??this.anchorNode).after(...this.queuedElements),this.queuedElements.length=0}stopBatch(){if(this.writeBatch(),this.needsArrayKeyFastPath=!1,this.batchStartIndex=null,this.batchEndIndex=null,this.metadataCache){for(let{domNode:t}of this.metadataCache.values())t.remove();this.metadataCache.clear()}}removeByIndex(t){let[e]=this.metadata.splice(t,1),{domNode:s,key:n}=e;this.keys.splice(t,1),s.remove(),this.metadataCache?this.metadataCache.set(n,e):this.metadataCache=new Map([[n,e]])}renderData(t,e,s,n,i,o){var h;if(t<this.metadata.length){let c=this.metadata[t],u=c.key,p=u===n,m=i!==n;if(p){m?c.render(e,s):o||c.render(e,s);return}let b=this.metadataCache??=new Map,g=!1;this.needsArrayKeyFastPath&&(g=!this.keys.includes(n),this.needsArrayFastPath=!1);let S=g?-1:this.keys.indexOf(n,t+1);if(S===-1){if(b.has(n)){let d=b.get(n);this.metadata.splice(t,0,d),this.keys.splice(t,0,n),(((h=this.metadata[t-1])==null?void 0:h.domNode)??this.anchorNode).after(d.domNode),b.delete(n);return}b.set(u,c)}else{if(t-S===-1){this.removeByIndex(t);return}let d=this.metadata[S];this.metadata[t]=d,this.metadata.splice(S,1);let{domNode:f}=c;f.replaceWith(d.domNode),o||d.render(e,s),this.keys[t]=n,this.keys.splice(S,1),f.remove(),b.set(u,c);return}}let a=this.render(e,s),l=a.target;this.metadata[t]={render:a,element:l,key:n,domNode:l},this.keys[t]=n,(this.batchEndIndex===null||this.batchEndIndex!==t-1)&&(this.writeBatch(),this.batchStartIndex=t),this.batchEndIndex=t,this.queuedElements.push(l)}removeEntries(t=0){let{length:e}=this.metadata;for(let s=e-1;s>=t;s--)this.metadata[s].domNode.remove();this.metadata.length=t,this.keys.length=t}hide(t,e,s){if(!e&&(t==null&&(t=this.keys.indexOf(s)),e=this.metadata[t],!e)||e.hidden)return!1;let{comment:n,element:i}=e;return n||(n=F(),e.comment=n),i.replaceWith(n),e.domNode=n,e.hidden=!0,!0}show(t,e,s){if(!e&&(t==null&&(t=this.keys.indexOf(s)),e=this.metadata[t],!e)||!e.hidden)return!1;let{comment:n,element:i}=e;return n.replaceWith(i),e.domNode=i,e.hidden=!1,!0}};var G=new Map;function V(r,t=!0){if(t&&G.has(r))return G.get(r);let e=new CSSStyleSheet;return e.replaceSync(r),t&&G.set(r,e),e}var X=new Map,ct;function At(r,t=!0){let e;return t&&X.has(r)?e=X.get(r):(ct??=document.implementation.createHTMLDocument(),e=ct.createElement("style"),e.textContent=r,t&&X.set(r,e)),e.cloneNode(!0)}var q;function ht(r,t=!0){if(q==null)try{let e=V(r,t);return q=!0,e}catch{q=!1}return q?V(r,t):At(r,t)}function*ut(r,t=!0){for(let e of r)e instanceof HTMLStyleElement?yield V(e.textContent,t):e.ownerNode?yield V([...e.cssRules].map(s=>s.cssText).join(""),t):yield e}var z=new WeakMap;function*dt(r,t=!0){for(let e of r)if(e instanceof HTMLStyleElement)yield e;else if(e.ownerNode instanceof HTMLStyleElement)yield e.ownerNode.cloneNode(!0);else if(t&&z.has(e))yield z.get(e).cloneNode(!0);else{let s=document.createElement("style");s.textContent=[...e.cssRules].map(n=>n.cssText).join(""),t&&z.set(e,s),yield s.cloneNode(!0)}}function ft(r,...t){return ht(typeof r=="string"?r:String.raw({raw:r},...t))}function gt(r){switch(r){case void 0:case null:case!1:return null;case!0:return"";default:return`${r}`}}var $;function j(r){if($??=new Map,$.has(r))return $.get(r);let t=r.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);return $.set(r,t),t}var pt,Ot=Number.parseFloat((pt=navigator.userAgent.match(/Chrome\/([\d.]+)/))==null?void 0:pt[1]),mt,Gt=Number.parseFloat((mt=navigator.userAgent.match(/Firefox\/([\d.]+)/))==null?void 0:mt[1]),bt,Xt=Ot||!navigator.userAgent.includes("AppleWebKit")?Number.NaN:Number.parseFloat((bt=navigator.userAgent.match(/Version\/([\d.]+)/))==null?void 0:bt[1]);function Y(r,t){if(r===t)return r;if(r==null||t==null||typeof t!="object")return t;typeof r!="object"&&(r={});for(let[e,s]of Object.entries(t))s==null?e in r&&delete r[e]:r[e]=Y(r[e],s);return r}function H(r,t,e="reference"){if(r===t)return null;if(t==null||typeof t!="object")return t;if(r==null||typeof r!="object")return structuredClone(t);let s={};if(Array.isArray(t)){if(e==="reference")return t;if(e==="clone")return structuredClone(t);for(let[i,o]of t.entries()){if(o===null){s[i]=null;continue}if(o==null)continue;let a=H(r[i],o,e);a!==null&&(s[i]=a)}return t.length!==r.length&&(s.length=t.length),s}let n=new Set(Object.keys(r));for(let[i,o]of Object.entries(t)){if(n.delete(i),o===null){s[i]=null;continue}if(o==null)continue;let a=H(r[i],o,e);a!==null&&(s[i]=a)}for(let i of n)s[i]=null;return s}function Z(r,t){if(r===t)return!1;if(t==null||typeof t!="object"||r!=null&&typeof r!="object")return!0;for(let[e,s]of Object.entries(t))if(s==null){if(e in r)return!0}else if(Z(r[e],s))return!0;return!1}function yt(r){switch(r){case"boolean":return!1;case"integer":case"float":case"number":return 0;case"map":return new Map;case"set":return new Set;case"array":return[];case"object":return null;default:case"string":return""}}function tt(r,t,e,s){return r??={},new Proxy(r,{get(n,i){let o=n[i];if(typeof i!="symbol"){let a=s?`${s}.${i}`:i;if(s?e.add(a):t.add(a),typeof o=="object"&&o!=null)return tt(o,t,e,a)}return o},has(n,i){let o=Reflect.has(n,i);if(typeof i!="symbol"){let a=s?`${s}.p`:i;s?e.add(a):t.add(a)}return o}})}function Mt(r){switch(r){case"boolean":return t=>!!t;case"integer":return Math.round;case"float":case"number":return t=>+t;case"map":return Map;case"set":return Set;case"object":case"array":return t=>t;default:case"string":return t=>`${t}`}}function et(r,...t){let e=new Set,s=new Set,n=t.map(l=>{let h=new Set,c=new Set,u=tt(l,h,c);return{poked:h,pokedDeep:c,proxy:u}}),i=tt(this??{},e,s),o=r.apply(i,n.map(l=>l.proxy)),a=r.name?!0:!e.size;return{props:{this:[...e],args:n.map(l=>[...l.poked])},deepPropStrings:{this:[...s],args:n.map(l=>[...l.pokedDeep])},deepProps:{this:[...s].map(l=>l.split(".")),args:n.map(l=>[...l.pokedDeep].map(h=>h.split(".")))},defaultValue:o,reusable:a}}function Tt(){return null}function Ft(r,t,e){let s=typeof t=="string"?{type:t}:t,{watchers:n,value:i,readonly:o,empty:a,type:l,enumerable:h,reflect:c,attr:u,nullable:p,parser:m,nullParser:b,get:g,is:S,diff:d,props:f}=s;if(n??=[],o??=!1,a===void 0&&(a=null),i??=a,g&&!f){let E=et(g.bind(e),e,()=>i);i??=E.defaultValue,f=new Set([...E.props.this,...E.props.args[0]])}if(!l)if(i==null)l="string";else{let E=typeof i;l=E==="number"?Number.isInteger(i)?"integer":"float":E}return h??=r[0]!=="_",p??=l==="boolean"?!1:a==null,p||(a??=yt(l),i??=a),c??=h?l!=="object":u?"write":!1,u??=c?j(r):null,m??=Mt(l),b||(p?b=Tt:b=a===null?()=>yt(l):()=>a),S??=l==="object"?(E,N)=>!Z(E,N):l==="array"?()=>!1:Object.is,d===void 0&&(d=l==="object"?(E,N)=>H(E,N,"reference"):null),{...s,type:l,is:S,diff:d,attr:u,reflect:c,readonly:o,enumerable:h,value:i,parser:m,nullParser:b,key:r,props:f,watchers:n}}function J(r,t,e){var i,o;r.get;let s=e==null?r.nullParser.call(this,e):r.parser.call(this,e),n=s;if(t==null){if(s==null)return!1}else if(s!=null){if(r.diff){if(n=r.diff.call(this,t,s),n==null)return!1}else if(r.is.call(this,t,s))return!1}return r.values?r.values.set(this,s):r.values=new WeakMap([[this,s]]),(i=r.propChangedCallback)==null||i.call(this,r.key,t,s,n),(o=r.changedCallback)==null||o.call(this,t,s,n),!0}function st(r,t,e){let s=Ft(t,e,r);function n(){var c;return(c=s.values)!=null&&c.has(this)?s.values.get(this):s.value}function i(c){let u=this[t];J.call(this,s,u,c)}function o(){var p,m;let c=(p=s.computedValues)==null?void 0:p.get(this),u=this[t];(m=s.needsSelfInvalidation)==null||m.delete(this),J.call(this,s,c,u)}if(s.props)for(let c of s.props)s.watchers.push([c,o]);function a(){let c=s.get.call(this,this,n.bind(this));return(s.computedValues??=new WeakMap).set(this,c),c}function l(c){s.needsSelfInvalidation?s.needsSelfInvalidation.add(this):s.needsSelfInvalidation=new WeakSet([this]);let u=this[t];s.set.call(this,c,i.bind(this));let p=this[t];s.needsSelfInvalidation.has(this)&&(s.needsSelfInvalidation.delete(this),J.call(this,s,u,p))}let h={enumerable:s.enumerable,configurable:!0,get:s.get?a:n,set:s.set?l:i};return Object.defineProperty(r,t,h),s}var Ct=new Set;function U(r="mdw_",t=4){let e;for(;Ct.has(e=Math.random().toString(36).slice(2,t+2)););return Ct.add(e),`${r}${e}`}var nt,St,xt;function B(r){return nt??=document.implementation.createHTMLDocument(),r?(xt??=nt.createRange(),xt.createContextualFragment(r)):(St??=nt.createDocumentFragment(),St.cloneNode())}var K=new Map;function rt(r){let t=`#${U()}`;return K.set(t,{fn:r}),`{${t}}`}var it=new Map;function ot(r,...t){let e,s=t.map(o=>{switch(typeof o){case"string":return o;case"function":return rt(o);case"object":{if(o==null)return"";let a=U();return e??=new Map,e.set(a,o),`<div id="${a}"></div>`}default:throw new Error(`Unexpected substitution: ${o}`)}}),n=String.raw({raw:r},...s);if(e){let o=B(n);for(let[a,l]of e)o.getElementById(a).replaceWith(l);return o}let i;return it.has(n)?i=it.get(n):(i=B(n),it.set(n,i)),i.cloneNode(!0)}function jt({nodes:r},t){let{nodeIndex:e,attrName:s}=this,n=r[e];switch(t){case void 0:case null:case!1:return n.removeAttribute(s),!1;case!0:return n.setAttribute(s,""),"";default:return n.setAttribute(s,t),t}}function Bt({nodeStates:r,comments:t,nodes:e},s){let{commentIndex:n,nodeIndex:i}=this,o=r[i],a=o&1;if(!(s!=null&&s!==!1)){if(a)return;let u=t[n];u||(u=F(),t[n]=u),e[i].replaceWith(u),r[i]|=1;return}let h=e[i],c=o&2;if(typeof s!="object")if(c){let u=new Text(s);h.replaceWith(u),e[i]=u,r[i]&=-3}else h.data=s;a&&(t[n].replaceWith(h),r[i]&=-2)}function Rt({nodeStates:r,nodes:t,comments:e},s){let{commentIndex:n,nodeIndex:i}=this,o=r[i]&1,a=s!=null&&s!==!1;if(a===!o)return;let l=t[i],h=e[n];h||(h=F(),e[n]=h),a?(h.replaceWith(l),r[i]&=-2):(l.replaceWith(h),r[i]|=1)}function Lt({comments:r,nodeStates:t,nodes:e}){let{commentIndex:s,nodeIndex:n}=this,i=F();r[s]=i,t[n]|=1,e[n].replaceWith(i)}function at(r,...t){let[{caches:e,searchStates:s}]=t,{cacheIndex:n,searchIndex:i,subSearch:o,invocation:a}=r,l=e[n],h=s[i];if(h&1)return{value:l,dirty:(h&2)===2};s[i]|=1;let c;if(a){if(o){let u=at(o,...t);if(!u.dirty&&l!==void 0)return s[i]&=-3,{value:l,dirty:!1};c=r.invocation(u.value)}else c=r.invocation(...t);if(c===void 0||l===c)return{value:c,dirty:!1}}return e[n]=c,s[i]|=2,{value:c,dirty:!0}}function wt({options:{context:r,store:t,injections:e}},s,n){return this.expression.call(r,t??n,e)}function Wt(r,t){return t[this.prop]}function Dt(r,t,e){let s=t;for(let n of this.deepProp){if(s===null)return null;if(!(n in s))return;s=s[n]}return s}var Ut=/{([^}]*)}/g;function qt(r,t){if(t)return t[r]}function Et(r,t){if(!t)return;let e=t,s;for(s of r)if(typeof e=="object"){if(e===null)return null;if(!(s in e))return;e=e[s]}else return e[s];return e}function Vt(r,t){let e=t;for(let s of r.split("."))if(!s||(e=e[s],e==null))return null;return e===t?null:e}var Nt=new Map,R=class r{static EVENT_PREFIX_REGEX=/^([*1~]+)?(.*)$/;_interpolationState={nodeIndex:-1,searchIndex:0,cacheIndex:0,commentIndex:0,nodeEntry:null};static shadowRootTag=Symbol();nodesToBind=[];props=[];searches=[];initCache=[];searchByQuery;actionsByPropsUsed;postInitActions=[];tagsWithBindings;tags=[];adapter;events;cloneable;styles=[];adoptedStyleSheets=[];stylesFragment;allIds=[];temporaryIds;interpolated=!1;constructor(...t){this.template=B(),this.append(...t)}*[Symbol.iterator](){for(let t of this.styles)yield t;yield this.template}static compose(...t){for(let[s,n]of Nt)if(s.length===t.length&&t.every((i,o)=>i===s[o]))return n;let e=new r(...t);return Nt.set(t,e),e}append(...t){for(let e of t)typeof e=="string"?this.append(B(e.trim())):e instanceof r?this.append(...e):e instanceof DocumentFragment?this.template.append(e):(e instanceof CSSStyleSheet||e instanceof HTMLStyleElement)&&this.styles.push(e);return this}addCompositionEventListener(t){let e=t.tag??"",s=this.events??=new Map;return s.has(e)?s.get(e).push(t):s.set(e,[t]),this}#n(t,e,s){var n;if((n=this.events)!=null&&n.has(t))for(let i of this.events.get(t)){let o;i.handleEvent?o=i.handleEvent:i.deepProp.length?o=Et(i.deepProp,this.interpolateOptions.defaults):o=qt(i.prop,this.interpolateOptions.defaults),e.addEventListener(i.type,s?o.bind(s):o,i)}}render(t,e,s={}){this.interpolated||this.interpolate({defaults:e??t,...s});let n=this.cloneable.cloneNode(!0),i=s.shadowRoot,o=i??s.target??n.firstElementChild,a={lastChildNode:null,lastChildNodeIndex:0,lastElement:null,nodeStates:new Uint8Array(this._interpolationState.nodeIndex+1),searchStates:new Uint8Array(this._interpolationState.searchIndex),comments:[],nodes:[],caches:this.initCache.slice(),refs:[],options:s},{nodes:l,refs:h,searchStates:c,caches:u}=a;for(let{tag:m,textNodes:b}of this.nodesToBind){let g;if(m===""){if(!b.length)continue;h.push(null),l.push(null),g=n.firstChild}else{let d=n.getElementById(m);if(h.push(d),l.push(d),this.#n(m,d,s.context),!b.length)continue;g=d.firstChild}let S=0;for(let d of b){for(;d!==S;)g=g.nextSibling,S++;l.push(g)}}this.#n("",s.context),this.#n(r.shadowRootTag,s.context.shadowRoot,s.context);for(let m of this.postInitActions)m.invocation(a);let p=(m,b)=>{var S;if(!m)return;let g=!1;for(let d of this.props){if(!((S=this.actionsByPropsUsed)!=null&&S.has(d))||!(d in m))continue;let f=this.actionsByPropsUsed.get(d);for(let E of f){g=!0;let{dirty:N,value:P}=at(E.search,a,m,b);N&&E.invocation(a,P,m,b)}}g&&c.fill(0)};return i?(s.context??=i.host,"adoptedStyleSheets"in i?this.adoptedStyleSheets.length&&(i.adoptedStyleSheets=[...i.adoptedStyleSheets,...this.adoptedStyleSheets]):this.stylesFragment.hasChildNodes()&&n.prepend(this.stylesFragment.cloneNode(!0))):s.context??=o,t!==this.interpolateOptions.defaults&&p(t,e),i&&(i.append(n),customElements.upgrade(i)),p.target=o,p.byProp=(m,b,g)=>{var E,N;if(!((E=this.actionsByPropsUsed)!=null&&E.has(m)))return;let S=!1;if((N=this.searchByQuery)!=null&&N.has(m)){S=!0;let P=this.searchByQuery.get(m);if(u[P.cacheIndex]===b)return;u[P.cacheIndex]=b,c[P.searchIndex]=3}let d,f=this.actionsByPropsUsed.get(m);for(let P of f)if(P.search.query===m)P.invocation(a,b);else{d??={[m]:b},g??=d,S=!0;let _=at(P.search,a,d,g);_.dirty&&P.invocation(a,_.value,d,g)}S&&c.fill(0)},p.state=a,p}#s(t,e,s,n){var _,T;let{nodeValue:i,nodeName:o,nodeType:a}=t,l,h;if(a===Node.ATTRIBUTE_NODE?l=t:h=t,n==null){if(!i)return;let y=i.trim();if(!y)return;if(l||(e==null?void 0:e.tagName)==="STYLE"){if(y[0]!=="{")return;let{length:I}=y;if(y[I-1]!=="}")return;n=y.slice(1,-1)}else{let I=y.split(Ut);if(I.length<3)return;if(I.length===3&&!I[0]&&!I[2])n=I[1];else{for(let[C,k]of I.entries())if(C%2){let x=lt();h.before(x),this.#s(x,e,s,k)}else k&&h.before(k);return!0}}}let c=n,u=n[0]==="!",p=!1;u&&(n=n.slice(1),p=n[0]==="!",p&&(n=n.slice(1)));let m,b;if(h){e!==h.parentElement&&(e=h.parentElement),b=0;let y=h;for(;y=y.previousSibling;)b++}else if(e!==l.ownerElement&&(e=l.ownerElement),o.startsWith("on")){let y=o.indexOf("-");if(y===-1)return;m=y===2}if(m){e.removeAttribute(o);let y=this.#e(e),I=o.slice(3),[,C,k]=I.match(/^([*1~]+)?(.*)$/),x,v,w=[];if(n.startsWith("#"))x=K.get(n).fn;else{let O=n.split(".");O.length===1?(v=n,w=[]):(v=O[0],w=O)}this.addCompositionEventListener({tag:y,type:k,handleEvent:x,prop:v,deepProp:w,once:C==null?void 0:C.includes("1"),passive:C==null?void 0:C.includes("~"),capture:C==null?void 0:C.includes("*")});return}let g;if((_=this.searchByQuery)!=null&&_.has(c))g=this.searchByQuery.get(c);else{let y=n,I=y!==c,C;if(I&&((T=this.searchByQuery)!=null&&T.has(y)))C=this.searchByQuery.get(y);else{let k,x,v,w,O,L,W,A;if(n.startsWith("#")){if(A=K.get(n),!A)return;k=A.fn,W=wt,A.props?(x=A.props,v=A.deepProps,w=A.defaultValue??null):w=A.fn}else w=null,s!=null&&s.defaults&&(w=Et(n.split("."),s.defaults)??null),w==null&&(s!=null&&s.injections)&&(w=Vt(n,s.injections));if(!x)if(typeof w=="function"){let M=et.call(this,w,s==null?void 0:s.defaults,s==null?void 0:s.injections),It=new Set([...M.props.this,...M.props.args[0],...M.props.args[1]]),vt=new Set([...M.deepPropStrings.this,...M.deepPropStrings.args[0]]);k=w,w=M.defaultValue,x=[...It],v=[...vt].map(kt=>kt.split(".")),W=wt}else{let M=n.split(".");M.length===1?(O=n,x=[O],W=Wt):(x=[M[0]],L=M,v=[M],W=Dt)}A&&(A.defaultValue=w,A.props=x,A.deepProps=v),C={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:y,defaultValue:w,subSearch:null,prop:O,propsUsed:x,deepProp:L,deepPropsUsed:v,invocation:W,expression:k},this.addSearch(C)}I?(g={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:c,subSearch:C,negate:u,doubleNegate:p,prop:C.prop,deepProp:C.deepProp,propsUsed:C.propsUsed,deepPropsUsed:C.deepPropsUsed,defaultValue:p?!!C.defaultValue:u?!C.defaultValue:C.defaultValue,invocation(k){return this.doubleNegate?!!k:this.negate?!k:k}},this.addSearch(g)):g=C}let S,d=null,f=g.defaultValue;h?d=b:o==="mdw-if"?(S=this.#e(e),e.removeAttribute(o),f=f!=null&&f!==!1):(d=o,o==="id"||f==null||f===!1?e.removeAttribute(o):e.setAttribute(o,f===!0?"":f)),S??=this.#e(e);let E=this._interpolationState.nodeEntry;(!E||E.tag!==S)&&(E={tag:S,textNodes:[]},this._interpolationState.nodeEntry=E,this.nodesToBind.push(E),this._interpolationState.nodeIndex++);let N;if(h)switch(E.textNodes.push(b),this._interpolationState.nodeIndex++,N={nodeIndex:this._interpolationState.nodeIndex,commentIndex:this._interpolationState.commentIndex++,invocation:Bt,defaultValue:f,search:g},typeof f){case"string":h.data=f;break;case"number":h.data=`${f}`;break;default:h.data="";break}else d?N={nodeIndex:this._interpolationState.nodeIndex,attrName:d,defaultValue:f,invocation:jt,search:g}:(N={nodeIndex:this._interpolationState.nodeIndex,commentIndex:this._interpolationState.commentIndex++,defaultValue:f,invocation:Rt,search:g},f||this.postInitActions.push({...N,invocation:Lt}));this.addAction(N),(this.tagsWithBindings??=new Set).add(S)}#e(t){if(!t)return"";let e=t.id;return e?this.allIds.includes(e)||this.allIds.push(e):(e=U(),(this.temporaryIds??=new Set).add(e),this.allIds.push(e),t.id=e),e}#t(t,e){let s=t.getAttribute("mdw-for"),n=s==null?void 0:s.trim();if(!n||n[0]!=="{")return null;let{length:i}=n;if(n[i-1]!=="}")return null;let o=n.slice(1,-1),[a,l]=o.split(/\s+of\s+/);t.removeAttribute("mdw-for");let h=t.ownerDocument.createElement("template");t.replaceWith(h);let c=this.#e(h),u=this._interpolationState.nodeEntry;(!u||u.tag!==c)&&(u={tag:c,textNodes:[]},this._interpolationState.nodeEntry=u,this.nodesToBind.push(u),this._interpolationState.nodeIndex++);let p=new r;p.template.append(t);let m={...e.injections,[a]:null,index:null},b=[l],g={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:null,prop:null,deepProp:null,propsUsed:b,deepPropsUsed:[[l]],defaultValue:{},invocation:null},S={defaultValue:null,nodeIndex:this._interpolationState.nodeIndex,search:g,commentIndex:this._interpolationState.commentIndex++,injections:m,invocation(f,E,N,P){if(!p.adapter){let x=f.nodes[this.nodeIndex],v=F();f.comments[this.commentIndex]=v,x.replaceWith(v),p.adapter=new D({anchorNode:v,composition:p,renderOptions:{target:null,context:f.options.context,store:f.options.store,injections:this.injections}})}let{adapter:_}=p,T=(P??f.options.store)[l];if(!T||T.length===0){_.removeEntries();return}let y=N[l],I={...N},C=p.props.some(x=>x!==l&&x in N);_.startBatch();let k;if(!C&&!(k=Array.isArray(y))){let x=k?y.entries():Object.entries(y);for(let[v,w]of x){if(v==="length"||w===null)continue;let O=+v,L=T[O];I[a]=w,this.injections[a]=L,this.injections.index=O,_.renderData(O,I,P,L,w)}}else{y||delete I[a];for(let[x,v]of T.entries()){let w;if(y){if(!C&&!(x in y)||(w=y[x],w===null))continue;I[a]=w}this.injections[a]=v,this.injections.index=x,_.renderData(x,I,P,v,w)}}_.stopBatch(),_.removeEntries(T.length)}};return p.interpolate({defaults:e.defaults,injections:m}),b.push(...p.props),this.addSearch(g),this.addAction(S),(this.tagsWithBindings??=new Set).add(c),p}interpolate(t){var i;this.interpolateOptions=t,this.cloneable=this.template.cloneNode(!0);let s=document.createTreeWalker(this.cloneable,5),n=s.nextNode();for(;n;){let o=null;switch(n.nodeType){case Node.ELEMENT_NODE:if(o=n,o.tagName==="TEMPLATE"){for(;o.contains(n=s.nextNode()););continue}if(o.tagName==="SCRIPT"){for(;o.contains(n=s.nextNode()););continue}if(o.hasAttribute("mdw-for")){for(;o.contains(n=s.nextNode()););this.#t(o,t);continue}else{let a=o.attributes.id;a&&(this.#s(a,o,t),this.#e(o));for(let l of[...o.attributes].reverse())l.nodeName!=="id"&&this.#s(l,o,t)}break;case Node.TEXT_NODE:if(o=n.parentElement,this.#s(n,o,t)){let a=s.nextNode();n.remove(),n=a;continue}break;default:throw new Error(`Unexpected node type: ${n.nodeType}`)}n=s.nextNode()}"adoptedStyleSheets"in document?this.adoptedStyleSheets=[...ut(this.styles)]:(this.stylesFragment=B(),this.stylesFragment.append(...dt(this.styles))),this.props=this.actionsByPropsUsed?[...this.actionsByPropsUsed.keys()]:[];for(let o of this.allIds)(i=this.tagsWithBindings)!=null&&i.has(o)||this.nodesToBind.push({tag:o,textNodes:[]});this.tags=this.nodesToBind.map(o=>o.tag),this.interpolated=!0}addSearch(t){return this.searches.push(t),t.query&&((this.searchByQuery??=new Map).set(t.query,t),this.initCache[t.cacheIndex]=t.defaultValue),t}addAction(t){let e=this.actionsByPropsUsed??=new Map;for(let s of t.search.propsUsed)e.has(s)?e.get(s).push(t):e.set(s,[t]);return t}};function ge(r,t){return(e,s,n)=>{s==null?n.refs[t].removeAttribute(r):n.refs[t].setAttribute(r,s)}}var Q=class r extends HTMLElement{static elementName;static get observedAttributes(){return this.attrList.keys()}compose(){return this.#t??=new R}static _composition=null;static _props=new Map;static _attrs=new Map;static _propChangedCallbacks=new Map;static _attributeChangedCallbacks=new Map;static _onComposeCallbacks=[];static _onConnectedCallbacks=[];static _onDisconnectedCallbacks=[];static _onConstructedCallbacks=[];static interpolatesTemplate=!0;static supportsElementInternals="attachInternals"in HTMLElement.prototype;static supportsElementInternalsRole=r.supportsElementInternals&&"role"in ElementInternals.prototype;static templatable=null;static defined=!1;static autoRegistration=!0;static registrations=new Map;static expressions=this.set;static methods=this.set;static overrides=this.set;static props=this.observe;static idl=this.prop;static _addCallback(t,e){if(!this.hasOwnProperty(t)){this[t]=[...this[t],e];return}this[t].push(e)}static append(...t){return this._onComposeCallbacks.push(({composition:e})=>{e.append(...t)}),this._addCallback("_onComposeCallbacks",(e=>{let{composition:s}=e;s.append(...t)})),this}static recompose(t){return this._addCallback("_onComposeCallbacks",t),this}static css(t,...e){return this._addCallback("_onComposeCallbacks",(s=>{let{composition:n}=s;typeof t=="string"||Array.isArray(t)?n.append(ft(t,...e)):n.append(t,...e)})),this}static autoRegister(t){return this.hasOwnProperty("defined")&&this.defined?this:(this.register(t),this)}static html(t,...e){return this._addCallback("_onComposeCallbacks",(s=>{let{composition:n}=s;n.append(ot(t,...e))})),this}static extend(t){return t?t(this):class extends this{}}static setStatic(t){return Object.assign(this,t),this}static readonly(t,e){return this.set(t,{...e,writable:!1})}static set(t,e){return Object.defineProperties(this.prototype,Object.fromEntries([...Object.entries(t).map(([s,n])=>(this.undefine(s),[s,{enumerable:s[0]!=="_",configurable:!0,value:n,writable:!0,...e}])),...Object.getOwnPropertySymbols(t).map(s=>[s,{enumerable:!1,configurable:!0,value:t[s],writable:!0,...e}])])),this}static mixin(t){return t(this)}static register(t){return t&&(this.elementName=t),customElements.define(this.elementName,this),r.registrations.set(this.elementName,this),this.defined=!0,this}static get propList(){return this.hasOwnProperty("_props")||(this._props=new Map(this._props)),this._props}static get attrList(){return this.hasOwnProperty("_attrs")||(this._attrs=new Map(this._attrs)),this._attrs}static get propChangedCallbacks(){return this.hasOwnProperty("_propChangedCallbacks")||(this._propChangedCallbacks=new Map([...this._propChangedCallbacks].map(([t,e])=>[t,e.slice()]))),this._propChangedCallbacks}static get attributeChangedCallbacks(){return this.hasOwnProperty("_attributeChangedCallbacks")||(this._attributeChangedCallbacks=new Map([...this._attributeChangedCallbacks].map(([t,e])=>[t,e.slice()]))),this._attributeChangedCallbacks}static prop(t,e){let s=st(this.prototype,t,e),{changedCallback:n,attr:i,reflect:o,watchers:a}=s;return n&&a.push([t,n]),s.changedCallback=function(h,c,u){this._onObserverPropertyChanged.call(this,t,h,c,u)},this.propList.set(t,s),i&&(o===!0||o==="read")&&(s.enumerable||!this.attrList.has(i)||!this.attrList.get(i).enumerable)&&this.attrList.set(i,s),this.onPropChanged(a),this}static define(t){return Object.defineProperties(this.prototype,Object.fromEntries(Object.entries(t).map(([e,s])=>(this.undefine(e),[e,{enumerable:e[0]!=="_",configurable:!0,...typeof s=="function"?{get:s}:s}])))),this}static undefine(t){if(Reflect.deleteProperty(this.prototype,t),this.propList.has(t)){let{watchers:e,attr:s,reflect:n}=this.propList.get(t);if(e.length&&this.propChangedCallbacks.has(t)){let i=this.propChangedCallbacks.get(t);for(let[o,a]of e){let l=i.indexOf(a);l!==-1&&i.splice(l,1)}}s&&(n===!0||n==="read")&&this.attrList.delete(s),this.propList.delete(t)}return this}static observe(t){for(let[e,s]of Object.entries(t??{})){let n=typeof s=="function"?{reflect:!1,get:s}:s;this.prop(e,n)}return this}static defineStatic(t){for(let[e,s]of Object.entries(t??{}))st(this,e,{reflect:!1,...typeof s=="function"?{get:s}:typeof s=="string"?{type:s}:s});return this}static events(t,e){return this.on({composed({composition:s}){for(let[n,i]of Object.entries(t)){let[,o,a]=n.match(/^([*1~]+)?(.*)$/),l,h=[];if(typeof i=="string"){let c=i.split(".");c.length===1?(l=i,h=[]):(l=c[0],h=c)}s.addCompositionEventListener({type:a,once:o==null?void 0:o.includes("1"),passive:o==null?void 0:o.includes("~"),capture:o==null?void 0:o.includes("*"),...typeof i=="function"?{handleEvent:i}:typeof i=="string"?{prop:l,deepProp:h}:i,...e})}}}),this}static childEvents(t,e){for(let[s,n]of Object.entries(t))this.events(n,{tag:j(s),...e});return this}static rootEvents(t,e){return this.events(t,{tag:R.shadowRootTag,...e})}static on(t,e){let s=typeof t=="string"?{[t]:e}:t;for(let[n,i]of Object.entries(s)){let o;switch(n){case"composed":o="_onComposeCallbacks";break;case"constructed":o="_onConstructedCallbacks";break;case"connected":o="_onConnectedCallbacks";break;case"disconnected":o="_onDisconnectedCallbacks";break;case"props":this.onPropChanged(i);continue;case"attrs":this.onAttributeChanged(i);continue;default:if(n.endsWith("Changed")){let a=n.slice(0,n.length-7);this.onPropChanged({[a]:i});continue}throw new Error("Invalid callback name")}this._addCallback(o,i)}return this}static onPropChanged(t){let e=Array.isArray(t)?t:Object.entries(t),{propChangedCallbacks:s}=this;for(let[n,i]of e)s.has(n)?s.get(n).push(i):s.set(n,[i]);return this}static onAttributeChanged(t){let e=Array.isArray(t)?t:Object.entries(t),{attributeChangedCallbacks:s}=this;for(let[n,i]of e)s.has(n)?s.get(n).push(i):s.set(n,[i]);return this}#n;#s=new Map;#e=new Map;#t;#r=!1;#i=[];_propAttributeCache;_callbackArguments=null;constructor(...t){super(),r.supportsElementInternals&&(this.elementInternals=this.attachInternals()),this.attachShadow({mode:"open",delegatesFocus:this.delegatesFocus}),this.render=this.composition.render(this.constructor.prototype,this,{defaults:this.constructor.prototype,store:this,shadowRoot:this.shadowRoot,context:this});for(let e of this.static._onConstructedCallbacks)e.call(this,this.callbackArguments)}propChangedCallback(t,e,s,n=s){this.#r?this.#i.push([t,n,this]):this.render.byProp(t,n,this);let{_propChangedCallbacks:i}=this.static;if(i.has(t))for(let o of i.get(t))o.call(this,e,s,n,this)}attributeChangedCallback(t,e,s){let{attributeChangedCallbacks:n}=this.static;if(n.has(t))for(let c of n.get(t))c.call(this,e,s,this);let{attrList:i}=this.static;if(!i.has(t))return;let o=i.get(t);if(o.attributeChangedCallback){o.attributeChangedCallback.call(this,t,e,s);return}let a;if(this.attributeCache.has(t)&&(a=this.attributeCache.get(t),a.stringValue===s))return;let l=this[o.key],h=s===null?o.nullParser(s):o.type==="boolean"?!0:o.parser(s);h!==l&&(a?(a.stringValue=s,a.parsedValue=h):this.attributeCache.set(t,{stringValue:s,parsedValue:h}),this[o.key]=h)}get#o(){var t;return(t=this.#t)==null?void 0:t.template}_onObserverPropertyChanged(t,e,s,n){let{propList:i}=this.static;if(i.has(t)){let{reflect:o,attr:a}=i.get(t);if(a&&(o===!0||o==="write")){let l,h=!1,{attributeCache:c}=this;if(c.has(a)?(l=c.get(a),h=l.parsedValue!==s):(l={},c.set(a,l),h=!0),h){let u=gt(s);l.parsedValue=s,l.stringValue=u,u==null?this.removeAttribute(a):this.setAttribute(a,u)}}}this.propChangedCallback(t,e,s,n)}patch(t){this.#r=!0,Y(this,t);for(let[e,s,n]of this.#i)e in t||this.render.byProp(e,s,n);this.#i.slice(0,this.#i.length),this.render(t),this.#r=!1}get refs(){return this.#n??=new Proxy({},{get:(t,e)=>{this.#t;let s=this.composition,n;if(!s.interpolated){if(this.#e.has(e)&&(n=this.#e.get(e).deref(),n))return n;let a=j(e);return n=s.template.getElementById(a),n?(this.#e.set(e,new WeakRef(n)),n):null}if(this.#s.has(e)&&(n=this.#s.get(e).deref(),n))return n;let i=j(e),o=this.composition.tags.indexOf(i);return n=this.render.state.refs[o],n?(this.#s.set(e,new WeakRef(n)),n):null}})}get attributeCache(){return this._propAttributeCache??=new Map}get static(){return this.constructor}get unique(){return!1}get callbackArguments(){return this._callbackArguments??={composition:this.#t,refs:this.refs,html:ot.bind(this),inline:rt,template:this.#o,element:this}}get composition(){if(this.#t)return this.#t;if(!this.unique&&this.static.hasOwnProperty("_composition"))return this.#t=this.static._composition,this.static._composition;this.compose();for(let t of this.static._onComposeCallbacks)t.call(this,this.callbackArguments);return this.unique||(this.static._composition=this.#t),this.#t}connectedCallback(){for(let t of this.static._onConnectedCallbacks)t.call(this,this.callbackArguments)}disconnectedCallback(){for(let t of this.static._onDisconnectedCallbacks)t.call(this,this.callbackArguments)}};Q.prototype.delegatesFocus=!1;export{ge as cloneAttributeCallback,Q as default};
|
|
1
|
+
var De,Ue;function me(){return(De??=new Text).cloneNode()}function W(){return(Ue??=new Comment).cloneNode()}function Ve(i){var e,t;return(e=i==null?void 0:i.matches)!=null&&e.call(i,":focus")?i:(t=i==null?void 0:i.querySelector)==null?void 0:t.call(i,":focus")}function qe(i){i&&i.isConnected&&!i.matches(":focus")&&i.focus()}function ye(i,e){var n;let t=Ve(i);e?e.before(i):(n=i.parentNode)==null||n.append(i),qe(t)}var $e=typeof Element.prototype.moveBefore=="function",q=class{constructor(e){this.anchorNode=e.anchorNode,this.metadata=[],this.keys=[],this.needsArrayKeyFastPath=!1,this.composition=e.composition,this.renderOptions=e.renderOptions,this.metadataCache=null,this.queuedElements=[],this.batchStartIndex=null,this.batchEndIndex=null}render(e,t){return this.composition.render(e,t,this.renderOptions)}startBatch(){this.needsArrayKeyFastPath=!0}writeBatch(){var t;if(!this.queuedElements.length)return;(((t=this.metadata[this.batchStartIndex-1])==null?void 0:t.domNode)??this.anchorNode).after(...this.queuedElements),this.queuedElements.length=0}stopBatch(){if(this.writeBatch(),this.needsArrayKeyFastPath=!1,this.batchStartIndex=null,this.batchEndIndex=null,this.metadataCache){for(let{domNode:e}of this.metadataCache.values())e.remove();this.metadataCache.clear()}}removeByIndex(e){let[t]=this.metadata.splice(e,1),{domNode:n,key:s}=t;this.keys.splice(e,1),n.remove(),this.metadataCache?this.metadataCache.set(s,t):this.metadataCache=new Map([[s,t]])}renderData(e,t,n,s,r,o){var l;if(e<this.metadata.length){let u=this.metadata[e],p=u.key,x=p===s,g=r!==s;if(x){g?u.render(t,n):o||u.render(t,n);return}let y=this.metadataCache??=new Map,h=!1;this.needsArrayKeyFastPath&&(h=!this.keys.includes(s),this.needsArrayFastPath=!1);let f=h?-1:this.keys.indexOf(s,e+1);if(f===-1){if(y.has(s)){let d=y.get(s);this.metadata.splice(e,0,d),this.keys.splice(e,0,s),(((l=this.metadata[e-1])==null?void 0:l.domNode)??this.anchorNode).after(d.domNode),y.delete(s);return}y.set(p,u)}else{if(e-f===-1){this.removeByIndex(e);return}let d=this.metadata[f];this.metadata[e]=d,this.metadata[f]=u;let{domNode:m}=u,b=m.parentNode,w=d.domNode.nextSibling;$e?(b.moveBefore(d.domNode,m),w&&b.moveBefore(m,w)):(ye(d.domNode,m),w&&ye(m,w)),o||d.render(t,n),this.keys[e]=s,this.keys[f]=p;return}}let a=this.render(t,n),c=a.target;this.metadata[e]={render:a,element:c,key:s,domNode:c},this.keys[e]=s,(this.batchEndIndex===null||this.batchEndIndex!==e-1)&&(this.writeBatch(),this.batchStartIndex=e),this.batchEndIndex=e,this.queuedElements.push(c)}removeEntries(e=0){let{length:t}=this.metadata;for(let n=t-1;n>=e;n--){let s=this.metadata[n];!s||!s.domNode||s.domNode.remove()}this.metadata.length=e,this.keys.length=e}hide(e,t,n){if(!t&&(e==null&&(e=this.keys.indexOf(n)),t=this.metadata[e],!t)||t.hidden)return!1;let{comment:s,element:r}=t;return s||(s=W(),t.comment=s),r.replaceWith(s),t.domNode=s,t.hidden=!0,!0}show(e,t,n){if(!t&&(e==null&&(e=this.keys.indexOf(n)),t=this.metadata[e],!t)||!t.hidden)return!1;let{comment:s,element:r}=t;return s.replaceWith(r),t.domNode=r,t.hidden=!1,!0}};var ee=new Map;function G(i,e=!0){if(e&&ee.has(i))return ee.get(i);let t=new CSSStyleSheet;return t.replaceSync(i),e&&ee.set(i,t),t}var te=new Map,be;function He(i,e=!0){let t;return e&&te.has(i)?t=te.get(i):(be??=document.implementation.createHTMLDocument(),t=be.createElement("style"),t.textContent=i,e&&te.set(i,t)),t.cloneNode(!0)}var Q;function ge(i,e=!0){if(Q==null)try{let t=G(i,e);return Q=!0,t}catch{Q=!1}return Q?G(i,e):He(i,e)}function*xe(i,e=!0){for(let t of i)t instanceof HTMLStyleElement?yield G(t.textContent,e):t.ownerNode?yield G([...t.cssRules].map(n=>n.cssText).join(""),e):yield t}var ne=new WeakMap;function*Ce(i,e=!0){for(let t of i)if(t instanceof HTMLStyleElement)yield t;else if(t.ownerNode instanceof HTMLStyleElement)yield t.ownerNode.cloneNode(!0);else if(e&&ne.has(t))yield ne.get(t).cloneNode(!0);else{let n=document.createElement("style");n.textContent=[...t.cssRules].map(s=>s.cssText).join(""),e&&ne.set(t,n),yield n.cloneNode(!0)}}function Se(i,...e){return ge(typeof i=="string"?i:String.raw({raw:i},...e))}function Ie(i){switch(i){case void 0:case null:case!1:return null;case!0:return"";default:return`${i}`}}var X;function D(i){if(X??=new Map,X.has(i))return X.get(i);let e=i.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);return X.set(i,e),e}var we,Ke=Number.parseFloat((we=navigator.userAgent.match(/Chrome\/([\d.]+)/))==null?void 0:we[1]),Pe,ut=Number.parseFloat((Pe=navigator.userAgent.match(/Firefox\/([\d.]+)/))==null?void 0:Pe[1]),ke,dt=Ke||!navigator.userAgent.includes("AppleWebKit")?Number.NaN:Number.parseFloat((ke=navigator.userAgent.match(/Version\/([\d.]+)/))==null?void 0:ke[1]);function Ee(i,e){if(i===e)return i;if(Array.isArray(e)||i==null||e==null||typeof e!="object")return e;typeof i!="object"&&(i={});for(let[t,n]of Object.entries(e))n==null?t in i&&delete i[t]:i[t]=Ee(i[t],n);return i}function Ne(i,e){if(i===e)return i;let t=e!=null&&typeof e=="object"&&!Array.isArray(e),n=i!=null&&typeof i=="object"&&!Array.isArray(i);if(!t||!n)return e;for(let[s,r]of Object.entries(e))r==null?s in i&&delete i[s]:i[s]=Ne(i[s],r);return i}function ve(i,e,t="reference"){switch(t){case"clone":case"object":return Ee(i,e);default:return Ne(i,e)}}function _e(i,e){if(i===e)return null;if(e==null||typeof e!="object")return e;if(i==null||typeof i!="object")return structuredClone(e);let t={};if(Array.isArray(e))return e;let n=new Set(Object.keys(i));for(let[s,r]of Object.entries(e)){if(n.delete(s),r===null){t[s]=null;continue}if(r==null)continue;let o=_e(i[s],r);o!==null&&(t[s]=o)}for(let s of n)t[s]=null;return t}function Ae(i,e){if(i===e)return null;if(e==null||typeof e!="object")return e;if(i==null||typeof i!="object")return structuredClone(e);let t={};if(Array.isArray(e))return structuredClone(e);let n=new Set(Object.keys(i));for(let[s,r]of Object.entries(e)){if(n.delete(s),r===null){t[s]=null;continue}if(r==null)continue;let o=Ae(i[s],r);o!==null&&(t[s]=o)}for(let s of n)t[s]=null;return t}function se(i,e){if(i===e)return null;if(e==null||typeof e!="object")return e;if(i==null||typeof i!="object")return structuredClone(e);let t={};if(Array.isArray(e)){for(let[s,r]of e.entries()){if(r===null){t[s]=null;continue}if(r==null)continue;let o=se(i[s],r);o!==null&&(t[s]=o)}return e.length!==i.length&&(t.length=e.length),t}let n=new Set(Object.keys(i));for(let[s,r]of Object.entries(e)){if(n.delete(s),r===null){t[s]=null;continue}if(r==null)continue;let o=se(i[s],r);o!==null&&(t[s]=o)}for(let s of n)t[s]=null;return t}function Oe(i,e,t="reference"){switch(t){case"clone":return Ae(i,e);case"object":return se(i,e);default:return _e(i,e)}}function ie(i,e){if(i===e)return!1;if(e==null||typeof e!="object"||i!=null&&typeof i!="object")return!0;for(let[t,n]of Object.entries(e))if(n==null){if(t in i)return!0}else if(ie(i[t],n))return!0;return!1}function Qe(i,e){return Array.isArray(e)?i!==e:ie(i,e)}function Me(i,e,t="reference"){switch(t){case"clone":case"object":return Qe(i,e);default:return ie(i,e)}}function je(i){switch(i){case"boolean":return!1;case"integer":case"float":case"number":return 0;case"map":return new Map;case"set":return new Set;case"array":return[];case"proxy":case"object":return null;default:case"string":return""}}function re(i,e,t,n){return i??={},new Proxy(i,{get(s,r){let o=s[r];if(typeof r!="symbol"){let a=n?`${n}.${r}`:r;if(n?t.add(a):e.add(a),typeof o=="object"&&o!=null)return re(o,e,t,a)}return o},has(s,r){let o=Reflect.has(s,r);if(typeof r!="symbol"){let a=n?`${n}.${r}`:r;n?t.add(a):e.add(a)}return o}})}var Y=new WeakMap,oe=new WeakMap;function Ge(i){if(i==null||typeof i!="object")return null;let e=oe.get(i);if(!e){let t=new Set;e={subscribe(n){t.add(n)},unsubscribe(n){t.delete(n)},emit(n){for(let s of t)s(n)}},oe.set(i,e)}return e}function z(i,e){let t={},n=t;for(let s=0;s<i.length-1;s++)n[i[s]]={},n=n[i[s]];return n[i.at(-1)]=e,t}function Te(i,e,t,n,s){if(i==null||typeof i!="object")return i;let r=Ge(i);s||(s=r);let o=Y.get(i);if(o||(o=new Map,Y.set(i,o)),o.has(n))return o.get(n);let a=new Proxy(i,{get(c,l){if(typeof l=="symbol")return c[l];let u=c[l];return Te(u,e,t.concat(l),n,s)},set(c,l,u){if(c[l]=u,typeof l!="symbol"){let p=z(t.concat(l),u);if(e(p),s==null||s.emit(p),r&&r!==s){let x=z([l],u);r.emit(x)}}return!0},deleteProperty(c,l){if(typeof l!="symbol"){let u=z(t.concat(l),null);if(e(u),s==null||s.emit(u),r&&r!==s){let p=z([l],null);r.emit(p)}}return Reflect.deleteProperty(c,l)}});return Y.set(a,o),r&&oe.set(a,r),o.set(n,a),a}function Xe(i){switch(i){case"boolean":return e=>!!e;case"integer":return Math.round;case"float":case"number":return e=>+e;case"map":return Map;case"set":return Set;case"object":case"array":case"proxy":return e=>e;default:case"string":return e=>`${e}`}}function ae(i,...e){let t=new Set,n=new Set,s=e.map(c=>{let l=new Set,u=new Set,p=re(c,l,u);return{poked:l,pokedDeep:u,proxy:p}}),r=re(this??{},t,n),o=i.apply(r,s.map(c=>c.proxy)),a=i.name?!0:!t.size;return{props:{this:[...t],args:s.map(c=>[...c.poked])},deepPropStrings:{this:[...n],args:s.map(c=>[...c.pokedDeep])},deepProps:{this:[...n].map(c=>c.split(".")),args:s.map(c=>[...c.pokedDeep].map(l=>l.split(".")))},defaultValue:o,reusable:a}}function ze(){return null}function Ye(i,e,t){let n=typeof e=="string"?{type:e}:e,{watchers:s,value:r,readonly:o,empty:a,type:c,enumerable:l,reflect:u,attr:p,nullable:x,parser:g,nullParser:y,get:h,is:f,diff:d,props:m}=n;if(s??=[],o??=!1,a===void 0&&(a=null),r??=a,h&&!m){let b=ae(h.bind(t),t,()=>r);r??=b.defaultValue,m=new Set([...b.props.this,...b.props.args[0]])}if(!c)if(r==null)c="string";else{let b=typeof r;c=b==="number"?Number.isInteger(r)?"integer":"float":b}return l??=i[0]!=="_",x??=c==="boolean"?!1:a==null,x||(a??=je(c),r??=a),u??=l?c!=="object":p?"write":!1,p??=u?D(i):null,g??=Xe(c),y||(x?y=ze:y=a===null?()=>je(c):()=>a),f??=c==="object"||c==="proxy"?(b,w)=>!Me(b,w):c==="array"?()=>!1:Object.is,d===void 0&&(d=c==="object"?(b,w)=>Oe(b,w):null),{...n,type:c,is:f,diff:d,attr:p,reflect:u,readonly:o,enumerable:l,value:r,parser:g,nullParser:y,key:i,props:m,watchers:s}}function $(i,e,t){var r,o;i.get;let n=t==null?i.nullParser.call(this,t):i.parser.call(this,t),s=n;if(e==null){if(n==null)return!1}else if(n!=null){if(i.diff){if(s=i.diff.call(this,e,n),s==null)return!1}else if(i.is.call(this,e,n))return!1}return i.values?i.values.set(this,n):i.values=new WeakMap([[this,n]]),(r=i.propChangedCallback)==null||r.call(this,i.key,e,n,s),(o=i.changedCallback)==null||o.call(this,e,n,s),!0}function ce(i,e,t){let n=Ye(e,t,i);function s(h){if(n.type!=="proxy"||h==null||typeof h!="object")return h;let f=Y.get(h);if(f&&f.has(this))return f.get(this);let d=this;return Te(h,b=>{var P,j,T;let w=((P=n.values)==null?void 0:P.get(d))??h;(j=n.propChangedCallback)==null||j.call(d,n.key,w,w,b),(T=n.changedCallback)==null||T.call(d,w,w,b)},[],d,null)}function r(){var h;return(h=n.values)!=null&&h.has(this)?n.values.get(this):n.value}function o(){var f;if((f=n.values)!=null&&f.has(this))return n.values.get(this);let h=s.call(this,n.value);return h!==n.value&&(n.values?n.values.set(this,h):n.values=new WeakMap([[this,h]])),h}function a(h){var d;if(i===this&&((d=this==null?void 0:this.constructor)==null?void 0:d.prototype)===this)return;let f=this[e];$.call(this,n,f,h)}function c(h){var m;if(i===this&&((m=this==null?void 0:this.constructor)==null?void 0:m.prototype)===this)return;let f=this[e],d=s.call(this,h);$.call(this,n,f,d)}function l(){var d,m;let h=(d=n.computedValues)==null?void 0:d.get(this),f=this[e];(m=n.needsSelfInvalidation)==null||m.delete(this),$.call(this,n,h,f)}if(n.props)for(let h of n.props)n.watchers.push([h,l]);function u(){let h=n.get.call(this,this,r.bind(this));return(n.computedValues??=new WeakMap).set(this,h),h}function p(){let h=n.get.call(this,this,o.bind(this)),f=s.call(this,h);return(n.computedValues??=new WeakMap).set(this,f),f}function x(h){n.needsSelfInvalidation?n.needsSelfInvalidation.add(this):n.needsSelfInvalidation=new WeakSet([this]);let f=this[e];n.set.call(this,h,a.bind(this));let d=this[e];n.needsSelfInvalidation.has(this)&&(n.needsSelfInvalidation.delete(this),$.call(this,n,f,d))}function g(h){n.needsSelfInvalidation?n.needsSelfInvalidation.add(this):n.needsSelfInvalidation=new WeakSet([this]);let f=this[e];n.set.call(this,h,c.bind(this));let d=this[e];n.needsSelfInvalidation.has(this)&&(n.needsSelfInvalidation.delete(this),$.call(this,n,f,d))}let y={enumerable:n.enumerable,configurable:!0,get:n.get?n.type==="proxy"?p:u:n.type==="proxy"?o:r,set:n.set?n.type==="proxy"?g:x:n.type==="proxy"?c:a};return Object.defineProperty(i,e,y),n}var Fe=new Set;function H(i="mdw_",e=4){let t;for(;Fe.has(t=Math.random().toString(36).slice(2,e+2)););return Fe.add(t),`${i}${t}`}var le,Be,Re;function U(i){return le??=document.implementation.createHTMLDocument(),i?(Re??=le.createRange(),Re.createContextualFragment(i)):(Be??=le.createDocumentFragment(),Be.cloneNode())}var Z=new Map;function ue(i){let e=`#${H()}`;return Z.set(e,{fn:i}),`{${e}}`}var he=new Map;function de(i,...e){let t,n=e.map(o=>{switch(typeof o){case"string":return o;case"function":return ue(o);case"object":{if(o==null)return"";let a=H();return t??=new Map,t.set(a,o),`<div id="${a}"></div>`}default:throw new Error(`Unexpected substitution: ${o}`)}}),s=String.raw({raw:i},...n);if(t){let o=U(s);for(let[a,c]of t)o.getElementById(a).replaceWith(c);return o}let r;return he.has(s)?r=he.get(s):(r=U(s),he.set(s,r)),r.cloneNode(!0)}function Ze({nodes:i},e){let{nodeIndex:t,attrName:n}=this,s=i[t];switch(e){case void 0:case null:case!1:return s.removeAttribute(n),!1;case!0:return s.setAttribute(n,""),"";default:return s.setAttribute(n,e),e}}function Je({nodeStates:i,comments:e,nodes:t},n){let{commentIndex:s,nodeIndex:r}=this,o=i[r],a=o&1;if(!(n!=null&&n!==!1)){if(a)return;let p=e[s];p||(p=W(),e[s]=p),t[r].replaceWith(p),i[r]|=1;return}let l=t[r],u=o&2;if(typeof n!="object")if(u){let p=new Text(n);l.replaceWith(p),t[r]=p,i[r]&=-3}else l.data=n;a&&(e[s].replaceWith(l),i[r]&=-2)}function et({nodeStates:i,nodes:e,comments:t},n){let{commentIndex:s,nodeIndex:r}=this,o=i[r]&1,a=n!=null&&n!==!1;if(a===!o)return;let c=e[r],l=t[s];l||(l=W(),t[s]=l),a?(l.replaceWith(c),i[r]&=-2):(c.replaceWith(l),i[r]|=1)}function tt({comments:i,nodeStates:e,nodes:t}){let{commentIndex:n,nodeIndex:s}=this,r=W();i[n]=r,e[s]|=1,t[s].replaceWith(r)}function fe(i,...e){let[{caches:t,searchStates:n}]=e,{cacheIndex:s,searchIndex:r,subSearch:o,invocation:a}=i,c=t[s],l=n[r];if(l&1)return{value:c,dirty:(l&2)===2};n[r]|=1;let u;if(a){if(o){let p=fe(o,...e);if(!p.dirty&&c!==void 0)return n[r]&=-3,{value:c,dirty:!1};u=i.invocation(p.value)}else u=i.invocation(...e);if(u===void 0||c===u)return{value:u,dirty:!1}}return t[s]=u,n[r]|=2,{value:u,dirty:!0}}function We({options:{context:i,store:e,injections:t}},n,s){return this.expression.call(i,e??s,t)}function nt(i,e){return e[this.prop]}function st(i,e,t){let n=e;for(let s of this.deepProp){if(n===null)return null;if(!(s in n))return;n=n[s]}return n}var it=/{([^}]*)}/g;function rt(i,e){if(e)return e[i]}function K(i,e){if(!e)return;let t=e,n;for(n of i)if(typeof t=="object"){if(t===null)return null;if(!(n in t))return;t=t[n]}else return t[n];return t}function ot(i,e){let t=e;for(let n of i.split("."))if(!n||(t=t[n],t==null))return null;return t===e?null:t}var Le=new Map,V=class i{static EVENT_PREFIX_REGEX=/^([*1~]+)?(.*)$/;_interpolationState={nodeIndex:-1,searchIndex:0,cacheIndex:0,commentIndex:0,adapterIndex:0,nodeEntry:null};static shadowRootTag=Symbol();nodesToBind=[];props=[];searches=[];initCache=[];searchByQuery;actionsByPropsUsed;postInitActions=[];tagsWithBindings;tags=[];adapter;events;cloneable;styles=[];adoptedStyleSheets=[];stylesFragment;allIds=[];temporaryIds;interpolated=!1;constructor(...e){this.template=U(),this.append(...e)}*[Symbol.iterator](){for(let e of this.styles)yield e;yield this.template}static compose(...e){for(let[n,s]of Le)if(n.length===e.length&&e.every((r,o)=>r===n[o]))return s;let t=new i(...e);return Le.set(e,t),t}append(...e){for(let t of e)typeof t=="string"?this.append(U(t.trim())):t instanceof i?this.append(...t):t instanceof DocumentFragment?this.template.append(t):(t instanceof CSSStyleSheet||t instanceof HTMLStyleElement)&&this.styles.push(t);return this}addCompositionEventListener(e){let t=e.tag??"",n=this.events??=new Map;return n.has(t)?n.get(t).push(e):n.set(t,[e]),this}#s(e,t,n){var s;if((s=this.events)!=null&&s.has(e))for(let r of this.events.get(e)){let o;r.handleEvent?o=r.handleEvent:r.deepProp.length?o=K(r.deepProp,this.interpolateOptions.defaults):o=rt(r.prop,this.interpolateOptions.defaults),t.addEventListener(r.type,n?o.bind(n):o,r)}}render(e,t,n={}){this.interpolated||this.interpolate({defaults:t??e,...n});let s=this.cloneable.cloneNode(!0),r=n.shadowRoot,o=r??n.target??s.firstElementChild,a={lastChildNode:null,lastChildNodeIndex:0,lastElement:null,nodeStates:new Uint8Array(this._interpolationState.nodeIndex+1),searchStates:new Uint8Array(this._interpolationState.searchIndex),comments:[],nodes:[],caches:this.initCache.slice(),refs:[],adapters:[],options:n},{nodes:c,refs:l,searchStates:u,caches:p}=a;for(let{tag:g,textNodes:y}of this.nodesToBind){let h;if(g===""){if(!y.length)continue;l.push(null),c.push(null),h=s.firstChild}else{let d=s.getElementById(g);if(l.push(d),c.push(d),this.#s(g,d,n.context),!y.length)continue;h=d.firstChild}let f=0;for(let d of y){for(;d!==f;)h=h.nextSibling,f++;c.push(h)}}this.#s("",n.context),this.#s(i.shadowRootTag,n.context.shadowRoot,n.context);for(let g of this.postInitActions)g.invocation(a);let x=(g,y)=>{var f;if(!g)return;let h=!1;for(let d of this.props){if(!((f=this.actionsByPropsUsed)!=null&&f.has(d))||!(d in g))continue;let m=this.actionsByPropsUsed.get(d);for(let b of m){h=!0;let{dirty:w,value:P}=fe(b.search,a,g,y);w&&b.invocation(a,P,g,y)}}h&&u.fill(0)};return r?(n.context??=r.host,"adoptedStyleSheets"in r?this.adoptedStyleSheets.length&&(r.adoptedStyleSheets=[...r.adoptedStyleSheets,...this.adoptedStyleSheets]):this.stylesFragment.hasChildNodes()&&s.prepend(this.stylesFragment.cloneNode(!0))):n.context??=o,e!==this.interpolateOptions.defaults&&x(e,t),r&&(r.append(s),customElements.upgrade(r)),x.target=o,x.byProp=(g,y,h)=>{var b,w;if(!((b=this.actionsByPropsUsed)!=null&&b.has(g)))return;let f=!1;if((w=this.searchByQuery)!=null&&w.has(g)){f=!0;let P=this.searchByQuery.get(g);if(p[P.cacheIndex]===y)return;p[P.cacheIndex]=y,u[P.searchIndex]=3}let d,m=this.actionsByPropsUsed.get(g);for(let P of m)if(P.search.query===g)P.invocation(a,y);else{d??={[g]:y},h??=d,f=!0;let j=fe(P.search,a,d,h);j.dirty&&P.invocation(a,j.value,d,h)}f&&u.fill(0)},x.state=a,x}#n(e,t,n,s){var j,T;let{nodeValue:r,nodeName:o,nodeType:a}=e,c,l;if(a===Node.ATTRIBUTE_NODE?c=e:l=e,s==null){if(!r)return;let E=r.trim();if(!E)return;if(c||(t==null?void 0:t.tagName)==="STYLE"){if(E[0]!=="{")return;let{length:v}=E;if(E[v-1]!=="}")return;s=E.slice(1,-1)}else{let v=E.split(it);if(v.length<3)return;if(v.length===3&&!v[0]&&!v[2])s=v[1];else{for(let[C,S]of v.entries())if(C%2){let N=me();l.before(N),this.#n(N,t,n,S)}else S&&l.before(S);return!0}}}let u=s,p=s[0]==="!",x=!1;p&&(s=s.slice(1),x=s[0]==="!",x&&(s=s.slice(1)));let g,y;if(l){t!==l.parentElement&&(t=l.parentElement),y=0;let E=l;for(;E=E.previousSibling;)y++}else if(t!==c.ownerElement&&(t=c.ownerElement),o.startsWith("on")){let E=o.indexOf("-");if(E===-1)return;g=E===2}if(g){t.removeAttribute(o);let E=this.#t(t),v=o.slice(3),[,C,S]=v.match(/^([*1~]+)?(.*)$/),N,O,k=[];if(s.startsWith("#"))N=Z.get(s).fn;else{let _=s.split(".");_.length===1?(O=s,k=[]):(O=_[0],k=_)}this.addCompositionEventListener({tag:E,type:S,handleEvent:N,prop:O,deepProp:k,once:C==null?void 0:C.includes("1"),passive:C==null?void 0:C.includes("~"),capture:C==null?void 0:C.includes("*")});return}let h;if((j=this.searchByQuery)!=null&&j.has(u))h=this.searchByQuery.get(u);else{let E=s,v=E!==u,C;if(v&&((T=this.searchByQuery)!=null&&T.has(E)))C=this.searchByQuery.get(E);else{let S,N,O,k,_,B,R,A;if(s.startsWith("#")){if(A=Z.get(s),!A)return;S=A.fn,R=We,A.props?(N=A.props,O=A.deepProps,k=A.defaultValue??null):k=A.fn}else k=null,n!=null&&n.defaults&&(k=K(s.split("."),n.defaults)??null),k==null&&(n!=null&&n.injections)&&(k=ot(s,n.injections));if(!N)if(typeof k=="function"){let I=ae.call(this,k,n==null?void 0:n.defaults,n==null?void 0:n.injections),M=new Set([...I.props.this,...I.props.args[0],...I.props.args[1]]),F=new Set([...I.deepPropStrings.this,...I.deepPropStrings.args[0]]);S=k,k=I.defaultValue,N=[...M],O=[...F].map(L=>L.split(".")),R=We}else{let I=s.split(".");I.length===1?(_=s,N=[_],R=nt):(N=[I[0]],B=I,O=[I],R=st)}A&&(A.defaultValue=k,A.props=N,A.deepProps=O),C={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:E,defaultValue:k,subSearch:null,prop:_,propsUsed:N,deepProp:B,deepPropsUsed:O,invocation:R,expression:S},this.addSearch(C)}v?(h={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:u,subSearch:C,negate:p,doubleNegate:x,prop:C.prop,deepProp:C.deepProp,propsUsed:C.propsUsed,deepPropsUsed:C.deepPropsUsed,defaultValue:x?!!C.defaultValue:p?!C.defaultValue:C.defaultValue,invocation(S){return this.doubleNegate?!!S:this.negate?!S:S}},this.addSearch(h)):h=C}let f,d=null,m=h.defaultValue;l?d=y:o==="mdw-if"?(f=this.#t(t),t.removeAttribute(o),m=m!=null&&m!==!1):(d=o,o==="id"||m==null||m===!1?t.removeAttribute(o):t.setAttribute(o,m===!0?"":m)),f??=this.#t(t);let b=this._interpolationState.nodeEntry;(!b||b.tag!==f)&&(b={tag:f,textNodes:[]},this._interpolationState.nodeEntry=b,this.nodesToBind.push(b),this._interpolationState.nodeIndex++);let w;if(l)switch(b.textNodes.push(y),this._interpolationState.nodeIndex++,w={nodeIndex:this._interpolationState.nodeIndex,commentIndex:this._interpolationState.commentIndex++,invocation:Je,defaultValue:m,search:h},typeof m){case"string":l.data=m;break;case"number":l.data=`${m}`;break;default:l.data="";break}else d?w={nodeIndex:this._interpolationState.nodeIndex,attrName:d,defaultValue:m,invocation:Ze,search:h}:(w={nodeIndex:this._interpolationState.nodeIndex,commentIndex:this._interpolationState.commentIndex++,defaultValue:m,invocation:et,search:h},m||this.postInitActions.push({...w,invocation:tt}));this.addAction(w),(this.tagsWithBindings??=new Set).add(f)}#t(e){if(!e)return"";let t=e.id;return t?this.allIds.includes(t)||this.allIds.push(t):(t=H(),(this.temporaryIds??=new Set).add(t),this.allIds.push(t),e.id=t),t}#e(e,t){let n=e.getAttribute("mdw-for"),s=n==null?void 0:n.trim();if(!s||s[0]!=="{")return null;let{length:r}=s;if(s[r-1]!=="}")return null;let o=s.slice(1,-1),[a,c]=o.split(/\s+of\s+/);e.removeAttribute("mdw-for");let l=e.ownerDocument.createElement("template");e.replaceWith(l);let u=this.#t(l),p=this._interpolationState.nodeEntry;(!p||p.tag!==u)&&(p={tag:u,textNodes:[]},this._interpolationState.nodeEntry=p,this.nodesToBind.push(p),this._interpolationState.nodeIndex++);let x=new i;x.template.append(e);let g={...t.injections,[a]:null,index:null},y=c.split("."),h=y.length>1?y:null,f=h?y[0]:c,d=[f],m={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:null,prop:null,deepProp:h,propsUsed:d,deepPropsUsed:h?[h]:[[f]],defaultValue:{},invocation:null},b={defaultValue:null,nodeIndex:this._interpolationState.nodeIndex,search:m,commentIndex:this._interpolationState.commentIndex++,adapterIndex:this._interpolationState.adapterIndex++,injections:g,invocation(P,j,T,E){let v=P.adapters[this.adapterIndex],C=P.options.iterationIndex??0,S;if(!v||!(S=v[C])){let I=P.nodes[this.nodeIndex],M=W();if(P.comments[this.commentIndex])throw new Error("Comment already exists at index");P.comments[this.commentIndex]=M,I.replaceWith(M),S=new q({anchorNode:M,composition:x,renderOptions:{target:null,context:P.options.context,store:P.options.store,injections:this.injections}}),v=P.adapters[this.adapterIndex]??=[],v[C]=S}let N=P.options.injections??this.injections,O=E??P.options.store,k=h?K(h,O):O[f];if(k===void 0&&h&&N&&(k=K(h,N)),!k||k.length===0){S.removeEntries();return}let _=h?K(h,T):T[f];if(_===void 0)return;let B={...T},R=x.props.some(I=>I!==f&&I in T);S.startBatch();let A;if(!R&&!(A=Array.isArray(_))){let I=A?_.entries():Object.entries(_);for(let[M,F]of I){if(M==="length"||F===null)continue;let L=+M,pe=k[L];B[a]=F,N[a]=pe,N.index=L,S.renderOptions.injections=N,S.renderOptions.iterationIndex=L,S.renderData(L,B,E,pe,F)}}else{_||delete B[a];for(let[I,M]of k.entries()){let F;if(_){if(!R&&!(I in _)||(F=_[I],F===null))continue;B[a]=F}N[a]=M,N.index=I,S.renderOptions.injections=N,S.renderOptions.iterationIndex=I,S.renderData(I,B,E,M,F)}}S.stopBatch(),S.removeEntries(k.length)}};return x.interpolate({defaults:t.defaults,injections:g}),d.push(...x.props),this.addSearch(m),this.addAction(b),(this.tagsWithBindings??=new Set).add(u),x}interpolate(e){var r;this.interpolateOptions=e,this.cloneable=this.template.cloneNode(!0);let n=document.createTreeWalker(this.cloneable,5),s=n.nextNode();for(;s;){let o=null;switch(s.nodeType){case Node.ELEMENT_NODE:if(o=s,o.tagName==="TEMPLATE"){for(;o.contains(s=n.nextNode()););continue}if(o.tagName==="SCRIPT"){for(;o.contains(s=n.nextNode()););continue}if(o.hasAttribute("mdw-for")){for(;o.contains(s=n.nextNode()););this.#e(o,e);continue}else{let a=o.attributes.id;a&&(this.#n(a,o,e),this.#t(o));for(let c of[...o.attributes].reverse())c.nodeName!=="id"&&this.#n(c,o,e)}break;case Node.TEXT_NODE:if(o=s.parentElement,this.#n(s,o,e)){let a=n.nextNode();s.remove(),s=a;continue}break;default:throw new Error(`Unexpected node type: ${s.nodeType}`)}s=n.nextNode()}"adoptedStyleSheets"in document?this.adoptedStyleSheets=[...xe(this.styles)]:(this.stylesFragment=U(),this.stylesFragment.append(...Ce(this.styles))),this.props=this.actionsByPropsUsed?[...this.actionsByPropsUsed.keys()]:[];for(let o of this.allIds)(r=this.tagsWithBindings)!=null&&r.has(o)||this.nodesToBind.push({tag:o,textNodes:[]});this.tags=this.nodesToBind.map(o=>o.tag),this.interpolated=!0}addSearch(e){return this.searches.push(e),e.query&&((this.searchByQuery??=new Map).set(e.query,e),this.initCache[e.cacheIndex]=e.defaultValue),e}addAction(e){let t=this.actionsByPropsUsed??=new Map;for(let n of e.search.propsUsed)t.has(n)?t.get(n).push(e):t.set(n,[e]);return e}};function Tt(i,e){return(t,n,s)=>{n==null?s.refs[e].removeAttribute(i):s.refs[e].setAttribute(i,n)}}var J=class i extends HTMLElement{static elementName;static get observedAttributes(){return this.attrList.keys()}compose(){return this.#e??=new V}static _composition=null;static _props=new Map;static _attrs=new Map;static _propChangedCallbacks=new Map;static _attributeChangedCallbacks=new Map;static _onComposeCallbacks=[];static _onConnectedCallbacks=[];static _onDisconnectedCallbacks=[];static _onConstructedCallbacks=[];static interpolatesTemplate=!0;static supportsElementInternals="attachInternals"in HTMLElement.prototype;static supportsElementInternalsRole=i.supportsElementInternals&&"role"in ElementInternals.prototype;static defined=!1;static registrations=new Map;static expressions=this.set;static methods=this.set;static overrides=this.set;static props=this.observe;static idl=this.prop;static _addCallback(e,t){if(!this.hasOwnProperty(e)){this[e]=[...this[e],t];return}this[e].push(t)}static _removeCallback(e,t){this.hasOwnProperty(e)||(this[e]=[...this[e]]),this[e]=this[e].filter(n=>n!==t)}static _removeFromCallbackMap(e,t,n){if(!e.has(t))return;if(!n){e.delete(t);return}let s=e.get(t).filter(r=>r!==n);s.length===0?e.delete(t):e.set(t,s)}static append(...e){return this._onComposeCallbacks.push(({composition:t})=>{t.append(...e)}),this._addCallback("_onComposeCallbacks",(t=>{let{composition:n}=t;n.append(...e)})),this}static recompose(e){return this._addCallback("_onComposeCallbacks",e),this}static css(e,...t){return this._addCallback("_onComposeCallbacks",(n=>{let{composition:s}=n;typeof e=="string"||Array.isArray(e)?s.append(Se(e,...t)):s.append(e,...t)})),this}static autoRegister(e){return this.hasOwnProperty("defined")&&this.defined?this:(this.register(e),this)}static html(e,...t){return this._addCallback("_onComposeCallbacks",(n=>{let{composition:s}=n;s.append(de(e,...t))})),this}static extend(e){return e?e(this):class extends this{}}static setStatic(e){return Object.assign(this,e),this}static readonly(e,t){return this.set(e,{...t,writable:!1})}static set(e,t){return Object.defineProperties(this.prototype,Object.fromEntries([...Object.entries(e).map(([n,s])=>(this.undefine(n),[n,{enumerable:n[0]!=="_",configurable:!0,value:s,writable:!0,...t}])),...Object.getOwnPropertySymbols(e).map(n=>[n,{enumerable:!1,configurable:!0,value:e[n],writable:!0,...t}])])),this}static mixin(e){return e(this)}static register(e){return e&&(this.elementName=e),customElements.define(this.elementName,this),i.registrations.set(this.elementName,this),this.defined=!0,this}static get propList(){return this.hasOwnProperty("_props")||(this._props=new Map(this._props)),this._props}static get attrList(){return this.hasOwnProperty("_attrs")||(this._attrs=new Map(this._attrs)),this._attrs}static get propChangedCallbacks(){return this.hasOwnProperty("_propChangedCallbacks")||(this._propChangedCallbacks=new Map([...this._propChangedCallbacks].map(([e,t])=>[e,t.slice()]))),this._propChangedCallbacks}static get attributeChangedCallbacks(){return this.hasOwnProperty("_attributeChangedCallbacks")||(this._attributeChangedCallbacks=new Map([...this._attributeChangedCallbacks].map(([e,t])=>[e,t.slice()]))),this._attributeChangedCallbacks}static prop(e,t){let n=ce(this.prototype,e,t),{changedCallback:s,attr:r,reflect:o,watchers:a}=n;return s&&a.push([e,s]),n.changedCallback=function(l,u,p){this.#l.call(this,e,l,u,p)},this.propList.set(e,n),r&&(o===!0||o==="read")&&(n.enumerable||!this.attrList.has(r)||!this.attrList.get(r).enumerable)&&this.attrList.set(r,n),this.onPropChanged(a),this}static setPrototype(e,t){return this.prop(e,t),null}static define(e){return Object.defineProperties(this.prototype,Object.fromEntries(Object.entries(e).map(([t,n])=>(this.undefine(t),[t,{enumerable:t[0]!=="_",configurable:!0,...typeof n=="function"?{get:n}:n}])))),this}static undefine(e){if(Reflect.deleteProperty(this.prototype,e),this.propList.has(e)){let{watchers:t,attr:n,reflect:s}=this.propList.get(e);if(t.length&&this.propChangedCallbacks.has(e)){let r=this.propChangedCallbacks.get(e);for(let[o,a]of t){let c=r.indexOf(a);c!==-1&&r.splice(c,1)}}n&&(s===!0||s==="read")&&this.attrList.delete(n),this.propList.delete(e)}return this}static observe(e){for(let[t,n]of Object.entries(e??{})){let s=typeof n=="function"?{reflect:!1,get:n}:n;this.prop(t,s)}return this}static defineStatic(e){for(let[t,n]of Object.entries(e??{}))ce(this,t,{reflect:!1,...typeof n=="function"?{get:n}:typeof n=="string"?{type:n}:n});return this}static events(e,t){return this.on({composed({composition:n}){for(let[s,r]of Object.entries(e)){let[,o,a]=s.match(/^([*1~]+)?(.*)$/),c,l=[];if(typeof r=="string"){let u=r.split(".");u.length===1?(c=r,l=[]):(c=u[0],l=u)}n.addCompositionEventListener({type:a,once:o==null?void 0:o.includes("1"),passive:o==null?void 0:o.includes("~"),capture:o==null?void 0:o.includes("*"),...typeof r=="function"?{handleEvent:r}:typeof r=="string"?{prop:c,deepProp:l}:r,...t})}}}),this}static childEvents(e,t){for(let[n,s]of Object.entries(e))this.events(s,{tag:D(n),...t});return this}static rootEvents(e,t){return this.events(e,{tag:V.shadowRootTag,...t})}static on(e,t){let n=typeof e=="string"?{[e]:t}:e;for(let[s,r]of Object.entries(n)){let o;switch(s){case"composed":o="_onComposeCallbacks";break;case"constructed":o="_onConstructedCallbacks";break;case"connected":o="_onConnectedCallbacks";break;case"disconnected":o="_onDisconnectedCallbacks";break;case"props":this.onPropChanged(r);continue;case"attrs":this.onAttributeChanged(r);continue;default:if(s.endsWith("Changed")){let a=s.slice(0,s.length-7);this.onPropChanged({[a]:r});continue}throw new Error("Invalid callback name")}this._addCallback(o,r)}return this}static off(e,t){let n=typeof e=="string"?{[e]:t}:e;for(let[s,r]of Object.entries(n)){let o;switch(s){case"composed":o="_onComposeCallbacks";break;case"constructed":o="_onConstructedCallbacks";break;case"connected":o="_onConnectedCallbacks";break;case"disconnected":o="_onDisconnectedCallbacks";break;case"props":this.offPropChanged(r);continue;case"attrs":this.offAttributeChanged(r);continue;default:if(s.endsWith("Changed")){let a=s.slice(0,s.length-7);this.offPropChanged({[a]:r});continue}throw new Error("Invalid callback name")}this._removeCallback(o,r)}return this}static offPropChanged(e){let t=Array.isArray(e)?e:Object.entries(e),{propChangedCallbacks:n}=this;for(let[s,r]of t)this._removeFromCallbackMap(n,s,r);return this}static offAttributeChanged(e){let t=Array.isArray(e)?e:Object.entries(e),{attributeChangedCallbacks:n}=this;for(let[s,r]of t)this._removeFromCallbackMap(n,s,r);return this}static onPropChanged(e){let t=Array.isArray(e)?e:Object.entries(e),{propChangedCallbacks:n}=this;for(let[s,r]of t)n.has(s)?n.get(s).push(r):n.set(s,[r]);return this}static onAttributeChanged(e){let t=Array.isArray(e)?e:Object.entries(e),{attributeChangedCallbacks:n}=this;for(let[s,r]of t)n.has(s)?n.get(s).push(r):n.set(s,[r]);return this}#s;#n=new Map;#t=new Map;#e;#r=!1;#i=[];#o;#a=null;constructor(...e){super(),i.supportsElementInternals&&(this.elementInternals=this.attachInternals()),this.attachShadow({mode:"open",delegatesFocus:this.delegatesFocus}),this.render=this.composition.render(this.constructor.prototype,this,{defaults:this.constructor.prototype,store:this,shadowRoot:this.shadowRoot,context:this});for(let t of this.static._onConstructedCallbacks)t.call(this,this.callbackArguments)}propChangedCallback(e,t,n,s=n){this.#r?this.#i.push([e,s,this]):this.render.byProp(e,s,this);let{_propChangedCallbacks:r}=this.static;if(r.has(e))for(let o of r.get(e))o.call(this,t,n,s,this)}attributeChangedCallback(e,t,n){let{attributeChangedCallbacks:s}=this.static;if(s.has(e))for(let u of s.get(e))u.call(this,t,n,this);let{attrList:r}=this.static;if(!r.has(e))return;let o=r.get(e);if(o.attributeChangedCallback){o.attributeChangedCallback.call(this,e,t,n);return}let a;if(this.attributeCache.has(e)&&(a=this.attributeCache.get(e),a.stringValue===n))return;let c=this[o.key],l=n===null?o.nullParser(n):o.type==="boolean"?!0:o.parser(n);l!==c&&(a?(a.stringValue=n,a.parsedValue=l):this.attributeCache.set(e,{stringValue:n,parsedValue:l}),this[o.key]=l)}get#c(){var e;return(e=this.#e)==null?void 0:e.template}#l(e,t,n,s){let{propList:r}=this.static;if(r.has(e)){let{reflect:o,attr:a}=r.get(e);if(a&&(o===!0||o==="write")){let c,l=!1,{attributeCache:u}=this;if(u.has(a)?(c=u.get(a),l=c.parsedValue!==n):(c={},u.set(a,c),l=!0),l){let p=Ie(n);c.parsedValue=n,c.stringValue=p,p==null?this.removeAttribute(a):this.setAttribute(a,p)}}}this.propChangedCallback(e,t,n,s)}get static(){return this.constructor}patch(e){this.#r=!0,ve(this,e,"object");for(let[t,n,s]of this.#i)t in e||this.render.byProp(t,n,s);this.#i.slice(0,this.#i.length),this.render(e),this.#r=!1}get refs(){return this.#s??=new Proxy({},{get:(e,t)=>{let n=this.composition,s;if(!n.interpolated){if(this.#t.has(t)&&(s=this.#t.get(t).deref(),s))return s;let a=D(t);return s=n.template.getElementById(a),s?(this.#t.set(t,new WeakRef(s)),s):null}if(this.#n.has(t)&&(s=this.#n.get(t).deref(),s))return s;let r=D(t),o=this.composition.tags.indexOf(r);return s=this.render.state.refs[o],s?(this.#n.set(t,new WeakRef(s)),s):null}})}get attributeCache(){return this.#o??=new Map}get callbackArguments(){return this.#a??={composition:this.#e,refs:this.refs,html:de.bind(this),inline:ue,template:this.#c,element:this}}get composition(){if(this.#e)return this.#e;if(this.static.hasOwnProperty("_composition"))return this.#e=this.static._composition,this.static._composition;this.compose();for(let e of this.static._onComposeCallbacks)e.call(this,this.callbackArguments);return this.static._composition=this.#e,this.#e}connectedCallback(){for(let e of this.static._onConnectedCallbacks)e.call(this,this.callbackArguments)}disconnectedCallback(){for(let e of this.static._onDisconnectedCallbacks)e.call(this,this.callbackArguments)}};J.prototype.delegatesFocus=!1;export{Tt as cloneAttributeCallback,J as default};
|
|
2
2
|
//# sourceMappingURL=CustomElement.min.js.map
|