@microsoft/fast-router 0.4.1 → 0.4.2

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 CHANGED
@@ -2,7 +2,82 @@
2
2
  "name": "@microsoft/fast-router",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 03 May 2022 07:12:26 GMT",
5
+ "date": "Tue, 24 May 2022 07:08:28 GMT",
6
+ "tag": "@microsoft/fast-router_v0.4.2",
7
+ "version": "0.4.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "comment": "Bump @microsoft/fast-element to v1.10.2",
12
+ "author": "roeisenb@microsoft.com",
13
+ "commit": "476be7672653b2e63b9ab771949718aa8f43df0d",
14
+ "package": "@microsoft/fast-router"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Sun, 15 May 2022 07:08:25 GMT",
21
+ "tag": "@microsoft/fast-router_v0.4.1",
22
+ "version": "0.4.1",
23
+ "comments": {
24
+ "none": [
25
+ {
26
+ "comment": "fix url path for npm version badge on README.md",
27
+ "author": "nicholasrice@users.noreply.github.com",
28
+ "commit": "f43629c7b3065a95ec05bf6186c851496d5320ec",
29
+ "package": "@microsoft/fast-router"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Sun, 08 May 2022 07:08:18 GMT",
36
+ "tag": "@microsoft/fast-router_v0.4.1",
37
+ "version": "0.4.1",
38
+ "comments": {
39
+ "none": [
40
+ {
41
+ "comment": "Bump @microsoft/fast-element to v1.10.1",
42
+ "author": "chhol@microsoft.com",
43
+ "commit": "890ff058b8771c84a9e669b4e9202c43f4d3e7fc",
44
+ "package": "@microsoft/fast-router"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Fri, 06 May 2022 20:58:02 GMT",
51
+ "tag": "@microsoft/fast-router_v0.4.1",
52
+ "version": "0.4.1",
53
+ "comments": {
54
+ "none": [
55
+ {
56
+ "comment": "update api extractor to 7.23.1 to ensure we can support TS 4.7 internal API changes",
57
+ "author": "chhol@microsoft.com",
58
+ "commit": "fbc6a7fb670453322c93f8f12a223febad86f735",
59
+ "package": "@microsoft/fast-router"
60
+ }
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "date": "Wed, 04 May 2022 07:14:00 GMT",
66
+ "tag": "@microsoft/fast-router_v0.4.1",
67
+ "version": "0.4.1",
68
+ "comments": {
69
+ "none": [
70
+ {
71
+ "comment": "Bump @microsoft/fast-element to v1.10.1",
72
+ "author": "steph@huynhicode.dev",
73
+ "commit": "c49a98f7f1bd8e167b0b7a96a181990f9a675f34",
74
+ "package": "@microsoft/fast-router"
75
+ }
76
+ ]
77
+ }
78
+ },
79
+ {
80
+ "date": "Tue, 03 May 2022 07:15:44 GMT",
6
81
  "tag": "@microsoft/fast-router_v0.4.1",
7
82
  "version": "0.4.1",
8
83
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @microsoft/fast-router
2
2
 
3
- This log was last generated on Tue, 03 May 2022 07:12:26 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 24 May 2022 07:08:28 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.4.2
8
+
9
+ Tue, 24 May 2022 07:08:28 GMT
10
+
11
+ ### Patches
12
+
13
+ - Bump @microsoft/fast-element to v1.10.2 (roeisenb@microsoft.com)
14
+
7
15
  ## 0.4.1
8
16
 
9
- Tue, 03 May 2022 07:12:26 GMT
17
+ Tue, 03 May 2022 07:15:44 GMT
10
18
 
11
19
  ### Patches
12
20
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # FAST Router
2
2
 
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
- [![npm version](https://badge.fury.io/js/%40microsoft%2Ffast-foundation.svg)](https://badge.fury.io/js/%40microsoft%2Ffast-router)
4
+ [![npm version](https://badge.fury.io/js/%40microsoft%2Ffast-router.svg)](https://badge.fury.io/js/%40microsoft%2Ffast-router)
5
5
 
6
6
  The `fast-router` package contains a history-based navigation and routing solution designed around web components. By using `fast-router`, you can create multi-page and full application experiences.
7
7
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "metadata": {
3
3
  "toolPackage": "@microsoft/api-extractor",
4
- "toolVersion": "7.23.0",
4
+ "toolVersion": "7.23.1",
5
5
  "schemaVersion": 1005,
6
6
  "oldestForwardsCompatibleVersion": 1001,
7
7
  "tsdocConfig": {
@@ -1,4 +1,4 @@
1
- /*! *****************************************************************************
1
+ /******************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -374,36 +374,6 @@ const DOM = Object.freeze({
374
374
 
375
375
  });
376
376
 
377
- function spilloverSubscribe(subscriber) {
378
- const spillover = this.spillover;
379
- const index = spillover.indexOf(subscriber);
380
-
381
- if (index === -1) {
382
- spillover.push(subscriber);
383
- }
384
- }
385
-
386
- function spilloverUnsubscribe(subscriber) {
387
- const spillover = this.spillover;
388
- const index = spillover.indexOf(subscriber);
389
-
390
- if (index !== -1) {
391
- spillover.splice(index, 1);
392
- }
393
- }
394
-
395
- function spilloverNotifySubscribers(args) {
396
- const spillover = this.spillover;
397
- const source = this.source;
398
-
399
- for (let i = 0, ii = spillover.length; i < ii; ++i) {
400
- spillover[i].handleChange(source, args);
401
- }
402
- }
403
-
404
- function spilloverHas(subscriber) {
405
- return this.spillover.indexOf(subscriber) !== -1;
406
- }
407
377
  /**
408
378
  * An implementation of {@link Notifier} that efficiently keeps track of
409
379
  * subscribers interested in a specific change notification on an
@@ -415,8 +385,6 @@ function spilloverHas(subscriber) {
415
385
  * If the set ever exceeds two subscribers, it upgrades to an array automatically.
416
386
  * @public
417
387
  */
418
-
419
-
420
388
  class SubscriberSet {
421
389
  /**
422
390
  * Creates an instance of SubscriberSet for the specified source.
@@ -437,7 +405,7 @@ class SubscriberSet {
437
405
 
438
406
 
439
407
  has(subscriber) {
440
- return this.sub1 === subscriber || this.sub2 === subscriber;
408
+ return this.spillover === void 0 ? this.sub1 === subscriber || this.sub2 === subscriber : this.spillover.indexOf(subscriber) !== -1;
441
409
  }
442
410
  /**
443
411
  * Subscribes to notification of changes in an object's state.
@@ -446,27 +414,33 @@ class SubscriberSet {
446
414
 
447
415
 
448
416
  subscribe(subscriber) {
449
- if (this.has(subscriber)) {
450
- return;
451
- }
417
+ const spillover = this.spillover;
452
418
 
453
- if (this.sub1 === void 0) {
454
- this.sub1 = subscriber;
455
- return;
456
- }
419
+ if (spillover === void 0) {
420
+ if (this.has(subscriber)) {
421
+ return;
422
+ }
457
423
 
458
- if (this.sub2 === void 0) {
459
- this.sub2 = subscriber;
460
- return;
461
- }
424
+ if (this.sub1 === void 0) {
425
+ this.sub1 = subscriber;
426
+ return;
427
+ }
462
428
 
463
- this.spillover = [this.sub1, this.sub2, subscriber];
464
- this.subscribe = spilloverSubscribe;
465
- this.unsubscribe = spilloverUnsubscribe;
466
- this.notify = spilloverNotifySubscribers;
467
- this.has = spilloverHas;
468
- this.sub1 = void 0;
469
- this.sub2 = void 0;
429
+ if (this.sub2 === void 0) {
430
+ this.sub2 = subscriber;
431
+ return;
432
+ }
433
+
434
+ this.spillover = [this.sub1, this.sub2, subscriber];
435
+ this.sub1 = void 0;
436
+ this.sub2 = void 0;
437
+ } else {
438
+ const index = spillover.indexOf(subscriber);
439
+
440
+ if (index === -1) {
441
+ spillover.push(subscriber);
442
+ }
443
+ }
470
444
  }
471
445
  /**
472
446
  * Unsubscribes from notification of changes in an object's state.
@@ -475,10 +449,20 @@ class SubscriberSet {
475
449
 
476
450
 
477
451
  unsubscribe(subscriber) {
478
- if (this.sub1 === subscriber) {
479
- this.sub1 = void 0;
480
- } else if (this.sub2 === subscriber) {
481
- this.sub2 = void 0;
452
+ const spillover = this.spillover;
453
+
454
+ if (spillover === void 0) {
455
+ if (this.sub1 === subscriber) {
456
+ this.sub1 = void 0;
457
+ } else if (this.sub2 === subscriber) {
458
+ this.sub2 = void 0;
459
+ }
460
+ } else {
461
+ const index = spillover.indexOf(subscriber);
462
+
463
+ if (index !== -1) {
464
+ spillover.splice(index, 1);
465
+ }
482
466
  }
483
467
  }
484
468
  /**
@@ -488,16 +472,24 @@ class SubscriberSet {
488
472
 
489
473
 
490
474
  notify(args) {
491
- const sub1 = this.sub1;
492
- const sub2 = this.sub2;
475
+ const spillover = this.spillover;
493
476
  const source = this.source;
494
477
 
495
- if (sub1 !== void 0) {
496
- sub1.handleChange(source, args);
497
- }
478
+ if (spillover === void 0) {
479
+ const sub1 = this.sub1;
480
+ const sub2 = this.sub2;
481
+
482
+ if (sub1 !== void 0) {
483
+ sub1.handleChange(source, args);
484
+ }
498
485
 
499
- if (sub2 !== void 0) {
500
- sub2.handleChange(source, args);
486
+ if (sub2 !== void 0) {
487
+ sub2.handleChange(source, args);
488
+ }
489
+ } else {
490
+ for (let i = 0, ii = spillover.length; i < ii; ++i) {
491
+ spillover[i].handleChange(source, args);
492
+ }
501
493
  }
502
494
  }
503
495
 
@@ -3571,6 +3563,11 @@ class ArrayObserver extends SubscriberSet {
3571
3563
  });
3572
3564
  }
3573
3565
 
3566
+ subscribe(subscriber) {
3567
+ this.flush();
3568
+ super.subscribe(subscriber);
3569
+ }
3570
+
3574
3571
  addSplice(splice) {
3575
3572
  if (this.splices === void 0) {
3576
3573
  this.splices = [splice];
@@ -1,15 +1 @@
1
- /*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
- function t(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{a(s.next(t))}catch(t){r(t)}}function l(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,l)}a((s=s.apply(t,e||[])).next())}))}const e=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof global)return global;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;try{return new Function("return this")()}catch(t){return{}}}();void 0===e.trustedTypes&&(e.trustedTypes={createPolicy:(t,e)=>e});const i={configurable:!1,enumerable:!1,writable:!1};void 0===e.FAST&&Reflect.defineProperty(e,"FAST",Object.assign({value:Object.create(null)},i));const s=e.FAST;if(void 0===s.getById){const t=Object.create(null);Reflect.defineProperty(s,"getById",Object.assign({value(e,i){let s=t[e];return void 0===s&&(s=i?t[e]=i():null),s}},i))}const n=Object.freeze([]),r=e.FAST.getById(1,()=>{const t=[],i=[];function s(){if(i.length)throw i.shift()}function n(t){try{t.call()}catch(t){i.push(t),setTimeout(s,0)}}function r(){let e=0;for(;e<t.length;)if(n(t[e]),e++,e>1024){for(let i=0,s=t.length-e;i<s;i++)t[i]=t[i+e];t.length-=e,e=0}t.length=0}return Object.freeze({enqueue:function(i){t.length<1&&e.requestAnimationFrame(r),t.push(i)},process:r})}),o=e.trustedTypes.createPolicy("fast-html",{createHTML:t=>t});let l=o;const a="fast-"+Math.random().toString(36).substring(2,8),h=a+"{",c="}"+a,u=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(l!==o)throw new Error("The HTML policy can only be set once.");l=t},createHTML:t=>l.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(a),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(a+":","")),createInterpolationPlaceholder:t=>`${h}${t}${c}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${a}:${t}--\x3e`,queueUpdate:r.enqueue,processUpdates:r.process,nextUpdate:()=>new Promise(r.enqueue),setAttribute(t,e,i){null==i?t.removeAttribute(e):t.setAttribute(e,i)},setBooleanAttribute(t,e,i){i?t.setAttribute(e,""):t.removeAttribute(e)},removeChildNodes(t){for(let e=t.firstChild;null!==e;e=t.firstChild)t.removeChild(e)},createTemplateWalker:t=>document.createTreeWalker(t,133,null,!1)});function d(t){const e=this.spillover;-1===e.indexOf(t)&&e.push(t)}function f(t){const e=this.spillover,i=e.indexOf(t);-1!==i&&e.splice(i,1)}function p(t){const e=this.spillover,i=this.source;for(let s=0,n=e.length;s<n;++s)e[s].handleChange(i,t)}function g(t){return-1!==this.spillover.indexOf(t)}class v{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.source=t,this.sub1=e}has(t){return this.sub1===t||this.sub2===t}subscribe(t){this.has(t)||(void 0!==this.sub1?void 0!==this.sub2?(this.spillover=[this.sub1,this.sub2,t],this.subscribe=d,this.unsubscribe=f,this.notify=p,this.has=g,this.sub1=void 0,this.sub2=void 0):this.sub2=t:this.sub1=t)}unsubscribe(t){this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0)}notify(t){const e=this.sub1,i=this.sub2,s=this.source;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}}class m{constructor(t){this.subscribers={},this.sourceSubscribers=null,this.source=t}notify(t){var e;const i=this.subscribers[t];void 0!==i&&i.notify(t),null===(e=this.sourceSubscribers)||void 0===e||e.notify(t)}subscribe(t,e){var i;if(e){let i=this.subscribers[e];void 0===i&&(this.subscribers[e]=i=new v(this.source)),i.subscribe(t)}else this.sourceSubscribers=null!==(i=this.sourceSubscribers)&&void 0!==i?i:new v(this.source),this.sourceSubscribers.subscribe(t)}unsubscribe(t,e){var i;if(e){const i=this.subscribers[e];void 0!==i&&i.unsubscribe(t)}else null===(i=this.sourceSubscribers)||void 0===i||i.unsubscribe(t)}}const b=s.getById(2,()=>{const t=/(:|&&|\|\||if)/,e=new WeakMap,i=new WeakMap,s=u.queueUpdate;let n=void 0,r=t=>{throw new Error("Must call enableArrayObservation before observing arrays.")};function o(t){let i=t.$fastController||e.get(t);return void 0===i&&(Array.isArray(t)?i=r(t):e.set(t,i=new m(t))),i}function l(t){let e=i.get(t);if(void 0===e){let s=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==s;)e=i.get(s),s=Reflect.getPrototypeOf(s);e=void 0===e?[]:e.slice(0),i.set(t,e)}return e}class a{constructor(t){this.name=t,this.field="_"+t,this.callback=t+"Changed"}getValue(t){return void 0!==n&&n.watch(t,this.name),t[this.field]}setValue(t,e){const i=this.field,s=t[i];if(s!==e){t[i]=e;const n=t[this.callback];"function"==typeof n&&n.call(t,s,e),o(t).notify(this.name)}}}class h extends v{constructor(t,e,i=!1){super(t,e),this.binding=t,this.isVolatileBinding=i,this.needsRefresh=!0,this.needsQueue=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}observe(t,e){this.needsRefresh&&null!==this.last&&this.disconnect();const i=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const s=this.binding(t,e);return n=i,s}disconnect(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=!0}}watch(t,e){const i=this.last,s=o(t),r=null===i?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=s,s.subscribe(this,e),null!==i){if(!this.needsRefresh){let e;n=void 0,e=i.propertySource[i.propertyName],n=this,t===e&&(this.needsRefresh=!0)}i.next=r}this.last=r}handleChange(){this.needsQueue&&(this.needsQueue=!1,s(this))}call(){null!==this.last&&(this.needsQueue=!0,this.notify(this))}records(){let t=this.first;return{next:()=>{const e=t;return void 0===e?{value:void 0,done:!0}:(t=t.next,{value:e,done:!1})},[Symbol.iterator]:function(){return this}}}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){void 0!==n&&n.watch(t,e)},trackVolatile(){void 0!==n&&(n.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){"string"==typeof e&&(e=new a(e)),l(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get:function(){return e.getValue(this)},set:function(t){e.setValue(this,t)}})},getAccessors:l,binding(t,e,i=this.isVolatileBinding(t)){return new h(t,e,i)},isVolatileBinding:e=>t.test(e.toString())})});function y(t,e){b.defineProperty(t,e)}function C(t,e,i){return Object.assign({},i,{get:function(){return b.trackVolatile(),i.get.apply(this)}})}const w=s.getById(3,()=>{let t=null;return{get:()=>t,set(e){t=e}}});class S{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}get event(){return w.get()}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}static setEvent(t){w.set(t)}}b.defineProperty(S.prototype,"index"),b.defineProperty(S.prototype,"length");const x=Object.seal(new S);class O{constructor(){this.targetIndex=0}}class T extends O{constructor(){super(...arguments),this.createPlaceholder=u.createInterpolationPlaceholder}}class k extends O{constructor(t,e,i){super(),this.name=t,this.behavior=e,this.options=i}createPlaceholder(t){return u.createCustomAttributePlaceholder(this.name,t)}createBehavior(t){return new this.behavior(t,this.options)}}function B(t,e){this.source=t,this.context=e,null===this.bindingObserver&&(this.bindingObserver=b.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(t,e))}function N(t,e){this.source=t,this.context=e,this.target.addEventListener(this.targetName,this)}function A(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function $(){this.bindingObserver.disconnect(),this.source=null,this.context=null;const t=this.target.$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}function R(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function P(t){u.setAttribute(this.target,this.targetName,t)}function E(t){u.setBooleanAttribute(this.target,this.targetName,t)}function V(t){if(null==t&&(t=""),t.create){this.target.textContent="";let e=this.target.$fastView;void 0===e?e=t.create():this.target.$fastTemplate!==t&&(e.isComposed&&(e.remove(),e.unbind()),e=t.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(this.source,this.context)):(e.isComposed=!0,e.bind(this.source,this.context),e.insertBefore(this.target),this.target.$fastView=e,this.target.$fastTemplate=t)}else{const e=this.target.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),this.target.textContent=t}}function F(t){this.target[this.targetName]=t}function j(t){const e=this.classVersions||Object.create(null),i=this.target;let s=this.version||0;if(null!=t&&t.length){const n=t.split(/\s+/);for(let t=0,r=n.length;t<r;++t){const r=n[t];""!==r&&(e[r]=s,i.classList.add(r))}}if(this.classVersions=e,this.version=s+1,0!==s){s-=1;for(const t in e)e[t]===s&&i.classList.remove(t)}}class z extends T{constructor(t){super(),this.binding=t,this.bind=B,this.unbind=A,this.updateTarget=P,this.isBindingVolatile=b.isVolatileBinding(this.binding)}get targetName(){return this.originalTargetName}set targetName(t){if(this.originalTargetName=t,void 0!==t)switch(t[0]){case":":if(this.cleanedTargetName=t.substr(1),this.updateTarget=F,"innerHTML"===this.cleanedTargetName){const t=this.binding;this.binding=(e,i)=>u.createHTML(t(e,i))}break;case"?":this.cleanedTargetName=t.substr(1),this.updateTarget=E;break;case"@":this.cleanedTargetName=t.substr(1),this.bind=N,this.unbind=R;break;default:this.cleanedTargetName=t,"class"===t&&(this.updateTarget=j)}}targetAtContent(){this.updateTarget=V,this.unbind=$}createBehavior(t){return new I(t,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class I{constructor(t,e,i,s,n,r,o){this.source=null,this.context=null,this.bindingObserver=null,this.target=t,this.binding=e,this.isBindingVolatile=i,this.bind=s,this.unbind=n,this.updateTarget=r,this.targetName=o}handleChange(){this.updateTarget(this.bindingObserver.observe(this.source,this.context))}handleEvent(t){S.setEvent(t);const e=this.binding(this.source,this.context);S.setEvent(null),!0!==e&&t.preventDefault()}}let M=null;class _{addFactory(t){t.targetIndex=this.targetIndex,this.behaviorFactories.push(t)}captureContentBinding(t){t.targetAtContent(),this.addFactory(t)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){M=this}static borrow(t){const e=M||new _;return e.directives=t,e.reset(),M=null,e}}function L(t){if(1===t.length)return t[0];let e;const i=t.length,s=t.map(t=>"string"==typeof t?()=>t:(e=t.targetName||e,t.binding)),n=new z((t,e)=>{let n="";for(let r=0;r<i;++r)n+=s[r](t,e);return n});return n.targetName=e,n}const q=c.length;function H(t,e){const i=e.split(h);if(1===i.length)return null;const s=[];for(let e=0,n=i.length;e<n;++e){const n=i[e],r=n.indexOf(c);let o;if(-1===r)o=n;else{const e=parseInt(n.substring(0,r));s.push(t.directives[e]),o=n.substring(r+q)}""!==o&&s.push(o)}return s}function D(t,e,i=!1){const s=e.attributes;for(let n=0,r=s.length;n<r;++n){const o=s[n],l=o.value,a=H(t,l);let h=null;null===a?i&&(h=new z(()=>l),h.targetName=o.name):h=L(a),null!==h&&(e.removeAttributeNode(o),n--,r--,t.addFactory(h))}}function Q(t,e,i){const s=H(t,e.textContent);if(null!==s){let n=e;for(let r=0,o=s.length;r<o;++r){const o=s[r],l=0===r?e:n.parentNode.insertBefore(document.createTextNode(""),n.nextSibling);"string"==typeof o?l.textContent=o:(l.textContent=" ",t.captureContentBinding(o)),n=l,t.targetIndex++,l!==e&&i.nextNode()}t.targetIndex--}}function U(t,e){const i=t.content;document.adoptNode(i);const s=_.borrow(e);D(s,t,!0);const n=s.behaviorFactories;s.reset();const r=u.createTemplateWalker(i);let o;for(;o=r.nextNode();)switch(s.targetIndex++,o.nodeType){case 1:D(s,o);break;case 3:Q(s,o,r);break;case 8:u.isMarker(o)&&s.addFactory(e[u.extractDirectiveIndexFromMarker(o)])}let l=0;(u.isMarker(i.firstChild)||1===i.childNodes.length&&e.length)&&(i.insertBefore(document.createComment(""),i.firstChild),l=-1);const a=s.behaviorFactories;return s.release(),{fragment:i,viewBehaviorFactories:a,hostBehaviorFactories:n,targetOffset:l}}const W=document.createRange();class K{constructor(t,e){this.fragment=t,this.behaviors=e,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=t.parentNode,i=this.lastChild;let s,n=this.firstChild;for(;n!==i;)s=n.nextSibling,e.insertBefore(n,t),n=s;e.insertBefore(i,t)}}remove(){const t=this.fragment,e=this.lastChild;let i,s=this.firstChild;for(;s!==e;)i=s.nextSibling,t.appendChild(s),s=i;t.appendChild(e)}dispose(){const t=this.firstChild.parentNode,e=this.lastChild;let i,s=this.firstChild;for(;s!==e;)i=s.nextSibling,t.removeChild(s),s=i;t.removeChild(e);const n=this.behaviors,r=this.source;for(let t=0,e=n.length;t<e;++t)n[t].unbind(r)}bind(t,e){const i=this.behaviors;if(this.source!==t)if(null!==this.source){const s=this.source;this.source=t,this.context=e;for(let n=0,r=i.length;n<r;++n){const r=i[n];r.unbind(s),r.bind(t,e)}}else{this.source=t,this.context=e;for(let s=0,n=i.length;s<n;++s)i[s].bind(t,e)}}unbind(){if(null===this.source)return;const t=this.behaviors,e=this.source;for(let i=0,s=t.length;i<s;++i)t[i].unbind(e);this.source=null}static disposeContiguousBatch(t){if(0!==t.length){W.setStartBefore(t[0].firstChild),W.setEndAfter(t[t.length-1].lastChild),W.deleteContents();for(let e=0,i=t.length;e<i;++e){const i=t[e],s=i.behaviors,n=i.source;for(let t=0,e=s.length;t<e;++t)s[t].unbind(n)}}}}class J{constructor(t,e){this.behaviorCount=0,this.hasHostBehaviors=!1,this.fragment=null,this.targetOffset=0,this.viewBehaviorFactories=null,this.hostBehaviorFactories=null,this.html=t,this.directives=e}create(t){if(null===this.fragment){let t;const e=this.html;if("string"==typeof e){t=document.createElement("template"),t.innerHTML=u.createHTML(e);const i=t.content.firstElementChild;null!==i&&"TEMPLATE"===i.tagName&&(t=i)}else t=e;const i=U(t,this.directives);this.fragment=i.fragment,this.viewBehaviorFactories=i.viewBehaviorFactories,this.hostBehaviorFactories=i.hostBehaviorFactories,this.targetOffset=i.targetOffset,this.behaviorCount=this.viewBehaviorFactories.length+this.hostBehaviorFactories.length,this.hasHostBehaviors=this.hostBehaviorFactories.length>0}const e=this.fragment.cloneNode(!0),i=this.viewBehaviorFactories,s=new Array(this.behaviorCount),n=u.createTemplateWalker(e);let r=0,o=this.targetOffset,l=n.nextNode();for(let t=i.length;r<t;++r){const t=i[r],e=t.targetIndex;for(;null!==l;){if(o===e){s[r]=t.createBehavior(l);break}l=n.nextNode(),o++}}if(this.hasHostBehaviors){const e=this.hostBehaviorFactories;for(let i=0,n=e.length;i<n;++i,++r)s[r]=e[i].createBehavior(t)}return new K(e,s)}render(t,e,i){"string"==typeof e&&(e=document.getElementById(e)),void 0===i&&(i=e);const s=this.create(i);return s.bind(t,x),s.appendTo(e),s}}const G=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function X(t,...e){const i=[];let s="";for(let n=0,r=t.length-1;n<r;++n){const r=t[n];let o=e[n];if(s+=r,o instanceof J){const t=o;o=()=>t}if("function"==typeof o&&(o=new z(o)),o instanceof T){const t=G.exec(r);null!==t&&(o.targetName=t[2])}o instanceof O?(s+=o.createPlaceholder(i.length),i.push(o)):s+=o}return s+=t[t.length-1],new J(s,i)}class Y{constructor(){this.targets=new WeakSet}addStylesTo(t){this.targets.add(t)}removeStylesFrom(t){this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}}function Z(t){return t.map(t=>t instanceof Y?Z(t.styles):[t]).reduce((t,e)=>t.concat(e),[])}function tt(t){return t.map(t=>t instanceof Y?t.behaviors:null).reduce((t,e)=>null===e?t:(null===t&&(t=[]),t.concat(e)),null)}Y.create=(()=>{if(u.supportsAdoptedStyleSheets){const t=new Map;return e=>new et(e,t)}return t=>new st(t)})();class et extends Y{constructor(t,e){super(),this.styles=t,this.styleSheetCache=e,this._styleSheets=void 0,this.behaviors=tt(t)}get styleSheets(){if(void 0===this._styleSheets){const t=this.styles,e=this.styleSheetCache;this._styleSheets=Z(t).map(t=>{if(t instanceof CSSStyleSheet)return t;let i=e.get(t);return void 0===i&&(i=new CSSStyleSheet,i.replaceSync(t),e.set(t,i)),i})}return this._styleSheets}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.styleSheets],super.addStylesTo(t)}removeStylesFrom(t){const e=this.styleSheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>-1===e.indexOf(t)),super.removeStylesFrom(t)}}let it=0;class st extends Y{constructor(t){super(),this.styles=t,this.behaviors=null,this.behaviors=tt(t),this.styleSheets=Z(t),this.styleClass="fast-style-class-"+ ++it}addStylesTo(t){const e=this.styleSheets,i=this.styleClass;t=this.normalizeTarget(t);for(let s=0;s<e.length;s++){const n=document.createElement("style");n.innerHTML=e[s],n.className=i,t.append(n)}super.addStylesTo(t)}removeStylesFrom(t){const e=(t=this.normalizeTarget(t)).querySelectorAll("."+this.styleClass);for(let i=0,s=e.length;i<s;++i)t.removeChild(e[i]);super.removeStylesFrom(t)}isAttachedTo(t){return super.isAttachedTo(this.normalizeTarget(t))}normalizeTarget(t){return t===document?document.body:t}}const nt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t},rt={toView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e.toString()},fromView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}};class ot{constructor(t,e,i=e.toLowerCase(),s="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=i,this.mode=s,this.converter=n,this.fieldName="_"+e,this.callbackName=e+"Changed",this.hasCallback=this.callbackName in t.prototype,"boolean"===s&&void 0===n&&(this.converter=nt)}setValue(t,e){const i=t[this.fieldName],s=this.converter;void 0!==s&&(e=s.fromView(e)),i!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](i,e),t.$fastController.notify(this.name))}getValue(t){return b.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,i=this.guards;i.has(t)||"fromView"===e||u.queueUpdate(()=>{i.add(t);const s=t[this.fieldName];switch(e){case"reflect":const e=this.converter;u.setAttribute(t,this.attribute,void 0!==e?e.toView(s):s);break;case"boolean":u.setBooleanAttribute(t,this.attribute,s)}i.delete(t)})}static collect(t,...e){const i=[];e.push(t.attributes);for(let s=0,n=e.length;s<n;++s){const n=e[s];if(void 0!==n)for(let e=0,s=n.length;e<s;++e){const s=n[e];"string"==typeof s?i.push(new ot(t,s)):i.push(new ot(t,s.property,s.attribute,s.mode,s.converter))}}return i}}function lt(t,e){let i;function s(t,e){arguments.length>1&&(i.property=e);const s=t.constructor.attributes||(t.constructor.attributes=[]);s.push(i)}return arguments.length>1?(i={},void s(t,e)):(i=void 0===t?{}:t,s)}const at={mode:"open"},ht={},ct=s.getById(4,()=>{const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e)})});class ut{constructor(t,e=t.definition){"string"==typeof e&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const i=ot.collect(t,e.attributes),s=new Array(i.length),n={},r={};for(let t=0,e=i.length;t<e;++t){const e=i[t];s[t]=e.attribute,n[e.name]=e,r[e.attribute]=e}this.attributes=i,this.observedAttributes=s,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===e.shadowOptions?at:null===e.shadowOptions?void 0:Object.assign(Object.assign({},at),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?ht:Object.assign(Object.assign({},ht),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?Y.create(e.styles):e.styles instanceof Y?e.styles:Y.create([e.styles])}get isDefined(){return!!ct.getByType(this.type)}define(t=customElements){const e=this.type;if(ct.register(this)){const t=this.attributes,i=e.prototype;for(let e=0,s=t.length;e<s;++e)b.defineProperty(i,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}}ut.forType=ct.getByType;const dt=new WeakMap,ft={bubbles:!0,composed:!0,cancelable:!0};function pt(t){return t.shadowRoot||dt.get(t)||null}class gt extends m{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const i=e.shadowOptions;if(void 0!==i){const e=t.attachShadow(i);"closed"===i.mode&&dt.set(t,e)}const s=b.getAccessors(t);if(s.length>0){const e=this.boundObservables=Object.create(null);for(let i=0,n=s.length;i<n;++i){const n=s[i].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return b.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,b.notify(this,"isConnected")}get template(){return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||null===t||this.addStyles(t))}addStyles(t){const e=pt(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.append(t);else if(!t.isAttachedTo(e)){const i=t.behaviors;t.addStylesTo(e),null!==i&&this.addBehaviors(i)}}removeStyles(t){const e=pt(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.removeChild(t);else if(t.isAttachedTo(e)){const i=t.behaviors;t.removeStylesFrom(e),null!==i&&this.removeBehaviors(i)}}addBehaviors(t){const e=this.behaviors||(this.behaviors=new Map),i=t.length,s=[];for(let n=0;n<i;++n){const i=t[n];e.has(i)?e.set(i,e.get(i)+1):(e.set(i,1),s.push(i))}if(this._isConnected){const t=this.element;for(let e=0;e<s.length;++e)s[e].bind(t,x)}}removeBehaviors(t,e=!1){const i=this.behaviors;if(null===i)return;const s=t.length,n=[];for(let r=0;r<s;++r){const s=t[r];if(i.has(s)){const t=i.get(s)-1;0===t||e?i.delete(s)&&n.push(s):i.set(s,t)}}if(this._isConnected){const t=this.element;for(let e=0;e<n.length;++e)n[e].unbind(t)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,x);const e=this.behaviors;if(null!==e)for(const[i]of e)i.bind(t,x);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element;for(const[i]of e)i.unbind(t)}}onAttributeChangedCallback(t,e,i){const s=this.definition.attributeLookup[t];void 0!==s&&s.onAttributeChangedCallback(this.element,i)}emit(t,e,i){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},ft),i)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const i=Object.keys(e);for(let s=0,n=i.length;s<n;++s){const n=i[s];t[n]=e[n]}this.boundObservables=null}const i=this.definition;null===this._template&&(this.element.resolveTemplate?this._template=this.element.resolveTemplate():i.template&&(this._template=i.template||null)),null!==this._template&&this.renderTemplate(this._template),null===this._styles&&(this.element.resolveStyles?this._styles=this.element.resolveStyles():i.styles&&(this._styles=i.styles||null)),null!==this._styles&&this.addStyles(this._styles),this.needsInitialization=!1}renderTemplate(t){const e=this.element,i=pt(e)||e;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||u.removeChildNodes(i),t&&(this.view=t.render(e,i,e))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const i=ut.forType(t.constructor);if(void 0===i)throw new Error("Missing FASTElement definition.");return t.$fastController=new gt(t,i)}}function vt(t){return class extends t{constructor(){super(),gt.forCustomElement(this)}$emit(t,e,i){return this.$fastController.emit(t,e,i)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,i){this.$fastController.onAttributeChangedCallback(t,e,i)}}}const mt=Object.assign(vt(HTMLElement),{from:t=>vt(t),define:(t,e)=>new ut(t,e).define().type});function bt(t){return function(e){new ut(e,t).define()}}class yt{createCSS(){return""}createBehavior(){}}function Ct(t,e){const i=[];let s="";const n=[];for(let r=0,o=t.length-1;r<o;++r){s+=t[r];let o=e[r];if(o instanceof yt){const t=o.createBehavior();o=o.createCSS(),t&&n.push(t)}o instanceof Y||o instanceof CSSStyleSheet?(""!==s.trim()&&(i.push(s),s=""),i.push(o)):s+=o}return s+=t[t.length-1],""!==s.trim()&&i.push(s),{styles:i,behaviors:n}}function wt(t,...e){const{styles:i,behaviors:s}=Ct(t,e),n=Y.create(i);return s.length&&n.withBehaviors(...s),n}class St extends yt{constructor(t,e){super(),this.behaviors=e,this.css="";const i=t.reduce((t,e)=>("string"==typeof e?this.css+=e:t.push(e),t),[]);i.length&&(this.styles=Y.create(i))}createBehavior(){return this}createCSS(){return this.css}bind(t){this.styles&&t.$fastController.addStyles(this.styles),this.behaviors.length&&t.$fastController.addBehaviors(this.behaviors)}unbind(t){this.styles&&t.$fastController.removeStyles(this.styles),this.behaviors.length&&t.$fastController.removeBehaviors(this.behaviors)}}function xt(t,...e){const{styles:i,behaviors:s}=Ct(t,e);return new St(i,s)}function Ot(t,e,i){return{index:t,removed:e,addedCount:i}}function Tt(t,e,i,s,r,o){let l=0,a=0;const h=Math.min(i-e,o-r);if(0===e&&0===r&&(l=function(t,e,i){for(let s=0;s<i;++s)if(t[s]!==e[s])return s;return i}(t,s,h)),i===t.length&&o===s.length&&(a=function(t,e,i){let s=t.length,n=e.length,r=0;for(;r<i&&t[--s]===e[--n];)r++;return r}(t,s,h-l)),r+=l,o-=a,(i-=a)-(e+=l)==0&&o-r==0)return n;if(e===i){const t=Ot(e,[],0);for(;r<o;)t.removed.push(s[r++]);return[t]}if(r===o)return[Ot(e,[],i-e)];const c=function(t){let e=t.length-1,i=t[0].length-1,s=t[e][i];const n=[];for(;e>0||i>0;){if(0===e){n.push(2),i--;continue}if(0===i){n.push(3),e--;continue}const r=t[e-1][i-1],o=t[e-1][i],l=t[e][i-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===s?n.push(0):(n.push(1),s=r),e--,i--):a===o?(n.push(3),e--,s=o):(n.push(2),i--,s=l)}return n.reverse(),n}(function(t,e,i,s,n,r){const o=r-n+1,l=i-e+1,a=new Array(o);let h,c;for(let t=0;t<o;++t)a[t]=new Array(l),a[t][0]=t;for(let t=0;t<l;++t)a[0][t]=t;for(let i=1;i<o;++i)for(let r=1;r<l;++r)t[e+r-1]===s[n+i-1]?a[i][r]=a[i-1][r-1]:(h=a[i-1][r]+1,c=a[i][r-1]+1,a[i][r]=h<c?h:c);return a}(t,e,i,s,r,o)),u=[];let d=void 0,f=e,p=r;for(let t=0;t<c.length;++t)switch(c[t]){case 0:void 0!==d&&(u.push(d),d=void 0),f++,p++;break;case 1:void 0===d&&(d=Ot(f,[],0)),d.addedCount++,f++,d.removed.push(s[p]),p++;break;case 2:void 0===d&&(d=Ot(f,[],0)),d.addedCount++,f++;break;case 3:void 0===d&&(d=Ot(f,[],0)),d.removed.push(s[p]),p++}return void 0!==d&&u.push(d),u}const kt=Array.prototype.push;function Bt(t,e,i,s){const n=Ot(e,i,s);let r=!1,o=0;for(let e=0;e<t.length;e++){const i=t[e];if(i.index+=o,r)continue;const s=(l=n.index,a=n.index+n.removed.length,h=i.index,c=i.index+i.addedCount,a<h||c<l?-1:a===h||c===l?0:l<h?a<c?a-h:c-h:c<a?c-l:a-l);if(s>=0){t.splice(e,1),e--,o-=i.addedCount-i.removed.length,n.addedCount+=i.addedCount-s;const l=n.removed.length+i.removed.length-s;if(n.addedCount||l){let t=i.removed;if(n.index<i.index){const e=n.removed.slice(0,i.index-n.index);kt.apply(e,t),t=e}if(n.index+n.removed.length>i.index+i.addedCount){const e=n.removed.slice(i.index+i.addedCount-n.index);kt.apply(t,e)}n.removed=t,i.index<n.index&&(n.index=i.index)}else r=!0}else if(n.index<i.index){r=!0,t.splice(e,0,n),e++;const s=n.addedCount-n.removed.length;i.index+=s,o+=s}}var l,a,h,c;r||t.push(n)}function Nt(t,e){let i=[];const s=function(t){const e=[];for(let i=0,s=t.length;i<s;i++){const s=t[i];Bt(e,s.index,s.removed,s.addedCount)}return e}(e);for(let e=0,n=s.length;e<n;++e){const n=s[e];1!==n.addedCount||1!==n.removed.length?i=i.concat(Tt(t,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==t[n.index]&&i.push(n)}return i}let At=!1;function $t(t,e){let i=t.index;const s=e.length;return i>s?i=s-t.addedCount:i<0&&(i=s+t.removed.length+i-t.addedCount),i<0&&(i=0),t.index=i,t}class Rt extends v{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,Reflect.defineProperty(t,"$fastController",{value:this,enumerable:!1})}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.needsQueue&&(this.needsQueue=!1,u.queueUpdate(this))}reset(t){this.oldCollection=t,this.needsQueue&&(this.needsQueue=!1,u.queueUpdate(this))}flush(){const t=this.splices,e=this.oldCollection;if(void 0===t&&void 0===e)return;this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0;const i=void 0===e?Nt(this.source,t):Tt(this.source,0,this.source.length,e,0,e.length);this.notify(i)}}function Pt(){if(At)return;At=!0,b.setArrayObserverFactory(t=>new Rt(t));const t=Array.prototype;if(t.$fastPatch)return;Reflect.defineProperty(t,"$fastPatch",{value:1,enumerable:!1});const e=t.pop,i=t.push,s=t.reverse,n=t.shift,r=t.sort,o=t.splice,l=t.unshift;t.pop=function(){const t=this.length>0,i=e.apply(this,arguments),s=this.$fastController;return void 0!==s&&t&&s.addSplice(Ot(this.length,[i],0)),i},t.push=function(){const t=i.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice($t(Ot(this.length-arguments.length,[],arguments.length),this)),t},t.reverse=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const i=s.apply(this,arguments);return void 0!==e&&e.reset(t),i},t.shift=function(){const t=this.length>0,e=n.apply(this,arguments),i=this.$fastController;return void 0!==i&&t&&i.addSplice(Ot(0,[e],0)),e},t.sort=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const i=r.apply(this,arguments);return void 0!==e&&e.reset(t),i},t.splice=function(){const t=o.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice($t(Ot(+arguments[0],t,arguments.length>2?arguments.length-2:0),this)),t},t.unshift=function(){const t=l.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice($t(Ot(0,[],arguments.length),this)),t}}class Et{constructor(t,e){this.target=t,this.propertyName=e}bind(t){t[this.propertyName]=this.target}unbind(){}}function Vt(t){return new k("fast-ref",Et,t)}function Ft(t,e){const i="function"==typeof e?e:()=>e;return(e,s)=>t(e,s)?i(e,s):null}const jt=Object.freeze({positioning:!1,recycle:!0});function zt(t,e,i,s){t.bind(e[i],s)}function It(t,e,i,s){const n=Object.create(s);n.index=i,n.length=e.length,t.bind(e[i],n)}class Mt{constructor(t,e,i,s,n,r){this.location=t,this.itemsBinding=e,this.templateBinding=s,this.options=r,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.originalContext=void 0,this.childContext=void 0,this.bindView=zt,this.itemsBindingObserver=b.binding(e,this,i),this.templateBindingObserver=b.binding(s,this,n),r.positioning&&(this.bindView=It)}bind(t,e){this.source=t,this.originalContext=e,this.childContext=Object.create(e),this.childContext.parent=t,this.childContext.parentContext=this.originalContext,this.items=this.itemsBindingObserver.observe(t,this.originalContext),this.template=this.templateBindingObserver.observe(t,this.originalContext),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.disconnect(),this.templateBindingObserver.disconnect()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.originalContext),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.originalContext),this.refreshAllViews(!0)):this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=n);const e=this.itemsObserver,i=this.itemsObserver=b.getNotifier(this.items),s=e!==i;s&&null!==e&&e.unsubscribe(this),(s||t)&&i.subscribe(this)}updateViews(t){const e=this.childContext,i=this.views,s=[],n=this.bindView;let r=0;for(let e=0,n=t.length;e<n;++e){const n=t[e],o=n.removed;s.push(...i.splice(n.index+r,o.length)),r-=n.addedCount}const o=this.items,l=this.template;for(let r=0,a=t.length;r<a;++r){const a=t[r];let h=a.index;const c=h+a.addedCount;for(;h<c;++h){const t=i[h],r=t?t.firstChild:this.location,a=this.options.recycle&&s.length>0?s.shift():l.create();i.splice(h,0,a),n(a,o,h,e),a.insertBefore(r)}}for(let t=0,e=s.length;t<e;++t)s[t].dispose();if(this.options.positioning)for(let t=0,e=i.length;t<e;++t){const s=i[t].context;s.length=e,s.index=t}}refreshAllViews(t=!1){const e=this.items,i=this.childContext,s=this.template,n=this.location,r=this.bindView;let o=e.length,l=this.views,a=l.length;if((0===o||t)&&(K.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=s.create();r(o,e,t,i),l[t]=o,o.insertBefore(n)}}else{let t=0;for(;t<o;++t)if(t<a){r(l[t],e,t,i)}else{const o=s.create();r(o,e,t,i),l.push(o),o.insertBefore(n)}const h=l.splice(t,a-t);for(t=0,o=h.length;t<o;++t)h[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,i=t.length;e<i;++e)t[e].unbind()}}class _t extends O{constructor(t,e,i){super(),this.itemsBinding=t,this.templateBinding=e,this.options=i,this.createPlaceholder=u.createBlockPlaceholder,Pt(),this.isItemsBindingVolatile=b.isVolatileBinding(t),this.isTemplateBindingVolatile=b.isVolatileBinding(e)}createBehavior(t){return new Mt(t,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Lt(t,e,i=jt){return new _t(t,"function"==typeof e?e:()=>e,i)}function qt(t){return t?function(e,i,s){return 1===e.nodeType&&e.matches(t)}:function(t,e,i){return 1===t.nodeType}}class Ht{constructor(t,e){this.target=t,this.options=e,this.source=null}bind(t){const e=this.options.property;this.shouldUpdate=b.getAccessors(t).some(t=>t.name===e),this.source=t,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(n),this.source=null,this.shouldUpdate&&this.disconnect()}handleEvent(){this.updateTarget(this.computeNodes())}computeNodes(){let t=this.getNodes();return void 0!==this.options.filter&&(t=t.filter(this.options.filter)),t}updateTarget(t){this.source[this.options.property]=t}}class Dt extends Ht{constructor(t,e){super(t,e)}observe(){this.target.addEventListener("slotchange",this)}disconnect(){this.target.removeEventListener("slotchange",this)}getNodes(){return this.target.assignedNodes(this.options)}}function Qt(t){return"string"==typeof t&&(t={property:t}),new k("fast-slotted",Dt,t)}class Ut extends Ht{constructor(t,e){super(t,e),this.observer=null,e.childList=!0}observe(){null===this.observer&&(this.observer=new MutationObserver(this.handleEvent.bind(this))),this.observer.observe(this.target,this.options)}disconnect(){this.observer.disconnect()}getNodes(){return"subtree"in this.options?Array.from(this.target.querySelectorAll(this.options.selector)):Array.from(this.target.childNodes)}}function Wt(t){return"string"==typeof t&&(t={property:t}),new k("fast-children",Ut,t)}class Kt{constructor(t){this.path=t}}const Jt=new Set,Gt=Object.freeze({register(t){Jt.add(t)},unregister(t){Jt.delete(t)}}),Xt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,Yt=Object.freeze({path:Object.freeze({get current(){return location.pathname+location.search},generateRoute(e,i,s={}){return t(this,void 0,void 0,(function*(){let t="config"in e?e:Be.find(e);for(;null!==t;){const e=yield t.config.generateRouteFromPath(i,s);if(null!==e)return e;t=t.parent}return null}))},push(t,e=!0){t&&Xt.test(t)?location.href=t:(history.pushState({},document.title,t),e&&Yt.path.trigger(t))},replace(t,e=!0){t&&Xt.test(t)?location.href=t:(history.replaceState({},document.title,t),e&&Yt.path.trigger(t))},trigger(t){const e=new Kt(t);for(const t of Jt)t.enqueue(e)}}),name:Object.freeze({generateRoute(e,i,s={}){return t(this,void 0,void 0,(function*(){let t="config"in e?e:Be.find(e);for(;null!==t;){const e=yield t.config.generateRouteFromName(i,s);if(null!==e)return e;t=t.parent}return null}))},push(e,i,s={},n=!0){return t(this,void 0,void 0,(function*(){const t=yield Yt.name.generateRoute(e,i,s);null!==t&&Yt.path.push(t,n)}))},replace(e,i,s={},n=!0){return t(this,void 0,void 0,(function*(){const t=yield Yt.name.generateRoute(e,i,s);null!==t&&Yt.path.replace(t,n)}))},trigger(e,i,s={}){return t(this,void 0,void 0,(function*(){const t=yield Yt.name.generateRoute(e,i,s);null!==t&&Yt.path.trigger(t)}))}})});class Zt{constructor(){this.queue=[],this.promise=null,this.resolve=null}connect(){this.enqueue(new Kt(Yt.path.current)),window.addEventListener("popstate",this),Gt.register(this)}disconnect(){this.queue=[],this.promise=null,this.resolve=null,window.removeEventListener("popstate",this),Gt.unregister(this)}receive(){return null!==this.promise||(this.promise=new Promise(t=>this.resolve=t),Promise.resolve().then(()=>this.tryDequeue())),this.promise}enqueue(t){this.queue.push(t),this.tryDequeue()}tryDequeue(){if(null===this.resolve||0===this.queue.length)return;const t=this.queue[this.queue.length-1],e=this.resolve;this.queue.length=0,this.promise=null,this.resolve=null,e(t)}handleEvent(t){this.enqueue(new Kt(Yt.path.current))}}const te=encodeURIComponent,ee=t=>te(t).replace("%24","$");function ie(t,e,i){let s=[];if(null==e)return s;if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)if(i)s.push(`${ee(t)}=${te(e[n])}`);else{const i=t+"["+("object"==typeof e[n]&&null!==e[n]?n:"")+"]";s=s.concat(ie(i,e[n]))}else if("object"!=typeof e||i)s.push(`${ee(t)}=${te(e)}`);else for(const i in e)s=s.concat(ie(t+"["+i+"]",e[i]));return s}function se(t,e){return Array.isArray(t)?(t.push(e),t):void 0!==t?[t,e]:e}function ne(t,e,i){let s=t;const n=e.length-1;for(let t=0;t<=n;t++){const r=""===e[t]?s.length:e[t];if(t<n){const i=s[r]&&"object"!=typeof s[r]?[s[r]]:s[r];s=s[r]=i||(isNaN(e[t+1])?{}:[])}else s=s[r]=i}}const re=Object.freeze({get current(){return location.search},build(t,e){let i=[];const s=Object.keys(t||{}).sort();for(let n=0,r=s.length;n<r;n++){const r=s[n];i=i.concat(ie(r,t[r],e))}return 0===i.length?"":i.join("&")},separate(t){const e=t.indexOf("?");let i="";return-1!==e&&(i=t.substr(e+1,t.length),t=t.substr(0,e)),{path:t,queryString:i}},parse(t){const e={};if(!t||"string"!=typeof t)return e;let i=t;"?"===i.charAt(0)&&(i=i.substr(1));const s=i.replace(/\+/g," ").split("&");for(let t=0;t<s.length;t++){const i=s[t].split("="),n=decodeURIComponent(i[0]);if(!n)continue;let r=n.split("]["),o=r.length-1;if(/\[/.test(r[0])&&/\]$/.test(r[o])?(r[o]=r[o].replace(/\]$/,""),r=r.shift().split("[").concat(r),o=r.length-1):o=0,i.length>=2){const t=i[1]?decodeURIComponent(i[1]):"";o?ne(e,r,t):e[n]=se(e[n],t)}else e[n]=!0}return e}}),oe=t=>t;class le{constructor(t,e,i){this.path=t,this.name=e,this.caseSensitive=i}}class ae{constructor(t,e,i,s){this.route=t,this.paramNames=e,this.paramTypes=i,this.settings=s}get path(){return this.route.path}}class he{constructor(t,e,i,s){this.endpoint=t,this.params=e,this.typedParams=i,this.queryParams=s,this.allParams=Object.assign(Object.assign({},e),s),this.allTypedParams=Object.assign(Object.assign({},i),s)}get settings(){return this.endpoint.settings}}class ce{constructor(t,e,i,s){var n;this.chars=t,this.states=e,this.skippedStates=i,this.result=s,this.head=e[e.length-1],this.endpoint=null===(n=this.head)||void 0===n?void 0:n.endpoint}advance(t){const{chars:e,states:i,skippedStates:s,result:n}=this;let r=null,o=0;const l=i[i.length-1];function a(h,c){if(h.isMatch(t)&&(1==++o?r=h:n.add(new ce(e.concat(t),i.concat(h),null===c?s:s.concat(c),n))),null===l.segment&&h.isOptional&&null!==h.nextStates){if(h.nextStates.length>1)throw new Error(h.nextStates.length+" nextStates");const t=h.nextStates[0];if(!t.isSeparator)throw new Error("Not a separator");if(null!==t.nextStates)for(const e of t.nextStates)a(e,h)}}if(l.isDynamic&&a(l,null),null!==l.nextStates)for(const t of l.nextStates)a(t,null);null!==r&&(i.push(this.head=r),e.push(t),null!==r.endpoint&&(this.endpoint=r.endpoint)),0===o&&n.remove(this)}finalize(){!function t(e,i){const s=i.nextStates;if(null!==s)if(1===s.length&&null===s[0].segment)t(e,s[0]);else for(const i of s)if(i.isOptional&&null!==i.endpoint){if(e.push(i),null!==i.nextStates)for(const s of i.nextStates)t(e,s);break}}(this.skippedStates,this.head)}getParams(){const{states:t,chars:e,endpoint:i}=this,s={};for(const t of i.paramNames)s[t]=void 0;for(let i=0,n=t.length;i<n;++i){const n=t[i];if(n.isDynamic){const t=n.segment.name;void 0===s[t]?s[t]=e[i]:s[t]+=e[i]}}return s}compareTo(t){const e=this.states,i=t.states;for(let t=0,s=0,n=Math.max(e.length,i.length);t<n;++t){let n=e[t];if(void 0===n)return 1;let r=i[s];if(void 0===r)return-1;let o=n.segment,l=r.segment;if(null===o){if(null===l){++s;continue}if(void 0===(n=e[++t]))return 1;o=n.segment}else if(null===l){if(void 0===(r=i[++s]))return-1;l=r.segment}if(o.kind<l.kind)return 1;if(o.kind>l.kind)return-1;++s}const s=this.skippedStates,n=t.skippedStates,r=s.length,o=n.length;if(r<o)return 1;if(r>o)return-1;for(let t=0;t<r;++t){const e=s[t],i=n[t];if(e.length<i.length)return 1;if(e.length>i.length)return-1}return 0}}function ue(t){return null!==t.head.endpoint}function de(t,e){return t.compareTo(e)}class fe{constructor(t){this.candidates=[],this.candidates=[new ce([""],[t],[],this)]}get isEmpty(){return 0===this.candidates.length}getSolution(){const t=this.candidates.filter(ue);if(0===t.length)return null;for(const e of t)e.finalize();return t.sort(de),t[0]}add(t){this.candidates.push(t)}remove(t){this.candidates.splice(this.candidates.indexOf(t),1)}advance(t){const e=this.candidates.slice();for(const i of e)i.advance(t)}}class pe{constructor(){this.names=new Map,this.paths=new Map,this.rootState=new ge(null,null,"")}add(t,e){if(t instanceof Array)for(const i of t)this.$add(i,e);else this.$add(t,e)}$add(t,e){const i=t.path,s=new le(t.path,t.name||"",!0===t.caseSensitive),n=""===i?[""]:i.split("/").filter(ve),r=[],o=[];let l=this.rootState;const a=[];for(const t of n)switch(l=l.append(null,"/"),t.charAt(0)){case"{":{const e=t.slice(1,-1).split(":").map(t=>t.trim());2===e.length?o.push(e[1]):o.push("string");const i=e[0].endsWith("?"),s=i?e[0].slice(0,-1):e[0];r.push(s);const n=new be(s,i);a.push(n),l=n.appendTo(l);break}case"*":{const e=t.slice(1);r.push(e),o.push("string");const i=new ye(e);a.push(i),l=i.appendTo(l);break}default:{const e=new me(t,s.caseSensitive);a.push(e),l=e.appendTo(l);break}}const h=new ae(s,r,o,e||null);l.setEndpoint(h),this.paths.set(i,a),t.name&&this.names.set(t.name,a)}recognize(e,i={}){return t(this,void 0,void 0,(function*(){const t=re.separate(e),s=re.parse(t.queryString);(e=decodeURI(t.path)).startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1));const n=new fe(this.rootState);for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(n.advance(i),n.isEmpty)return null}const r=n.getSolution();if(null===r)return null;const{endpoint:o}=r,l=o.paramNames,a=o.paramTypes,h=r.getParams(),c={};for(let t=0,e=l.length;t<e;++t){const e=l[t],s=i[a[t]]||oe,n=h[e],r=yield s(n);c[e]=r}return new he(o,h,c,s)}))}generateFromName(t,e){return this.generate(this.names.get(t),e)}generateFromPath(t,e){return this.generate(this.paths.get(t),e)}generate(t,e){if(!t)return null;const i=Object.assign({},e),s={};let n="";for(let e=0,r=t.length;e<r;e++){const r=t[e],o=r.generate(i,s);if(null==o){if(r instanceof be&&!r.optional)throw new Error(`A value is required for route parameter '${r.name}'.`)}else n+="/",n+=o}"/"!==n.charAt(0)&&(n="/"+n);for(const t in s)delete i[t];const r=re.build(i);return n+=r?"?"+r:"",n}}class ge{constructor(t,e,i){switch(this.prevState=t,this.segment=e,this.value=i,this.nextStates=null,this.endpoint=null,null==e?void 0:e.kind){case 2:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=e.optional;break;case 1:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=!1;break;case 3:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!1,this.isOptional=!1;break;case void 0:this.length=null===t?0:t.length,this.isSeparator=!0,this.isDynamic=!1,this.isOptional=!1}}append(t,e){let i,s=this.nextStates;return null===s?(i=void 0,s=this.nextStates=[]):i=null===t?s.find(t=>t.value===e):s.find(e=>{var i;return null===(i=e.segment)||void 0===i?void 0:i.equals(t)}),void 0===i&&s.push(i=new ge(this,t,e)),i}setEndpoint(t){if(null!==this.endpoint)throw new Error(`Cannot add ambiguous route. The pattern '${t.route.path}' clashes with '${this.endpoint.route.path}'`);this.endpoint=t,this.isOptional&&(this.prevState.setEndpoint(t),this.prevState.isSeparator&&null!==this.prevState.prevState&&this.prevState.prevState.setEndpoint(t))}isMatch(t){const e=this.segment;switch(null==e?void 0:e.kind){case 2:return!this.value.includes(t);case 1:return!0;case 3:case void 0:return this.value.includes(t)}}}function ve(t){return t.length>0}class me{constructor(t,e){this.value=t,this.caseSensitive=e}get kind(){return 3}appendTo(t){const{value:e,value:{length:i}}=this;if(this.caseSensitive)for(let s=0;s<i;++s)t=t.append(this,e.charAt(s));else for(let s=0;s<i;++s){const i=e.charAt(s);t=t.append(this,i.toUpperCase()+i.toLowerCase())}return t}generate(){return this.value}equals(t){return 3===t.kind&&t.caseSensitive===this.caseSensitive&&t.value===this.value}}class be{constructor(t,e){this.name=t,this.optional=e}get kind(){return 2}appendTo(t){return t=t.append(this,"/")}generate(t,e){return e[this.name]=!0,t[this.name]}equals(t){return 2===t.kind&&t.optional===this.optional&&t.name===this.name}}class ye{constructor(t){this.name=t}get kind(){return 1}appendTo(t){return t=t.append(this,"")}generate(t,e){return e[this.name]=!0,t[this.name]}equals(t){return 1===t.kind&&t.name===this.name}}const Ce="fast-child-route";function we(t,e){return"command"in e?e.command:"redirect"in e?new _e(e.redirect):De.fromDefinition(t,e)}const Se=t=>{if(null==t)return!1;switch(t.toLowerCase().trim()){case"true":case"yes":case"1":return!0;default:return!1}},xe={number:t=>void 0===t?NaN:parseFloat(t),float:t=>void 0===t?NaN:parseFloat(t),int:t=>void 0===t?NaN:parseInt(t),integer:t=>void 0===t?NaN:parseInt(t),Date:t=>void 0===t?new Date(Date.now()):new Date(t),boolean:Se,bool:Se};class Oe{constructor(t){this.owner=t,this._recognizer=null,this.pathToCommand=new Map,this.fallbackCommand=null,this.fallbackSettings=null,this.converters={}}get recognizer(){return null===this._recognizer&&(this._recognizer=this.owner.createRouteRecognizer()),this._recognizer}ignore(t){"string"==typeof t&&(t={path:t}),this.pathToCommand.set(t.path,new Me),this.recognizer.add(t,t.settings)}map(...t){for(const e of t){if("children"in e){const t=this.owner.createTitleBuilder(),i=e.children.map(i=>{const s=Object.assign(Object.assign(Object.assign({},e),i),{path:`${e.path}/${i.path}`});if("title"in e||"title"in i){const n=e.title||"",r=i.title||"";s.title=t.joinTitles(n,r)}if("name"in i){const t=e.name?e.name+"/":"";s.name=t+i.name}return s.children===e.children&&delete s.children,s});this.map(...i);continue}let t;if(t="command"in e?e.command:"redirect"in e?new _e(e.redirect):De.fromDefinition(this.owner,e),this.pathToCommand.set(e.path,t),this.recognizer.add(e,e.settings),"childRouters"in e&&e.childRouters){const i=Object.assign(Object.assign({},e),{path:e.path+"/*fast-child-route"});this.pathToCommand.set(i.path,t),this.recognizer.add(i,i.settings)}}}fallback(e){const i=this.owner;this.fallbackCommand="function"==typeof e?{createContributor(s,n){return t(this,void 0,void 0,(function*(){const t=yield e();return we(i,t).createContributor(s,n)}))}}:we(i,e)}converter(t,e){let i;i="convert"in e?e.convert.bind(e):e.prototype&&"convert"in e.prototype?t=>this.owner.construct(e).convert(t):e,this.converters[t]=i}recognize(e){return t(this,void 0,void 0,(function*(){const t=yield this.recognizer.recognize(e,this.aggregateConverters());if(null!==t)return{route:t,command:this.pathToCommand.get(t.endpoint.path)};if(null!==this.fallbackCommand){const t=re.separate(e),i=re.parse(t.queryString);return{route:new he(new ae(new le("*","",!1),[],[],this.fallbackSettings),{},{},i),command:this.fallbackCommand}}return null}))}generateFromName(t,e){return this.recognizer.generateFromName(t,e)}generateFromPath(t,e){return this.recognizer.generateFromPath(t,e)}aggregateConverters(){return null===this.owner.parent?Object.assign(Object.assign({},xe),this.converters):Object.assign(Object.assign({},this.owner.parent.routes.aggregateConverters()),this.converters)}}function Te(t){const e=t.parentElement;if(e)return e;{const e=t.getRootNode();if(e.host instanceof HTMLElement)return e.host}return null}function ke(t){let e=t;for(;e=Te(e);)if("$router"in e)return e.$router;return null}const Be=Object.freeze({getOrCreateFor(t){const e=t.$router;return void 0!==e?e:t.$router=new Ae(t)},find:t=>t.$router||ke(t),from(t){class e extends t{constructor(){super(),Be.getOrCreateFor(this)}get config(){return this.$router.config}set config(t){this.$router.config=t}}const i=e.prototype;if("connectedCallback"in i){const t=i.connectedCallback;i.connectedCallback=function(){t.call(this),this.$router.connect()}}else i.connectedCallback=function(){this.$router.connect()};if("disconnectedCallback"in i){const t=i.disconnectedCallback;i.disconnectedCallback=function(){t.call(this),this.$router.disconnect()}}else i.disconnectedCallback=function(){this.$router.disconnect()};return e}});function Ne(t){return t instanceof mt}class Ae{constructor(e){this.host=e,this.parentRouter=void 0,this.contributors=new Set,this.navigationQueue=null,this.linkHandler=null,this.newView=null,this.newRoute=null,this.childCommandContributor=null,this.childRoute=null,this.isConnected=!1,this.routerConfig=null,this.view=null,this.route=null,this.onNavigationMessage=e=>t(this,void 0,void 0,(function*(){const t=this.config.createNavigationProcess();yield t.run(this,e),this.navigationQueue.receive().then(this.onNavigationMessage)})),e.$router=this}get config(){return this.routerConfig}set config(t){this.routerConfig=t,this.tryConnect()}get parent(){if(void 0===this.parentRouter){if(!this.isConnected)return null;this.parentRouter=ke(this.host)}return this.parentRouter||null}get level(){return null===this.parent?0:this.parent.level+1}shouldRender(t){var e;if(this.route&&this.route.endpoint.path===t.endpoint.path){const i=null==t?void 0:t.allParams,s=null===(e=this.route)||void 0===e?void 0:e.allParams;if(JSON.stringify(s)===JSON.stringify(i))return!1}return!0}beginRender(e,i){return t(this,void 0,void 0,(function*(){return this.newRoute=e,this.newView=yield i.createView(),this.newView.bind(e.allTypedParams,$e.create(this)),this.newView.appendTo(this.host),yield i.transition.begin(this.host,this.view,this.newView),{commit:this.renderOperationCommit.bind(this,i.layout,i.transition),rollback:this.renderOperationRollback.bind(this,i.transition)}}))}connect(){this.isConnected=!0,this.tryConnect()}disconnect(){null===this.parent?(null!==this.navigationQueue&&(this.navigationQueue.disconnect(),this.navigationQueue=null),null!==this.linkHandler&&(this.linkHandler.disconnect(),this.linkHandler=null)):this.parent.removeContributor(this),this.isConnected=!1,this.parentRouter=void 0}addContributor(t){this.contributors.add(t)}removeContributor(t){this.contributors.delete(t)}tryConnect(){null!==this.config&&this.isConnected&&(null===this.parent?(null!==this.navigationQueue&&this.navigationQueue.disconnect(),this.navigationQueue=this.config.createNavigationQueue(),this.navigationQueue.connect(),this.navigationQueue.receive().then(this.onNavigationMessage),null!==this.linkHandler&&this.linkHandler.disconnect(),this.linkHandler=this.config.createLinkHandler(),this.linkHandler.connect()):(this.config.parent=this.parent.config,this.parent.addContributor(this)))}renderOperationCommit(e,i){return t(this,void 0,void 0,(function*(){yield e.beforeCommit(this.host),yield i.commit(this.host,this.view,this.newView),yield e.afterCommit(this.host),null!==this.view&&this.view.dispose(),this.route=this.newRoute,this.view=this.newView,this.newRoute=null,this.newView=null}))}renderOperationRollback(e){return t(this,void 0,void 0,(function*(){null!==this.newView&&(yield e.rollback(this.host,this.view,this.newView),this.newView.dispose(),this.newRoute=null,this.newView=null)}))}navigate(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}leave(e){return t(this,void 0,void 0,(function*(){if(yield this.tunnel(e),!e.canceled){const t=this.contributors;this.contributors=new Set,e.onCancel(()=>this.contributors=t)}}))}construct(e){return t(this,void 0,void 0,(function*(){if(null!==this.parent){const t=e.route.allParams["fast-child-route"]||"",i=yield this.config.recognizeRoute(t);if(null===i){return this.config.createEventSink().onUnhandledNavigationMessage(this,new Kt(t)),void e.cancel()}this.childRoute=i.route,this.childCommandContributor=yield i.command.createContributor(this,i.route)}yield this.tunnel(e)}))}enter(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}commit(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}tunnel(e){return t(this,void 0,void 0,(function*(){const t=this.childRoute,i=this.childCommandContributor;if(t&&i&&(yield e.evaluateContributor(i,t,this)),e.canceled)return;const s=[...this.config.findContributors(e.name),...Array.from(this.contributors)];for(const t of s)if(yield e.evaluateContributor(t,void 0,this),e.canceled)return}))}}const $e=Object.freeze({create:t=>Object.create(x,{router:{value:t}})}),Re=Object.freeze({default:Object.freeze({begin(e,i,s){return t(this,void 0,void 0,(function*(){}))},rollback(e,i,s){return t(this,void 0,void 0,(function*(){}))},commit(e,i,s){return t(this,void 0,void 0,(function*(){}))}})});class Pe{constructor(t=null,e=null,i=!0){this.template=t,this.runBeforeCommit=i,this.styles=null==e?null:Array.isArray(e)?Y.create(e):e instanceof Y?e:Y.create([e])}beforeCommit(e){return t(this,void 0,void 0,(function*(){this.runBeforeCommit&&this.apply(e)}))}afterCommit(e){return t(this,void 0,void 0,(function*(){this.runBeforeCommit||this.apply(e)}))}apply(t){Ne(t)&&(t.$fastController.template!==this.template&&(t.$fastController.template=this.template),t.$fastController.styles!==this.styles&&(t.$fastController.styles=this.styles))}}const Ee=Object.freeze({default:new Pe(X`<slot></slot>`)});function Ve(t,e){return e in t}const Fe={lifecycle:!0,parameters:!0};class je extends O{constructor(t){super(),this.options=t}createPlaceholder(t){return u.createCustomAttributePlaceholder("fast-navigation-contributor",t)}createBehavior(t){return new ze(t,this.options)}}class ze{constructor(t,e){this.contributor=t,this.options=e,this.router=null}bind(t,e){if(this.options.lifecycle&&(this.router=e.router||Be.find(this.contributor),this.router.addContributor(this.contributor)),this.options.parameters){const e=this.contributor,i=t;for(const t in i)e[t]=i[t]}}unbind(t){null!==this.router&&this.router.removeContributor(this.contributor)}}function Ie(t){return new je(Object.assign({},Fe,t))}class Me{createContributor(){return t(this,void 0,void 0,(function*(){return{navigate(e){return t(this,void 0,void 0,(function*(){e.cancel()}))}}}))}}class _e{constructor(t){this.redirect=t}createContributor(){return t(this,void 0,void 0,(function*(){const e=this.redirect;return{navigate(i){return t(this,void 0,void 0,(function*(){const s=i.router.config,n=(yield s.generateRouteFromName(e,i.route.allParams))||(yield s.generateRouteFromPath(e,i.route.allParams));if(null===n)throw new Error("Invalid redirect. Name or path not found: "+e);i.cancel(()=>t(this,void 0,void 0,(function*(){return Yt.path.replace(n)})))}))}}}))}}function Le(t){return X`<${t} ${Ie()}></${t}>`}function qe(t){const e=document.createDocumentFragment();e.appendChild(t);const i=new K(e,[Ie().createBehavior(t)]);return{create:()=>i}}class He{constructor(t,e,i){this.router=t,this.route=e,this.command=i}construct(e){return t(this,void 0,void 0,(function*(){this.router.shouldRender(this.route)?(this.operation=yield this.router.beginRender(this.route,this.command),e.onCancel(()=>this.operation.rollback())):e.cancel()}))}commit(e){return t(this,void 0,void 0,(function*(){yield this.operation.commit(),this.command.title&&e.setTitle(this.command.title)}))}}class De{constructor(t,e){this.owner=t,this.createView=e,this._layout=null,this._transition=null,this.title=""}get transition(){return this._transition||this.owner.defaultTransition}set transition(t){this._transition=t}get layout(){return this._layout||this.owner.defaultLayout}set layout(t){this._layout=t}createContributor(e,i){return t(this,void 0,void 0,(function*(){return new He(e,i,this)}))}static fromDefinition(e,i){let s;s="template"in i?()=>t(this,void 0,void 0,(function*(){let t=i.template;return"function"==typeof t&&(t=yield t()),t.create()})):()=>t(this,void 0,void 0,(function*(){let t=i.element,e=null;if(i.factory)e=i.factory;else if("function"==typeof t){let i=ut.forType(t);if(i)e=Le(i.name);else if(t=yield t(),"string"==typeof t)e=Le(t);else if(t instanceof HTMLElement)e=qe(t);else{if(i=ut.forType(t),!i)throw new Error("Invalid value for element in route config.");e=Le(i.name)}}else t instanceof HTMLElement?i.factory=e=qe(t):i.factory=e=Le(t);return e.create()}));const n=new De(e,s);return i.layout&&(i.layout instanceof J?n.layout=new Pe(i.layout):n.layout=i.layout),i.transition&&(n.transition=i.transition),i.title&&(n.title=i.title),n}}class Qe{constructor(){this.handler=t=>{const{shouldHandleEvent:e,href:i}=this.getEventInfo(t);e&&(t.preventDefault(),Yt.path.push(i))}}connect(){window.addEventListener("click",this.handler,!0)}disconnect(){window.removeEventListener("click",this.handler)}getEventInfo(t){const e={shouldHandleEvent:!1,href:null,anchor:null},i=this.findClosestAnchor(t);if(!i||!this.targetIsThisWindow(i))return e;if(i.hasAttribute("download")||i.hasAttribute("router-ignore")||i.hasAttribute("data-router-ignore"))return e;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return e;const s=i.getAttribute("href");e.anchor=i,e.href=s;const n=1===t.which,r=s&&!("#"===s.charAt(0)||/^[a-z]+:/i.test(s));return e.shouldHandleEvent=n&&!!r,e}findClosestAnchor(t){const e=t.composedPath();for(let t=0,i=e.length;t<i;++t){const i=e[t];if("A"===i.tagName)return i}return t.target}targetIsThisWindow(t){const e=t.getAttribute("target");return!e||e===window.name||"_self"===e}}class Ue{constructor(t,e,i,s,n){this.name=t,this.commitActions=s,this.cancelActions=n,this.routes=[],this.routers=[],this.canceled=!1,this.titles=[],this.routes.push(e),this.routers.push(i)}get route(){return this.routes[this.routes.length-1]}get router(){return this.routers[this.routers.length-1]}cancel(t){this.canceled=!0,t&&this.cancelActions.push(t)}onCommit(t){this.commitActions.push(t)}onCancel(t){this.cancelActions.push(t)}setTitle(t){const e=this.router.level;for(;this.titles.length<e+1;)this.titles.push([]);this.titles[e].push(t)}evaluateContributor(e,i=this.route,s=this.router){return t(this,void 0,void 0,(function*(){Ve(e,this.name)&&(this.routes.push(i),this.routers.push(s),yield e[this.name](this),this.routes.pop(),this.routers.pop())}))}}class We{constructor(){this.phases=["navigate","leave","construct","enter","commit"]}run(e,i){return t(this,void 0,void 0,(function*(){const t=e.config.createEventSink(),s=yield e.config.recognizeRoute(i.path);if(null===s)return void t.onUnhandledNavigationMessage(e,i);const n=s.route,r=s.command;t.onNavigationBegin(e,n,r);const o=[],l=[];let a=o;const h=[yield r.createContributor(e,n),e,this];for(const i of this.phases){const s=new Ue(i,n,e,o,l);if(t.onPhaseBegin(s),s.canceled)a=l;else for(const t of h)if(yield s.evaluateContributor(t),s.canceled){a=l;break}if(t.onPhaseEnd(s),s.canceled)break}yield Promise.all(a.map(t=>t())).then(()=>t.onNavigationEnd(e,n,r))}))}commit(t){const e=t.router.config.createTitleBuilder();document.title=e.buildTitle(t.router.config.title,t.titles)}}class Ke{constructor(t=" - ",e=":"){this.segmentSeparator=t,this.fragmentSeparator=e}joinTitles(t,e){return""===t?e:""===e?t:`${t}${this.segmentSeparator}${e}`}buildTitle(t,e){let i=t;for(const t of e){i&&(i+=this.segmentSeparator);let e="";for(const i of t)e&&(e+=this.fragmentSeparator),e+=i;i+=e}return i}}class Je{onUnhandledNavigationMessage(t,e){}onNavigationBegin(t,e,i){}onPhaseBegin(t){}onPhaseEnd(t){}onNavigationEnd(t,e,i){}}class Ge{constructor(){this.isConfigured=!1,this.routes=new Oe(this),this.contributors=[],this.defaultLayout=Ee.default,this.defaultTransition=Re.default,this.title="",this.parent=null}createNavigationQueue(){return this.construct(Zt)}createLinkHandler(){return this.construct(Qe)}createNavigationProcess(){return new We}createEventSink(){return this.construct(Je)}createTitleBuilder(){return this.construct(Ke)}createRouteRecognizer(){return this.construct(pe)}construct(t){return null!==this.parent?this.parent.construct(t):new t}recognizeRoute(e){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.recognize(e)}))}generateRouteFromName(e,i){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.generateFromName(e,i)}))}generateRouteFromPath(e,i){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.generateFromPath(e,i)}))}findContributors(t){return this.contributors.filter(e=>Ve(e,t))}cached(e){let i=null;return()=>t(this,void 0,void 0,(function*(){return null===i&&(i=new e),i}))}ensureConfigured(){return t(this,void 0,void 0,(function*(){this.isConfigured||(yield this.configure(),this.isConfigured=!0)}))}}let Xe=class extends(Be.from(mt)){};Xe=function(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}([bt("fast-router")],Xe);export{e as $global,k as AttachedBehaviorHTMLDirective,ot as AttributeDefinition,I as BindingBehavior,yt as CSSDirective,Ut as ChildrenBehavior,le as ConfigurableRoute,gt as Controller,u as DOM,Qe as DefaultLinkHandler,We as DefaultNavigationProcess,Zt as DefaultNavigationQueue,pe as DefaultRouteRecognizer,Ae as DefaultRouter,Y as ElementStyles,ae as Endpoint,S as ExecutionContext,s as FAST,mt as FASTElement,ut as FASTElementDefinition,Pe as FASTElementLayout,Xe as FASTRouter,z as HTMLBindingDirective,O as HTMLDirective,K as HTMLView,Me as Ignore,Ee as Layout,Gt as NavigationHandler,Kt as NavigationMessage,b as Observable,m as PropertyChangeNotifier,re as QueryString,he as RecognizedRoute,_e as Redirect,Et as RefBehavior,De as Render,Mt as RepeatBehavior,_t as RepeatDirective,Yt as Route,Oe as RouteCollection,Be as Router,Ge as RouterConfiguration,$e as RouterExecutionContext,Dt as SlottedBehavior,v as SubscriberSet,T as TargetedHTMLDirective,Re as Transition,J as ViewTemplate,lt as attr,nt as booleanConverter,Ce as childRouteParameter,Wt as children,U as compileTemplate,wt as css,xt as cssPartial,bt as customElement,x as defaultExecutionContext,qt as elements,n as emptyArray,Pt as enableArrayObservation,X as html,Ne as isFASTElementHost,Ve as isNavigationPhaseContributor,Ie as navigationContributor,rt as nullableNumberConverter,y as observable,Vt as ref,Lt as repeat,Qt as slotted,C as volatile,Ft as when};
1
+ function t(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{a(s.next(t))}catch(t){r(t)}}function l(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,l)}a((s=s.apply(t,e||[])).next())}))}const e=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof global)return global;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;try{return new Function("return this")()}catch(t){return{}}}();void 0===e.trustedTypes&&(e.trustedTypes={createPolicy:(t,e)=>e});const i={configurable:!1,enumerable:!1,writable:!1};void 0===e.FAST&&Reflect.defineProperty(e,"FAST",Object.assign({value:Object.create(null)},i));const s=e.FAST;if(void 0===s.getById){const t=Object.create(null);Reflect.defineProperty(s,"getById",Object.assign({value(e,i){let s=t[e];return void 0===s&&(s=i?t[e]=i():null),s}},i))}const n=Object.freeze([]),r=e.FAST.getById(1,()=>{const t=[],i=[];function s(){if(i.length)throw i.shift()}function n(t){try{t.call()}catch(t){i.push(t),setTimeout(s,0)}}function r(){let e=0;for(;e<t.length;)if(n(t[e]),e++,e>1024){for(let i=0,s=t.length-e;i<s;i++)t[i]=t[i+e];t.length-=e,e=0}t.length=0}return Object.freeze({enqueue:function(i){t.length<1&&e.requestAnimationFrame(r),t.push(i)},process:r})}),o=e.trustedTypes.createPolicy("fast-html",{createHTML:t=>t});let l=o;const a="fast-"+Math.random().toString(36).substring(2,8),h=a+"{",c="}"+a,u=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(l!==o)throw new Error("The HTML policy can only be set once.");l=t},createHTML:t=>l.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(a),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(a+":","")),createInterpolationPlaceholder:t=>`${h}${t}${c}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${a}:${t}--\x3e`,queueUpdate:r.enqueue,processUpdates:r.process,nextUpdate:()=>new Promise(r.enqueue),setAttribute(t,e,i){null==i?t.removeAttribute(e):t.setAttribute(e,i)},setBooleanAttribute(t,e,i){i?t.setAttribute(e,""):t.removeAttribute(e)},removeChildNodes(t){for(let e=t.firstChild;null!==e;e=t.firstChild)t.removeChild(e)},createTemplateWalker:t=>document.createTreeWalker(t,133,null,!1)});class d{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.source=t,this.sub1=e}has(t){return void 0===this.spillover?this.sub1===t||this.sub2===t:-1!==this.spillover.indexOf(t)}subscribe(t){const e=this.spillover;if(void 0===e){if(this.has(t))return;if(void 0===this.sub1)return void(this.sub1=t);if(void 0===this.sub2)return void(this.sub2=t);this.spillover=[this.sub1,this.sub2,t],this.sub1=void 0,this.sub2=void 0}else{-1===e.indexOf(t)&&e.push(t)}}unsubscribe(t){const e=this.spillover;if(void 0===e)this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0);else{const i=e.indexOf(t);-1!==i&&e.splice(i,1)}}notify(t){const e=this.spillover,i=this.source;if(void 0===e){const e=this.sub1,s=this.sub2;void 0!==e&&e.handleChange(i,t),void 0!==s&&s.handleChange(i,t)}else for(let s=0,n=e.length;s<n;++s)e[s].handleChange(i,t)}}class f{constructor(t){this.subscribers={},this.sourceSubscribers=null,this.source=t}notify(t){var e;const i=this.subscribers[t];void 0!==i&&i.notify(t),null===(e=this.sourceSubscribers)||void 0===e||e.notify(t)}subscribe(t,e){var i;if(e){let i=this.subscribers[e];void 0===i&&(this.subscribers[e]=i=new d(this.source)),i.subscribe(t)}else this.sourceSubscribers=null!==(i=this.sourceSubscribers)&&void 0!==i?i:new d(this.source),this.sourceSubscribers.subscribe(t)}unsubscribe(t,e){var i;if(e){const i=this.subscribers[e];void 0!==i&&i.unsubscribe(t)}else null===(i=this.sourceSubscribers)||void 0===i||i.unsubscribe(t)}}const p=s.getById(2,()=>{const t=/(:|&&|\|\||if)/,e=new WeakMap,i=new WeakMap,s=u.queueUpdate;let n=void 0,r=t=>{throw new Error("Must call enableArrayObservation before observing arrays.")};function o(t){let i=t.$fastController||e.get(t);return void 0===i&&(Array.isArray(t)?i=r(t):e.set(t,i=new f(t))),i}function l(t){let e=i.get(t);if(void 0===e){let s=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==s;)e=i.get(s),s=Reflect.getPrototypeOf(s);e=void 0===e?[]:e.slice(0),i.set(t,e)}return e}class a{constructor(t){this.name=t,this.field="_"+t,this.callback=t+"Changed"}getValue(t){return void 0!==n&&n.watch(t,this.name),t[this.field]}setValue(t,e){const i=this.field,s=t[i];if(s!==e){t[i]=e;const n=t[this.callback];"function"==typeof n&&n.call(t,s,e),o(t).notify(this.name)}}}class h extends d{constructor(t,e,i=!1){super(t,e),this.binding=t,this.isVolatileBinding=i,this.needsRefresh=!0,this.needsQueue=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}observe(t,e){this.needsRefresh&&null!==this.last&&this.disconnect();const i=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const s=this.binding(t,e);return n=i,s}disconnect(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=!0}}watch(t,e){const i=this.last,s=o(t),r=null===i?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=s,s.subscribe(this,e),null!==i){if(!this.needsRefresh){let e;n=void 0,e=i.propertySource[i.propertyName],n=this,t===e&&(this.needsRefresh=!0)}i.next=r}this.last=r}handleChange(){this.needsQueue&&(this.needsQueue=!1,s(this))}call(){null!==this.last&&(this.needsQueue=!0,this.notify(this))}records(){let t=this.first;return{next:()=>{const e=t;return void 0===e?{value:void 0,done:!0}:(t=t.next,{value:e,done:!1})},[Symbol.iterator]:function(){return this}}}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){void 0!==n&&n.watch(t,e)},trackVolatile(){void 0!==n&&(n.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){"string"==typeof e&&(e=new a(e)),l(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get:function(){return e.getValue(this)},set:function(t){e.setValue(this,t)}})},getAccessors:l,binding(t,e,i=this.isVolatileBinding(t)){return new h(t,e,i)},isVolatileBinding:e=>t.test(e.toString())})});function g(t,e){p.defineProperty(t,e)}function v(t,e,i){return Object.assign({},i,{get:function(){return p.trackVolatile(),i.get.apply(this)}})}const m=s.getById(3,()=>{let t=null;return{get:()=>t,set(e){t=e}}});class b{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}get event(){return m.get()}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}static setEvent(t){m.set(t)}}p.defineProperty(b.prototype,"index"),p.defineProperty(b.prototype,"length");const y=Object.seal(new b);class C{constructor(){this.targetIndex=0}}class w extends C{constructor(){super(...arguments),this.createPlaceholder=u.createInterpolationPlaceholder}}class S extends C{constructor(t,e,i){super(),this.name=t,this.behavior=e,this.options=i}createPlaceholder(t){return u.createCustomAttributePlaceholder(this.name,t)}createBehavior(t){return new this.behavior(t,this.options)}}function x(t,e){this.source=t,this.context=e,null===this.bindingObserver&&(this.bindingObserver=p.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(t,e))}function O(t,e){this.source=t,this.context=e,this.target.addEventListener(this.targetName,this)}function T(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function k(){this.bindingObserver.disconnect(),this.source=null,this.context=null;const t=this.target.$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}function B(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function N(t){u.setAttribute(this.target,this.targetName,t)}function A(t){u.setBooleanAttribute(this.target,this.targetName,t)}function $(t){if(null==t&&(t=""),t.create){this.target.textContent="";let e=this.target.$fastView;void 0===e?e=t.create():this.target.$fastTemplate!==t&&(e.isComposed&&(e.remove(),e.unbind()),e=t.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(this.source,this.context)):(e.isComposed=!0,e.bind(this.source,this.context),e.insertBefore(this.target),this.target.$fastView=e,this.target.$fastTemplate=t)}else{const e=this.target.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),this.target.textContent=t}}function R(t){this.target[this.targetName]=t}function P(t){const e=this.classVersions||Object.create(null),i=this.target;let s=this.version||0;if(null!=t&&t.length){const n=t.split(/\s+/);for(let t=0,r=n.length;t<r;++t){const r=n[t];""!==r&&(e[r]=s,i.classList.add(r))}}if(this.classVersions=e,this.version=s+1,0!==s){s-=1;for(const t in e)e[t]===s&&i.classList.remove(t)}}class E extends w{constructor(t){super(),this.binding=t,this.bind=x,this.unbind=T,this.updateTarget=N,this.isBindingVolatile=p.isVolatileBinding(this.binding)}get targetName(){return this.originalTargetName}set targetName(t){if(this.originalTargetName=t,void 0!==t)switch(t[0]){case":":if(this.cleanedTargetName=t.substr(1),this.updateTarget=R,"innerHTML"===this.cleanedTargetName){const t=this.binding;this.binding=(e,i)=>u.createHTML(t(e,i))}break;case"?":this.cleanedTargetName=t.substr(1),this.updateTarget=A;break;case"@":this.cleanedTargetName=t.substr(1),this.bind=O,this.unbind=B;break;default:this.cleanedTargetName=t,"class"===t&&(this.updateTarget=P)}}targetAtContent(){this.updateTarget=$,this.unbind=k}createBehavior(t){return new V(t,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class V{constructor(t,e,i,s,n,r,o){this.source=null,this.context=null,this.bindingObserver=null,this.target=t,this.binding=e,this.isBindingVolatile=i,this.bind=s,this.unbind=n,this.updateTarget=r,this.targetName=o}handleChange(){this.updateTarget(this.bindingObserver.observe(this.source,this.context))}handleEvent(t){b.setEvent(t);const e=this.binding(this.source,this.context);b.setEvent(null),!0!==e&&t.preventDefault()}}let F=null;class j{addFactory(t){t.targetIndex=this.targetIndex,this.behaviorFactories.push(t)}captureContentBinding(t){t.targetAtContent(),this.addFactory(t)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){F=this}static borrow(t){const e=F||new j;return e.directives=t,e.reset(),F=null,e}}function z(t){if(1===t.length)return t[0];let e;const i=t.length,s=t.map(t=>"string"==typeof t?()=>t:(e=t.targetName||e,t.binding)),n=new E((t,e)=>{let n="";for(let r=0;r<i;++r)n+=s[r](t,e);return n});return n.targetName=e,n}const I=c.length;function M(t,e){const i=e.split(h);if(1===i.length)return null;const s=[];for(let e=0,n=i.length;e<n;++e){const n=i[e],r=n.indexOf(c);let o;if(-1===r)o=n;else{const e=parseInt(n.substring(0,r));s.push(t.directives[e]),o=n.substring(r+I)}""!==o&&s.push(o)}return s}function _(t,e,i=!1){const s=e.attributes;for(let n=0,r=s.length;n<r;++n){const o=s[n],l=o.value,a=M(t,l);let h=null;null===a?i&&(h=new E(()=>l),h.targetName=o.name):h=z(a),null!==h&&(e.removeAttributeNode(o),n--,r--,t.addFactory(h))}}function L(t,e,i){const s=M(t,e.textContent);if(null!==s){let n=e;for(let r=0,o=s.length;r<o;++r){const o=s[r],l=0===r?e:n.parentNode.insertBefore(document.createTextNode(""),n.nextSibling);"string"==typeof o?l.textContent=o:(l.textContent=" ",t.captureContentBinding(o)),n=l,t.targetIndex++,l!==e&&i.nextNode()}t.targetIndex--}}function q(t,e){const i=t.content;document.adoptNode(i);const s=j.borrow(e);_(s,t,!0);const n=s.behaviorFactories;s.reset();const r=u.createTemplateWalker(i);let o;for(;o=r.nextNode();)switch(s.targetIndex++,o.nodeType){case 1:_(s,o);break;case 3:L(s,o,r);break;case 8:u.isMarker(o)&&s.addFactory(e[u.extractDirectiveIndexFromMarker(o)])}let l=0;(u.isMarker(i.firstChild)||1===i.childNodes.length&&e.length)&&(i.insertBefore(document.createComment(""),i.firstChild),l=-1);const a=s.behaviorFactories;return s.release(),{fragment:i,viewBehaviorFactories:a,hostBehaviorFactories:n,targetOffset:l}}const H=document.createRange();class D{constructor(t,e){this.fragment=t,this.behaviors=e,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=t.parentNode,i=this.lastChild;let s,n=this.firstChild;for(;n!==i;)s=n.nextSibling,e.insertBefore(n,t),n=s;e.insertBefore(i,t)}}remove(){const t=this.fragment,e=this.lastChild;let i,s=this.firstChild;for(;s!==e;)i=s.nextSibling,t.appendChild(s),s=i;t.appendChild(e)}dispose(){const t=this.firstChild.parentNode,e=this.lastChild;let i,s=this.firstChild;for(;s!==e;)i=s.nextSibling,t.removeChild(s),s=i;t.removeChild(e);const n=this.behaviors,r=this.source;for(let t=0,e=n.length;t<e;++t)n[t].unbind(r)}bind(t,e){const i=this.behaviors;if(this.source!==t)if(null!==this.source){const s=this.source;this.source=t,this.context=e;for(let n=0,r=i.length;n<r;++n){const r=i[n];r.unbind(s),r.bind(t,e)}}else{this.source=t,this.context=e;for(let s=0,n=i.length;s<n;++s)i[s].bind(t,e)}}unbind(){if(null===this.source)return;const t=this.behaviors,e=this.source;for(let i=0,s=t.length;i<s;++i)t[i].unbind(e);this.source=null}static disposeContiguousBatch(t){if(0!==t.length){H.setStartBefore(t[0].firstChild),H.setEndAfter(t[t.length-1].lastChild),H.deleteContents();for(let e=0,i=t.length;e<i;++e){const i=t[e],s=i.behaviors,n=i.source;for(let t=0,e=s.length;t<e;++t)s[t].unbind(n)}}}}class Q{constructor(t,e){this.behaviorCount=0,this.hasHostBehaviors=!1,this.fragment=null,this.targetOffset=0,this.viewBehaviorFactories=null,this.hostBehaviorFactories=null,this.html=t,this.directives=e}create(t){if(null===this.fragment){let t;const e=this.html;if("string"==typeof e){t=document.createElement("template"),t.innerHTML=u.createHTML(e);const i=t.content.firstElementChild;null!==i&&"TEMPLATE"===i.tagName&&(t=i)}else t=e;const i=q(t,this.directives);this.fragment=i.fragment,this.viewBehaviorFactories=i.viewBehaviorFactories,this.hostBehaviorFactories=i.hostBehaviorFactories,this.targetOffset=i.targetOffset,this.behaviorCount=this.viewBehaviorFactories.length+this.hostBehaviorFactories.length,this.hasHostBehaviors=this.hostBehaviorFactories.length>0}const e=this.fragment.cloneNode(!0),i=this.viewBehaviorFactories,s=new Array(this.behaviorCount),n=u.createTemplateWalker(e);let r=0,o=this.targetOffset,l=n.nextNode();for(let t=i.length;r<t;++r){const t=i[r],e=t.targetIndex;for(;null!==l;){if(o===e){s[r]=t.createBehavior(l);break}l=n.nextNode(),o++}}if(this.hasHostBehaviors){const e=this.hostBehaviorFactories;for(let i=0,n=e.length;i<n;++i,++r)s[r]=e[i].createBehavior(t)}return new D(e,s)}render(t,e,i){"string"==typeof e&&(e=document.getElementById(e)),void 0===i&&(i=e);const s=this.create(i);return s.bind(t,y),s.appendTo(e),s}}const U=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function W(t,...e){const i=[];let s="";for(let n=0,r=t.length-1;n<r;++n){const r=t[n];let o=e[n];if(s+=r,o instanceof Q){const t=o;o=()=>t}if("function"==typeof o&&(o=new E(o)),o instanceof w){const t=U.exec(r);null!==t&&(o.targetName=t[2])}o instanceof C?(s+=o.createPlaceholder(i.length),i.push(o)):s+=o}return s+=t[t.length-1],new Q(s,i)}class K{constructor(){this.targets=new WeakSet}addStylesTo(t){this.targets.add(t)}removeStylesFrom(t){this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}}function J(t){return t.map(t=>t instanceof K?J(t.styles):[t]).reduce((t,e)=>t.concat(e),[])}function G(t){return t.map(t=>t instanceof K?t.behaviors:null).reduce((t,e)=>null===e?t:(null===t&&(t=[]),t.concat(e)),null)}K.create=(()=>{if(u.supportsAdoptedStyleSheets){const t=new Map;return e=>new X(e,t)}return t=>new Z(t)})();class X extends K{constructor(t,e){super(),this.styles=t,this.styleSheetCache=e,this._styleSheets=void 0,this.behaviors=G(t)}get styleSheets(){if(void 0===this._styleSheets){const t=this.styles,e=this.styleSheetCache;this._styleSheets=J(t).map(t=>{if(t instanceof CSSStyleSheet)return t;let i=e.get(t);return void 0===i&&(i=new CSSStyleSheet,i.replaceSync(t),e.set(t,i)),i})}return this._styleSheets}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.styleSheets],super.addStylesTo(t)}removeStylesFrom(t){const e=this.styleSheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>-1===e.indexOf(t)),super.removeStylesFrom(t)}}let Y=0;class Z extends K{constructor(t){super(),this.styles=t,this.behaviors=null,this.behaviors=G(t),this.styleSheets=J(t),this.styleClass="fast-style-class-"+ ++Y}addStylesTo(t){const e=this.styleSheets,i=this.styleClass;t=this.normalizeTarget(t);for(let s=0;s<e.length;s++){const n=document.createElement("style");n.innerHTML=e[s],n.className=i,t.append(n)}super.addStylesTo(t)}removeStylesFrom(t){const e=(t=this.normalizeTarget(t)).querySelectorAll("."+this.styleClass);for(let i=0,s=e.length;i<s;++i)t.removeChild(e[i]);super.removeStylesFrom(t)}isAttachedTo(t){return super.isAttachedTo(this.normalizeTarget(t))}normalizeTarget(t){return t===document?document.body:t}}const tt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t},et={toView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e.toString()},fromView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}};class it{constructor(t,e,i=e.toLowerCase(),s="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=i,this.mode=s,this.converter=n,this.fieldName="_"+e,this.callbackName=e+"Changed",this.hasCallback=this.callbackName in t.prototype,"boolean"===s&&void 0===n&&(this.converter=tt)}setValue(t,e){const i=t[this.fieldName],s=this.converter;void 0!==s&&(e=s.fromView(e)),i!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](i,e),t.$fastController.notify(this.name))}getValue(t){return p.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,i=this.guards;i.has(t)||"fromView"===e||u.queueUpdate(()=>{i.add(t);const s=t[this.fieldName];switch(e){case"reflect":const e=this.converter;u.setAttribute(t,this.attribute,void 0!==e?e.toView(s):s);break;case"boolean":u.setBooleanAttribute(t,this.attribute,s)}i.delete(t)})}static collect(t,...e){const i=[];e.push(t.attributes);for(let s=0,n=e.length;s<n;++s){const n=e[s];if(void 0!==n)for(let e=0,s=n.length;e<s;++e){const s=n[e];"string"==typeof s?i.push(new it(t,s)):i.push(new it(t,s.property,s.attribute,s.mode,s.converter))}}return i}}function st(t,e){let i;function s(t,e){arguments.length>1&&(i.property=e);const s=t.constructor.attributes||(t.constructor.attributes=[]);s.push(i)}return arguments.length>1?(i={},void s(t,e)):(i=void 0===t?{}:t,s)}const nt={mode:"open"},rt={},ot=s.getById(4,()=>{const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e)})});class lt{constructor(t,e=t.definition){"string"==typeof e&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const i=it.collect(t,e.attributes),s=new Array(i.length),n={},r={};for(let t=0,e=i.length;t<e;++t){const e=i[t];s[t]=e.attribute,n[e.name]=e,r[e.attribute]=e}this.attributes=i,this.observedAttributes=s,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===e.shadowOptions?nt:null===e.shadowOptions?void 0:Object.assign(Object.assign({},nt),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?rt:Object.assign(Object.assign({},rt),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?K.create(e.styles):e.styles instanceof K?e.styles:K.create([e.styles])}get isDefined(){return!!ot.getByType(this.type)}define(t=customElements){const e=this.type;if(ot.register(this)){const t=this.attributes,i=e.prototype;for(let e=0,s=t.length;e<s;++e)p.defineProperty(i,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}}lt.forType=ot.getByType;const at=new WeakMap,ht={bubbles:!0,composed:!0,cancelable:!0};function ct(t){return t.shadowRoot||at.get(t)||null}class ut extends f{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const i=e.shadowOptions;if(void 0!==i){const e=t.attachShadow(i);"closed"===i.mode&&at.set(t,e)}const s=p.getAccessors(t);if(s.length>0){const e=this.boundObservables=Object.create(null);for(let i=0,n=s.length;i<n;++i){const n=s[i].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return p.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,p.notify(this,"isConnected")}get template(){return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||null===t||this.addStyles(t))}addStyles(t){const e=ct(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.append(t);else if(!t.isAttachedTo(e)){const i=t.behaviors;t.addStylesTo(e),null!==i&&this.addBehaviors(i)}}removeStyles(t){const e=ct(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.removeChild(t);else if(t.isAttachedTo(e)){const i=t.behaviors;t.removeStylesFrom(e),null!==i&&this.removeBehaviors(i)}}addBehaviors(t){const e=this.behaviors||(this.behaviors=new Map),i=t.length,s=[];for(let n=0;n<i;++n){const i=t[n];e.has(i)?e.set(i,e.get(i)+1):(e.set(i,1),s.push(i))}if(this._isConnected){const t=this.element;for(let e=0;e<s.length;++e)s[e].bind(t,y)}}removeBehaviors(t,e=!1){const i=this.behaviors;if(null===i)return;const s=t.length,n=[];for(let r=0;r<s;++r){const s=t[r];if(i.has(s)){const t=i.get(s)-1;0===t||e?i.delete(s)&&n.push(s):i.set(s,t)}}if(this._isConnected){const t=this.element;for(let e=0;e<n.length;++e)n[e].unbind(t)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,y);const e=this.behaviors;if(null!==e)for(const[i]of e)i.bind(t,y);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element;for(const[i]of e)i.unbind(t)}}onAttributeChangedCallback(t,e,i){const s=this.definition.attributeLookup[t];void 0!==s&&s.onAttributeChangedCallback(this.element,i)}emit(t,e,i){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},ht),i)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const i=Object.keys(e);for(let s=0,n=i.length;s<n;++s){const n=i[s];t[n]=e[n]}this.boundObservables=null}const i=this.definition;null===this._template&&(this.element.resolveTemplate?this._template=this.element.resolveTemplate():i.template&&(this._template=i.template||null)),null!==this._template&&this.renderTemplate(this._template),null===this._styles&&(this.element.resolveStyles?this._styles=this.element.resolveStyles():i.styles&&(this._styles=i.styles||null)),null!==this._styles&&this.addStyles(this._styles),this.needsInitialization=!1}renderTemplate(t){const e=this.element,i=ct(e)||e;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||u.removeChildNodes(i),t&&(this.view=t.render(e,i,e))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const i=lt.forType(t.constructor);if(void 0===i)throw new Error("Missing FASTElement definition.");return t.$fastController=new ut(t,i)}}function dt(t){return class extends t{constructor(){super(),ut.forCustomElement(this)}$emit(t,e,i){return this.$fastController.emit(t,e,i)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,i){this.$fastController.onAttributeChangedCallback(t,e,i)}}}const ft=Object.assign(dt(HTMLElement),{from:t=>dt(t),define:(t,e)=>new lt(t,e).define().type});function pt(t){return function(e){new lt(e,t).define()}}class gt{createCSS(){return""}createBehavior(){}}function vt(t,e){const i=[];let s="";const n=[];for(let r=0,o=t.length-1;r<o;++r){s+=t[r];let o=e[r];if(o instanceof gt){const t=o.createBehavior();o=o.createCSS(),t&&n.push(t)}o instanceof K||o instanceof CSSStyleSheet?(""!==s.trim()&&(i.push(s),s=""),i.push(o)):s+=o}return s+=t[t.length-1],""!==s.trim()&&i.push(s),{styles:i,behaviors:n}}function mt(t,...e){const{styles:i,behaviors:s}=vt(t,e),n=K.create(i);return s.length&&n.withBehaviors(...s),n}class bt extends gt{constructor(t,e){super(),this.behaviors=e,this.css="";const i=t.reduce((t,e)=>("string"==typeof e?this.css+=e:t.push(e),t),[]);i.length&&(this.styles=K.create(i))}createBehavior(){return this}createCSS(){return this.css}bind(t){this.styles&&t.$fastController.addStyles(this.styles),this.behaviors.length&&t.$fastController.addBehaviors(this.behaviors)}unbind(t){this.styles&&t.$fastController.removeStyles(this.styles),this.behaviors.length&&t.$fastController.removeBehaviors(this.behaviors)}}function yt(t,...e){const{styles:i,behaviors:s}=vt(t,e);return new bt(i,s)}function Ct(t,e,i){return{index:t,removed:e,addedCount:i}}function wt(t,e,i,s,r,o){let l=0,a=0;const h=Math.min(i-e,o-r);if(0===e&&0===r&&(l=function(t,e,i){for(let s=0;s<i;++s)if(t[s]!==e[s])return s;return i}(t,s,h)),i===t.length&&o===s.length&&(a=function(t,e,i){let s=t.length,n=e.length,r=0;for(;r<i&&t[--s]===e[--n];)r++;return r}(t,s,h-l)),r+=l,o-=a,(i-=a)-(e+=l)==0&&o-r==0)return n;if(e===i){const t=Ct(e,[],0);for(;r<o;)t.removed.push(s[r++]);return[t]}if(r===o)return[Ct(e,[],i-e)];const c=function(t){let e=t.length-1,i=t[0].length-1,s=t[e][i];const n=[];for(;e>0||i>0;){if(0===e){n.push(2),i--;continue}if(0===i){n.push(3),e--;continue}const r=t[e-1][i-1],o=t[e-1][i],l=t[e][i-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===s?n.push(0):(n.push(1),s=r),e--,i--):a===o?(n.push(3),e--,s=o):(n.push(2),i--,s=l)}return n.reverse(),n}(function(t,e,i,s,n,r){const o=r-n+1,l=i-e+1,a=new Array(o);let h,c;for(let t=0;t<o;++t)a[t]=new Array(l),a[t][0]=t;for(let t=0;t<l;++t)a[0][t]=t;for(let i=1;i<o;++i)for(let r=1;r<l;++r)t[e+r-1]===s[n+i-1]?a[i][r]=a[i-1][r-1]:(h=a[i-1][r]+1,c=a[i][r-1]+1,a[i][r]=h<c?h:c);return a}(t,e,i,s,r,o)),u=[];let d=void 0,f=e,p=r;for(let t=0;t<c.length;++t)switch(c[t]){case 0:void 0!==d&&(u.push(d),d=void 0),f++,p++;break;case 1:void 0===d&&(d=Ct(f,[],0)),d.addedCount++,f++,d.removed.push(s[p]),p++;break;case 2:void 0===d&&(d=Ct(f,[],0)),d.addedCount++,f++;break;case 3:void 0===d&&(d=Ct(f,[],0)),d.removed.push(s[p]),p++}return void 0!==d&&u.push(d),u}const St=Array.prototype.push;function xt(t,e,i,s){const n=Ct(e,i,s);let r=!1,o=0;for(let e=0;e<t.length;e++){const i=t[e];if(i.index+=o,r)continue;const s=(l=n.index,a=n.index+n.removed.length,h=i.index,c=i.index+i.addedCount,a<h||c<l?-1:a===h||c===l?0:l<h?a<c?a-h:c-h:c<a?c-l:a-l);if(s>=0){t.splice(e,1),e--,o-=i.addedCount-i.removed.length,n.addedCount+=i.addedCount-s;const l=n.removed.length+i.removed.length-s;if(n.addedCount||l){let t=i.removed;if(n.index<i.index){const e=n.removed.slice(0,i.index-n.index);St.apply(e,t),t=e}if(n.index+n.removed.length>i.index+i.addedCount){const e=n.removed.slice(i.index+i.addedCount-n.index);St.apply(t,e)}n.removed=t,i.index<n.index&&(n.index=i.index)}else r=!0}else if(n.index<i.index){r=!0,t.splice(e,0,n),e++;const s=n.addedCount-n.removed.length;i.index+=s,o+=s}}var l,a,h,c;r||t.push(n)}function Ot(t,e){let i=[];const s=function(t){const e=[];for(let i=0,s=t.length;i<s;i++){const s=t[i];xt(e,s.index,s.removed,s.addedCount)}return e}(e);for(let e=0,n=s.length;e<n;++e){const n=s[e];1!==n.addedCount||1!==n.removed.length?i=i.concat(wt(t,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==t[n.index]&&i.push(n)}return i}let Tt=!1;function kt(t,e){let i=t.index;const s=e.length;return i>s?i=s-t.addedCount:i<0&&(i=s+t.removed.length+i-t.addedCount),i<0&&(i=0),t.index=i,t}class Bt extends d{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,Reflect.defineProperty(t,"$fastController",{value:this,enumerable:!1})}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.needsQueue&&(this.needsQueue=!1,u.queueUpdate(this))}reset(t){this.oldCollection=t,this.needsQueue&&(this.needsQueue=!1,u.queueUpdate(this))}flush(){const t=this.splices,e=this.oldCollection;if(void 0===t&&void 0===e)return;this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0;const i=void 0===e?Ot(this.source,t):wt(this.source,0,this.source.length,e,0,e.length);this.notify(i)}}function Nt(){if(Tt)return;Tt=!0,p.setArrayObserverFactory(t=>new Bt(t));const t=Array.prototype;if(t.$fastPatch)return;Reflect.defineProperty(t,"$fastPatch",{value:1,enumerable:!1});const e=t.pop,i=t.push,s=t.reverse,n=t.shift,r=t.sort,o=t.splice,l=t.unshift;t.pop=function(){const t=this.length>0,i=e.apply(this,arguments),s=this.$fastController;return void 0!==s&&t&&s.addSplice(Ct(this.length,[i],0)),i},t.push=function(){const t=i.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(kt(Ct(this.length-arguments.length,[],arguments.length),this)),t},t.reverse=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const i=s.apply(this,arguments);return void 0!==e&&e.reset(t),i},t.shift=function(){const t=this.length>0,e=n.apply(this,arguments),i=this.$fastController;return void 0!==i&&t&&i.addSplice(Ct(0,[e],0)),e},t.sort=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const i=r.apply(this,arguments);return void 0!==e&&e.reset(t),i},t.splice=function(){const t=o.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(kt(Ct(+arguments[0],t,arguments.length>2?arguments.length-2:0),this)),t},t.unshift=function(){const t=l.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(kt(Ct(0,[],arguments.length),this)),t}}class At{constructor(t,e){this.target=t,this.propertyName=e}bind(t){t[this.propertyName]=this.target}unbind(){}}function $t(t){return new S("fast-ref",At,t)}function Rt(t,e){const i="function"==typeof e?e:()=>e;return(e,s)=>t(e,s)?i(e,s):null}const Pt=Object.freeze({positioning:!1,recycle:!0});function Et(t,e,i,s){t.bind(e[i],s)}function Vt(t,e,i,s){const n=Object.create(s);n.index=i,n.length=e.length,t.bind(e[i],n)}class Ft{constructor(t,e,i,s,n,r){this.location=t,this.itemsBinding=e,this.templateBinding=s,this.options=r,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.originalContext=void 0,this.childContext=void 0,this.bindView=Et,this.itemsBindingObserver=p.binding(e,this,i),this.templateBindingObserver=p.binding(s,this,n),r.positioning&&(this.bindView=Vt)}bind(t,e){this.source=t,this.originalContext=e,this.childContext=Object.create(e),this.childContext.parent=t,this.childContext.parentContext=this.originalContext,this.items=this.itemsBindingObserver.observe(t,this.originalContext),this.template=this.templateBindingObserver.observe(t,this.originalContext),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.disconnect(),this.templateBindingObserver.disconnect()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.originalContext),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.originalContext),this.refreshAllViews(!0)):this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=n);const e=this.itemsObserver,i=this.itemsObserver=p.getNotifier(this.items),s=e!==i;s&&null!==e&&e.unsubscribe(this),(s||t)&&i.subscribe(this)}updateViews(t){const e=this.childContext,i=this.views,s=[],n=this.bindView;let r=0;for(let e=0,n=t.length;e<n;++e){const n=t[e],o=n.removed;s.push(...i.splice(n.index+r,o.length)),r-=n.addedCount}const o=this.items,l=this.template;for(let r=0,a=t.length;r<a;++r){const a=t[r];let h=a.index;const c=h+a.addedCount;for(;h<c;++h){const t=i[h],r=t?t.firstChild:this.location,a=this.options.recycle&&s.length>0?s.shift():l.create();i.splice(h,0,a),n(a,o,h,e),a.insertBefore(r)}}for(let t=0,e=s.length;t<e;++t)s[t].dispose();if(this.options.positioning)for(let t=0,e=i.length;t<e;++t){const s=i[t].context;s.length=e,s.index=t}}refreshAllViews(t=!1){const e=this.items,i=this.childContext,s=this.template,n=this.location,r=this.bindView;let o=e.length,l=this.views,a=l.length;if((0===o||t)&&(D.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=s.create();r(o,e,t,i),l[t]=o,o.insertBefore(n)}}else{let t=0;for(;t<o;++t)if(t<a){r(l[t],e,t,i)}else{const o=s.create();r(o,e,t,i),l.push(o),o.insertBefore(n)}const h=l.splice(t,a-t);for(t=0,o=h.length;t<o;++t)h[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,i=t.length;e<i;++e)t[e].unbind()}}class jt extends C{constructor(t,e,i){super(),this.itemsBinding=t,this.templateBinding=e,this.options=i,this.createPlaceholder=u.createBlockPlaceholder,Nt(),this.isItemsBindingVolatile=p.isVolatileBinding(t),this.isTemplateBindingVolatile=p.isVolatileBinding(e)}createBehavior(t){return new Ft(t,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function zt(t,e,i=Pt){return new jt(t,"function"==typeof e?e:()=>e,i)}function It(t){return t?function(e,i,s){return 1===e.nodeType&&e.matches(t)}:function(t,e,i){return 1===t.nodeType}}class Mt{constructor(t,e){this.target=t,this.options=e,this.source=null}bind(t){const e=this.options.property;this.shouldUpdate=p.getAccessors(t).some(t=>t.name===e),this.source=t,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(n),this.source=null,this.shouldUpdate&&this.disconnect()}handleEvent(){this.updateTarget(this.computeNodes())}computeNodes(){let t=this.getNodes();return void 0!==this.options.filter&&(t=t.filter(this.options.filter)),t}updateTarget(t){this.source[this.options.property]=t}}class _t extends Mt{constructor(t,e){super(t,e)}observe(){this.target.addEventListener("slotchange",this)}disconnect(){this.target.removeEventListener("slotchange",this)}getNodes(){return this.target.assignedNodes(this.options)}}function Lt(t){return"string"==typeof t&&(t={property:t}),new S("fast-slotted",_t,t)}class qt extends Mt{constructor(t,e){super(t,e),this.observer=null,e.childList=!0}observe(){null===this.observer&&(this.observer=new MutationObserver(this.handleEvent.bind(this))),this.observer.observe(this.target,this.options)}disconnect(){this.observer.disconnect()}getNodes(){return"subtree"in this.options?Array.from(this.target.querySelectorAll(this.options.selector)):Array.from(this.target.childNodes)}}function Ht(t){return"string"==typeof t&&(t={property:t}),new S("fast-children",qt,t)}class Dt{constructor(t){this.path=t}}const Qt=new Set,Ut=Object.freeze({register(t){Qt.add(t)},unregister(t){Qt.delete(t)}}),Wt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,Kt=Object.freeze({path:Object.freeze({get current(){return location.pathname+location.search},generateRoute(e,i,s={}){return t(this,void 0,void 0,(function*(){let t="config"in e?e:xe.find(e);for(;null!==t;){const e=yield t.config.generateRouteFromPath(i,s);if(null!==e)return e;t=t.parent}return null}))},push(t,e=!0){t&&Wt.test(t)?location.href=t:(history.pushState({},document.title,t),e&&Kt.path.trigger(t))},replace(t,e=!0){t&&Wt.test(t)?location.href=t:(history.replaceState({},document.title,t),e&&Kt.path.trigger(t))},trigger(t){const e=new Dt(t);for(const t of Qt)t.enqueue(e)}}),name:Object.freeze({generateRoute(e,i,s={}){return t(this,void 0,void 0,(function*(){let t="config"in e?e:xe.find(e);for(;null!==t;){const e=yield t.config.generateRouteFromName(i,s);if(null!==e)return e;t=t.parent}return null}))},push(e,i,s={},n=!0){return t(this,void 0,void 0,(function*(){const t=yield Kt.name.generateRoute(e,i,s);null!==t&&Kt.path.push(t,n)}))},replace(e,i,s={},n=!0){return t(this,void 0,void 0,(function*(){const t=yield Kt.name.generateRoute(e,i,s);null!==t&&Kt.path.replace(t,n)}))},trigger(e,i,s={}){return t(this,void 0,void 0,(function*(){const t=yield Kt.name.generateRoute(e,i,s);null!==t&&Kt.path.trigger(t)}))}})});class Jt{constructor(){this.queue=[],this.promise=null,this.resolve=null}connect(){this.enqueue(new Dt(Kt.path.current)),window.addEventListener("popstate",this),Ut.register(this)}disconnect(){this.queue=[],this.promise=null,this.resolve=null,window.removeEventListener("popstate",this),Ut.unregister(this)}receive(){return null!==this.promise||(this.promise=new Promise(t=>this.resolve=t),Promise.resolve().then(()=>this.tryDequeue())),this.promise}enqueue(t){this.queue.push(t),this.tryDequeue()}tryDequeue(){if(null===this.resolve||0===this.queue.length)return;const t=this.queue[this.queue.length-1],e=this.resolve;this.queue.length=0,this.promise=null,this.resolve=null,e(t)}handleEvent(t){this.enqueue(new Dt(Kt.path.current))}}const Gt=encodeURIComponent,Xt=t=>Gt(t).replace("%24","$");function Yt(t,e,i){let s=[];if(null==e)return s;if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)if(i)s.push(`${Xt(t)}=${Gt(e[n])}`);else{const i=t+"["+("object"==typeof e[n]&&null!==e[n]?n:"")+"]";s=s.concat(Yt(i,e[n]))}else if("object"!=typeof e||i)s.push(`${Xt(t)}=${Gt(e)}`);else for(const i in e)s=s.concat(Yt(t+"["+i+"]",e[i]));return s}function Zt(t,e){return Array.isArray(t)?(t.push(e),t):void 0!==t?[t,e]:e}function te(t,e,i){let s=t;const n=e.length-1;for(let t=0;t<=n;t++){const r=""===e[t]?s.length:e[t];if(t<n){const i=s[r]&&"object"!=typeof s[r]?[s[r]]:s[r];s=s[r]=i||(isNaN(e[t+1])?{}:[])}else s=s[r]=i}}const ee=Object.freeze({get current(){return location.search},build(t,e){let i=[];const s=Object.keys(t||{}).sort();for(let n=0,r=s.length;n<r;n++){const r=s[n];i=i.concat(Yt(r,t[r],e))}return 0===i.length?"":i.join("&")},separate(t){const e=t.indexOf("?");let i="";return-1!==e&&(i=t.substr(e+1,t.length),t=t.substr(0,e)),{path:t,queryString:i}},parse(t){const e={};if(!t||"string"!=typeof t)return e;let i=t;"?"===i.charAt(0)&&(i=i.substr(1));const s=i.replace(/\+/g," ").split("&");for(let t=0;t<s.length;t++){const i=s[t].split("="),n=decodeURIComponent(i[0]);if(!n)continue;let r=n.split("]["),o=r.length-1;if(/\[/.test(r[0])&&/\]$/.test(r[o])?(r[o]=r[o].replace(/\]$/,""),r=r.shift().split("[").concat(r),o=r.length-1):o=0,i.length>=2){const t=i[1]?decodeURIComponent(i[1]):"";o?te(e,r,t):e[n]=Zt(e[n],t)}else e[n]=!0}return e}}),ie=t=>t;class se{constructor(t,e,i){this.path=t,this.name=e,this.caseSensitive=i}}class ne{constructor(t,e,i,s){this.route=t,this.paramNames=e,this.paramTypes=i,this.settings=s}get path(){return this.route.path}}class re{constructor(t,e,i,s){this.endpoint=t,this.params=e,this.typedParams=i,this.queryParams=s,this.allParams=Object.assign(Object.assign({},e),s),this.allTypedParams=Object.assign(Object.assign({},i),s)}get settings(){return this.endpoint.settings}}class oe{constructor(t,e,i,s){var n;this.chars=t,this.states=e,this.skippedStates=i,this.result=s,this.head=e[e.length-1],this.endpoint=null===(n=this.head)||void 0===n?void 0:n.endpoint}advance(t){const{chars:e,states:i,skippedStates:s,result:n}=this;let r=null,o=0;const l=i[i.length-1];function a(h,c){if(h.isMatch(t)&&(1==++o?r=h:n.add(new oe(e.concat(t),i.concat(h),null===c?s:s.concat(c),n))),null===l.segment&&h.isOptional&&null!==h.nextStates){if(h.nextStates.length>1)throw new Error(h.nextStates.length+" nextStates");const t=h.nextStates[0];if(!t.isSeparator)throw new Error("Not a separator");if(null!==t.nextStates)for(const e of t.nextStates)a(e,h)}}if(l.isDynamic&&a(l,null),null!==l.nextStates)for(const t of l.nextStates)a(t,null);null!==r&&(i.push(this.head=r),e.push(t),null!==r.endpoint&&(this.endpoint=r.endpoint)),0===o&&n.remove(this)}finalize(){!function t(e,i){const s=i.nextStates;if(null!==s)if(1===s.length&&null===s[0].segment)t(e,s[0]);else for(const i of s)if(i.isOptional&&null!==i.endpoint){if(e.push(i),null!==i.nextStates)for(const s of i.nextStates)t(e,s);break}}(this.skippedStates,this.head)}getParams(){const{states:t,chars:e,endpoint:i}=this,s={};for(const t of i.paramNames)s[t]=void 0;for(let i=0,n=t.length;i<n;++i){const n=t[i];if(n.isDynamic){const t=n.segment.name;void 0===s[t]?s[t]=e[i]:s[t]+=e[i]}}return s}compareTo(t){const e=this.states,i=t.states;for(let t=0,s=0,n=Math.max(e.length,i.length);t<n;++t){let n=e[t];if(void 0===n)return 1;let r=i[s];if(void 0===r)return-1;let o=n.segment,l=r.segment;if(null===o){if(null===l){++s;continue}if(void 0===(n=e[++t]))return 1;o=n.segment}else if(null===l){if(void 0===(r=i[++s]))return-1;l=r.segment}if(o.kind<l.kind)return 1;if(o.kind>l.kind)return-1;++s}const s=this.skippedStates,n=t.skippedStates,r=s.length,o=n.length;if(r<o)return 1;if(r>o)return-1;for(let t=0;t<r;++t){const e=s[t],i=n[t];if(e.length<i.length)return 1;if(e.length>i.length)return-1}return 0}}function le(t){return null!==t.head.endpoint}function ae(t,e){return t.compareTo(e)}class he{constructor(t){this.candidates=[],this.candidates=[new oe([""],[t],[],this)]}get isEmpty(){return 0===this.candidates.length}getSolution(){const t=this.candidates.filter(le);if(0===t.length)return null;for(const e of t)e.finalize();return t.sort(ae),t[0]}add(t){this.candidates.push(t)}remove(t){this.candidates.splice(this.candidates.indexOf(t),1)}advance(t){const e=this.candidates.slice();for(const i of e)i.advance(t)}}class ce{constructor(){this.names=new Map,this.paths=new Map,this.rootState=new ue(null,null,"")}add(t,e){if(t instanceof Array)for(const i of t)this.$add(i,e);else this.$add(t,e)}$add(t,e){const i=t.path,s=new se(t.path,t.name||"",!0===t.caseSensitive),n=""===i?[""]:i.split("/").filter(de),r=[],o=[];let l=this.rootState;const a=[];for(const t of n)switch(l=l.append(null,"/"),t.charAt(0)){case"{":{const e=t.slice(1,-1).split(":").map(t=>t.trim());2===e.length?o.push(e[1]):o.push("string");const i=e[0].endsWith("?"),s=i?e[0].slice(0,-1):e[0];r.push(s);const n=new pe(s,i);a.push(n),l=n.appendTo(l);break}case"*":{const e=t.slice(1);r.push(e),o.push("string");const i=new ge(e);a.push(i),l=i.appendTo(l);break}default:{const e=new fe(t,s.caseSensitive);a.push(e),l=e.appendTo(l);break}}const h=new ne(s,r,o,e||null);l.setEndpoint(h),this.paths.set(i,a),t.name&&this.names.set(t.name,a)}recognize(e,i={}){return t(this,void 0,void 0,(function*(){const t=ee.separate(e),s=ee.parse(t.queryString);(e=decodeURI(t.path)).startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1));const n=new he(this.rootState);for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(n.advance(i),n.isEmpty)return null}const r=n.getSolution();if(null===r)return null;const{endpoint:o}=r,l=o.paramNames,a=o.paramTypes,h=r.getParams(),c={};for(let t=0,e=l.length;t<e;++t){const e=l[t],s=i[a[t]]||ie,n=h[e],r=yield s(n);c[e]=r}return new re(o,h,c,s)}))}generateFromName(t,e){return this.generate(this.names.get(t),e)}generateFromPath(t,e){return this.generate(this.paths.get(t),e)}generate(t,e){if(!t)return null;const i=Object.assign({},e),s={};let n="";for(let e=0,r=t.length;e<r;e++){const r=t[e],o=r.generate(i,s);if(null==o){if(r instanceof pe&&!r.optional)throw new Error(`A value is required for route parameter '${r.name}'.`)}else n+="/",n+=o}"/"!==n.charAt(0)&&(n="/"+n);for(const t in s)delete i[t];const r=ee.build(i);return n+=r?"?"+r:"",n}}class ue{constructor(t,e,i){switch(this.prevState=t,this.segment=e,this.value=i,this.nextStates=null,this.endpoint=null,null==e?void 0:e.kind){case 2:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=e.optional;break;case 1:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=!1;break;case 3:this.length=t.length+1,this.isSeparator=!1,this.isDynamic=!1,this.isOptional=!1;break;case void 0:this.length=null===t?0:t.length,this.isSeparator=!0,this.isDynamic=!1,this.isOptional=!1}}append(t,e){let i,s=this.nextStates;return null===s?(i=void 0,s=this.nextStates=[]):i=null===t?s.find(t=>t.value===e):s.find(e=>{var i;return null===(i=e.segment)||void 0===i?void 0:i.equals(t)}),void 0===i&&s.push(i=new ue(this,t,e)),i}setEndpoint(t){if(null!==this.endpoint)throw new Error(`Cannot add ambiguous route. The pattern '${t.route.path}' clashes with '${this.endpoint.route.path}'`);this.endpoint=t,this.isOptional&&(this.prevState.setEndpoint(t),this.prevState.isSeparator&&null!==this.prevState.prevState&&this.prevState.prevState.setEndpoint(t))}isMatch(t){const e=this.segment;switch(null==e?void 0:e.kind){case 2:return!this.value.includes(t);case 1:return!0;case 3:case void 0:return this.value.includes(t)}}}function de(t){return t.length>0}class fe{constructor(t,e){this.value=t,this.caseSensitive=e}get kind(){return 3}appendTo(t){const{value:e,value:{length:i}}=this;if(this.caseSensitive)for(let s=0;s<i;++s)t=t.append(this,e.charAt(s));else for(let s=0;s<i;++s){const i=e.charAt(s);t=t.append(this,i.toUpperCase()+i.toLowerCase())}return t}generate(){return this.value}equals(t){return 3===t.kind&&t.caseSensitive===this.caseSensitive&&t.value===this.value}}class pe{constructor(t,e){this.name=t,this.optional=e}get kind(){return 2}appendTo(t){return t=t.append(this,"/")}generate(t,e){return e[this.name]=!0,t[this.name]}equals(t){return 2===t.kind&&t.optional===this.optional&&t.name===this.name}}class ge{constructor(t){this.name=t}get kind(){return 1}appendTo(t){return t=t.append(this,"")}generate(t,e){return e[this.name]=!0,t[this.name]}equals(t){return 1===t.kind&&t.name===this.name}}const ve="fast-child-route";function me(t,e){return"command"in e?e.command:"redirect"in e?new je(e.redirect):_e.fromDefinition(t,e)}const be=t=>{if(null==t)return!1;switch(t.toLowerCase().trim()){case"true":case"yes":case"1":return!0;default:return!1}},ye={number:t=>void 0===t?NaN:parseFloat(t),float:t=>void 0===t?NaN:parseFloat(t),int:t=>void 0===t?NaN:parseInt(t),integer:t=>void 0===t?NaN:parseInt(t),Date:t=>void 0===t?new Date(Date.now()):new Date(t),boolean:be,bool:be};class Ce{constructor(t){this.owner=t,this._recognizer=null,this.pathToCommand=new Map,this.fallbackCommand=null,this.fallbackSettings=null,this.converters={}}get recognizer(){return null===this._recognizer&&(this._recognizer=this.owner.createRouteRecognizer()),this._recognizer}ignore(t){"string"==typeof t&&(t={path:t}),this.pathToCommand.set(t.path,new Fe),this.recognizer.add(t,t.settings)}map(...t){for(const e of t){if("children"in e){const t=this.owner.createTitleBuilder(),i=e.children.map(i=>{const s=Object.assign(Object.assign(Object.assign({},e),i),{path:`${e.path}/${i.path}`});if("title"in e||"title"in i){const n=e.title||"",r=i.title||"";s.title=t.joinTitles(n,r)}if("name"in i){const t=e.name?e.name+"/":"";s.name=t+i.name}return s.children===e.children&&delete s.children,s});this.map(...i);continue}let t;if(t="command"in e?e.command:"redirect"in e?new je(e.redirect):_e.fromDefinition(this.owner,e),this.pathToCommand.set(e.path,t),this.recognizer.add(e,e.settings),"childRouters"in e&&e.childRouters){const i=Object.assign(Object.assign({},e),{path:e.path+"/*fast-child-route"});this.pathToCommand.set(i.path,t),this.recognizer.add(i,i.settings)}}}fallback(e){const i=this.owner;this.fallbackCommand="function"==typeof e?{createContributor(s,n){return t(this,void 0,void 0,(function*(){const t=yield e();return me(i,t).createContributor(s,n)}))}}:me(i,e)}converter(t,e){let i;i="convert"in e?e.convert.bind(e):e.prototype&&"convert"in e.prototype?t=>this.owner.construct(e).convert(t):e,this.converters[t]=i}recognize(e){return t(this,void 0,void 0,(function*(){const t=yield this.recognizer.recognize(e,this.aggregateConverters());if(null!==t)return{route:t,command:this.pathToCommand.get(t.endpoint.path)};if(null!==this.fallbackCommand){const t=ee.separate(e),i=ee.parse(t.queryString);return{route:new re(new ne(new se("*","",!1),[],[],this.fallbackSettings),{},{},i),command:this.fallbackCommand}}return null}))}generateFromName(t,e){return this.recognizer.generateFromName(t,e)}generateFromPath(t,e){return this.recognizer.generateFromPath(t,e)}aggregateConverters(){return null===this.owner.parent?Object.assign(Object.assign({},ye),this.converters):Object.assign(Object.assign({},this.owner.parent.routes.aggregateConverters()),this.converters)}}function we(t){const e=t.parentElement;if(e)return e;{const e=t.getRootNode();if(e.host instanceof HTMLElement)return e.host}return null}function Se(t){let e=t;for(;e=we(e);)if("$router"in e)return e.$router;return null}const xe=Object.freeze({getOrCreateFor(t){const e=t.$router;return void 0!==e?e:t.$router=new Te(t)},find:t=>t.$router||Se(t),from(t){class e extends t{constructor(){super(),xe.getOrCreateFor(this)}get config(){return this.$router.config}set config(t){this.$router.config=t}}const i=e.prototype;if("connectedCallback"in i){const t=i.connectedCallback;i.connectedCallback=function(){t.call(this),this.$router.connect()}}else i.connectedCallback=function(){this.$router.connect()};if("disconnectedCallback"in i){const t=i.disconnectedCallback;i.disconnectedCallback=function(){t.call(this),this.$router.disconnect()}}else i.disconnectedCallback=function(){this.$router.disconnect()};return e}});function Oe(t){return t instanceof ft}class Te{constructor(e){this.host=e,this.parentRouter=void 0,this.contributors=new Set,this.navigationQueue=null,this.linkHandler=null,this.newView=null,this.newRoute=null,this.childCommandContributor=null,this.childRoute=null,this.isConnected=!1,this.routerConfig=null,this.view=null,this.route=null,this.onNavigationMessage=e=>t(this,void 0,void 0,(function*(){const t=this.config.createNavigationProcess();yield t.run(this,e),this.navigationQueue.receive().then(this.onNavigationMessage)})),e.$router=this}get config(){return this.routerConfig}set config(t){this.routerConfig=t,this.tryConnect()}get parent(){if(void 0===this.parentRouter){if(!this.isConnected)return null;this.parentRouter=Se(this.host)}return this.parentRouter||null}get level(){return null===this.parent?0:this.parent.level+1}shouldRender(t){var e;if(this.route&&this.route.endpoint.path===t.endpoint.path){const i=null==t?void 0:t.allParams,s=null===(e=this.route)||void 0===e?void 0:e.allParams;if(JSON.stringify(s)===JSON.stringify(i))return!1}return!0}beginRender(e,i){return t(this,void 0,void 0,(function*(){return this.newRoute=e,this.newView=yield i.createView(),this.newView.bind(e.allTypedParams,ke.create(this)),this.newView.appendTo(this.host),yield i.transition.begin(this.host,this.view,this.newView),{commit:this.renderOperationCommit.bind(this,i.layout,i.transition),rollback:this.renderOperationRollback.bind(this,i.transition)}}))}connect(){this.isConnected=!0,this.tryConnect()}disconnect(){null===this.parent?(null!==this.navigationQueue&&(this.navigationQueue.disconnect(),this.navigationQueue=null),null!==this.linkHandler&&(this.linkHandler.disconnect(),this.linkHandler=null)):this.parent.removeContributor(this),this.isConnected=!1,this.parentRouter=void 0}addContributor(t){this.contributors.add(t)}removeContributor(t){this.contributors.delete(t)}tryConnect(){null!==this.config&&this.isConnected&&(null===this.parent?(null!==this.navigationQueue&&this.navigationQueue.disconnect(),this.navigationQueue=this.config.createNavigationQueue(),this.navigationQueue.connect(),this.navigationQueue.receive().then(this.onNavigationMessage),null!==this.linkHandler&&this.linkHandler.disconnect(),this.linkHandler=this.config.createLinkHandler(),this.linkHandler.connect()):(this.config.parent=this.parent.config,this.parent.addContributor(this)))}renderOperationCommit(e,i){return t(this,void 0,void 0,(function*(){yield e.beforeCommit(this.host),yield i.commit(this.host,this.view,this.newView),yield e.afterCommit(this.host),null!==this.view&&this.view.dispose(),this.route=this.newRoute,this.view=this.newView,this.newRoute=null,this.newView=null}))}renderOperationRollback(e){return t(this,void 0,void 0,(function*(){null!==this.newView&&(yield e.rollback(this.host,this.view,this.newView),this.newView.dispose(),this.newRoute=null,this.newView=null)}))}navigate(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}leave(e){return t(this,void 0,void 0,(function*(){if(yield this.tunnel(e),!e.canceled){const t=this.contributors;this.contributors=new Set,e.onCancel(()=>this.contributors=t)}}))}construct(e){return t(this,void 0,void 0,(function*(){if(null!==this.parent){const t=e.route.allParams["fast-child-route"]||"",i=yield this.config.recognizeRoute(t);if(null===i){return this.config.createEventSink().onUnhandledNavigationMessage(this,new Dt(t)),void e.cancel()}this.childRoute=i.route,this.childCommandContributor=yield i.command.createContributor(this,i.route)}yield this.tunnel(e)}))}enter(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}commit(e){return t(this,void 0,void 0,(function*(){yield this.tunnel(e)}))}tunnel(e){return t(this,void 0,void 0,(function*(){const t=this.childRoute,i=this.childCommandContributor;if(t&&i&&(yield e.evaluateContributor(i,t,this)),e.canceled)return;const s=[...this.config.findContributors(e.name),...Array.from(this.contributors)];for(const t of s)if(yield e.evaluateContributor(t,void 0,this),e.canceled)return}))}}const ke=Object.freeze({create:t=>Object.create(y,{router:{value:t}})}),Be=Object.freeze({default:Object.freeze({begin(e,i,s){return t(this,void 0,void 0,(function*(){}))},rollback(e,i,s){return t(this,void 0,void 0,(function*(){}))},commit(e,i,s){return t(this,void 0,void 0,(function*(){}))}})});class Ne{constructor(t=null,e=null,i=!0){this.template=t,this.runBeforeCommit=i,this.styles=null==e?null:Array.isArray(e)?K.create(e):e instanceof K?e:K.create([e])}beforeCommit(e){return t(this,void 0,void 0,(function*(){this.runBeforeCommit&&this.apply(e)}))}afterCommit(e){return t(this,void 0,void 0,(function*(){this.runBeforeCommit||this.apply(e)}))}apply(t){Oe(t)&&(t.$fastController.template!==this.template&&(t.$fastController.template=this.template),t.$fastController.styles!==this.styles&&(t.$fastController.styles=this.styles))}}const Ae=Object.freeze({default:new Ne(W`<slot></slot>`)});function $e(t,e){return e in t}const Re={lifecycle:!0,parameters:!0};class Pe extends C{constructor(t){super(),this.options=t}createPlaceholder(t){return u.createCustomAttributePlaceholder("fast-navigation-contributor",t)}createBehavior(t){return new Ee(t,this.options)}}class Ee{constructor(t,e){this.contributor=t,this.options=e,this.router=null}bind(t,e){if(this.options.lifecycle&&(this.router=e.router||xe.find(this.contributor),this.router.addContributor(this.contributor)),this.options.parameters){const e=this.contributor,i=t;for(const t in i)e[t]=i[t]}}unbind(t){null!==this.router&&this.router.removeContributor(this.contributor)}}function Ve(t){return new Pe(Object.assign({},Re,t))}class Fe{createContributor(){return t(this,void 0,void 0,(function*(){return{navigate(e){return t(this,void 0,void 0,(function*(){e.cancel()}))}}}))}}class je{constructor(t){this.redirect=t}createContributor(){return t(this,void 0,void 0,(function*(){const e=this.redirect;return{navigate(i){return t(this,void 0,void 0,(function*(){const s=i.router.config,n=(yield s.generateRouteFromName(e,i.route.allParams))||(yield s.generateRouteFromPath(e,i.route.allParams));if(null===n)throw new Error("Invalid redirect. Name or path not found: "+e);i.cancel(()=>t(this,void 0,void 0,(function*(){return Kt.path.replace(n)})))}))}}}))}}function ze(t){return W`<${t} ${Ve()}></${t}>`}function Ie(t){const e=document.createDocumentFragment();e.appendChild(t);const i=new D(e,[Ve().createBehavior(t)]);return{create:()=>i}}class Me{constructor(t,e,i){this.router=t,this.route=e,this.command=i}construct(e){return t(this,void 0,void 0,(function*(){this.router.shouldRender(this.route)?(this.operation=yield this.router.beginRender(this.route,this.command),e.onCancel(()=>this.operation.rollback())):e.cancel()}))}commit(e){return t(this,void 0,void 0,(function*(){yield this.operation.commit(),this.command.title&&e.setTitle(this.command.title)}))}}class _e{constructor(t,e){this.owner=t,this.createView=e,this._layout=null,this._transition=null,this.title=""}get transition(){return this._transition||this.owner.defaultTransition}set transition(t){this._transition=t}get layout(){return this._layout||this.owner.defaultLayout}set layout(t){this._layout=t}createContributor(e,i){return t(this,void 0,void 0,(function*(){return new Me(e,i,this)}))}static fromDefinition(e,i){let s;s="template"in i?()=>t(this,void 0,void 0,(function*(){let t=i.template;return"function"==typeof t&&(t=yield t()),t.create()})):()=>t(this,void 0,void 0,(function*(){let t=i.element,e=null;if(i.factory)e=i.factory;else if("function"==typeof t){let i=lt.forType(t);if(i)e=ze(i.name);else if(t=yield t(),"string"==typeof t)e=ze(t);else if(t instanceof HTMLElement)e=Ie(t);else{if(i=lt.forType(t),!i)throw new Error("Invalid value for element in route config.");e=ze(i.name)}}else t instanceof HTMLElement?i.factory=e=Ie(t):i.factory=e=ze(t);return e.create()}));const n=new _e(e,s);return i.layout&&(i.layout instanceof Q?n.layout=new Ne(i.layout):n.layout=i.layout),i.transition&&(n.transition=i.transition),i.title&&(n.title=i.title),n}}class Le{constructor(){this.handler=t=>{const{shouldHandleEvent:e,href:i}=this.getEventInfo(t);e&&(t.preventDefault(),Kt.path.push(i))}}connect(){window.addEventListener("click",this.handler,!0)}disconnect(){window.removeEventListener("click",this.handler)}getEventInfo(t){const e={shouldHandleEvent:!1,href:null,anchor:null},i=this.findClosestAnchor(t);if(!i||!this.targetIsThisWindow(i))return e;if(i.hasAttribute("download")||i.hasAttribute("router-ignore")||i.hasAttribute("data-router-ignore"))return e;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return e;const s=i.getAttribute("href");e.anchor=i,e.href=s;const n=1===t.which,r=s&&!("#"===s.charAt(0)||/^[a-z]+:/i.test(s));return e.shouldHandleEvent=n&&!!r,e}findClosestAnchor(t){const e=t.composedPath();for(let t=0,i=e.length;t<i;++t){const i=e[t];if("A"===i.tagName)return i}return t.target}targetIsThisWindow(t){const e=t.getAttribute("target");return!e||e===window.name||"_self"===e}}class qe{constructor(t,e,i,s,n){this.name=t,this.commitActions=s,this.cancelActions=n,this.routes=[],this.routers=[],this.canceled=!1,this.titles=[],this.routes.push(e),this.routers.push(i)}get route(){return this.routes[this.routes.length-1]}get router(){return this.routers[this.routers.length-1]}cancel(t){this.canceled=!0,t&&this.cancelActions.push(t)}onCommit(t){this.commitActions.push(t)}onCancel(t){this.cancelActions.push(t)}setTitle(t){const e=this.router.level;for(;this.titles.length<e+1;)this.titles.push([]);this.titles[e].push(t)}evaluateContributor(e,i=this.route,s=this.router){return t(this,void 0,void 0,(function*(){$e(e,this.name)&&(this.routes.push(i),this.routers.push(s),yield e[this.name](this),this.routes.pop(),this.routers.pop())}))}}class He{constructor(){this.phases=["navigate","leave","construct","enter","commit"]}run(e,i){return t(this,void 0,void 0,(function*(){const t=e.config.createEventSink(),s=yield e.config.recognizeRoute(i.path);if(null===s)return void t.onUnhandledNavigationMessage(e,i);const n=s.route,r=s.command;t.onNavigationBegin(e,n,r);const o=[],l=[];let a=o;const h=[yield r.createContributor(e,n),e,this];for(const i of this.phases){const s=new qe(i,n,e,o,l);if(t.onPhaseBegin(s),s.canceled)a=l;else for(const t of h)if(yield s.evaluateContributor(t),s.canceled){a=l;break}if(t.onPhaseEnd(s),s.canceled)break}yield Promise.all(a.map(t=>t())).then(()=>t.onNavigationEnd(e,n,r))}))}commit(t){const e=t.router.config.createTitleBuilder();document.title=e.buildTitle(t.router.config.title,t.titles)}}class De{constructor(t=" - ",e=":"){this.segmentSeparator=t,this.fragmentSeparator=e}joinTitles(t,e){return""===t?e:""===e?t:`${t}${this.segmentSeparator}${e}`}buildTitle(t,e){let i=t;for(const t of e){i&&(i+=this.segmentSeparator);let e="";for(const i of t)e&&(e+=this.fragmentSeparator),e+=i;i+=e}return i}}class Qe{onUnhandledNavigationMessage(t,e){}onNavigationBegin(t,e,i){}onPhaseBegin(t){}onPhaseEnd(t){}onNavigationEnd(t,e,i){}}class Ue{constructor(){this.isConfigured=!1,this.routes=new Ce(this),this.contributors=[],this.defaultLayout=Ae.default,this.defaultTransition=Be.default,this.title="",this.parent=null}createNavigationQueue(){return this.construct(Jt)}createLinkHandler(){return this.construct(Le)}createNavigationProcess(){return new He}createEventSink(){return this.construct(Qe)}createTitleBuilder(){return this.construct(De)}createRouteRecognizer(){return this.construct(ce)}construct(t){return null!==this.parent?this.parent.construct(t):new t}recognizeRoute(e){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.recognize(e)}))}generateRouteFromName(e,i){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.generateFromName(e,i)}))}generateRouteFromPath(e,i){return t(this,void 0,void 0,(function*(){return yield this.ensureConfigured(),this.routes.generateFromPath(e,i)}))}findContributors(t){return this.contributors.filter(e=>$e(e,t))}cached(e){let i=null;return()=>t(this,void 0,void 0,(function*(){return null===i&&(i=new e),i}))}ensureConfigured(){return t(this,void 0,void 0,(function*(){this.isConfigured||(yield this.configure(),this.isConfigured=!0)}))}}let We=class extends(xe.from(ft)){};We=function(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}([pt("fast-router")],We);export{e as $global,S as AttachedBehaviorHTMLDirective,it as AttributeDefinition,V as BindingBehavior,gt as CSSDirective,qt as ChildrenBehavior,se as ConfigurableRoute,ut as Controller,u as DOM,Le as DefaultLinkHandler,He as DefaultNavigationProcess,Jt as DefaultNavigationQueue,ce as DefaultRouteRecognizer,Te as DefaultRouter,K as ElementStyles,ne as Endpoint,b as ExecutionContext,s as FAST,ft as FASTElement,lt as FASTElementDefinition,Ne as FASTElementLayout,We as FASTRouter,E as HTMLBindingDirective,C as HTMLDirective,D as HTMLView,Fe as Ignore,Ae as Layout,Ut as NavigationHandler,Dt as NavigationMessage,p as Observable,f as PropertyChangeNotifier,ee as QueryString,re as RecognizedRoute,je as Redirect,At as RefBehavior,_e as Render,Ft as RepeatBehavior,jt as RepeatDirective,Kt as Route,Ce as RouteCollection,xe as Router,Ue as RouterConfiguration,ke as RouterExecutionContext,_t as SlottedBehavior,d as SubscriberSet,w as TargetedHTMLDirective,Be as Transition,Q as ViewTemplate,st as attr,tt as booleanConverter,ve as childRouteParameter,Ht as children,q as compileTemplate,mt as css,yt as cssPartial,pt as customElement,y as defaultExecutionContext,It as elements,n as emptyArray,Nt as enableArrayObservation,W as html,Oe as isFASTElementHost,$e as isNavigationPhaseContributor,Ve as navigationContributor,et as nullableNumberConverter,g as observable,$t as ref,zt as repeat,Lt as slotted,v as volatile,Rt as when};
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.23.0"
8
+ "packageVersion": "7.23.1"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@microsoft/fast-router",
3
3
  "description": "A web-components-based router.",
4
4
  "sideEffects": false,
5
- "version": "0.4.1",
5
+ "version": "0.4.2",
6
6
  "author": {
7
7
  "name": "Microsoft",
8
8
  "url": "https://discord.gg/FcSNfg4"
@@ -44,7 +44,7 @@
44
44
  "test-firefox:verbose": "karma start karma.conf.cjs --browsers=FirefoxHeadless --single-run --coverage --reporter=mocha"
45
45
  },
46
46
  "devDependencies": {
47
- "@microsoft/api-extractor": "7.23.0",
47
+ "@microsoft/api-extractor": "7.23.1",
48
48
  "@types/chai": "^4.2.11",
49
49
  "@types/karma": "^5.0.0",
50
50
  "@types/mocha": "^7.0.2",
@@ -84,6 +84,6 @@
84
84
  "webpack": "^4.44.0"
85
85
  },
86
86
  "dependencies": {
87
- "@microsoft/fast-element": "^1.10.1"
87
+ "@microsoft/fast-element": "^1.10.2"
88
88
  }
89
89
  }