@microsoft/fast-element 2.0.0-beta.15 → 2.0.0-beta.16
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/CHANGELOG.json +15 -0
- package/CHANGELOG.md +9 -1
- package/dist/dts/components/element-controller.d.ts +7 -2
- package/dist/esm/components/element-controller.js +23 -13
- package/dist/fast-element.d.ts +7 -2
- package/dist/fast-element.debug.js +23 -13
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +23 -13
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +7 -2
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/fast-element",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Fri, 28 Oct 2022 20:44:44 GMT",
|
|
6
|
+
"tag": "@microsoft/fast-element_v2.0.0-beta.16",
|
|
7
|
+
"version": "2.0.0-beta.16",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "nicholasrice@users.noreply.github.com",
|
|
12
|
+
"package": "@microsoft/fast-element",
|
|
13
|
+
"commit": "5b745b1fb3bf249a7a2d172b7fb69cb08694aadd",
|
|
14
|
+
"comment": "Fixed bug preventing main component stylesheet behaviors from being connected during connectedCallback"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
4
19
|
{
|
|
5
20
|
"date": "Tue, 25 Oct 2022 20:24:32 GMT",
|
|
6
21
|
"tag": "@microsoft/fast-element_v2.0.0-beta.15",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
# Change Log - @microsoft/fast-element
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 28 Oct 2022 20:44:44 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 2.0.0-beta.16
|
|
8
|
+
|
|
9
|
+
Fri, 28 Oct 2022 20:44:44 GMT
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- Fixed bug preventing main component stylesheet behaviors from being connected during connectedCallback (nicholasrice@users.noreply.github.com)
|
|
14
|
+
|
|
7
15
|
## 2.0.0-beta.15
|
|
8
16
|
|
|
9
17
|
Tue, 25 Oct 2022 20:24:32 GMT
|
|
@@ -21,7 +21,13 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
21
21
|
private needsInitialization;
|
|
22
22
|
private hasExistingShadowRoot;
|
|
23
23
|
private _template;
|
|
24
|
-
private
|
|
24
|
+
private stage;
|
|
25
|
+
/**
|
|
26
|
+
* A guard against connecting behaviors multiple times
|
|
27
|
+
* during connect in scenarios where a behavior adds
|
|
28
|
+
* another behavior during it's connectedCallback
|
|
29
|
+
*/
|
|
30
|
+
private guardBehaviorConnection;
|
|
25
31
|
private behaviors;
|
|
26
32
|
private _mainStyles;
|
|
27
33
|
/**
|
|
@@ -53,7 +59,6 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
53
59
|
* connected to the document.
|
|
54
60
|
*/
|
|
55
61
|
get isConnected(): boolean;
|
|
56
|
-
private setIsConnected;
|
|
57
62
|
/**
|
|
58
63
|
* Gets/sets the template used to render the component.
|
|
59
64
|
* @remarks
|
|
@@ -34,7 +34,13 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
34
34
|
this.needsInitialization = true;
|
|
35
35
|
this.hasExistingShadowRoot = false;
|
|
36
36
|
this._template = null;
|
|
37
|
-
this.
|
|
37
|
+
this.stage = 3 /* Stages.disconnected */;
|
|
38
|
+
/**
|
|
39
|
+
* A guard against connecting behaviors multiple times
|
|
40
|
+
* during connect in scenarios where a behavior adds
|
|
41
|
+
* another behavior during it's connectedCallback
|
|
42
|
+
*/
|
|
43
|
+
this.guardBehaviorConnection = false;
|
|
38
44
|
this.behaviors = null;
|
|
39
45
|
this._mainStyles = null;
|
|
40
46
|
/**
|
|
@@ -90,11 +96,7 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
90
96
|
*/
|
|
91
97
|
get isConnected() {
|
|
92
98
|
Observable.track(this, isConnectedPropertyName);
|
|
93
|
-
return this.
|
|
94
|
-
}
|
|
95
|
-
setIsConnected(value) {
|
|
96
|
-
this._isConnected = value;
|
|
97
|
-
Observable.notify(this, isConnectedPropertyName);
|
|
99
|
+
return this.stage === 1 /* Stages.connected */;
|
|
98
100
|
}
|
|
99
101
|
/**
|
|
100
102
|
* Gets/sets the template used to render the component.
|
|
@@ -169,7 +171,9 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
169
171
|
if (count === 0) {
|
|
170
172
|
targetBehaviors.set(behavior, 1);
|
|
171
173
|
behavior.addedCallback && behavior.addedCallback(this);
|
|
172
|
-
if (behavior.connectedCallback &&
|
|
174
|
+
if (behavior.connectedCallback &&
|
|
175
|
+
!this.guardBehaviorConnection &&
|
|
176
|
+
(this.stage === 1 /* Stages.connected */ || this.stage === 0 /* Stages.connecting */)) {
|
|
173
177
|
behavior.connectedCallback(this);
|
|
174
178
|
}
|
|
175
179
|
}
|
|
@@ -193,7 +197,7 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
193
197
|
}
|
|
194
198
|
if (count === 1 || force) {
|
|
195
199
|
targetBehaviors.delete(behavior);
|
|
196
|
-
if (behavior.disconnectedCallback && this.
|
|
200
|
+
if (behavior.disconnectedCallback && this.stage !== 3 /* Stages.disconnected */) {
|
|
197
201
|
behavior.disconnectedCallback(this);
|
|
198
202
|
}
|
|
199
203
|
behavior.removedCallback && behavior.removedCallback(this);
|
|
@@ -254,9 +258,10 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
254
258
|
* Runs connected lifecycle behavior on the associated element.
|
|
255
259
|
*/
|
|
256
260
|
connect() {
|
|
257
|
-
if (this.
|
|
261
|
+
if (this.stage !== 3 /* Stages.disconnected */) {
|
|
258
262
|
return;
|
|
259
263
|
}
|
|
264
|
+
this.stage = 0 /* Stages.connecting */;
|
|
260
265
|
// If we have any observables that were bound, re-apply their values.
|
|
261
266
|
if (this.boundObservables !== null) {
|
|
262
267
|
const element = this.source;
|
|
@@ -270,9 +275,11 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
270
275
|
}
|
|
271
276
|
const behaviors = this.behaviors;
|
|
272
277
|
if (behaviors !== null) {
|
|
278
|
+
this.guardBehaviorConnection = true;
|
|
273
279
|
for (const key of behaviors.keys()) {
|
|
274
280
|
key.connectedCallback && key.connectedCallback(this);
|
|
275
281
|
}
|
|
282
|
+
this.guardBehaviorConnection = false;
|
|
276
283
|
}
|
|
277
284
|
if (this.needsInitialization) {
|
|
278
285
|
this.renderTemplate(this.template);
|
|
@@ -282,16 +289,18 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
282
289
|
else if (this.view !== null) {
|
|
283
290
|
this.view.bind(this.source);
|
|
284
291
|
}
|
|
285
|
-
this.
|
|
292
|
+
this.stage = 1 /* Stages.connected */;
|
|
293
|
+
Observable.notify(this, isConnectedPropertyName);
|
|
286
294
|
}
|
|
287
295
|
/**
|
|
288
296
|
* Runs disconnected lifecycle behavior on the associated element.
|
|
289
297
|
*/
|
|
290
298
|
disconnect() {
|
|
291
|
-
if (
|
|
299
|
+
if (this.stage !== 1 /* Stages.connected */) {
|
|
292
300
|
return;
|
|
293
301
|
}
|
|
294
|
-
this.
|
|
302
|
+
this.stage = 2 /* Stages.disconnecting */;
|
|
303
|
+
Observable.notify(this, isConnectedPropertyName);
|
|
295
304
|
if (this.view !== null) {
|
|
296
305
|
this.view.unbind();
|
|
297
306
|
}
|
|
@@ -301,6 +310,7 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
301
310
|
key.disconnectedCallback && key.disconnectedCallback(this);
|
|
302
311
|
}
|
|
303
312
|
}
|
|
313
|
+
this.stage = 3 /* Stages.disconnected */;
|
|
304
314
|
}
|
|
305
315
|
/**
|
|
306
316
|
* Runs the attribute changed callback for the associated element.
|
|
@@ -323,7 +333,7 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
323
333
|
* Only emits events if connected.
|
|
324
334
|
*/
|
|
325
335
|
emit(type, detail, options) {
|
|
326
|
-
if (this.
|
|
336
|
+
if (this.stage === 1 /* Stages.connected */) {
|
|
327
337
|
return this.source.dispatchEvent(new CustomEvent(type, Object.assign(Object.assign({ detail }, defaultEventOptions), options)));
|
|
328
338
|
}
|
|
329
339
|
return false;
|
package/dist/fast-element.d.ts
CHANGED
|
@@ -663,7 +663,13 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
663
663
|
private needsInitialization;
|
|
664
664
|
private hasExistingShadowRoot;
|
|
665
665
|
private _template;
|
|
666
|
-
private
|
|
666
|
+
private stage;
|
|
667
|
+
/**
|
|
668
|
+
* A guard against connecting behaviors multiple times
|
|
669
|
+
* during connect in scenarios where a behavior adds
|
|
670
|
+
* another behavior during it's connectedCallback
|
|
671
|
+
*/
|
|
672
|
+
private guardBehaviorConnection;
|
|
667
673
|
private behaviors;
|
|
668
674
|
private _mainStyles;
|
|
669
675
|
/**
|
|
@@ -695,7 +701,6 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
695
701
|
* connected to the document.
|
|
696
702
|
*/
|
|
697
703
|
get isConnected(): boolean;
|
|
698
|
-
private setIsConnected;
|
|
699
704
|
/**
|
|
700
705
|
* Gets/sets the template used to render the component.
|
|
701
706
|
* @remarks
|
|
@@ -3593,7 +3593,13 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3593
3593
|
this.needsInitialization = true;
|
|
3594
3594
|
this.hasExistingShadowRoot = false;
|
|
3595
3595
|
this._template = null;
|
|
3596
|
-
this.
|
|
3596
|
+
this.stage = 3 /* Stages.disconnected */;
|
|
3597
|
+
/**
|
|
3598
|
+
* A guard against connecting behaviors multiple times
|
|
3599
|
+
* during connect in scenarios where a behavior adds
|
|
3600
|
+
* another behavior during it's connectedCallback
|
|
3601
|
+
*/
|
|
3602
|
+
this.guardBehaviorConnection = false;
|
|
3597
3603
|
this.behaviors = null;
|
|
3598
3604
|
this._mainStyles = null;
|
|
3599
3605
|
/**
|
|
@@ -3649,11 +3655,7 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3649
3655
|
*/
|
|
3650
3656
|
get isConnected() {
|
|
3651
3657
|
Observable.track(this, isConnectedPropertyName);
|
|
3652
|
-
return this.
|
|
3653
|
-
}
|
|
3654
|
-
setIsConnected(value) {
|
|
3655
|
-
this._isConnected = value;
|
|
3656
|
-
Observable.notify(this, isConnectedPropertyName);
|
|
3658
|
+
return this.stage === 1 /* Stages.connected */;
|
|
3657
3659
|
}
|
|
3658
3660
|
/**
|
|
3659
3661
|
* Gets/sets the template used to render the component.
|
|
@@ -3728,7 +3730,9 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3728
3730
|
if (count === 0) {
|
|
3729
3731
|
targetBehaviors.set(behavior, 1);
|
|
3730
3732
|
behavior.addedCallback && behavior.addedCallback(this);
|
|
3731
|
-
if (behavior.connectedCallback &&
|
|
3733
|
+
if (behavior.connectedCallback &&
|
|
3734
|
+
!this.guardBehaviorConnection &&
|
|
3735
|
+
(this.stage === 1 /* Stages.connected */ || this.stage === 0 /* Stages.connecting */)) {
|
|
3732
3736
|
behavior.connectedCallback(this);
|
|
3733
3737
|
}
|
|
3734
3738
|
}
|
|
@@ -3752,7 +3756,7 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3752
3756
|
}
|
|
3753
3757
|
if (count === 1 || force) {
|
|
3754
3758
|
targetBehaviors.delete(behavior);
|
|
3755
|
-
if (behavior.disconnectedCallback && this.
|
|
3759
|
+
if (behavior.disconnectedCallback && this.stage !== 3 /* Stages.disconnected */) {
|
|
3756
3760
|
behavior.disconnectedCallback(this);
|
|
3757
3761
|
}
|
|
3758
3762
|
behavior.removedCallback && behavior.removedCallback(this);
|
|
@@ -3813,9 +3817,10 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3813
3817
|
* Runs connected lifecycle behavior on the associated element.
|
|
3814
3818
|
*/
|
|
3815
3819
|
connect() {
|
|
3816
|
-
if (this.
|
|
3820
|
+
if (this.stage !== 3 /* Stages.disconnected */) {
|
|
3817
3821
|
return;
|
|
3818
3822
|
}
|
|
3823
|
+
this.stage = 0 /* Stages.connecting */;
|
|
3819
3824
|
// If we have any observables that were bound, re-apply their values.
|
|
3820
3825
|
if (this.boundObservables !== null) {
|
|
3821
3826
|
const element = this.source;
|
|
@@ -3829,9 +3834,11 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3829
3834
|
}
|
|
3830
3835
|
const behaviors = this.behaviors;
|
|
3831
3836
|
if (behaviors !== null) {
|
|
3837
|
+
this.guardBehaviorConnection = true;
|
|
3832
3838
|
for (const key of behaviors.keys()) {
|
|
3833
3839
|
key.connectedCallback && key.connectedCallback(this);
|
|
3834
3840
|
}
|
|
3841
|
+
this.guardBehaviorConnection = false;
|
|
3835
3842
|
}
|
|
3836
3843
|
if (this.needsInitialization) {
|
|
3837
3844
|
this.renderTemplate(this.template);
|
|
@@ -3841,16 +3848,18 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3841
3848
|
else if (this.view !== null) {
|
|
3842
3849
|
this.view.bind(this.source);
|
|
3843
3850
|
}
|
|
3844
|
-
this.
|
|
3851
|
+
this.stage = 1 /* Stages.connected */;
|
|
3852
|
+
Observable.notify(this, isConnectedPropertyName);
|
|
3845
3853
|
}
|
|
3846
3854
|
/**
|
|
3847
3855
|
* Runs disconnected lifecycle behavior on the associated element.
|
|
3848
3856
|
*/
|
|
3849
3857
|
disconnect() {
|
|
3850
|
-
if (
|
|
3858
|
+
if (this.stage !== 1 /* Stages.connected */) {
|
|
3851
3859
|
return;
|
|
3852
3860
|
}
|
|
3853
|
-
this.
|
|
3861
|
+
this.stage = 2 /* Stages.disconnecting */;
|
|
3862
|
+
Observable.notify(this, isConnectedPropertyName);
|
|
3854
3863
|
if (this.view !== null) {
|
|
3855
3864
|
this.view.unbind();
|
|
3856
3865
|
}
|
|
@@ -3860,6 +3869,7 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3860
3869
|
key.disconnectedCallback && key.disconnectedCallback(this);
|
|
3861
3870
|
}
|
|
3862
3871
|
}
|
|
3872
|
+
this.stage = 3 /* Stages.disconnected */;
|
|
3863
3873
|
}
|
|
3864
3874
|
/**
|
|
3865
3875
|
* Runs the attribute changed callback for the associated element.
|
|
@@ -3882,7 +3892,7 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3882
3892
|
* Only emits events if connected.
|
|
3883
3893
|
*/
|
|
3884
3894
|
emit(type, detail, options) {
|
|
3885
|
-
if (this.
|
|
3895
|
+
if (this.stage === 1 /* Stages.connected */) {
|
|
3886
3896
|
return this.source.dispatchEvent(new CustomEvent(type, Object.assign(Object.assign({ detail }, defaultEventOptions), options)));
|
|
3887
3897
|
}
|
|
3888
3898
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t}),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const e=globalThis.FAST,t={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1203:"View=>Model update skipped. To use twoWay binding, the target property must be observable.",1204:"No host element is present. Cannot bind host with ${name}.",1205:"The requested binding behavior is not supported by the binding engine.",1401:"Missing FASTElement definition.",1501:"No registration for Context/Interface '${name}'.",1502:"Dependency injection resolver for '${key}' returned a null factory.",1503:"Invalid dependency injection resolver strategy specified '${strategy}'.",1504:"Unable to autoregister dependency.",1505:"Unable to resolve dependency injection key '${key}'.",1506:"'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.",1507:"Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?",1508:"Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?",1509:"Attempted to jitRegister an interface '${value}'.",1510:"A valid resolver was not returned from the register method.",1511:"Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",1512:"'${key}' not registered. Did you forget to add @singleton()?",1513:"Cyclic dependency found '${name}'.",1514:"Injected properties that are updated on changes to DOM connectivity require the target object to be an instance of FASTElement."},s=/(\$\{\w+?})/g,i=/\$\{(\w+?)}/g,n=Object.freeze({});function r(e,t){return e.split(s).map((e=>{var s;const n=e.replace(i,"$1");return String(null!==(s=t[n])&&void 0!==s?s:e)})).join("")}Object.assign(e,{addMessages(e){Object.assign(t,e)},warn(e,s=n){var i;const o=null!==(i=t[e])&&void 0!==i?i:"Unknown Warning";console.warn(r(o,s))},error(e,s=n){var i;const o=null!==(i=t[e])&&void 0!==i?i:"Unknown Error";return new Error(r(o,s))}});const o={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},o));const l=globalThis.FAST;if(void 0===l.getById){const e=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const a=Object.freeze([]);function h(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function c(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const d=e=>"function"==typeof e,u=e=>"string"==typeof e,f=l.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class p{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class g{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new p(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new p(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const b=Object.freeze({unknown:void 0,coupled:1}),v=l.getById(2,(()=>{const e=f.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap;let i,n=e=>{throw l.error(1101)};function r(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=n(e):s.set(e,i=new g(e))),i}const o=c();class a{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==i&&i.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];d(n)&&n.call(e,i,t),r(e).notify(this.name)}}}class h extends p{constructor(e,t,s=!1){super(e,t),this.expression=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==b.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=i;let n;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{n=this.expression(e,t)}finally{i=s}return n}disconnect(){this.dispose()}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,n=r(e),o=null===s?this.first:{};if(o.propertySource=e,o.propertyName=t,o.notifier=n,n.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;i=void 0,t=s.propertySource[s.propertyName],i=this,e===t&&(this.needsRefresh=!0)}s.next=o}this.last=o}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){n=e},getNotifier:r,track(e,t){i&&i.watch(e,t)},trackVolatile(){i&&(i.needsRefresh=!0)},notify(e,t){r(e).notify(t)},defineProperty(e,t){u(t)&&(t=new a(t)),o(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:o,binding(e,t,s=this.isVolatileBinding(e)){return new h(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function y(e,t){v.defineProperty(e,t)}function m(e,t,s){return Object.assign({},s,{get(){return v.trackVolatile(),s.get.apply(this)}})}const w=l.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),C=Object.freeze({default:{index:0,length:0,get event(){return C.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>w.get(),setEvent(e){w.set(e)}});class x{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const T=Object.freeze({reset:1,splice:2,optimized:3}),S=new x(0,a,0);S.reset=!0;const O=[S];function A(e,t,s,i,n,r){let o=0,l=0;const h=Math.min(s-t,r-n);if(0===t&&0===n&&(o=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,i,h)),s===e.length&&r===i.length&&(l=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,i,h-o)),n+=o,r-=l,(s-=l)-(t+=o)==0&&r-n==0)return a;if(t===s){const e=new x(t,[],0);for(;n<r;)e.removed.push(i[n++]);return[e]}if(n===r)return[new x(t,[],s-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,s,i,n,r)),d=[];let u,f=t,p=n;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++,u.removed.push(i[p]),p++;break;case 2:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new x(f,[],0)),u.removed.push(i[p]),p++}return void 0!==u&&d.push(u),d}function B(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let k=Object.freeze({support:T.optimized,normalize:(e,t,s)=>void 0===e?void 0===s?a:s.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)B(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(A(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,s):s:O,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(0,[],i.length).adjustTo(e)),n}});const j=Object.freeze({reset:O,setDefaultStrategy(e){k=e}});function $(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class I extends p{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,$(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,v.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:k).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,f.enqueue(this))}}let V=!1;const E=Object.freeze({enable(){if(V)return;V=!0,v.setArrayObserverFactory((e=>new I(e)));const e=Array.prototype;e.$fastPatch||($(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:k)[t.name](this,i,t,e)}})))}});function N(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(E.enable(),t=v.getNotifier(e)),v.track(t.lengthObserver,"length"),e.length}let M;function F(e){return e.map((e=>e instanceof L?F(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class L{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof L?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(M),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(F(this.styles)),this}static setDefaultStrategy(e){M=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new L(e):e instanceof L?e:new L([e])}}L.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;const _=h(),z=Object.freeze({getForInstance:_.getForInstance,getByType:_.getByType,define:e=>(_.register({type:e}),e)});function P(){return function(e){z.define(e)}}function R(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==z.getForInstance(o)&&(o=o.createCSS(r)),o instanceof L||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const D=(e,...t)=>{const{styles:s,behaviors:i}=R(e,t),n=new L(s);return i.length?n.withBehaviors(...i):n};class H{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(u(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new L(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}z.define(H);const U=D.partial=(e,...t)=>{const{styles:s,behaviors:i}=R(e,t);return new H(s,i)},q=Object.freeze({queueUpdate:f.enqueue,nextUpdate:f.next,processUpdates:f.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),Q=`fast-${Math.random().toString(36).substring(2,8)}`,W=`${Q}{`,K=`}${Q}`,G=K.length;let J=0;const X=()=>`${Q}-${++J}`,Y=Object.freeze({interpolation:e=>`${W}${e}${K}`,attribute:e=>`${X()}="${W}${e}${K}"`,comment:e=>`\x3c!--${W}${e}${K}--\x3e`}),Z=Object.freeze({parse(e,t){const s=e.split(W);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(K);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+G)}""!==o&&i.push(o)}return i}}),ee=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:C.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=X());e.id||(e.id=X()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),te=h(),se=Object.freeze({getForInstance:te.getForInstance,getByType:te.getByType,define:(e,t)=>((t=t||{}).type=e,te.register(t),e)});function ie(e){return function(t){se.define(t,e)}}class ne{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const re=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":e.targetAspect=t.substring(1),e.aspectType="classList"===e.targetAspect?re.tokenList:re.property;break;case"?":e.targetAspect=t.substring(1),e.aspectType=re.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=re.event;break;default:e.targetAspect=t,e.aspectType=re.attribute}else e.aspectType=re.content}});class oe{constructor(e){this.options=e,this.id=X()}createHTML(e){return Y.attribute(e(this))}createBehavior(){return this}}const le=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:e=>e;class ae extends ne{createObserver(e,t){return v.binding(this.evaluate,t,this.isVolatile)}}class he extends ne{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ce(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function de(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={v:0,cv:Object.create(null)},o=r.cv;let l=r.v;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const ue=(e,t,s)=>e[t]=s,fe=()=>{};class pe{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=X(),this.aspectType=re.content,this.data=`${this.id}-d`}createHTML(e){return Y.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=le(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=q.setAttribute;break;case 2:this.updateTarget=q.setBooleanAttribute;break;case 3:this.updateTarget=ue;break;case 4:this.updateTarget=ce;break;case 5:this.updateTarget=de;break;case 6:this.updateTarget=fe;break;default:throw l.error(1205)}return this}bind(e){var t;const s=e.targets[this.nodeId];switch(this.updateTarget){case fe:s[this.data]=e,s.addEventListener(this.targetAspect,this,this.dataBinding.options);break;case ce:e.onUnbind(this);default:const i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e)}}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget[this.data];if(t.isBound){C.setEvent(e);const s=this.dataBinding.evaluate(t.source,t.context);C.setEvent(null),!0!==s&&e.preventDefault()}}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function ge(e,t=v.isVolatileBinding(e)){return new ae(e,t)}function be(e){return new he(e)}function ve(e,t){const s=new ae(e,!1);return s.options=t,s}function ye(e){return d(e)?ge(e):e instanceof ne?e:be((()=>e))}function me(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}se.define(pe,{aspected:!0});class we{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=b.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return C.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){me(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){me(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}v.defineProperty(we.prototype,"index"),v.defineProperty(we.prototype,"length");const Ce=(e,t)=>`${e}.${t}`,xe={},Te={index:0,node:null};function Se(e){e.startsWith("fast-")||l.warn(1204,{name:e})}const Oe=new Proxy(document.createElement("div"),{get(e,t){Se(t);const s=Reflect.get(e,t);return d(s)?s.bind(e):s},set:(e,t,s)=>(Se(t),Reflect.set(e,t,s))});class Ae{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=xe[t];if(!n){const i=`_${t}`;xe[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:Oe;for(const e of this.nodeIds)s[e];return new we(t,this.factories,s)}}function Be(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=Z.parse(d,l);let f=null;null===u?r&&(f=new pe(be((()=>d))),re.assign(f,c.name)):f=Ee.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function ke(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=je(e,s,n,i);n=t.node,i=t.index}}function je(e,t,s,i){const n=Ce(t,i);switch(s.nodeType){case 1:Be(e,t,s,n,i),ke(e,s,n);break;case 3:return function(e,t,s,i,n){const r=Z.parse(t.textContent,e.directives);if(null===r)return Te.node=t.nextSibling,Te.index=n+1,Te;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=Ce(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),u(a)?o.textContent=a:(o.textContent=" ",re.assign(a),e.addFactory(a,s,i,n)),l=o}return Te.index=n+1,Te.node=l.nextSibling,Te}(e,s,t,n,i);case 8:const r=Z.parse(s.data,e.directives);null!==r&&e.addFactory(Ee.aggregate(r),t,n,i)}return Te.index=i+1,Te.node=s.nextSibling,Te}const $e={createHTML:e=>e};let Ie=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",$e):$e;const Ve=Ie,Ee={setHTMLPolicy(e){if(Ie!==Ve)throw l.error(1201);Ie=e},compile(e,t){let s;if(u(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Ie.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new Ae(i,t);return Be(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==Z.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),ke(n,i,"r"),Te.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>u(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new pe(s);return re.assign(o,t),o}};class Ne{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Ee.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const Me=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Fe(e,t,s){const i=Me.exec(t);return null!==i&&re.assign(e,i[2]),e.createHTML(s)}function Le(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=X();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,d(o))s+=Fe(new pe(ge(o)),r,n);else if(u(o)){const e=Me.exec(r);if(null!==e){const t=new pe(be((()=>o)));re.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof ne?s+=Fe(new pe(o),r,n):void 0===(l=se.getForInstance(o))?s+=Fe(new pe(be((()=>o))),r,n):l.aspected?s+=Fe(o,r,n):s+=o.createHTML(n)}return new Ne(s+e[e.length-1],i)}class _e extends oe{bind(e){e.source[this.options]=e.targets[this.nodeId]}}se.define(_e);const ze=e=>new _e(e);function Pe(e,t){const s=d(e)?e:()=>e,i=d(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const Re=Object.freeze({positioning:!1,recycle:!0});function De(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function He(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Ue{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=De,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=He)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=a);const t=this.itemsObserver,s=this.itemsObserver=v.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=t.splice(d.index,u.length),v=h=l.length+b.length;for(;p<g;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(p,0,d),s(d,i,p,r),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=s,i.index=e}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(we.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class qe{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=X(),E.enable()}createHTML(e){return Y.comment(e(this))}createBehavior(){return new Ue(this)}}function Qe(e,t,s=Re){const i=ye(e),n=ye(t);return new qe(i,n,Object.assign(Object.assign({},Re),s))}se.define(qe);const We=e=>1===e.nodeType,Ke=e=>e?t=>1===t.nodeType&&t.matches(e):We;class Ge extends oe{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,a),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class Je extends Ge{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function Xe(e){return u(e)&&(e={property:e}),new Je(e)}se.define(Je);class Ye extends Ge{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function Ze(e){return u(e)&&(e={property:e}),new Ye(e)}se.define(Ye);const et=Object.freeze({locate:c()}),tt={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function st(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const it={toView(e){const t=st(e);return t?t.toString():t},fromView:st};class nt{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=tt)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return v.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||f.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;q.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":q.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(et.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];u(i)?s.push(new nt(e,i)):s.push(new nt(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function rt(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),et.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const ot={mode:"open"},lt={},at=new Set,ht=l.getById(4,(()=>h()));class ct{constructor(e,t=e.definition){var s;this.platformDefined=!1,u(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=nt.collect(e,t.attributes),r=new Array(n.length),o={},l={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,o[t.name]=t,l[t.attribute]=t,v.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=o,this.attributeLookup=l,this.shadowOptions=void 0===t.shadowOptions?ot:null===t.shadowOptions?void 0:Object.assign(Object.assign({},ot),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?lt:Object.assign(Object.assign({},lt),t.elementOptions),this.styles=L.normalize(t.styles),ht.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){return at.has(e)||ht.getByType(e)?new ct(class extends e{},t):new ct(e,t)}static registerBaseType(e){at.add(e)}}ct.getByType=ht.getByType,ct.getForInstance=ht.getForInstance;const dt={bubbles:!0,composed:!0,cancelable:!0},ut=new WeakMap;function ft(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ut.get(e))&&void 0!==s?s:null}let pt;class gt extends g{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ut.set(e,t))}const i=v.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return v.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,v.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=ft(s))&&void 0!==t?t:this.source).append(e)}else if(!e.isAttachedTo(s)){const t=e.behaviors;if(e.addStylesTo(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=ft(s))&&void 0!==t?t:s).removeChild(e)}else if(e.isAttachedTo(s)){const t=e.behaviors;if(e.removeStylesFrom(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;if(null!==this.boundObservables){const e=this.source,t=this.boundObservables,s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.needsInitialization?(this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1):null!==this.view&&this.view.bind(this.source),this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},dt),s)))}renderTemplate(e){var t;const s=this.source,i=null!==(t=ft(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=b.coupled)}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=ct.getForInstance(e);if(void 0===s)throw l.error(1401);return e.$fastController=new pt(e,s)}static setStrategy(e){pt=e}}function bt(e){var t;return"adoptedStyleSheets"in e?e:null!==(t=ft(e))&&void 0!==t?t:e.getRootNode()}gt.setStrategy(gt);class vt{constructor(e){const t=vt.styleSheetCache;this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let s=t.get(e);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(e),t.set(e,s)),s}))}addStylesTo(e){const t=bt(e);t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=bt(e),s=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((e=>-1===s.indexOf(e)))}}vt.styleSheetCache=new Map;let yt=0;function mt(e){return e===document?document.body:e}function wt(e){const t=class extends e{constructor(){super(),gt.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}};return ct.registerBaseType(t),t}function Ct(e,t){return d(e)?ct.compose(e,t).define().type:ct.compose(this,e).define().type}L.setDefaultStrategy(L.supportsAdoptedStyleSheets?vt:class{constructor(e){this.styles=e,this.styleClass="fast-"+ ++yt}addStylesTo(e){e=mt(bt(e));const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=(e=mt(bt(e))).querySelectorAll(`.${this.styleClass}`);t[0].parentNode;for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}});const xt=Object.assign(wt(HTMLElement),{from:function(e){return wt(e)},define:Ct,compose:function(e,t){return d(e)?ct.compose(e,t):ct.compose(this,e)}});function Tt(e){return function(t){Ct(t,e)}}export{E as ArrayObserver,re as Aspect,et as AttributeConfiguration,nt as AttributeDefinition,ne as Binding,z as CSSDirective,Ye as ChildrenDirective,Ee as Compiler,q as DOM,gt as ElementController,L as ElementStyles,C as ExecutionContext,l as FAST,xt as FASTElement,ct as FASTElementDefinition,pe as HTMLBindingDirective,se as HTMLDirective,we as HTMLView,Y as Markup,Ge as NodeObservationDirective,v as Observable,Z as Parser,g as PropertyChangeNotifier,_e as RefDirective,Ue as RepeatBehavior,qe as RepeatDirective,Je as SlottedDirective,b as SourceLifetime,x as Splice,j as SpliceStrategy,T as SpliceStrategySupport,oe as StatelessAttachedAttributeDirective,p as SubscriberSet,f as Updates,ee as ViewBehaviorOrchestrator,Ne as ViewTemplate,rt as attr,ge as bind,tt as booleanConverter,Ze as children,c as createMetadataLocator,h as createTypeRegistry,D as css,P as cssDirective,U as cssPartial,Tt as customElement,Ke as elements,a as emptyArray,Le as html,ie as htmlDirective,N as lengthOf,ve as listener,ye as normalizeBinding,it as nullableNumberConverter,y as observable,be as oneTime,ze as ref,Qe as repeat,Xe as slotted,m as volatile,Pe as when};
|
|
1
|
+
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t}),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const e=globalThis.FAST,t={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1203:"View=>Model update skipped. To use twoWay binding, the target property must be observable.",1204:"No host element is present. Cannot bind host with ${name}.",1205:"The requested binding behavior is not supported by the binding engine.",1401:"Missing FASTElement definition.",1501:"No registration for Context/Interface '${name}'.",1502:"Dependency injection resolver for '${key}' returned a null factory.",1503:"Invalid dependency injection resolver strategy specified '${strategy}'.",1504:"Unable to autoregister dependency.",1505:"Unable to resolve dependency injection key '${key}'.",1506:"'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.",1507:"Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?",1508:"Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?",1509:"Attempted to jitRegister an interface '${value}'.",1510:"A valid resolver was not returned from the register method.",1511:"Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",1512:"'${key}' not registered. Did you forget to add @singleton()?",1513:"Cyclic dependency found '${name}'.",1514:"Injected properties that are updated on changes to DOM connectivity require the target object to be an instance of FASTElement."},s=/(\$\{\w+?})/g,i=/\$\{(\w+?)}/g,n=Object.freeze({});function r(e,t){return e.split(s).map((e=>{var s;const n=e.replace(i,"$1");return String(null!==(s=t[n])&&void 0!==s?s:e)})).join("")}Object.assign(e,{addMessages(e){Object.assign(t,e)},warn(e,s=n){var i;const o=null!==(i=t[e])&&void 0!==i?i:"Unknown Warning";console.warn(r(o,s))},error(e,s=n){var i;const o=null!==(i=t[e])&&void 0!==i?i:"Unknown Error";return new Error(r(o,s))}});const o={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},o));const l=globalThis.FAST;if(void 0===l.getById){const e=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const a=Object.freeze([]);function h(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function c(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const d=e=>"function"==typeof e,u=e=>"string"==typeof e,f=l.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class g{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class p{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new g(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new g(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const b=Object.freeze({unknown:void 0,coupled:1}),v=l.getById(2,(()=>{const e=f.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap;let i,n=e=>{throw l.error(1101)};function r(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=n(e):s.set(e,i=new p(e))),i}const o=c();class a{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==i&&i.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];d(n)&&n.call(e,i,t),r(e).notify(this.name)}}}class h extends g{constructor(e,t,s=!1){super(e,t),this.expression=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==b.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=i;let n;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{n=this.expression(e,t)}finally{i=s}return n}disconnect(){this.dispose()}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,n=r(e),o=null===s?this.first:{};if(o.propertySource=e,o.propertyName=t,o.notifier=n,n.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;i=void 0,t=s.propertySource[s.propertyName],i=this,e===t&&(this.needsRefresh=!0)}s.next=o}this.last=o}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){n=e},getNotifier:r,track(e,t){i&&i.watch(e,t)},trackVolatile(){i&&(i.needsRefresh=!0)},notify(e,t){r(e).notify(t)},defineProperty(e,t){u(t)&&(t=new a(t)),o(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:o,binding(e,t,s=this.isVolatileBinding(e)){return new h(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function y(e,t){v.defineProperty(e,t)}function m(e,t,s){return Object.assign({},s,{get(){return v.trackVolatile(),s.get.apply(this)}})}const w=l.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),C=Object.freeze({default:{index:0,length:0,get event(){return C.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>w.get(),setEvent(e){w.set(e)}});class x{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const T=Object.freeze({reset:1,splice:2,optimized:3}),S=new x(0,a,0);S.reset=!0;const O=[S];function B(e,t,s,i,n,r){let o=0,l=0;const h=Math.min(s-t,r-n);if(0===t&&0===n&&(o=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,i,h)),s===e.length&&r===i.length&&(l=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,i,h-o)),n+=o,r-=l,(s-=l)-(t+=o)==0&&r-n==0)return a;if(t===s){const e=new x(t,[],0);for(;n<r;)e.removed.push(i[n++]);return[e]}if(n===r)return[new x(t,[],s-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,s,i,n,r)),d=[];let u,f=t,g=n;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,g++;break;case 1:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++,u.removed.push(i[g]),g++;break;case 2:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new x(f,[],0)),u.removed.push(i[g]),g++}return void 0!==u&&d.push(u),d}function A(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let k=Object.freeze({support:T.optimized,normalize:(e,t,s)=>void 0===e?void 0===s?a:s.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)A(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(B(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,s):s:O,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(0,[],i.length).adjustTo(e)),n}});const j=Object.freeze({reset:O,setDefaultStrategy(e){k=e}});function $(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class I extends g{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,$(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,v.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:k).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,f.enqueue(this))}}let V=!1;const E=Object.freeze({enable(){if(V)return;V=!0,v.setArrayObserverFactory((e=>new I(e)));const e=Array.prototype;e.$fastPatch||($(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:k)[t.name](this,i,t,e)}})))}});function N(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(E.enable(),t=v.getNotifier(e)),v.track(t.lengthObserver,"length"),e.length}let M;function F(e){return e.map((e=>e instanceof L?F(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class L{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof L?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(M),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(F(this.styles)),this}static setDefaultStrategy(e){M=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new L(e):e instanceof L?e:new L([e])}}L.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;const z=h(),P=Object.freeze({getForInstance:z.getForInstance,getByType:z.getByType,define:e=>(z.register({type:e}),e)});function R(){return function(e){P.define(e)}}function _(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==P.getForInstance(o)&&(o=o.createCSS(r)),o instanceof L||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const D=(e,...t)=>{const{styles:s,behaviors:i}=_(e,t),n=new L(s);return i.length?n.withBehaviors(...i):n};class H{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(u(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new L(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}P.define(H);const U=D.partial=(e,...t)=>{const{styles:s,behaviors:i}=_(e,t);return new H(s,i)},q=Object.freeze({queueUpdate:f.enqueue,nextUpdate:f.next,processUpdates:f.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),Q=`fast-${Math.random().toString(36).substring(2,8)}`,W=`${Q}{`,K=`}${Q}`,G=K.length;let J=0;const X=()=>`${Q}-${++J}`,Y=Object.freeze({interpolation:e=>`${W}${e}${K}`,attribute:e=>`${X()}="${W}${e}${K}"`,comment:e=>`\x3c!--${W}${e}${K}--\x3e`}),Z=Object.freeze({parse(e,t){const s=e.split(W);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(K);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+G)}""!==o&&i.push(o)}return i}}),ee=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:C.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=X());e.id||(e.id=X()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),te=h(),se=Object.freeze({getForInstance:te.getForInstance,getByType:te.getByType,define:(e,t)=>((t=t||{}).type=e,te.register(t),e)});function ie(e){return function(t){se.define(t,e)}}class ne{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const re=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":e.targetAspect=t.substring(1),e.aspectType="classList"===e.targetAspect?re.tokenList:re.property;break;case"?":e.targetAspect=t.substring(1),e.aspectType=re.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=re.event;break;default:e.targetAspect=t,e.aspectType=re.attribute}else e.aspectType=re.content}});class oe{constructor(e){this.options=e,this.id=X()}createHTML(e){return Y.attribute(e(this))}createBehavior(){return this}}const le=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:e=>e;class ae extends ne{createObserver(e,t){return v.binding(this.evaluate,t,this.isVolatile)}}class he extends ne{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ce(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function de(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={v:0,cv:Object.create(null)},o=r.cv;let l=r.v;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const ue=(e,t,s)=>e[t]=s,fe=()=>{};class ge{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=X(),this.aspectType=re.content,this.data=`${this.id}-d`}createHTML(e){return Y.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=le(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=q.setAttribute;break;case 2:this.updateTarget=q.setBooleanAttribute;break;case 3:this.updateTarget=ue;break;case 4:this.updateTarget=ce;break;case 5:this.updateTarget=de;break;case 6:this.updateTarget=fe;break;default:throw l.error(1205)}return this}bind(e){var t;const s=e.targets[this.nodeId];switch(this.updateTarget){case fe:s[this.data]=e,s.addEventListener(this.targetAspect,this,this.dataBinding.options);break;case ce:e.onUnbind(this);default:const i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e)}}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget[this.data];if(t.isBound){C.setEvent(e);const s=this.dataBinding.evaluate(t.source,t.context);C.setEvent(null),!0!==s&&e.preventDefault()}}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function pe(e,t=v.isVolatileBinding(e)){return new ae(e,t)}function be(e){return new he(e)}function ve(e,t){const s=new ae(e,!1);return s.options=t,s}function ye(e){return d(e)?pe(e):e instanceof ne?e:be((()=>e))}function me(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}se.define(ge,{aspected:!0});class we{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=b.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return C.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){me(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){me(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}v.defineProperty(we.prototype,"index"),v.defineProperty(we.prototype,"length");const Ce=(e,t)=>`${e}.${t}`,xe={},Te={index:0,node:null};function Se(e){e.startsWith("fast-")||l.warn(1204,{name:e})}const Oe=new Proxy(document.createElement("div"),{get(e,t){Se(t);const s=Reflect.get(e,t);return d(s)?s.bind(e):s},set:(e,t,s)=>(Se(t),Reflect.set(e,t,s))});class Be{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=xe[t];if(!n){const i=`_${t}`;xe[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:Oe;for(const e of this.nodeIds)s[e];return new we(t,this.factories,s)}}function Ae(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=Z.parse(d,l);let f=null;null===u?r&&(f=new ge(be((()=>d))),re.assign(f,c.name)):f=Ee.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function ke(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=je(e,s,n,i);n=t.node,i=t.index}}function je(e,t,s,i){const n=Ce(t,i);switch(s.nodeType){case 1:Ae(e,t,s,n,i),ke(e,s,n);break;case 3:return function(e,t,s,i,n){const r=Z.parse(t.textContent,e.directives);if(null===r)return Te.node=t.nextSibling,Te.index=n+1,Te;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=Ce(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),u(a)?o.textContent=a:(o.textContent=" ",re.assign(a),e.addFactory(a,s,i,n)),l=o}return Te.index=n+1,Te.node=l.nextSibling,Te}(e,s,t,n,i);case 8:const r=Z.parse(s.data,e.directives);null!==r&&e.addFactory(Ee.aggregate(r),t,n,i)}return Te.index=i+1,Te.node=s.nextSibling,Te}const $e={createHTML:e=>e};let Ie=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",$e):$e;const Ve=Ie,Ee={setHTMLPolicy(e){if(Ie!==Ve)throw l.error(1201);Ie=e},compile(e,t){let s;if(u(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Ie.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new Be(i,t);return Ae(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==Z.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),ke(n,i,"r"),Te.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>u(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new ge(s);return re.assign(o,t),o}};class Ne{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Ee.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const Me=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Fe(e,t,s){const i=Me.exec(t);return null!==i&&re.assign(e,i[2]),e.createHTML(s)}function Le(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=X();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,d(o))s+=Fe(new ge(pe(o)),r,n);else if(u(o)){const e=Me.exec(r);if(null!==e){const t=new ge(be((()=>o)));re.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof ne?s+=Fe(new ge(o),r,n):void 0===(l=se.getForInstance(o))?s+=Fe(new ge(be((()=>o))),r,n):l.aspected?s+=Fe(o,r,n):s+=o.createHTML(n)}return new Ne(s+e[e.length-1],i)}class ze extends oe{bind(e){e.source[this.options]=e.targets[this.nodeId]}}se.define(ze);const Pe=e=>new ze(e);function Re(e,t){const s=d(e)?e:()=>e,i=d(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const _e=Object.freeze({positioning:!1,recycle:!0});function De(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function He(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Ue{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=De,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=He)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=a);const t=this.itemsObserver,s=this.itemsObserver=v.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,g=d.index;const p=g+d.addedCount,b=t.splice(d.index,u.length),v=h=l.length+b.length;for(;g<p;++g){const e=t[g],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(g,0,d),s(d,i,g,r),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=s,i.index=e}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(we.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class qe{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=X(),E.enable()}createHTML(e){return Y.comment(e(this))}createBehavior(){return new Ue(this)}}function Qe(e,t,s=_e){const i=ye(e),n=ye(t);return new qe(i,n,Object.assign(Object.assign({},_e),s))}se.define(qe);const We=e=>1===e.nodeType,Ke=e=>e?t=>1===t.nodeType&&t.matches(e):We;class Ge extends oe{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,a),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class Je extends Ge{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function Xe(e){return u(e)&&(e={property:e}),new Je(e)}se.define(Je);class Ye extends Ge{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function Ze(e){return u(e)&&(e={property:e}),new Ye(e)}se.define(Ye);const et=Object.freeze({locate:c()}),tt={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function st(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const it={toView(e){const t=st(e);return t?t.toString():t},fromView:st};class nt{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=tt)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return v.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||f.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;q.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":q.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(et.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];u(i)?s.push(new nt(e,i)):s.push(new nt(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function rt(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),et.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const ot={mode:"open"},lt={},at=new Set,ht=l.getById(4,(()=>h()));class ct{constructor(e,t=e.definition){var s;this.platformDefined=!1,u(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=nt.collect(e,t.attributes),r=new Array(n.length),o={},l={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,o[t.name]=t,l[t.attribute]=t,v.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=o,this.attributeLookup=l,this.shadowOptions=void 0===t.shadowOptions?ot:null===t.shadowOptions?void 0:Object.assign(Object.assign({},ot),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?lt:Object.assign(Object.assign({},lt),t.elementOptions),this.styles=L.normalize(t.styles),ht.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){return at.has(e)||ht.getByType(e)?new ct(class extends e{},t):new ct(e,t)}static registerBaseType(e){at.add(e)}}ct.getByType=ht.getByType,ct.getForInstance=ht.getForInstance;const dt={bubbles:!0,composed:!0,cancelable:!0},ut=new WeakMap;function ft(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ut.get(e))&&void 0!==s?s:null}let gt;class pt extends p{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this.stage=3,this.guardBehaviorConnection=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ut.set(e,t))}const i=v.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return v.track(this,"isConnected"),1===this.stage}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),!e.connectedCallback||this.guardBehaviorConnection||1!==this.stage&&0!==this.stage||e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&3!==this.stage&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=ft(s))&&void 0!==t?t:this.source).append(e)}else if(!e.isAttachedTo(s)){const t=e.behaviors;if(e.addStylesTo(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=ft(s))&&void 0!==t?t:s).removeChild(e)}else if(e.isAttachedTo(s)){const t=e.behaviors;if(e.removeStylesFrom(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(3!==this.stage)return;if(this.stage=0,null!==this.boundObservables){const e=this.source,t=this.boundObservables,s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}const e=this.behaviors;if(null!==e){this.guardBehaviorConnection=!0;for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.guardBehaviorConnection=!1}this.needsInitialization?(this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1):null!==this.view&&this.view.bind(this.source),this.stage=1,v.notify(this,"isConnected")}disconnect(){if(1!==this.stage)return;this.stage=2,v.notify(this,"isConnected"),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this);this.stage=3}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return 1===this.stage&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},dt),s)))}renderTemplate(e){var t;const s=this.source,i=null!==(t=ft(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=b.coupled)}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=ct.getForInstance(e);if(void 0===s)throw l.error(1401);return e.$fastController=new gt(e,s)}static setStrategy(e){gt=e}}function bt(e){var t;return"adoptedStyleSheets"in e?e:null!==(t=ft(e))&&void 0!==t?t:e.getRootNode()}pt.setStrategy(pt);class vt{constructor(e){const t=vt.styleSheetCache;this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let s=t.get(e);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(e),t.set(e,s)),s}))}addStylesTo(e){const t=bt(e);t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=bt(e),s=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((e=>-1===s.indexOf(e)))}}vt.styleSheetCache=new Map;let yt=0;function mt(e){return e===document?document.body:e}function wt(e){const t=class extends e{constructor(){super(),pt.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}};return ct.registerBaseType(t),t}function Ct(e,t){return d(e)?ct.compose(e,t).define().type:ct.compose(this,e).define().type}L.setDefaultStrategy(L.supportsAdoptedStyleSheets?vt:class{constructor(e){this.styles=e,this.styleClass="fast-"+ ++yt}addStylesTo(e){e=mt(bt(e));const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=(e=mt(bt(e))).querySelectorAll(`.${this.styleClass}`);t[0].parentNode;for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}});const xt=Object.assign(wt(HTMLElement),{from:function(e){return wt(e)},define:Ct,compose:function(e,t){return d(e)?ct.compose(e,t):ct.compose(this,e)}});function Tt(e){return function(t){Ct(t,e)}}export{E as ArrayObserver,re as Aspect,et as AttributeConfiguration,nt as AttributeDefinition,ne as Binding,P as CSSDirective,Ye as ChildrenDirective,Ee as Compiler,q as DOM,pt as ElementController,L as ElementStyles,C as ExecutionContext,l as FAST,xt as FASTElement,ct as FASTElementDefinition,ge as HTMLBindingDirective,se as HTMLDirective,we as HTMLView,Y as Markup,Ge as NodeObservationDirective,v as Observable,Z as Parser,p as PropertyChangeNotifier,ze as RefDirective,Ue as RepeatBehavior,qe as RepeatDirective,Je as SlottedDirective,b as SourceLifetime,x as Splice,j as SpliceStrategy,T as SpliceStrategySupport,oe as StatelessAttachedAttributeDirective,g as SubscriberSet,f as Updates,ee as ViewBehaviorOrchestrator,Ne as ViewTemplate,rt as attr,pe as bind,tt as booleanConverter,Ze as children,c as createMetadataLocator,h as createTypeRegistry,D as css,R as cssDirective,U as cssPartial,Tt as customElement,Ke as elements,a as emptyArray,Le as html,ie as htmlDirective,N as lengthOf,ve as listener,ye as normalizeBinding,it as nullableNumberConverter,y as observable,be as oneTime,Pe as ref,Qe as repeat,Xe as slotted,m as volatile,Re as when};
|
package/dist/fast-element.js
CHANGED
|
@@ -3532,7 +3532,13 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3532
3532
|
this.needsInitialization = true;
|
|
3533
3533
|
this.hasExistingShadowRoot = false;
|
|
3534
3534
|
this._template = null;
|
|
3535
|
-
this.
|
|
3535
|
+
this.stage = 3 /* Stages.disconnected */;
|
|
3536
|
+
/**
|
|
3537
|
+
* A guard against connecting behaviors multiple times
|
|
3538
|
+
* during connect in scenarios where a behavior adds
|
|
3539
|
+
* another behavior during it's connectedCallback
|
|
3540
|
+
*/
|
|
3541
|
+
this.guardBehaviorConnection = false;
|
|
3536
3542
|
this.behaviors = null;
|
|
3537
3543
|
this._mainStyles = null;
|
|
3538
3544
|
/**
|
|
@@ -3588,11 +3594,7 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3588
3594
|
*/
|
|
3589
3595
|
get isConnected() {
|
|
3590
3596
|
Observable.track(this, isConnectedPropertyName);
|
|
3591
|
-
return this.
|
|
3592
|
-
}
|
|
3593
|
-
setIsConnected(value) {
|
|
3594
|
-
this._isConnected = value;
|
|
3595
|
-
Observable.notify(this, isConnectedPropertyName);
|
|
3597
|
+
return this.stage === 1 /* Stages.connected */;
|
|
3596
3598
|
}
|
|
3597
3599
|
/**
|
|
3598
3600
|
* Gets/sets the template used to render the component.
|
|
@@ -3667,7 +3669,9 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3667
3669
|
if (count === 0) {
|
|
3668
3670
|
targetBehaviors.set(behavior, 1);
|
|
3669
3671
|
behavior.addedCallback && behavior.addedCallback(this);
|
|
3670
|
-
if (behavior.connectedCallback &&
|
|
3672
|
+
if (behavior.connectedCallback &&
|
|
3673
|
+
!this.guardBehaviorConnection &&
|
|
3674
|
+
(this.stage === 1 /* Stages.connected */ || this.stage === 0 /* Stages.connecting */)) {
|
|
3671
3675
|
behavior.connectedCallback(this);
|
|
3672
3676
|
}
|
|
3673
3677
|
}
|
|
@@ -3691,7 +3695,7 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3691
3695
|
}
|
|
3692
3696
|
if (count === 1 || force) {
|
|
3693
3697
|
targetBehaviors.delete(behavior);
|
|
3694
|
-
if (behavior.disconnectedCallback && this.
|
|
3698
|
+
if (behavior.disconnectedCallback && this.stage !== 3 /* Stages.disconnected */) {
|
|
3695
3699
|
behavior.disconnectedCallback(this);
|
|
3696
3700
|
}
|
|
3697
3701
|
behavior.removedCallback && behavior.removedCallback(this);
|
|
@@ -3752,9 +3756,10 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3752
3756
|
* Runs connected lifecycle behavior on the associated element.
|
|
3753
3757
|
*/
|
|
3754
3758
|
connect() {
|
|
3755
|
-
if (this.
|
|
3759
|
+
if (this.stage !== 3 /* Stages.disconnected */) {
|
|
3756
3760
|
return;
|
|
3757
3761
|
}
|
|
3762
|
+
this.stage = 0 /* Stages.connecting */;
|
|
3758
3763
|
// If we have any observables that were bound, re-apply their values.
|
|
3759
3764
|
if (this.boundObservables !== null) {
|
|
3760
3765
|
const element = this.source;
|
|
@@ -3768,9 +3773,11 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3768
3773
|
}
|
|
3769
3774
|
const behaviors = this.behaviors;
|
|
3770
3775
|
if (behaviors !== null) {
|
|
3776
|
+
this.guardBehaviorConnection = true;
|
|
3771
3777
|
for (const key of behaviors.keys()) {
|
|
3772
3778
|
key.connectedCallback && key.connectedCallback(this);
|
|
3773
3779
|
}
|
|
3780
|
+
this.guardBehaviorConnection = false;
|
|
3774
3781
|
}
|
|
3775
3782
|
if (this.needsInitialization) {
|
|
3776
3783
|
this.renderTemplate(this.template);
|
|
@@ -3780,16 +3787,18 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3780
3787
|
else if (this.view !== null) {
|
|
3781
3788
|
this.view.bind(this.source);
|
|
3782
3789
|
}
|
|
3783
|
-
this.
|
|
3790
|
+
this.stage = 1 /* Stages.connected */;
|
|
3791
|
+
Observable.notify(this, isConnectedPropertyName);
|
|
3784
3792
|
}
|
|
3785
3793
|
/**
|
|
3786
3794
|
* Runs disconnected lifecycle behavior on the associated element.
|
|
3787
3795
|
*/
|
|
3788
3796
|
disconnect() {
|
|
3789
|
-
if (
|
|
3797
|
+
if (this.stage !== 1 /* Stages.connected */) {
|
|
3790
3798
|
return;
|
|
3791
3799
|
}
|
|
3792
|
-
this.
|
|
3800
|
+
this.stage = 2 /* Stages.disconnecting */;
|
|
3801
|
+
Observable.notify(this, isConnectedPropertyName);
|
|
3793
3802
|
if (this.view !== null) {
|
|
3794
3803
|
this.view.unbind();
|
|
3795
3804
|
}
|
|
@@ -3799,6 +3808,7 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3799
3808
|
key.disconnectedCallback && key.disconnectedCallback(this);
|
|
3800
3809
|
}
|
|
3801
3810
|
}
|
|
3811
|
+
this.stage = 3 /* Stages.disconnected */;
|
|
3802
3812
|
}
|
|
3803
3813
|
/**
|
|
3804
3814
|
* Runs the attribute changed callback for the associated element.
|
|
@@ -3821,7 +3831,7 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3821
3831
|
* Only emits events if connected.
|
|
3822
3832
|
*/
|
|
3823
3833
|
emit(type, detail, options) {
|
|
3824
|
-
if (this.
|
|
3834
|
+
if (this.stage === 1 /* Stages.connected */) {
|
|
3825
3835
|
return this.source.dispatchEvent(new CustomEvent(type, Object.assign(Object.assign({ detail }, defaultEventOptions), options)));
|
|
3826
3836
|
}
|
|
3827
3837
|
return false;
|
package/dist/fast-element.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}void 0===t.error&&Object.assign(t,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const s=Object.freeze([]);function i(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function n(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const r=e=>"function"==typeof e,o=e=>"string"==typeof e,l=t.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class a{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class h{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new a(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new a(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const c=Object.freeze({unknown:void 0,coupled:1}),d=t.getById(2,(()=>{const e=l.enqueue,s=/(:|&&|\|\||if)/,i=new WeakMap;let d,u=e=>{throw t.error(1101)};function f(e){var t;let s=null!==(t=e.$fastController)&&void 0!==t?t:i.get(e);return void 0===s&&(Array.isArray(e)?s=u(e):i.set(e,s=new h(e))),s}const p=n();class g{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==d&&d.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];r(n)&&n.call(e,i,t),f(e).notify(this.name)}}}class b extends a{constructor(e,t,s=!1){super(e,t),this.expression=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==c.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=d;let i;d=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{i=this.expression(e,t)}finally{d=s}return i}disconnect(){this.dispose()}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,i=f(e),n=null===s?this.first:{};if(n.propertySource=e,n.propertyName=t,n.notifier=i,i.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;d=void 0,t=s.propertySource[s.propertyName],d=this,e===t&&(this.needsRefresh=!0)}s.next=n}this.last=n}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){u=e},getNotifier:f,track(e,t){d&&d.watch(e,t)},trackVolatile(){d&&(d.needsRefresh=!0)},notify(e,t){f(e).notify(t)},defineProperty(e,t){o(t)&&(t=new g(t)),p(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:p,binding(e,t,s=this.isVolatileBinding(e)){return new b(e,t,s)},isVolatileBinding:e=>s.test(e.toString())})}));function u(e,t){d.defineProperty(e,t)}function f(e,t,s){return Object.assign({},s,{get(){return d.trackVolatile(),s.get.apply(this)}})}const p=t.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),g=Object.freeze({default:{index:0,length:0,get event(){return g.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>p.get(),setEvent(e){p.set(e)}});class b{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const v=Object.freeze({reset:1,splice:2,optimized:3}),y=new b(0,s,0);y.reset=!0;const m=[y];function w(e,t,i,n,r,o){let l=0,a=0;const h=Math.min(i-t,o-r);if(0===t&&0===r&&(l=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,n,h)),i===e.length&&o===n.length&&(a=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,n,h-l)),r+=l,o-=a,(i-=a)-(t+=l)==0&&o-r==0)return s;if(t===i){const e=new b(t,[],0);for(;r<o;)e.removed.push(n[r++]);return[e]}if(r===o)return[new b(t,[],i-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,i,n,r,o)),d=[];let u,f=t,p=r;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new b(f,[],0)),u.addedCount++,f++,u.removed.push(n[p]),p++;break;case 2:void 0===u&&(u=new b(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new b(f,[],0)),u.removed.push(n[p]),p++}return void 0!==u&&d.push(u),d}function C(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let x=Object.freeze({support:v.optimized,normalize:(e,t,i)=>void 0===e?void 0===i?s:i.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)C(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(w(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,i):i:m,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new b(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new b(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(0,[],i.length).adjustTo(e)),n}});const S=Object.freeze({reset:m,setDefaultStrategy(e){x=e}});function T(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class O extends a{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,T(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,d.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:x).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,l.enqueue(this))}}let B=!1;const A=Object.freeze({enable(){if(B)return;B=!0,d.setArrayObserverFactory((e=>new O(e)));const e=Array.prototype;e.$fastPatch||(T(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:x)[t.name](this,i,t,e)}})))}});function k(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(A.enable(),t=d.getNotifier(e)),d.track(t.lengthObserver,"length"),e.length}let j;function $(e){return e.map((e=>e instanceof I?$(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class I{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof I?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(j),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e($(this.styles)),this}static setDefaultStrategy(e){j=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new I(e):e instanceof I?e:new I([e])}}I.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;const V=i(),N=Object.freeze({getForInstance:V.getForInstance,getByType:V.getByType,define:e=>(V.register({type:e}),e)});function E(){return function(e){N.define(e)}}function _(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==N.getForInstance(o)&&(o=o.createCSS(r)),o instanceof I||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const L=(e,...t)=>{const{styles:s,behaviors:i}=_(e,t),n=new I(s);return i.length?n.withBehaviors(...i):n};class z{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(o(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new I(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}N.define(z);const F=L.partial=(e,...t)=>{const{styles:s,behaviors:i}=_(e,t);return new z(s,i)},M=Object.freeze({queueUpdate:l.enqueue,nextUpdate:l.next,processUpdates:l.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),P=`fast-${Math.random().toString(36).substring(2,8)}`,R=`${P}{`,H=`}${P}`,q=H.length;let D=0;const U=()=>`${P}-${++D}`,Q=Object.freeze({interpolation:e=>`${R}${e}${H}`,attribute:e=>`${U()}="${R}${e}${H}"`,comment:e=>`\x3c!--${R}${e}${H}--\x3e`}),W=Object.freeze({parse(e,t){const s=e.split(R);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(H);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+q)}""!==o&&i.push(o)}return i}}),G=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:g.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=U());e.id||(e.id=U()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),J=i(),K=Object.freeze({getForInstance:J.getForInstance,getByType:J.getByType,define:(e,t)=>((t=t||{}).type=e,J.register(t),e)});function X(e){return function(t){K.define(t,e)}}class Y{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const Z=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":e.targetAspect=t.substring(1),e.aspectType="classList"===e.targetAspect?Z.tokenList:Z.property;break;case"?":e.targetAspect=t.substring(1),e.aspectType=Z.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=Z.event;break;default:e.targetAspect=t,e.aspectType=Z.attribute}else e.aspectType=Z.content}});class ee{constructor(e){this.options=e,this.id=U()}createHTML(e){return Q.attribute(e(this))}createBehavior(){return this}}const te=globalThis.TrustedHTML?e=>(s,i)=>{const n=e(s,i);if(n instanceof TrustedHTML)return n;throw t.error(1202)}:e=>e;class se extends Y{createObserver(e,t){return d.binding(this.evaluate,t,this.isVolatile)}}class ie extends Y{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ne(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function re(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={v:0,cv:Object.create(null)},o=r.cv;let l=r.v;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const oe=(e,t,s)=>e[t]=s,le=()=>{};class ae{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=U(),this.aspectType=Z.content,this.data=`${this.id}-d`}createHTML(e){return Q.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=te(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=M.setAttribute;break;case 2:this.updateTarget=M.setBooleanAttribute;break;case 3:this.updateTarget=oe;break;case 4:this.updateTarget=ne;break;case 5:this.updateTarget=re;break;case 6:this.updateTarget=le;break;default:throw t.error(1205)}return this}bind(e){var t;const s=e.targets[this.nodeId];switch(this.updateTarget){case le:s[this.data]=e,s.addEventListener(this.targetAspect,this,this.dataBinding.options);break;case ne:e.onUnbind(this);default:const i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e)}}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget[this.data];if(t.isBound){g.setEvent(e);const s=this.dataBinding.evaluate(t.source,t.context);g.setEvent(null),!0!==s&&e.preventDefault()}}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function he(e,t=d.isVolatileBinding(e)){return new se(e,t)}function ce(e){return new ie(e)}function de(e,t){const s=new se(e,!1);return s.options=t,s}function ue(e){return r(e)?he(e):e instanceof Y?e:ce((()=>e))}function fe(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}K.define(ae,{aspected:!0});class pe{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=c.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return g.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){fe(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){fe(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}d.defineProperty(pe.prototype,"index"),d.defineProperty(pe.prototype,"length");const ge=(e,t)=>`${e}.${t}`,be={},ve={index:0,node:null};function ye(e){e.startsWith("fast-")||t.warn(1204,{name:e})}const me=new Proxy(document.createElement("div"),{get(e,t){ye(t);const s=Reflect.get(e,t);return r(s)?s.bind(e):s},set:(e,t,s)=>(ye(t),Reflect.set(e,t,s))});class we{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=be[t];if(!n){const i=`_${t}`;be[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:me;for(const e of this.nodeIds)s[e];return new pe(t,this.factories,s)}}function Ce(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=W.parse(d,l);let f=null;null===u?r&&(f=new ae(ce((()=>d))),Z.assign(f,c.name)):f=Ae.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function xe(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Se(e,s,n,i);n=t.node,i=t.index}}function Se(e,t,s,i){const n=ge(t,i);switch(s.nodeType){case 1:Ce(e,t,s,n,i),xe(e,s,n);break;case 3:return function(e,t,s,i,n){const r=W.parse(t.textContent,e.directives);if(null===r)return ve.node=t.nextSibling,ve.index=n+1,ve;let l,a=l=t;for(let t=0,h=r.length;t<h;++t){const h=r[t];0!==t&&(n++,i=ge(s,n),l=a.parentNode.insertBefore(document.createTextNode(""),a.nextSibling)),o(h)?l.textContent=h:(l.textContent=" ",Z.assign(h),e.addFactory(h,s,i,n)),a=l}return ve.index=n+1,ve.node=a.nextSibling,ve}(e,s,t,n,i);case 8:const r=W.parse(s.data,e.directives);null!==r&&e.addFactory(Ae.aggregate(r),t,n,i)}return ve.index=i+1,ve.node=s.nextSibling,ve}const Te={createHTML:e=>e};let Oe=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Te):Te;const Be=Oe,Ae={setHTMLPolicy(e){if(Oe!==Be)throw t.error(1201);Oe=e},compile(e,t){let s;if(o(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Oe.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new we(i,t);return Ce(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==W.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),xe(n,i,"r"),ve.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>o(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const l=new ae(s);return Z.assign(l,t),l}};class ke{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Ae.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const je=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function $e(e,t,s){const i=je.exec(t);return null!==i&&Z.assign(e,i[2]),e.createHTML(s)}function Ie(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=U();return i[s]=e,s};for(let i=0,l=e.length-1;i<l;++i){const l=e[i],a=t[i];let h;if(s+=l,r(a))s+=$e(new ae(he(a)),l,n);else if(o(a)){const e=je.exec(l);if(null!==e){const t=new ae(ce((()=>a)));Z.assign(t,e[2]),s+=t.createHTML(n)}else s+=a}else a instanceof Y?s+=$e(new ae(a),l,n):void 0===(h=K.getForInstance(a))?s+=$e(new ae(ce((()=>a))),l,n):h.aspected?s+=$e(a,l,n):s+=a.createHTML(n)}return new ke(s+e[e.length-1],i)}class Ve extends ee{bind(e){e.source[this.options]=e.targets[this.nodeId]}}K.define(Ve);const Ne=e=>new Ve(e);function Ee(e,t){const s=r(e)?e:()=>e,i=r(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const _e=Object.freeze({positioning:!1,recycle:!0});function Le(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function ze(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Fe{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=Le,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=ze)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=s);const t=this.itemsObserver,i=this.itemsObserver=d.getNotifier(this.items),n=t!==i;n&&null!==t&&t.unsubscribe(this),(n||e)&&i.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=t.splice(d.index,u.length),v=h=l.length+b.length;for(;p<g;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(p,0,d),s(d,i,p,r),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=s,i.index=e}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(pe.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class Me{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=U(),A.enable()}createHTML(e){return Q.comment(e(this))}createBehavior(){return new Fe(this)}}function Pe(e,t,s=_e){const i=ue(e),n=ue(t);return new Me(i,n,Object.assign(Object.assign({},_e),s))}K.define(Me);const Re=e=>1===e.nodeType,He=e=>e?t=>1===t.nodeType&&t.matches(e):Re;class qe extends ee{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,s),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class De extends qe{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function Ue(e){return o(e)&&(e={property:e}),new De(e)}K.define(De);class Qe extends qe{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function We(e){return o(e)&&(e={property:e}),new Qe(e)}K.define(Qe);const Ge=Object.freeze({locate:n()}),Je={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function Ke(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const Xe={toView(e){const t=Ke(e);return t?t.toString():t},fromView:Ke};class Ye{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=Je)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return d.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||l.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;M.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":M.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(Ge.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];o(i)?s.push(new Ye(e,i)):s.push(new Ye(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function Ze(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),Ge.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const et={mode:"open"},tt={},st=new Set,it=t.getById(4,(()=>i()));class nt{constructor(e,t=e.definition){var s;this.platformDefined=!1,o(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=Ye.collect(e,t.attributes),r=new Array(n.length),l={},a={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,l[t.name]=t,a[t.attribute]=t,d.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=l,this.attributeLookup=a,this.shadowOptions=void 0===t.shadowOptions?et:null===t.shadowOptions?void 0:Object.assign(Object.assign({},et),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?tt:Object.assign(Object.assign({},tt),t.elementOptions),this.styles=I.normalize(t.styles),it.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){return st.has(e)||it.getByType(e)?new nt(class extends e{},t):new nt(e,t)}static registerBaseType(e){st.add(e)}}nt.getByType=it.getByType,nt.getForInstance=it.getForInstance;const rt={bubbles:!0,composed:!0,cancelable:!0},ot=new WeakMap;function lt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ot.get(e))&&void 0!==s?s:null}let at;class ht extends h{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ot.set(e,t))}const i=d.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return d.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,d.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=lt(s))&&void 0!==t?t:this.source).append(e)}else if(!e.isAttachedTo(s)){const t=e.behaviors;if(e.addStylesTo(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=lt(s))&&void 0!==t?t:s).removeChild(e)}else if(e.isAttachedTo(s)){const t=e.behaviors;if(e.removeStylesFrom(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;if(null!==this.boundObservables){const e=this.source,t=this.boundObservables,s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.needsInitialization?(this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1):null!==this.view&&this.view.bind(this.source),this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},rt),s)))}renderTemplate(e){var t;const s=this.source,i=null!==(t=lt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=c.coupled)}static forCustomElement(e){const s=e.$fastController;if(void 0!==s)return s;const i=nt.getForInstance(e);if(void 0===i)throw t.error(1401);return e.$fastController=new at(e,i)}static setStrategy(e){at=e}}function ct(e){var t;return"adoptedStyleSheets"in e?e:null!==(t=lt(e))&&void 0!==t?t:e.getRootNode()}ht.setStrategy(ht);class dt{constructor(e){const t=dt.styleSheetCache;this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let s=t.get(e);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(e),t.set(e,s)),s}))}addStylesTo(e){const t=ct(e);t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=ct(e),s=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((e=>-1===s.indexOf(e)))}}dt.styleSheetCache=new Map;let ut=0;function ft(e){return e===document?document.body:e}function pt(e){const t=class extends e{constructor(){super(),ht.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}};return nt.registerBaseType(t),t}function gt(e,t){return r(e)?nt.compose(e,t).define().type:nt.compose(this,e).define().type}I.setDefaultStrategy(I.supportsAdoptedStyleSheets?dt:class{constructor(e){this.styles=e,this.styleClass="fast-"+ ++ut}addStylesTo(e){e=ft(ct(e));const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=(e=ft(ct(e))).querySelectorAll(`.${this.styleClass}`);t[0].parentNode;for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}});const bt=Object.assign(pt(HTMLElement),{from:function(e){return pt(e)},define:gt,compose:function(e,t){return r(e)?nt.compose(e,t):nt.compose(this,e)}});function vt(e){return function(t){gt(t,e)}}export{A as ArrayObserver,Z as Aspect,Ge as AttributeConfiguration,Ye as AttributeDefinition,Y as Binding,N as CSSDirective,Qe as ChildrenDirective,Ae as Compiler,M as DOM,ht as ElementController,I as ElementStyles,g as ExecutionContext,t as FAST,bt as FASTElement,nt as FASTElementDefinition,ae as HTMLBindingDirective,K as HTMLDirective,pe as HTMLView,Q as Markup,qe as NodeObservationDirective,d as Observable,W as Parser,h as PropertyChangeNotifier,Ve as RefDirective,Fe as RepeatBehavior,Me as RepeatDirective,De as SlottedDirective,c as SourceLifetime,b as Splice,S as SpliceStrategy,v as SpliceStrategySupport,ee as StatelessAttachedAttributeDirective,a as SubscriberSet,l as Updates,G as ViewBehaviorOrchestrator,ke as ViewTemplate,Ze as attr,he as bind,Je as booleanConverter,We as children,n as createMetadataLocator,i as createTypeRegistry,L as css,E as cssDirective,F as cssPartial,vt as customElement,He as elements,s as emptyArray,Ie as html,X as htmlDirective,k as lengthOf,de as listener,ue as normalizeBinding,Xe as nullableNumberConverter,u as observable,ce as oneTime,Ne as ref,Pe as repeat,Ue as slotted,f as volatile,Ee as when};
|
|
1
|
+
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}void 0===t.error&&Object.assign(t,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const s=Object.freeze([]);function i(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function n(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const r=e=>"function"==typeof e,o=e=>"string"==typeof e,l=t.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class a{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class h{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new a(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new a(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const c=Object.freeze({unknown:void 0,coupled:1}),d=t.getById(2,(()=>{const e=l.enqueue,s=/(:|&&|\|\||if)/,i=new WeakMap;let d,u=e=>{throw t.error(1101)};function f(e){var t;let s=null!==(t=e.$fastController)&&void 0!==t?t:i.get(e);return void 0===s&&(Array.isArray(e)?s=u(e):i.set(e,s=new h(e))),s}const p=n();class g{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==d&&d.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];r(n)&&n.call(e,i,t),f(e).notify(this.name)}}}class b extends a{constructor(e,t,s=!1){super(e,t),this.expression=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==c.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=d;let i;d=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{i=this.expression(e,t)}finally{d=s}return i}disconnect(){this.dispose()}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,i=f(e),n=null===s?this.first:{};if(n.propertySource=e,n.propertyName=t,n.notifier=i,i.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;d=void 0,t=s.propertySource[s.propertyName],d=this,e===t&&(this.needsRefresh=!0)}s.next=n}this.last=n}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){u=e},getNotifier:f,track(e,t){d&&d.watch(e,t)},trackVolatile(){d&&(d.needsRefresh=!0)},notify(e,t){f(e).notify(t)},defineProperty(e,t){o(t)&&(t=new g(t)),p(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:p,binding(e,t,s=this.isVolatileBinding(e)){return new b(e,t,s)},isVolatileBinding:e=>s.test(e.toString())})}));function u(e,t){d.defineProperty(e,t)}function f(e,t,s){return Object.assign({},s,{get(){return d.trackVolatile(),s.get.apply(this)}})}const p=t.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),g=Object.freeze({default:{index:0,length:0,get event(){return g.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>p.get(),setEvent(e){p.set(e)}});class b{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const v=Object.freeze({reset:1,splice:2,optimized:3}),y=new b(0,s,0);y.reset=!0;const m=[y];function w(e,t,i,n,r,o){let l=0,a=0;const h=Math.min(i-t,o-r);if(0===t&&0===r&&(l=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,n,h)),i===e.length&&o===n.length&&(a=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,n,h-l)),r+=l,o-=a,(i-=a)-(t+=l)==0&&o-r==0)return s;if(t===i){const e=new b(t,[],0);for(;r<o;)e.removed.push(n[r++]);return[e]}if(r===o)return[new b(t,[],i-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,i,n,r,o)),d=[];let u,f=t,p=r;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new b(f,[],0)),u.addedCount++,f++,u.removed.push(n[p]),p++;break;case 2:void 0===u&&(u=new b(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new b(f,[],0)),u.removed.push(n[p]),p++}return void 0!==u&&d.push(u),d}function C(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let x=Object.freeze({support:v.optimized,normalize:(e,t,i)=>void 0===e?void 0===i?s:i.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)C(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(w(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,i):i:m,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new b(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new b(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(0,[],i.length).adjustTo(e)),n}});const S=Object.freeze({reset:m,setDefaultStrategy(e){x=e}});function T(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class O extends a{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,T(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,d.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:x).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,l.enqueue(this))}}let B=!1;const A=Object.freeze({enable(){if(B)return;B=!0,d.setArrayObserverFactory((e=>new O(e)));const e=Array.prototype;e.$fastPatch||(T(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:x)[t.name](this,i,t,e)}})))}});function k(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(A.enable(),t=d.getNotifier(e)),d.track(t.lengthObserver,"length"),e.length}let j;function $(e){return e.map((e=>e instanceof V?$(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class V{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof V?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(j),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e($(this.styles)),this}static setDefaultStrategy(e){j=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new V(e):e instanceof V?e:new V([e])}}V.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;const I=i(),N=Object.freeze({getForInstance:I.getForInstance,getByType:I.getByType,define:e=>(I.register({type:e}),e)});function E(){return function(e){N.define(e)}}function L(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==N.getForInstance(o)&&(o=o.createCSS(r)),o instanceof V||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const z=(e,...t)=>{const{styles:s,behaviors:i}=L(e,t),n=new V(s);return i.length?n.withBehaviors(...i):n};class F{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(o(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new V(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}N.define(F);const M=z.partial=(e,...t)=>{const{styles:s,behaviors:i}=L(e,t);return new F(s,i)},_=Object.freeze({queueUpdate:l.enqueue,nextUpdate:l.next,processUpdates:l.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),P=`fast-${Math.random().toString(36).substring(2,8)}`,R=`${P}{`,H=`}${P}`,q=H.length;let D=0;const U=()=>`${P}-${++D}`,Q=Object.freeze({interpolation:e=>`${R}${e}${H}`,attribute:e=>`${U()}="${R}${e}${H}"`,comment:e=>`\x3c!--${R}${e}${H}--\x3e`}),W=Object.freeze({parse(e,t){const s=e.split(R);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(H);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+q)}""!==o&&i.push(o)}return i}}),G=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:g.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=U());e.id||(e.id=U()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),J=i(),K=Object.freeze({getForInstance:J.getForInstance,getByType:J.getByType,define:(e,t)=>((t=t||{}).type=e,J.register(t),e)});function X(e){return function(t){K.define(t,e)}}class Y{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const Z=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":e.targetAspect=t.substring(1),e.aspectType="classList"===e.targetAspect?Z.tokenList:Z.property;break;case"?":e.targetAspect=t.substring(1),e.aspectType=Z.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=Z.event;break;default:e.targetAspect=t,e.aspectType=Z.attribute}else e.aspectType=Z.content}});class ee{constructor(e){this.options=e,this.id=U()}createHTML(e){return Q.attribute(e(this))}createBehavior(){return this}}const te=globalThis.TrustedHTML?e=>(s,i)=>{const n=e(s,i);if(n instanceof TrustedHTML)return n;throw t.error(1202)}:e=>e;class se extends Y{createObserver(e,t){return d.binding(this.evaluate,t,this.isVolatile)}}class ie extends Y{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ne(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function re(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={v:0,cv:Object.create(null)},o=r.cv;let l=r.v;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const oe=(e,t,s)=>e[t]=s,le=()=>{};class ae{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=U(),this.aspectType=Z.content,this.data=`${this.id}-d`}createHTML(e){return Q.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=te(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=_.setAttribute;break;case 2:this.updateTarget=_.setBooleanAttribute;break;case 3:this.updateTarget=oe;break;case 4:this.updateTarget=ne;break;case 5:this.updateTarget=re;break;case 6:this.updateTarget=le;break;default:throw t.error(1205)}return this}bind(e){var t;const s=e.targets[this.nodeId];switch(this.updateTarget){case le:s[this.data]=e,s.addEventListener(this.targetAspect,this,this.dataBinding.options);break;case ne:e.onUnbind(this);default:const i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e)}}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget[this.data];if(t.isBound){g.setEvent(e);const s=this.dataBinding.evaluate(t.source,t.context);g.setEvent(null),!0!==s&&e.preventDefault()}}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function he(e,t=d.isVolatileBinding(e)){return new se(e,t)}function ce(e){return new ie(e)}function de(e,t){const s=new se(e,!1);return s.options=t,s}function ue(e){return r(e)?he(e):e instanceof Y?e:ce((()=>e))}function fe(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}K.define(ae,{aspected:!0});class pe{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=c.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return g.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){fe(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){fe(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}d.defineProperty(pe.prototype,"index"),d.defineProperty(pe.prototype,"length");const ge=(e,t)=>`${e}.${t}`,be={},ve={index:0,node:null};function ye(e){e.startsWith("fast-")||t.warn(1204,{name:e})}const me=new Proxy(document.createElement("div"),{get(e,t){ye(t);const s=Reflect.get(e,t);return r(s)?s.bind(e):s},set:(e,t,s)=>(ye(t),Reflect.set(e,t,s))});class we{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=be[t];if(!n){const i=`_${t}`;be[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:me;for(const e of this.nodeIds)s[e];return new pe(t,this.factories,s)}}function Ce(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=W.parse(d,l);let f=null;null===u?r&&(f=new ae(ce((()=>d))),Z.assign(f,c.name)):f=Ae.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function xe(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Se(e,s,n,i);n=t.node,i=t.index}}function Se(e,t,s,i){const n=ge(t,i);switch(s.nodeType){case 1:Ce(e,t,s,n,i),xe(e,s,n);break;case 3:return function(e,t,s,i,n){const r=W.parse(t.textContent,e.directives);if(null===r)return ve.node=t.nextSibling,ve.index=n+1,ve;let l,a=l=t;for(let t=0,h=r.length;t<h;++t){const h=r[t];0!==t&&(n++,i=ge(s,n),l=a.parentNode.insertBefore(document.createTextNode(""),a.nextSibling)),o(h)?l.textContent=h:(l.textContent=" ",Z.assign(h),e.addFactory(h,s,i,n)),a=l}return ve.index=n+1,ve.node=a.nextSibling,ve}(e,s,t,n,i);case 8:const r=W.parse(s.data,e.directives);null!==r&&e.addFactory(Ae.aggregate(r),t,n,i)}return ve.index=i+1,ve.node=s.nextSibling,ve}const Te={createHTML:e=>e};let Oe=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Te):Te;const Be=Oe,Ae={setHTMLPolicy(e){if(Oe!==Be)throw t.error(1201);Oe=e},compile(e,t){let s;if(o(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Oe.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new we(i,t);return Ce(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==W.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),xe(n,i,"r"),ve.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>o(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const l=new ae(s);return Z.assign(l,t),l}};class ke{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Ae.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const je=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function $e(e,t,s){const i=je.exec(t);return null!==i&&Z.assign(e,i[2]),e.createHTML(s)}function Ve(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=U();return i[s]=e,s};for(let i=0,l=e.length-1;i<l;++i){const l=e[i],a=t[i];let h;if(s+=l,r(a))s+=$e(new ae(he(a)),l,n);else if(o(a)){const e=je.exec(l);if(null!==e){const t=new ae(ce((()=>a)));Z.assign(t,e[2]),s+=t.createHTML(n)}else s+=a}else a instanceof Y?s+=$e(new ae(a),l,n):void 0===(h=K.getForInstance(a))?s+=$e(new ae(ce((()=>a))),l,n):h.aspected?s+=$e(a,l,n):s+=a.createHTML(n)}return new ke(s+e[e.length-1],i)}class Ie extends ee{bind(e){e.source[this.options]=e.targets[this.nodeId]}}K.define(Ie);const Ne=e=>new Ie(e);function Ee(e,t){const s=r(e)?e:()=>e,i=r(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const Le=Object.freeze({positioning:!1,recycle:!0});function ze(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function Fe(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Me{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=ze,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=Fe)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=s);const t=this.itemsObserver,i=this.itemsObserver=d.getNotifier(this.items),n=t!==i;n&&null!==t&&t.unsubscribe(this),(n||e)&&i.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=t.splice(d.index,u.length),v=h=l.length+b.length;for(;p<g;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(p,0,d),s(d,i,p,r),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=s,i.index=e}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(pe.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class _e{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=U(),A.enable()}createHTML(e){return Q.comment(e(this))}createBehavior(){return new Me(this)}}function Pe(e,t,s=Le){const i=ue(e),n=ue(t);return new _e(i,n,Object.assign(Object.assign({},Le),s))}K.define(_e);const Re=e=>1===e.nodeType,He=e=>e?t=>1===t.nodeType&&t.matches(e):Re;class qe extends ee{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,s),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class De extends qe{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function Ue(e){return o(e)&&(e={property:e}),new De(e)}K.define(De);class Qe extends qe{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function We(e){return o(e)&&(e={property:e}),new Qe(e)}K.define(Qe);const Ge=Object.freeze({locate:n()}),Je={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function Ke(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const Xe={toView(e){const t=Ke(e);return t?t.toString():t},fromView:Ke};class Ye{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=Je)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return d.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||l.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;_.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":_.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(Ge.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];o(i)?s.push(new Ye(e,i)):s.push(new Ye(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function Ze(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),Ge.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const et={mode:"open"},tt={},st=new Set,it=t.getById(4,(()=>i()));class nt{constructor(e,t=e.definition){var s;this.platformDefined=!1,o(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=Ye.collect(e,t.attributes),r=new Array(n.length),l={},a={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,l[t.name]=t,a[t.attribute]=t,d.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=l,this.attributeLookup=a,this.shadowOptions=void 0===t.shadowOptions?et:null===t.shadowOptions?void 0:Object.assign(Object.assign({},et),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?tt:Object.assign(Object.assign({},tt),t.elementOptions),this.styles=V.normalize(t.styles),it.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){return st.has(e)||it.getByType(e)?new nt(class extends e{},t):new nt(e,t)}static registerBaseType(e){st.add(e)}}nt.getByType=it.getByType,nt.getForInstance=it.getForInstance;const rt={bubbles:!0,composed:!0,cancelable:!0},ot=new WeakMap;function lt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ot.get(e))&&void 0!==s?s:null}let at;class ht extends h{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this.stage=3,this.guardBehaviorConnection=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ot.set(e,t))}const i=d.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return d.track(this,"isConnected"),1===this.stage}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),!e.connectedCallback||this.guardBehaviorConnection||1!==this.stage&&0!==this.stage||e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&3!==this.stage&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=lt(s))&&void 0!==t?t:this.source).append(e)}else if(!e.isAttachedTo(s)){const t=e.behaviors;if(e.addStylesTo(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=lt(s))&&void 0!==t?t:s).removeChild(e)}else if(e.isAttachedTo(s)){const t=e.behaviors;if(e.removeStylesFrom(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(3!==this.stage)return;if(this.stage=0,null!==this.boundObservables){const e=this.source,t=this.boundObservables,s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}const e=this.behaviors;if(null!==e){this.guardBehaviorConnection=!0;for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.guardBehaviorConnection=!1}this.needsInitialization?(this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1):null!==this.view&&this.view.bind(this.source),this.stage=1,d.notify(this,"isConnected")}disconnect(){if(1!==this.stage)return;this.stage=2,d.notify(this,"isConnected"),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this);this.stage=3}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return 1===this.stage&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},rt),s)))}renderTemplate(e){var t;const s=this.source,i=null!==(t=lt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=c.coupled)}static forCustomElement(e){const s=e.$fastController;if(void 0!==s)return s;const i=nt.getForInstance(e);if(void 0===i)throw t.error(1401);return e.$fastController=new at(e,i)}static setStrategy(e){at=e}}function ct(e){var t;return"adoptedStyleSheets"in e?e:null!==(t=lt(e))&&void 0!==t?t:e.getRootNode()}ht.setStrategy(ht);class dt{constructor(e){const t=dt.styleSheetCache;this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let s=t.get(e);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(e),t.set(e,s)),s}))}addStylesTo(e){const t=ct(e);t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=ct(e),s=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((e=>-1===s.indexOf(e)))}}dt.styleSheetCache=new Map;let ut=0;function ft(e){return e===document?document.body:e}function pt(e){const t=class extends e{constructor(){super(),ht.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}};return nt.registerBaseType(t),t}function gt(e,t){return r(e)?nt.compose(e,t).define().type:nt.compose(this,e).define().type}V.setDefaultStrategy(V.supportsAdoptedStyleSheets?dt:class{constructor(e){this.styles=e,this.styleClass="fast-"+ ++ut}addStylesTo(e){e=ft(ct(e));const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=(e=ft(ct(e))).querySelectorAll(`.${this.styleClass}`);t[0].parentNode;for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}});const bt=Object.assign(pt(HTMLElement),{from:function(e){return pt(e)},define:gt,compose:function(e,t){return r(e)?nt.compose(e,t):nt.compose(this,e)}});function vt(e){return function(t){gt(t,e)}}export{A as ArrayObserver,Z as Aspect,Ge as AttributeConfiguration,Ye as AttributeDefinition,Y as Binding,N as CSSDirective,Qe as ChildrenDirective,Ae as Compiler,_ as DOM,ht as ElementController,V as ElementStyles,g as ExecutionContext,t as FAST,bt as FASTElement,nt as FASTElementDefinition,ae as HTMLBindingDirective,K as HTMLDirective,pe as HTMLView,Q as Markup,qe as NodeObservationDirective,d as Observable,W as Parser,h as PropertyChangeNotifier,Ie as RefDirective,Me as RepeatBehavior,_e as RepeatDirective,De as SlottedDirective,c as SourceLifetime,b as Splice,S as SpliceStrategy,v as SpliceStrategySupport,ee as StatelessAttachedAttributeDirective,a as SubscriberSet,l as Updates,G as ViewBehaviorOrchestrator,ke as ViewTemplate,Ze as attr,he as bind,Je as booleanConverter,We as children,n as createMetadataLocator,i as createTypeRegistry,z as css,E as cssDirective,M as cssPartial,vt as customElement,He as elements,s as emptyArray,Ve as html,X as htmlDirective,k as lengthOf,de as listener,ue as normalizeBinding,Xe as nullableNumberConverter,u as observable,ce as oneTime,Ne as ref,Pe as repeat,Ue as slotted,f as volatile,Ee as when};
|
|
@@ -679,7 +679,13 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
679
679
|
private needsInitialization;
|
|
680
680
|
private hasExistingShadowRoot;
|
|
681
681
|
private _template;
|
|
682
|
-
private
|
|
682
|
+
private stage;
|
|
683
|
+
/**
|
|
684
|
+
* A guard against connecting behaviors multiple times
|
|
685
|
+
* during connect in scenarios where a behavior adds
|
|
686
|
+
* another behavior during it's connectedCallback
|
|
687
|
+
*/
|
|
688
|
+
private guardBehaviorConnection;
|
|
683
689
|
private behaviors;
|
|
684
690
|
private _mainStyles;
|
|
685
691
|
/**
|
|
@@ -711,7 +717,6 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
711
717
|
* connected to the document.
|
|
712
718
|
*/
|
|
713
719
|
get isConnected(): boolean;
|
|
714
|
-
private setIsConnected;
|
|
715
720
|
/**
|
|
716
721
|
* Gets/sets the template used to render the component.
|
|
717
722
|
* @remarks
|