@microsoft/fast-router 0.2.8 → 0.2.12
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 +166 -1
- package/CHANGELOG.md +34 -2
- package/README.md +7 -9
- package/dist/dts/commands.d.ts +1 -1
- package/dist/dts/routes.d.ts +1 -1
- package/dist/esm/commands.js +1 -1
- package/dist/esm/contributors.js +1 -1
- package/dist/esm/links.js +1 -1
- package/dist/esm/process.js +1 -1
- package/dist/esm/query-string.js +8 -8
- package/dist/esm/recognizer.js +2 -2
- package/dist/esm/routes.js +2 -2
- package/dist/fast-router.js +54 -44
- package/dist/fast-router.min.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,172 @@
|
|
|
2
2
|
"name": "@microsoft/fast-router",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sun, 23 Jan 2022 07:11:35 GMT",
|
|
6
|
+
"tag": "@microsoft/fast-router_v0.2.12",
|
|
7
|
+
"version": "0.2.12",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Bump @microsoft/fast-element to v1.7.0",
|
|
12
|
+
"author": "scomea@microsoft.com",
|
|
13
|
+
"commit": "897c39862b58a63ad9900426ae6ae2f95d222e1e",
|
|
14
|
+
"package": "@microsoft/fast-router"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Wed, 12 Jan 2022 07:11:42 GMT",
|
|
21
|
+
"tag": "@microsoft/fast-router_v0.2.11",
|
|
22
|
+
"version": "0.2.11",
|
|
23
|
+
"comments": {
|
|
24
|
+
"none": [
|
|
25
|
+
{
|
|
26
|
+
"comment": "Bump @microsoft/fast-element to v1.6.2",
|
|
27
|
+
"author": "steph@huynhicode.dev",
|
|
28
|
+
"commit": "962ca2a330f8c277ac489613f0ff55cac08896e8",
|
|
29
|
+
"package": "@microsoft/fast-router"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Tue, 11 Jan 2022 07:09:27 GMT",
|
|
36
|
+
"tag": "@microsoft/fast-router_v0.2.11",
|
|
37
|
+
"version": "0.2.11",
|
|
38
|
+
"comments": {
|
|
39
|
+
"none": [
|
|
40
|
+
{
|
|
41
|
+
"comment": "update rollup-plugin-filesize from 8.0.2 to 9.1.2",
|
|
42
|
+
"author": "john.kreitlow@microsoft.com",
|
|
43
|
+
"commit": "af847f2749ff605cced426e55a1580ea85c89cb0",
|
|
44
|
+
"package": "@microsoft/fast-router"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"date": "Sun, 19 Dec 2021 07:12:39 GMT",
|
|
51
|
+
"tag": "@microsoft/fast-router_v0.2.11",
|
|
52
|
+
"version": "0.2.11",
|
|
53
|
+
"comments": {
|
|
54
|
+
"none": [
|
|
55
|
+
{
|
|
56
|
+
"comment": "Bump @microsoft/fast-element to v1.6.2",
|
|
57
|
+
"author": "steph@huynhicode.dev",
|
|
58
|
+
"commit": "5056e83234e1c758375fa4882943d104fb476ca2",
|
|
59
|
+
"package": "@microsoft/fast-router"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"date": "Tue, 14 Dec 2021 07:12:12 GMT",
|
|
66
|
+
"tag": "@microsoft/fast-router_v0.2.11",
|
|
67
|
+
"version": "0.2.11",
|
|
68
|
+
"comments": {
|
|
69
|
+
"none": [
|
|
70
|
+
{
|
|
71
|
+
"comment": "Bump @microsoft/fast-element to v1.6.2",
|
|
72
|
+
"author": "roeisenb@microsoft.com",
|
|
73
|
+
"commit": "babdb99e832319eaee76465765f9e6b72911d473",
|
|
74
|
+
"package": "@microsoft/fast-router"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"date": "Wed, 08 Dec 2021 07:10:04 GMT",
|
|
81
|
+
"tag": "@microsoft/fast-router_v0.2.11",
|
|
82
|
+
"version": "0.2.11",
|
|
83
|
+
"comments": {
|
|
84
|
+
"none": [
|
|
85
|
+
{
|
|
86
|
+
"comment": "Bump @microsoft/fast-element to v1.6.2",
|
|
87
|
+
"author": "roeisenb@microsoft.com",
|
|
88
|
+
"commit": "bd7d84152a823cc21aab0dfa196da9d663ad0778",
|
|
89
|
+
"package": "@microsoft/fast-router"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"date": "Thu, 02 Dec 2021 07:11:13 GMT",
|
|
96
|
+
"tag": "@microsoft/fast-router_v0.2.11",
|
|
97
|
+
"version": "0.2.11",
|
|
98
|
+
"comments": {
|
|
99
|
+
"none": [
|
|
100
|
+
{
|
|
101
|
+
"comment": "docs: corrections to cdn links",
|
|
102
|
+
"author": "roeisenb@microsoft.com",
|
|
103
|
+
"commit": "2ec536794820959f771ebbfe25efd5a4489e7a76",
|
|
104
|
+
"package": "@microsoft/fast-router"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"date": "Sun, 31 Oct 2021 07:17:45 GMT",
|
|
111
|
+
"tag": "@microsoft/fast-router_v0.2.11",
|
|
112
|
+
"version": "0.2.11",
|
|
113
|
+
"comments": {
|
|
114
|
+
"patch": [
|
|
115
|
+
{
|
|
116
|
+
"comment": "update fast eslint package version",
|
|
117
|
+
"author": "chhol@microsoft.com",
|
|
118
|
+
"commit": "a150068ee196e73fe7a4f7b538a38752e0e506ba",
|
|
119
|
+
"package": "@microsoft/fast-router"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"date": "Wed, 13 Oct 2021 22:45:16 GMT",
|
|
126
|
+
"tag": "@microsoft/fast-router_v0.2.10",
|
|
127
|
+
"version": "0.2.10",
|
|
128
|
+
"comments": {
|
|
129
|
+
"patch": [
|
|
130
|
+
{
|
|
131
|
+
"comment": "Bump @microsoft/fast-element to v1.6.1",
|
|
132
|
+
"author": "markwhitfeld@users.noreply.github.com",
|
|
133
|
+
"commit": "49d27d20bf430ea4639978ba363e017fc5aa88e4",
|
|
134
|
+
"package": "@microsoft/fast-router"
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"date": "Wed, 13 Oct 2021 01:53:37 GMT",
|
|
141
|
+
"tag": "@microsoft/fast-router_v0.2.9",
|
|
142
|
+
"version": "0.2.9",
|
|
143
|
+
"comments": {
|
|
144
|
+
"none": [
|
|
145
|
+
{
|
|
146
|
+
"comment": "Bump @microsoft/fast-element to v1.6.0",
|
|
147
|
+
"author": "skawian@gmail.com",
|
|
148
|
+
"commit": "1dd6243d7564f00d8af77d1335ab96b0e8153c2e",
|
|
149
|
+
"package": "@microsoft/fast-router"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"date": "Fri, 08 Oct 2021 19:53:11 GMT",
|
|
156
|
+
"tag": "@microsoft/fast-router_v0.2.9",
|
|
157
|
+
"version": "0.2.9",
|
|
158
|
+
"comments": {
|
|
159
|
+
"patch": [
|
|
160
|
+
{
|
|
161
|
+
"comment": "Bump @microsoft/fast-element to v1.6.0",
|
|
162
|
+
"author": "roeisenb@microsoft.com",
|
|
163
|
+
"commit": "d49d1ecc65ee74b7efb33b5a67fcad5fcead7342",
|
|
164
|
+
"package": "@microsoft/fast-router"
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"date": "Wed, 08 Sep 2021 07:16:17 GMT",
|
|
6
171
|
"tag": "@microsoft/fast-router_v0.2.8",
|
|
7
172
|
"version": "0.2.8",
|
|
8
173
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
1
|
# Change Log - @microsoft/fast-router
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sun, 23 Jan 2022 07:11:35 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.2.12
|
|
8
|
+
|
|
9
|
+
Sun, 23 Jan 2022 07:11:35 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump @microsoft/fast-element to v1.7.0 (scomea@microsoft.com)
|
|
14
|
+
|
|
15
|
+
## 0.2.11
|
|
16
|
+
|
|
17
|
+
Sun, 31 Oct 2021 07:17:45 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- update fast eslint package version (chhol@microsoft.com)
|
|
22
|
+
|
|
23
|
+
## 0.2.10
|
|
24
|
+
|
|
25
|
+
Wed, 13 Oct 2021 22:45:16 GMT
|
|
26
|
+
|
|
27
|
+
### Patches
|
|
28
|
+
|
|
29
|
+
- Bump @microsoft/fast-element to v1.6.1 (markwhitfeld@users.noreply.github.com)
|
|
30
|
+
|
|
31
|
+
## 0.2.9
|
|
32
|
+
|
|
33
|
+
Fri, 08 Oct 2021 19:53:11 GMT
|
|
34
|
+
|
|
35
|
+
### Patches
|
|
36
|
+
|
|
37
|
+
- Bump @microsoft/fast-element to v1.6.0 (roeisenb@microsoft.com)
|
|
38
|
+
|
|
7
39
|
## 0.2.8
|
|
8
40
|
|
|
9
|
-
Wed, 08 Sep 2021 07:
|
|
41
|
+
Wed, 08 Sep 2021 07:16:17 GMT
|
|
10
42
|
|
|
11
43
|
### Patches
|
|
12
44
|
|
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ A pre-bundled script that contains all APIs needed to use FAST Router and FAST E
|
|
|
36
36
|
<html lang="en">
|
|
37
37
|
<head>
|
|
38
38
|
<script type="module">
|
|
39
|
-
import { FASTRouter } from "https://
|
|
39
|
+
import { FASTRouter } from "https://cdn.jsdelivr.net/npm/@microsoft/fast-router/dist/fast-router.min.js";
|
|
40
40
|
|
|
41
41
|
// your code here
|
|
42
42
|
</script>
|
|
@@ -45,9 +45,11 @@ A pre-bundled script that contains all APIs needed to use FAST Router and FAST E
|
|
|
45
45
|
</html>
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
The markup above always references the latest release. When deploying to production, you will want to ship with a specific version. Here's an example of the markup for that:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@microsoft/fast-router@0.2.11/dist/fast-router.min.js"></script>
|
|
52
|
+
```
|
|
51
53
|
|
|
52
54
|
:::note
|
|
53
55
|
For simplicity, examples throughout the documentation will assume the library has been installed from NPM, but you can always replace the import location with the CDN URL.
|
|
@@ -134,17 +136,13 @@ export class AppRouterConfiguration extends RouterConfiguration<RouteSettings> {
|
|
|
134
136
|
|
|
135
137
|
```ts
|
|
136
138
|
import { FASTElement, customElement, html, css } from '@microsoft/fast-element';
|
|
137
|
-
import { FASTDesignSystemProvider } from '@microsoft/fast-components';
|
|
138
139
|
import { FASTRouter } from '@microsoft/fast-router';
|
|
139
140
|
import { AppRouterConfiguration } from './routes';
|
|
140
141
|
|
|
141
|
-
FASTDesignSystemProvider;
|
|
142
142
|
FASTRouter;
|
|
143
143
|
|
|
144
144
|
const template = html<MainApplication>`
|
|
145
|
-
<fast-design-system-provider>
|
|
146
145
|
<fast-router :config=${x => x.routerConfiguration}></fast-router>
|
|
147
|
-
</fast-design-system-provider>
|
|
148
146
|
`;
|
|
149
147
|
|
|
150
148
|
const styles = css`
|
|
@@ -152,7 +150,7 @@ const styles = css`
|
|
|
152
150
|
contain: content;
|
|
153
151
|
}
|
|
154
152
|
|
|
155
|
-
:host, fast-
|
|
153
|
+
:host, fast-router {
|
|
156
154
|
display: block;
|
|
157
155
|
width: 100%;
|
|
158
156
|
height: 100%;
|
package/dist/dts/commands.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Router } from "./router";
|
|
2
2
|
import { RouterConfiguration } from "./configuration";
|
|
3
3
|
import { Layout, RouteView, Transition } from "./view";
|
|
4
|
-
import {
|
|
4
|
+
import { ElementFallbackRouteDefinition, ElementRouteDefinition, TemplateFallbackRouteDefinition, TemplateRouteDefinition } from "./routes";
|
|
5
5
|
import { RecognizedRoute } from "./recognizer";
|
|
6
6
|
import { NavigationContributor } from "./contributors";
|
|
7
7
|
import { NavigationCommitPhase, NavigationPhase } from "./phases";
|
package/dist/dts/routes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Constructable, FASTElement, ViewTemplate } from "@microsoft/fast-element";
|
|
1
2
|
import { RecognizedRoute, RouteParameterConverter } from "./recognizer";
|
|
2
3
|
import { NavigationCommand } from "./commands";
|
|
3
|
-
import { ViewTemplate, FASTElement, Constructable } from "@microsoft/fast-element";
|
|
4
4
|
import { Layout, Transition } from "./view";
|
|
5
5
|
import { RouterConfiguration } from "./configuration";
|
|
6
6
|
import { Route } from "./navigation";
|
package/dist/esm/commands.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
-
import { html, HTMLView, ViewTemplate,
|
|
2
|
+
import { FASTElementDefinition, html, HTMLView, ViewTemplate, } from "@microsoft/fast-element";
|
|
3
3
|
import { FASTElementLayout } from "./view";
|
|
4
4
|
import { Route } from "./navigation";
|
|
5
5
|
import { navigationContributor } from "./contributors";
|
package/dist/esm/contributors.js
CHANGED
package/dist/esm/links.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Route } from "./navigation";
|
|
|
5
5
|
export class DefaultLinkHandler {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.handler = (e) => {
|
|
8
|
-
|
|
8
|
+
const { shouldHandleEvent, href } = this.getEventInfo(e);
|
|
9
9
|
if (shouldHandleEvent) {
|
|
10
10
|
e.preventDefault();
|
|
11
11
|
Route.path.push(href);
|
package/dist/esm/process.js
CHANGED
package/dist/esm/query-string.js
CHANGED
|
@@ -11,7 +11,7 @@ function buildParam(key, value, traditional) {
|
|
|
11
11
|
result.push(`${encodeKey(key)}=${encode(value[i])}`);
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
14
|
-
|
|
14
|
+
const arrayKey = key +
|
|
15
15
|
"[" +
|
|
16
16
|
(typeof value[i] === "object" && value[i] !== null ? i : "") +
|
|
17
17
|
"]";
|
|
@@ -20,7 +20,7 @@ function buildParam(key, value, traditional) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
else if (typeof value === "object" && !traditional) {
|
|
23
|
-
for (
|
|
23
|
+
for (const propertyName in value) {
|
|
24
24
|
result = result.concat(buildParam(key + "[" + propertyName + "]", value[propertyName]));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -47,11 +47,11 @@ function parseComplexParam(queryParams, keys, value) {
|
|
|
47
47
|
let currentParams = queryParams;
|
|
48
48
|
const keysLastIndex = keys.length - 1;
|
|
49
49
|
for (let j = 0; j <= keysLastIndex; j++) {
|
|
50
|
-
|
|
50
|
+
const key = keys[j] === "" ? currentParams.length : keys[j];
|
|
51
51
|
if (j < keysLastIndex) {
|
|
52
52
|
// The value has to be an array or a false value
|
|
53
53
|
// It can happen that the value is no array if the key was repeated with traditional style like `list=1&list[]=2`
|
|
54
|
-
|
|
54
|
+
const prevValue = !currentParams[key] || typeof currentParams[key] === "object"
|
|
55
55
|
? currentParams[key]
|
|
56
56
|
: [currentParams[key]];
|
|
57
57
|
currentParams = currentParams[key] =
|
|
@@ -80,7 +80,7 @@ export const QueryString = Object.freeze({
|
|
|
80
80
|
let pairs = [];
|
|
81
81
|
const keys = Object.keys(params || {}).sort();
|
|
82
82
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
83
|
-
|
|
83
|
+
const key = keys[i];
|
|
84
84
|
pairs = pairs.concat(buildParam(key, params[key], traditional));
|
|
85
85
|
}
|
|
86
86
|
if (pairs.length === 0) {
|
|
@@ -121,8 +121,8 @@ export const QueryString = Object.freeze({
|
|
|
121
121
|
}
|
|
122
122
|
const pairs = query.replace(/\+/g, " ").split("&");
|
|
123
123
|
for (let i = 0; i < pairs.length; i++) {
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
const pair = pairs[i].split("=");
|
|
125
|
+
const key = decodeURIComponent(pair[0]);
|
|
126
126
|
if (!key) {
|
|
127
127
|
continue;
|
|
128
128
|
}
|
|
@@ -141,7 +141,7 @@ export const QueryString = Object.freeze({
|
|
|
141
141
|
keysLastIndex = 0;
|
|
142
142
|
}
|
|
143
143
|
if (pair.length >= 2) {
|
|
144
|
-
|
|
144
|
+
const value = pair[1] ? decodeURIComponent(pair[1]) : "";
|
|
145
145
|
if (keysLastIndex) {
|
|
146
146
|
parseComplexParam(queryParams, keys, value);
|
|
147
147
|
}
|
package/dist/esm/recognizer.js
CHANGED
|
@@ -305,7 +305,7 @@ export class DefaultRouteRecognizer {
|
|
|
305
305
|
const paramNames = [];
|
|
306
306
|
const paramTypes = [];
|
|
307
307
|
let state = this.rootState;
|
|
308
|
-
|
|
308
|
+
const segments = [];
|
|
309
309
|
for (const part of parts) {
|
|
310
310
|
// Each segment always begins with a slash, so we represent this with a non-segment state
|
|
311
311
|
state = state.append(null, "/");
|
|
@@ -442,7 +442,7 @@ export class DefaultRouteRecognizer {
|
|
|
442
442
|
output = "/" + output;
|
|
443
443
|
}
|
|
444
444
|
// remove params used in the path and add the rest to the querystring
|
|
445
|
-
for (
|
|
445
|
+
for (const param in consumed) {
|
|
446
446
|
delete routeParams[param];
|
|
447
447
|
}
|
|
448
448
|
const queryString = QueryString.build(routeParams);
|
package/dist/esm/routes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import { Redirect, Render
|
|
2
|
+
import { ConfigurableRoute, Endpoint, RecognizedRoute, } from "./recognizer";
|
|
3
|
+
import { Ignore, Redirect, Render } from "./commands";
|
|
4
4
|
import { QueryString } from "./query-string";
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
package/dist/fast-router.js
CHANGED
|
@@ -132,33 +132,6 @@ function tryRunTask(task) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
function processQueue() {
|
|
136
|
-
const capacity = 1024;
|
|
137
|
-
let index = 0;
|
|
138
|
-
|
|
139
|
-
while (index < updateQueue.length) {
|
|
140
|
-
tryRunTask(updateQueue[index]);
|
|
141
|
-
index++; // Prevent leaking memory for long chains of recursive calls to `DOM.queueUpdate`.
|
|
142
|
-
// If we call `DOM.queueUpdate` within a task scheduled by `DOM.queueUpdate`, the queue will
|
|
143
|
-
// grow, but to avoid an O(n) walk for every task we execute, we don't
|
|
144
|
-
// shift tasks off the queue after they have been executed.
|
|
145
|
-
// Instead, we periodically shift 1024 tasks off the queue.
|
|
146
|
-
|
|
147
|
-
if (index > capacity) {
|
|
148
|
-
// Manually shift all values starting at the index back to the
|
|
149
|
-
// beginning of the queue.
|
|
150
|
-
for (let scan = 0, newLength = updateQueue.length - index; scan < newLength; scan++) {
|
|
151
|
-
updateQueue[scan] = updateQueue[scan + index];
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
updateQueue.length -= index;
|
|
155
|
-
index = 0;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
updateQueue.length = 0;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
135
|
const marker = `fast-${Math.random().toString(36).substring(2, 8)}`;
|
|
163
136
|
/** @internal */
|
|
164
137
|
|
|
@@ -258,12 +231,46 @@ const DOM = Object.freeze({
|
|
|
258
231
|
*/
|
|
259
232
|
queueUpdate(callable) {
|
|
260
233
|
if (updateQueue.length < 1) {
|
|
261
|
-
window.requestAnimationFrame(
|
|
234
|
+
window.requestAnimationFrame(DOM.processUpdates);
|
|
262
235
|
}
|
|
263
236
|
|
|
264
237
|
updateQueue.push(callable);
|
|
265
238
|
},
|
|
266
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Immediately processes all work previously scheduled
|
|
242
|
+
* through queueUpdate.
|
|
243
|
+
* @remarks
|
|
244
|
+
* This also forces nextUpdate promises
|
|
245
|
+
* to resolve.
|
|
246
|
+
*/
|
|
247
|
+
processUpdates() {
|
|
248
|
+
const capacity = 1024;
|
|
249
|
+
let index = 0;
|
|
250
|
+
|
|
251
|
+
while (index < updateQueue.length) {
|
|
252
|
+
tryRunTask(updateQueue[index]);
|
|
253
|
+
index++; // Prevent leaking memory for long chains of recursive calls to `DOM.queueUpdate`.
|
|
254
|
+
// If we call `DOM.queueUpdate` within a task scheduled by `DOM.queueUpdate`, the queue will
|
|
255
|
+
// grow, but to avoid an O(n) walk for every task we execute, we don't
|
|
256
|
+
// shift tasks off the queue after they have been executed.
|
|
257
|
+
// Instead, we periodically shift 1024 tasks off the queue.
|
|
258
|
+
|
|
259
|
+
if (index > capacity) {
|
|
260
|
+
// Manually shift all values starting at the index back to the
|
|
261
|
+
// beginning of the queue.
|
|
262
|
+
for (let scan = 0, newLength = updateQueue.length - index; scan < newLength; scan++) {
|
|
263
|
+
updateQueue[scan] = updateQueue[scan + index];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
updateQueue.length -= index;
|
|
267
|
+
index = 0;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
updateQueue.length = 0;
|
|
272
|
+
},
|
|
273
|
+
|
|
267
274
|
/**
|
|
268
275
|
* Resolves with the next DOM update.
|
|
269
276
|
*/
|
|
@@ -1228,7 +1235,6 @@ class HTMLBindingDirective extends TargetedHTMLDirective {
|
|
|
1228
1235
|
|
|
1229
1236
|
if (this.cleanedTargetName === "innerHTML") {
|
|
1230
1237
|
const binding = this.binding;
|
|
1231
|
-
/* eslint-disable-next-line */
|
|
1232
1238
|
|
|
1233
1239
|
this.binding = (s, c) => DOM.createHTML(binding(s, c));
|
|
1234
1240
|
}
|
|
@@ -1748,6 +1754,8 @@ class HTMLView {
|
|
|
1748
1754
|
* @public
|
|
1749
1755
|
*/
|
|
1750
1756
|
|
|
1757
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
1758
|
+
|
|
1751
1759
|
class ViewTemplate {
|
|
1752
1760
|
/**
|
|
1753
1761
|
* Creates an instance of ViewTemplate.
|
|
@@ -1855,7 +1863,8 @@ class ViewTemplate {
|
|
|
1855
1863
|
|
|
1856
1864
|
} // Much thanks to LitHTML for working this out!
|
|
1857
1865
|
|
|
1858
|
-
const lastAttributeNameRegex =
|
|
1866
|
+
const lastAttributeNameRegex =
|
|
1867
|
+
/* eslint-disable-next-line no-control-regex */
|
|
1859
1868
|
/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;
|
|
1860
1869
|
/**
|
|
1861
1870
|
* Transforms a template literal string into a renderable ViewTemplate.
|
|
@@ -3707,7 +3716,8 @@ function when(binding, templateOrTemplateBinding) {
|
|
|
3707
3716
|
}
|
|
3708
3717
|
|
|
3709
3718
|
const defaultRepeatOptions = Object.freeze({
|
|
3710
|
-
positioning: false
|
|
3719
|
+
positioning: false,
|
|
3720
|
+
recycle: true
|
|
3711
3721
|
});
|
|
3712
3722
|
|
|
3713
3723
|
function bindWithoutPositioning(view, items, index, context) {
|
|
@@ -3851,7 +3861,7 @@ class RepeatBehavior {
|
|
|
3851
3861
|
for (; addIndex < end; ++addIndex) {
|
|
3852
3862
|
const neighbor = views[addIndex];
|
|
3853
3863
|
const location = neighbor ? neighbor.firstChild : this.location;
|
|
3854
|
-
const view = totalRemoved.length > 0 ? totalRemoved.shift() : template.create();
|
|
3864
|
+
const view = this.options.recycle && totalRemoved.length > 0 ? totalRemoved.shift() : template.create();
|
|
3855
3865
|
views.splice(addIndex, 0, view);
|
|
3856
3866
|
bindView(view, items, addIndex, childContext);
|
|
3857
3867
|
view.insertBefore(location);
|
|
@@ -4411,12 +4421,12 @@ function buildParam(key, value, traditional) {
|
|
|
4411
4421
|
if (traditional) {
|
|
4412
4422
|
result.push(`${encodeKey(key)}=${encode(value[i])}`);
|
|
4413
4423
|
} else {
|
|
4414
|
-
|
|
4424
|
+
const arrayKey = key + "[" + (typeof value[i] === "object" && value[i] !== null ? i : "") + "]";
|
|
4415
4425
|
result = result.concat(buildParam(arrayKey, value[i]));
|
|
4416
4426
|
}
|
|
4417
4427
|
}
|
|
4418
4428
|
} else if (typeof value === "object" && !traditional) {
|
|
4419
|
-
for (
|
|
4429
|
+
for (const propertyName in value) {
|
|
4420
4430
|
result = result.concat(buildParam(key + "[" + propertyName + "]", value[propertyName]));
|
|
4421
4431
|
}
|
|
4422
4432
|
} else {
|
|
@@ -4448,12 +4458,12 @@ function parseComplexParam(queryParams, keys, value) {
|
|
|
4448
4458
|
const keysLastIndex = keys.length - 1;
|
|
4449
4459
|
|
|
4450
4460
|
for (let j = 0; j <= keysLastIndex; j++) {
|
|
4451
|
-
|
|
4461
|
+
const key = keys[j] === "" ? currentParams.length : keys[j];
|
|
4452
4462
|
|
|
4453
4463
|
if (j < keysLastIndex) {
|
|
4454
4464
|
// The value has to be an array or a false value
|
|
4455
4465
|
// It can happen that the value is no array if the key was repeated with traditional style like `list=1&list[]=2`
|
|
4456
|
-
|
|
4466
|
+
const prevValue = !currentParams[key] || typeof currentParams[key] === "object" ? currentParams[key] : [currentParams[key]];
|
|
4457
4467
|
currentParams = currentParams[key] = prevValue || (isNaN(keys[j + 1]) ? {} : []);
|
|
4458
4468
|
} else {
|
|
4459
4469
|
currentParams = currentParams[key] = value;
|
|
@@ -4482,7 +4492,7 @@ const QueryString = Object.freeze({
|
|
|
4482
4492
|
const keys = Object.keys(params || {}).sort();
|
|
4483
4493
|
|
|
4484
4494
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
4485
|
-
|
|
4495
|
+
const key = keys[i];
|
|
4486
4496
|
pairs = pairs.concat(buildParam(key, params[key], traditional));
|
|
4487
4497
|
}
|
|
4488
4498
|
|
|
@@ -4534,8 +4544,8 @@ const QueryString = Object.freeze({
|
|
|
4534
4544
|
const pairs = query.replace(/\+/g, " ").split("&");
|
|
4535
4545
|
|
|
4536
4546
|
for (let i = 0; i < pairs.length; i++) {
|
|
4537
|
-
|
|
4538
|
-
|
|
4547
|
+
const pair = pairs[i].split("=");
|
|
4548
|
+
const key = decodeURIComponent(pair[0]);
|
|
4539
4549
|
|
|
4540
4550
|
if (!key) {
|
|
4541
4551
|
continue;
|
|
@@ -4556,7 +4566,7 @@ const QueryString = Object.freeze({
|
|
|
4556
4566
|
}
|
|
4557
4567
|
|
|
4558
4568
|
if (pair.length >= 2) {
|
|
4559
|
-
|
|
4569
|
+
const value = pair[1] ? decodeURIComponent(pair[1]) : "";
|
|
4560
4570
|
|
|
4561
4571
|
if (keysLastIndex) {
|
|
4562
4572
|
parseComplexParam(queryParams, keys, value);
|
|
@@ -4949,7 +4959,7 @@ class DefaultRouteRecognizer {
|
|
|
4949
4959
|
const paramNames = [];
|
|
4950
4960
|
const paramTypes = [];
|
|
4951
4961
|
let state = this.rootState;
|
|
4952
|
-
|
|
4962
|
+
const segments = [];
|
|
4953
4963
|
|
|
4954
4964
|
for (const part of parts) {
|
|
4955
4965
|
// Each segment always begins with a slash, so we represent this with a non-segment state
|
|
@@ -5113,7 +5123,7 @@ class DefaultRouteRecognizer {
|
|
|
5113
5123
|
} // remove params used in the path and add the rest to the querystring
|
|
5114
5124
|
|
|
5115
5125
|
|
|
5116
|
-
for (
|
|
5126
|
+
for (const param in consumed) {
|
|
5117
5127
|
delete routeParams[param];
|
|
5118
5128
|
}
|
|
5119
5129
|
|
|
@@ -6308,7 +6318,7 @@ class Render {
|
|
|
6308
6318
|
class DefaultLinkHandler {
|
|
6309
6319
|
constructor() {
|
|
6310
6320
|
this.handler = e => {
|
|
6311
|
-
|
|
6321
|
+
const {
|
|
6312
6322
|
shouldHandleEvent,
|
|
6313
6323
|
href
|
|
6314
6324
|
} = this.getEventInfo(e);
|
|
@@ -6416,7 +6426,7 @@ class NavigationPhaseImpl {
|
|
|
6416
6426
|
}
|
|
6417
6427
|
|
|
6418
6428
|
setTitle(title) {
|
|
6419
|
-
|
|
6429
|
+
const level = this.router.level;
|
|
6420
6430
|
|
|
6421
6431
|
while (this.titles.length < level + 1) {
|
|
6422
6432
|
this.titles.push([]);
|
package/dist/fast-router.min.js
CHANGED
|
@@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
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=Object.freeze([]),s=[],n=e.trustedTypes.createPolicy("fast-html",{createHTML:t=>t});let r=n;const o=[];function l(){if(o.length)throw o.shift()}function a(t){try{t.call()}catch(t){o.push(t),setTimeout(l,0)}}function h(){let t=0;for(;t<s.length;)if(a(s[t]),t++,t>1024){for(let e=0,i=s.length-t;e<i;e++)s[e]=s[e+t];s.length-=t,t=0}s.length=0}const c="fast-"+Math.random().toString(36).substring(2,8),u=c+"{",d="}"+c,f=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(r!==n)throw new Error("The HTML policy can only be set once.");r=t},createHTML:t=>r.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(c),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(c+":","")),createInterpolationPlaceholder:t=>`${u}${t}${d}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${c}:${t}--\x3e`,queueUpdate(t){s.length<1&&window.requestAnimationFrame(h),s.push(t)},nextUpdate:()=>new Promise(t=>{f.queueUpdate(t)}),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 p(t){const e=this.spillover;-1===e.indexOf(t)&&e.push(t)}function g(t){const e=this.spillover,i=e.indexOf(t);-1!==i&&e.splice(i,1)}function v(t){const e=this.spillover,i=this.source;for(let s=0,n=e.length;s<n;++s)e[s].handleChange(i,t)}function m(t){return-1!==this.spillover.indexOf(t)}class b{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=p,this.unsubscribe=g,this.notify=v,this.has=m,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 y{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 b(this.source)),i.subscribe(t)}else this.sourceSubscribers=null!==(i=this.sourceSubscribers)&&void 0!==i?i:new b(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 C=/(:|&&|\|\||if)/,w=new WeakMap,S=new WeakMap;let x=void 0,O=t=>{throw new Error("Must call enableArrayObservation before observing arrays.")};class T{constructor(t){this.name=t,this.field="_"+t,this.callback=t+"Changed"}getValue(t){return void 0!==x&&x.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),N(t).notify(this.name)}}}const k=Object.freeze({setArrayObserverFactory(t){O=t},getNotifier(t){let e=t.$fastController||w.get(t);return void 0===e&&(Array.isArray(t)?e=O(t):w.set(t,e=new y(t))),e},track(t,e){void 0!==x&&x.watch(t,e)},trackVolatile(){void 0!==x&&(x.needsRefresh=!0)},notify(t,e){N(t).notify(e)},defineProperty(t,e){"string"==typeof e&&(e=new T(e)),this.getAccessors(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get:function(){return e.getValue(this)},set:function(t){e.setValue(this,t)}})},getAccessors(t){let e=S.get(t);if(void 0===e){let i=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==i;)e=S.get(i),i=Reflect.getPrototypeOf(i);e=void 0===e?[]:e.slice(0),S.set(t,e)}return e},binding(t,e,i=this.isVolatileBinding(t)){return new j(t,e,i)},isVolatileBinding:t=>C.test(t.toString())}),N=k.getNotifier,B=k.trackVolatile,A=f.queueUpdate;function $(t,e){k.defineProperty(t,e)}function R(t,e,i){return Object.assign({},i,{get:function(){return B(),i.get.apply(this)}})}let V=null;function E(t){V=t}class P{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}get event(){return V}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}}k.defineProperty(P.prototype,"index"),k.defineProperty(P.prototype,"length");const F=Object.seal(new P);class j extends b{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=x;x=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const s=this.binding(t,e);return x=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=N(t),n=null===i?this.first:{};if(n.propertySource=t,n.propertyName=e,n.notifier=s,s.subscribe(this,e),null!==i){if(!this.needsRefresh){let e;x=void 0,e=i.propertySource[i.propertyName],x=this,t===e&&(this.needsRefresh=!0)}i.next=n}this.last=n}handleChange(){this.needsQueue&&(this.needsQueue=!1,A(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}}}}class z{constructor(){this.targetIndex=0}}class M extends z{constructor(){super(...arguments),this.createPlaceholder=f.createInterpolationPlaceholder}}class I extends z{constructor(t,e,i){super(),this.name=t,this.behavior=e,this.options=i}createPlaceholder(t){return f.createCustomAttributePlaceholder(this.name,t)}createBehavior(t){return new this.behavior(t,this.options)}}function _(t,e){this.source=t,this.context=e,null===this.bindingObserver&&(this.bindingObserver=k.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(t,e))}function L(t,e){this.source=t,this.context=e,this.target.addEventListener(this.targetName,this)}function q(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function H(){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 D(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function Q(t){f.setAttribute(this.target,this.targetName,t)}function U(t){f.setBooleanAttribute(this.target,this.targetName,t)}function W(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 K(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 G extends M{constructor(t){super(),this.binding=t,this.bind=_,this.unbind=q,this.updateTarget=Q,this.isBindingVolatile=k.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=K,"innerHTML"===this.cleanedTargetName){const t=this.binding;this.binding=(e,i)=>f.createHTML(t(e,i))}break;case"?":this.cleanedTargetName=t.substr(1),this.updateTarget=U;break;case"@":this.cleanedTargetName=t.substr(1),this.bind=L,this.unbind=D;break;default:this.cleanedTargetName=t,"class"===t&&(this.updateTarget=J)}}targetAtContent(){this.updateTarget=W,this.unbind=H}createBehavior(t){return new X(t,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class X{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){E(t);const e=this.binding(this.source,this.context);E(null),!0!==e&&t.preventDefault()}}let Y=null;class Z{addFactory(t){t.targetIndex=this.targetIndex,this.behaviorFactories.push(t)}captureContentBinding(t){t.targetAtContent(),this.addFactory(t)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){Y=this}static borrow(t){const e=Y||new Z;return e.directives=t,e.reset(),Y=null,e}}function tt(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 G((t,e)=>{let n="";for(let r=0;r<i;++r)n+=s[r](t,e);return n});return n.targetName=e,n}const et=d.length;function it(t,e){const i=e.split(u);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(d);let o;if(-1===r)o=n;else{const e=parseInt(n.substring(0,r));s.push(t.directives[e]),o=n.substring(r+et)}""!==o&&s.push(o)}return s}function st(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=it(t,l);let h=null;null===a?i&&(h=new G(()=>l),h.targetName=o.name):h=tt(a),null!==h&&(e.removeAttributeNode(o),n--,r--,t.addFactory(h))}}function nt(t,e,i){const s=it(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 rt(t,e){const i=t.content;document.adoptNode(i);const s=Z.borrow(e);st(s,t,!0);const n=s.behaviorFactories;s.reset();const r=f.createTemplateWalker(i);let o;for(;o=r.nextNode();)switch(s.targetIndex++,o.nodeType){case 1:st(s,o);break;case 3:nt(s,o,r);break;case 8:f.isMarker(o)&&s.addFactory(e[f.extractDirectiveIndexFromMarker(o)])}let l=0;(f.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 ot=document.createRange();class lt{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){ot.setStartBefore(t[0].firstChild),ot.setEndAfter(t[t.length-1].lastChild),ot.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 at{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=f.createHTML(e);const i=t.content.firstElementChild;null!==i&&"TEMPLATE"===i.tagName&&(t=i)}else t=e;const i=rt(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=f.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 lt(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,F),s.appendTo(e),s}}const ht=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function ct(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 at){const t=o;o=()=>t}if("function"==typeof o&&(o=new G(o)),o instanceof M){const t=ht.exec(r);null!==t&&(o.targetName=t[2])}o instanceof z?(s+=o.createPlaceholder(i.length),i.push(o)):s+=o}return s+=t[t.length-1],new at(s,i)}class ut{constructor(){this.targets=new WeakSet,this.behaviors=null}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 dt(t){return t.map(t=>t instanceof ut?dt(t.styles):[t]).reduce((t,e)=>t.concat(e),[])}function ft(t){return t.map(t=>t instanceof ut?t.behaviors:null).reduce((t,e)=>null===e?t:(null===t&&(t=[]),t.concat(e)),null)}ut.create=(()=>{if(f.supportsAdoptedStyleSheets){const t=new Map;return e=>new pt(e,t)}return t=>new vt(t)})();class pt extends ut{constructor(t,e){super(),this.styles=t,this.styleSheetCache=e,this._styleSheets=void 0,this.behaviors=ft(t)}get styleSheets(){if(void 0===this._styleSheets){const t=this.styles,e=this.styleSheetCache;this._styleSheets=dt(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 gt=0;class vt extends ut{constructor(t){super(),this.styles=t,this.behaviors=null,this.behaviors=ft(t),this.styleSheets=dt(t),this.styleClass="fast-style-class-"+ ++gt}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 mt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t},bt={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 yt{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=mt)}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 k.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||f.queueUpdate(()=>{i.add(t);const s=t[this.fieldName];switch(e){case"reflect":const e=this.converter;f.setAttribute(t,this.attribute,void 0!==e?e.toView(s):s);break;case"boolean":f.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 yt(t,s)):i.push(new yt(t,s.property,s.attribute,s.mode,s.converter))}}return i}}function Ct(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 wt={mode:"open"},St={},xt=new Map;class Ot{constructor(t,e=t.definition){"string"==typeof e&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const i=yt.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?wt:null===e.shadowOptions?void 0:Object.assign(Object.assign({},wt),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?St:Object.assign(Object.assign({},St),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?ut.create(e.styles):e.styles instanceof ut?e.styles:ut.create([e.styles])}define(t=customElements){const e=this.type;if(!this.isDefined){const t=this.attributes,i=e.prototype;for(let e=0,s=t.length;e<s;++e)k.defineProperty(i,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0}),xt.set(e,this),this.isDefined=!0}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}static forType(t){return xt.get(t)}}const Tt=new WeakMap,kt={bubbles:!0,composed:!0,cancelable:!0};function Nt(t){return t.shadowRoot||Tt.get(t)||null}class Bt extends y{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&&Tt.set(t,e)}const s=k.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 k.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,k.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=Nt(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=Nt(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,F)}}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,F);const e=this.behaviors;if(null!==e)for(const[i]of e)i.bind(t,F);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},kt),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=Nt(e)||e;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||f.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=Ot.forType(t.constructor);if(void 0===i)throw new Error("Missing FASTElement definition.");return t.$fastController=new Bt(t,i)}}function At(t){return class extends t{constructor(){super(),Bt.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 $t=Object.assign(At(HTMLElement),{from:t=>At(t),define:(t,e)=>new Ot(t,e).define().type});function Rt(t){return function(e){new Ot(e,t).define()}}class Vt{createCSS(){return""}createBehavior(){}}function Et(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 Vt){const t=o.createBehavior();o=o.createCSS(),t&&n.push(t)}o instanceof ut||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 Pt(t,...e){const{styles:i,behaviors:s}=Et(t,e),n=ut.create(i);return s.length&&n.withBehaviors(...s),n}class Ft extends Vt{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=ut.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 jt(t,...e){const{styles:i,behaviors:s}=Et(t,e);return new Ft(i,s)}function zt(t,e,i){return{index:t,removed:e,addedCount:i}}function Mt(t,e,s,n,r,o){let l=0,a=0;const h=Math.min(s-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,n,h)),s===t.length&&o===n.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,n,h-l)),r+=l,o-=a,(s-=a)-(e+=l)==0&&o-r==0)return i;if(e===s){const t=zt(e,[],0);for(;r<o;)t.removed.push(n[r++]);return[t]}if(r===o)return[zt(e,[],s-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,s,n,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=zt(f,[],0)),d.addedCount++,f++,d.removed.push(n[p]),p++;break;case 2:void 0===d&&(d=zt(f,[],0)),d.addedCount++,f++;break;case 3:void 0===d&&(d=zt(f,[],0)),d.removed.push(n[p]),p++}return void 0!==d&&u.push(d),u}const It=Array.prototype.push;function _t(t,e,i,s){const n=zt(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);It.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);It.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 Lt(t,e){let i=[];const s=function(t){const e=[];for(let i=0,s=t.length;i<s;i++){const s=t[i];_t(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(Mt(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 qt=!1;function Ht(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 Dt extends b{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,t.$fastController=this}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.needsQueue&&(this.needsQueue=!1,f.queueUpdate(this))}reset(t){this.oldCollection=t,this.needsQueue&&(this.needsQueue=!1,f.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?Lt(this.source,t):Mt(this.source,0,this.source.length,e,0,e.length);this.notify(i)}}function Qt(){if(qt)return;qt=!0,k.setArrayObserverFactory(t=>new Dt(t));const t=Array.prototype,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(zt(this.length,[i],0)),i},t.push=function(){const t=i.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(Ht(zt(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(zt(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(Ht(zt(+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(Ht(zt(0,[],arguments.length),this)),t}}class Ut{constructor(t,e){this.target=t,this.propertyName=e}bind(t){t[this.propertyName]=this.target}unbind(){}}function Wt(t){return new I("fast-ref",Ut,t)}function Kt(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});function Gt(t,e,i,s){t.bind(e[i],s)}function Xt(t,e,i,s){const n=Object.create(s);n.index=i,n.length=e.length,t.bind(e[i],n)}class Yt{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=Gt,this.itemsBindingObserver=k.binding(e,this,i),this.templateBindingObserver=k.binding(s,this,n),r.positioning&&(this.bindView=Xt)}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=i);const e=this.itemsObserver,s=this.itemsObserver=k.getNotifier(this.items),n=e!==s;n&&null!==e&&e.unsubscribe(this),(n||t)&&s.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=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)&&(lt.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 Zt extends z{constructor(t,e,i){super(),this.itemsBinding=t,this.templateBinding=e,this.options=i,this.createPlaceholder=f.createBlockPlaceholder,Qt(),this.isItemsBindingVolatile=k.isVolatileBinding(t),this.isTemplateBindingVolatile=k.isVolatileBinding(e)}createBehavior(t){return new Yt(t,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function te(t,e,i=Jt){return new Zt(t,"function"==typeof e?e:()=>e,i)}function ee(t){return t?function(e,i,s){return 1===e.nodeType&&e.matches(t)}:function(t,e,i){return 1===t.nodeType}}class ie{constructor(t,e){this.target=t,this.options=e,this.source=null}bind(t){const e=this.options.property;this.shouldUpdate=k.getAccessors(t).some(t=>t.name===e),this.source=t,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(i),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 se extends ie{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 ne(t){return"string"==typeof t&&(t={property:t}),new I("fast-slotted",se,t)}class re extends ie{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 oe(t){return"string"==typeof t&&(t={property:t}),new I("fast-children",re,t)}class le{constructor(t){this.path=t}}const ae=new Set,he=Object.freeze({register(t){ae.add(t)},unregister(t){ae.delete(t)}}),ce=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ue=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:_e.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&&ce.test(t)?location.href=t:(history.pushState({},document.title,t),e&&ue.path.trigger(t))},replace(t,e=!0){t&&ce.test(t)?location.href=t:(history.replaceState({},document.title,t),e&&ue.path.trigger(t))},trigger(t){const e=new le(t);for(const t of ae)t.enqueue(e)}}),name:Object.freeze({generateRoute(e,i,s={}){return t(this,void 0,void 0,(function*(){let t="config"in e?e:_e.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 ue.name.generateRoute(e,i,s);null!==t&&ue.path.push(t,n)}))},replace(e,i,s={},n=!0){return t(this,void 0,void 0,(function*(){const t=yield ue.name.generateRoute(e,i,s);null!==t&&ue.path.replace(t,n)}))},trigger(e,i,s={}){return t(this,void 0,void 0,(function*(){const t=yield ue.name.generateRoute(e,i,s);null!==t&&ue.path.trigger(t)}))}})});class de{constructor(){this.queue=[],this.promise=null,this.resolve=null}connect(){this.enqueue(new le(ue.path.current)),window.addEventListener("popstate",this),he.register(this)}disconnect(){this.queue=[],this.promise=null,this.resolve=null,window.removeEventListener("popstate",this),he.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 le(ue.path.current))}}const fe=encodeURIComponent,pe=t=>fe(t).replace("%24","$");function ge(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(`${pe(t)}=${fe(e[n])}`);else{let i=t+"["+("object"==typeof e[n]&&null!==e[n]?n:"")+"]";s=s.concat(ge(i,e[n]))}else if("object"!=typeof e||i)s.push(`${pe(t)}=${fe(e)}`);else for(let i in e)s=s.concat(ge(t+"["+i+"]",e[i]));return s}function ve(t,e){return Array.isArray(t)?(t.push(e),t):void 0!==t?[t,e]:e}function me(t,e,i){let s=t;const n=e.length-1;for(let t=0;t<=n;t++){let r=""===e[t]?s.length:e[t];if(t<n){let 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 be=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++){let r=s[n];i=i.concat(ge(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++){let 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){let t=i[1]?decodeURIComponent(i[1]):"";o?me(e,r,t):e[n]=ve(e[n],t)}else e[n]=!0}return e}}),ye=t=>t;class Ce{constructor(t,e,i){this.path=t,this.name=e,this.caseSensitive=i}}class we{constructor(t,e,i,s){this.route=t,this.paramNames=e,this.paramTypes=i,this.settings=s}get path(){return this.route.path}}class Se{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 xe{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 xe(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 Oe(t){return null!==t.head.endpoint}function Te(t,e){return t.compareTo(e)}class ke{constructor(t){this.candidates=[],this.candidates=[new xe([""],[t],[],this)]}get isEmpty(){return 0===this.candidates.length}getSolution(){const t=this.candidates.filter(Oe);if(0===t.length)return null;for(const e of t)e.finalize();return t.sort(Te),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 Ne{constructor(){this.names=new Map,this.paths=new Map,this.rootState=new Be(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 Ce(t.path,t.name||"",!0===t.caseSensitive),n=""===i?[""]:i.split("/").filter(Ae),r=[],o=[];let l=this.rootState,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 Re(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 Ve(e);a.push(i),l=i.appendTo(l);break}default:{const e=new $e(t,s.caseSensitive);a.push(e),l=e.appendTo(l);break}}const h=new we(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=be.separate(e),s=be.parse(t.queryString);(e=decodeURI(t.path)).startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1));const n=new ke(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]]||ye,n=h[e],r=yield s(n);c[e]=r}return new Se(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 Re&&!r.optional)throw new Error(`A value is required for route parameter '${r.name}'.`)}else n+="/",n+=o}"/"!==n.charAt(0)&&(n="/"+n);for(let t in s)delete i[t];const r=be.build(i);return n+=r?"?"+r:"",n}}class Be{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 Be(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 Ae(t){return t.length>0}class $e{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 Re{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 Ve{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 Ee="fast-child-route";function Pe(t,e){return"command"in e?e.command:"redirect"in e?new Ze(e.redirect):si.fromDefinition(t,e)}const Fe=t=>{if(null==t)return!1;switch(t.toLowerCase().trim()){case"true":case"yes":case"1":return!0;default:return!1}},je={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:Fe,bool:Fe};class ze{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 Ye),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 Ze(e.redirect):si.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 Pe(i,t).createContributor(s,n)}))}}:Pe(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=be.separate(e),i=be.parse(t.queryString);return{route:new Se(new we(new Ce("*","",!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({},je),this.converters):Object.assign(Object.assign({},this.owner.parent.routes.aggregateConverters()),this.converters)}}function Me(t){const e=t.parentElement;if(e)return e;{const e=t.getRootNode();if(e.host instanceof HTMLElement)return e.host}return null}function Ie(t){let e=t;for(;e=Me(e);)if("$router"in e)return e.$router;return null}const _e=Object.freeze({getOrCreateFor(t){const e=t.$router;return void 0!==e?e:t.$router=new qe(t)},find:t=>t.$router||Ie(t),from(t){class e extends t{constructor(){super(),_e.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 Le(t){return t instanceof $t}class qe{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=Ie(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,He.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 le(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 He=Object.freeze({create:t=>Object.create(F,{router:{value:t}})}),De=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 Qe{constructor(t=null,e=null,i=!0){this.template=t,this.runBeforeCommit=i,this.styles=null==e?null:Array.isArray(e)?ut.create(e):e instanceof ut?e:ut.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){Le(t)&&(t.$fastController.template!==this.template&&(t.$fastController.template=this.template),t.$fastController.styles!==this.styles&&(t.$fastController.styles=this.styles))}}const Ue=Object.freeze({default:new Qe(ct`<slot></slot>`)});function We(t,e){return e in t}const Ke={lifecycle:!0,parameters:!0};class Je extends z{constructor(t){super(),this.options=t}createPlaceholder(t){return f.createCustomAttributePlaceholder("fast-navigation-contributor",t)}createBehavior(t){return new Ge(t,this.options)}}class Ge{constructor(t,e){this.contributor=t,this.options=e,this.router=null}bind(t,e){if(this.options.lifecycle&&(this.router=e.router||_e.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 Xe(t){return new Je(Object.assign({},Ke,t))}class Ye{createContributor(){return t(this,void 0,void 0,(function*(){return{navigate(e){return t(this,void 0,void 0,(function*(){e.cancel()}))}}}))}}class Ze{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 ue.path.replace(n)})))}))}}}))}}function ti(t){return ct`<${t} ${Xe()}></${t}>`}function ei(t){const e=document.createDocumentFragment();e.appendChild(t);const i=new lt(e,[Xe().createBehavior(t)]);return{create:()=>i}}class ii{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 si{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 ii(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=Ot.forType(t);if(i)e=ti(i.name);else if(t=yield t(),"string"==typeof t)e=ti(t);else if(t instanceof HTMLElement)e=ei(t);else{if(i=Ot.forType(t),!i)throw new Error("Invalid value for element in route config.");e=ti(i.name)}}else t instanceof HTMLElement?i.factory=e=ei(t):i.factory=e=ti(t);return e.create()}));const n=new si(e,s);return i.layout&&(i.layout instanceof at?n.layout=new Qe(i.layout):n.layout=i.layout),i.transition&&(n.transition=i.transition),i.title&&(n.title=i.title),n}}class ni{constructor(){this.handler=t=>{let{shouldHandleEvent:e,href:i}=this.getEventInfo(t);e&&(t.preventDefault(),ue.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 ri{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){let 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*(){We(e,this.name)&&(this.routes.push(i),this.routers.push(s),yield e[this.name](this),this.routes.pop(),this.routers.pop())}))}}class oi{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 ri(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 li{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 ai{onUnhandledNavigationMessage(t,e){}onNavigationBegin(t,e,i){}onPhaseBegin(t){}onPhaseEnd(t){}onNavigationEnd(t,e,i){}}class hi{constructor(){this.isConfigured=!1,this.routes=new ze(this),this.contributors=[],this.defaultLayout=Ue.default,this.defaultTransition=De.default,this.title="",this.parent=null}createNavigationQueue(){return this.construct(de)}createLinkHandler(){return this.construct(ni)}createNavigationProcess(){return new oi}createEventSink(){return this.construct(ai)}createTitleBuilder(){return this.construct(li)}createRouteRecognizer(){return this.construct(Ne)}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=>We(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 ci=class extends(_e.from($t)){};ci=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}([Rt("fast-router")],ci);export{e as $global,I as AttachedBehaviorHTMLDirective,yt as AttributeDefinition,X as BindingBehavior,Vt as CSSDirective,re as ChildrenBehavior,Ce as ConfigurableRoute,Bt as Controller,f as DOM,ni as DefaultLinkHandler,oi as DefaultNavigationProcess,de as DefaultNavigationQueue,Ne as DefaultRouteRecognizer,qe as DefaultRouter,ut as ElementStyles,we as Endpoint,P as ExecutionContext,$t as FASTElement,Ot as FASTElementDefinition,Qe as FASTElementLayout,ci as FASTRouter,G as HTMLBindingDirective,z as HTMLDirective,lt as HTMLView,Ye as Ignore,Ue as Layout,he as NavigationHandler,le as NavigationMessage,k as Observable,y as PropertyChangeNotifier,be as QueryString,Se as RecognizedRoute,Ze as Redirect,Ut as RefBehavior,si as Render,Yt as RepeatBehavior,Zt as RepeatDirective,ue as Route,ze as RouteCollection,_e as Router,hi as RouterConfiguration,He as RouterExecutionContext,se as SlottedBehavior,b as SubscriberSet,M as TargetedHTMLDirective,De as Transition,at as ViewTemplate,Ct as attr,mt as booleanConverter,Ee as childRouteParameter,oe as children,rt as compileTemplate,Pt as css,jt as cssPartial,Rt as customElement,F as defaultExecutionContext,ee as elements,i as emptyArray,Qt as enableArrayObservation,ct as html,Le as isFASTElementHost,We as isNavigationPhaseContributor,Xe as navigationContributor,bt as nullableNumberConverter,$ as observable,Wt as ref,te as repeat,E as setCurrentEvent,ne as slotted,R as volatile,Kt as when};
|
|
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=Object.freeze([]),s=[],n=e.trustedTypes.createPolicy("fast-html",{createHTML:t=>t});let r=n;const o=[];function l(){if(o.length)throw o.shift()}function a(t){try{t.call()}catch(t){o.push(t),setTimeout(l,0)}}const h="fast-"+Math.random().toString(36).substring(2,8),c=h+"{",u="}"+h,d=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(r!==n)throw new Error("The HTML policy can only be set once.");r=t},createHTML:t=>r.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(h),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(h+":","")),createInterpolationPlaceholder:t=>`${c}${t}${u}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${h}:${t}--\x3e`,queueUpdate(t){s.length<1&&window.requestAnimationFrame(d.processUpdates),s.push(t)},processUpdates(){let t=0;for(;t<s.length;)if(a(s[t]),t++,t>1024){for(let e=0,i=s.length-t;e<i;e++)s[e]=s[e+t];s.length-=t,t=0}s.length=0},nextUpdate:()=>new Promise(t=>{d.queueUpdate(t)}),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 f(t){const e=this.spillover;-1===e.indexOf(t)&&e.push(t)}function p(t){const e=this.spillover,i=e.indexOf(t);-1!==i&&e.splice(i,1)}function g(t){const e=this.spillover,i=this.source;for(let s=0,n=e.length;s<n;++s)e[s].handleChange(i,t)}function v(t){return-1!==this.spillover.indexOf(t)}class m{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=f,this.unsubscribe=p,this.notify=g,this.has=v,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 b{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 m(this.source)),i.subscribe(t)}else this.sourceSubscribers=null!==(i=this.sourceSubscribers)&&void 0!==i?i:new m(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 y=/(:|&&|\|\||if)/,C=new WeakMap,w=new WeakMap;let S=void 0,x=t=>{throw new Error("Must call enableArrayObservation before observing arrays.")};class O{constructor(t){this.name=t,this.field="_"+t,this.callback=t+"Changed"}getValue(t){return void 0!==S&&S.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),k(t).notify(this.name)}}}const T=Object.freeze({setArrayObserverFactory(t){x=t},getNotifier(t){let e=t.$fastController||C.get(t);return void 0===e&&(Array.isArray(t)?e=x(t):C.set(t,e=new b(t))),e},track(t,e){void 0!==S&&S.watch(t,e)},trackVolatile(){void 0!==S&&(S.needsRefresh=!0)},notify(t,e){k(t).notify(e)},defineProperty(t,e){"string"==typeof e&&(e=new O(e)),this.getAccessors(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get:function(){return e.getValue(this)},set:function(t){e.setValue(this,t)}})},getAccessors(t){let e=w.get(t);if(void 0===e){let i=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==i;)e=w.get(i),i=Reflect.getPrototypeOf(i);e=void 0===e?[]:e.slice(0),w.set(t,e)}return e},binding(t,e,i=this.isVolatileBinding(t)){return new F(t,e,i)},isVolatileBinding:t=>y.test(t.toString())}),k=T.getNotifier,N=T.trackVolatile,B=d.queueUpdate;function A(t,e){T.defineProperty(t,e)}function $(t,e,i){return Object.assign({},i,{get:function(){return N(),i.get.apply(this)}})}let R=null;function V(t){R=t}class E{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}get event(){return R}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}}T.defineProperty(E.prototype,"index"),T.defineProperty(E.prototype,"length");const P=Object.seal(new E);class F extends m{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=S;S=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const s=this.binding(t,e);return S=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=k(t),n=null===i?this.first:{};if(n.propertySource=t,n.propertyName=e,n.notifier=s,s.subscribe(this,e),null!==i){if(!this.needsRefresh){let e;S=void 0,e=i.propertySource[i.propertyName],S=this,t===e&&(this.needsRefresh=!0)}i.next=n}this.last=n}handleChange(){this.needsQueue&&(this.needsQueue=!1,B(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}}}}class j{constructor(){this.targetIndex=0}}class z extends j{constructor(){super(...arguments),this.createPlaceholder=d.createInterpolationPlaceholder}}class M extends j{constructor(t,e,i){super(),this.name=t,this.behavior=e,this.options=i}createPlaceholder(t){return d.createCustomAttributePlaceholder(this.name,t)}createBehavior(t){return new this.behavior(t,this.options)}}function I(t,e){this.source=t,this.context=e,null===this.bindingObserver&&(this.bindingObserver=T.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(t,e))}function _(t,e){this.source=t,this.context=e,this.target.addEventListener(this.targetName,this)}function L(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function q(){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 H(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function D(t){d.setAttribute(this.target,this.targetName,t)}function Q(t){d.setBooleanAttribute(this.target,this.targetName,t)}function U(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 W(t){this.target[this.targetName]=t}function K(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 J extends z{constructor(t){super(),this.binding=t,this.bind=I,this.unbind=L,this.updateTarget=D,this.isBindingVolatile=T.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=W,"innerHTML"===this.cleanedTargetName){const t=this.binding;this.binding=(e,i)=>d.createHTML(t(e,i))}break;case"?":this.cleanedTargetName=t.substr(1),this.updateTarget=Q;break;case"@":this.cleanedTargetName=t.substr(1),this.bind=_,this.unbind=H;break;default:this.cleanedTargetName=t,"class"===t&&(this.updateTarget=K)}}targetAtContent(){this.updateTarget=U,this.unbind=q}createBehavior(t){return new G(t,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class G{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){V(t);const e=this.binding(this.source,this.context);V(null),!0!==e&&t.preventDefault()}}let X=null;class Y{addFactory(t){t.targetIndex=this.targetIndex,this.behaviorFactories.push(t)}captureContentBinding(t){t.targetAtContent(),this.addFactory(t)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){X=this}static borrow(t){const e=X||new Y;return e.directives=t,e.reset(),X=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 J((t,e)=>{let n="";for(let r=0;r<i;++r)n+=s[r](t,e);return n});return n.targetName=e,n}const tt=u.length;function et(t,e){const i=e.split(c);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(u);let o;if(-1===r)o=n;else{const e=parseInt(n.substring(0,r));s.push(t.directives[e]),o=n.substring(r+tt)}""!==o&&s.push(o)}return s}function it(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=et(t,l);let h=null;null===a?i&&(h=new J(()=>l),h.targetName=o.name):h=Z(a),null!==h&&(e.removeAttributeNode(o),n--,r--,t.addFactory(h))}}function st(t,e,i){const s=et(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 nt(t,e){const i=t.content;document.adoptNode(i);const s=Y.borrow(e);it(s,t,!0);const n=s.behaviorFactories;s.reset();const r=d.createTemplateWalker(i);let o;for(;o=r.nextNode();)switch(s.targetIndex++,o.nodeType){case 1:it(s,o);break;case 3:st(s,o,r);break;case 8:d.isMarker(o)&&s.addFactory(e[d.extractDirectiveIndexFromMarker(o)])}let l=0;(d.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 rt=document.createRange();class ot{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){rt.setStartBefore(t[0].firstChild),rt.setEndAfter(t[t.length-1].lastChild),rt.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 lt{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=d.createHTML(e);const i=t.content.firstElementChild;null!==i&&"TEMPLATE"===i.tagName&&(t=i)}else t=e;const i=nt(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=d.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 ot(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,P),s.appendTo(e),s}}const at=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function ht(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 lt){const t=o;o=()=>t}if("function"==typeof o&&(o=new J(o)),o instanceof z){const t=at.exec(r);null!==t&&(o.targetName=t[2])}o instanceof j?(s+=o.createPlaceholder(i.length),i.push(o)):s+=o}return s+=t[t.length-1],new lt(s,i)}class ct{constructor(){this.targets=new WeakSet,this.behaviors=null}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 ut(t){return t.map(t=>t instanceof ct?ut(t.styles):[t]).reduce((t,e)=>t.concat(e),[])}function dt(t){return t.map(t=>t instanceof ct?t.behaviors:null).reduce((t,e)=>null===e?t:(null===t&&(t=[]),t.concat(e)),null)}ct.create=(()=>{if(d.supportsAdoptedStyleSheets){const t=new Map;return e=>new ft(e,t)}return t=>new gt(t)})();class ft extends ct{constructor(t,e){super(),this.styles=t,this.styleSheetCache=e,this._styleSheets=void 0,this.behaviors=dt(t)}get styleSheets(){if(void 0===this._styleSheets){const t=this.styles,e=this.styleSheetCache;this._styleSheets=ut(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 pt=0;class gt extends ct{constructor(t){super(),this.styles=t,this.behaviors=null,this.behaviors=dt(t),this.styleSheets=ut(t),this.styleClass="fast-style-class-"+ ++pt}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 vt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t},mt={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 bt{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=vt)}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 T.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||d.queueUpdate(()=>{i.add(t);const s=t[this.fieldName];switch(e){case"reflect":const e=this.converter;d.setAttribute(t,this.attribute,void 0!==e?e.toView(s):s);break;case"boolean":d.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 bt(t,s)):i.push(new bt(t,s.property,s.attribute,s.mode,s.converter))}}return i}}function yt(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 Ct={mode:"open"},wt={},St=new Map;class xt{constructor(t,e=t.definition){"string"==typeof e&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const i=bt.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?Ct:null===e.shadowOptions?void 0:Object.assign(Object.assign({},Ct),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?wt:Object.assign(Object.assign({},wt),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?ct.create(e.styles):e.styles instanceof ct?e.styles:ct.create([e.styles])}define(t=customElements){const e=this.type;if(!this.isDefined){const t=this.attributes,i=e.prototype;for(let e=0,s=t.length;e<s;++e)T.defineProperty(i,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0}),St.set(e,this),this.isDefined=!0}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}static forType(t){return St.get(t)}}const Ot=new WeakMap,Tt={bubbles:!0,composed:!0,cancelable:!0};function kt(t){return t.shadowRoot||Ot.get(t)||null}class Nt extends b{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&&Ot.set(t,e)}const s=T.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 T.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,T.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=kt(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=kt(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,P)}}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,P);const e=this.behaviors;if(null!==e)for(const[i]of e)i.bind(t,P);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},Tt),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=kt(e)||e;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||d.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=xt.forType(t.constructor);if(void 0===i)throw new Error("Missing FASTElement definition.");return t.$fastController=new Nt(t,i)}}function Bt(t){return class extends t{constructor(){super(),Nt.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 At=Object.assign(Bt(HTMLElement),{from:t=>Bt(t),define:(t,e)=>new xt(t,e).define().type});function $t(t){return function(e){new xt(e,t).define()}}class Rt{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 Rt){const t=o.createBehavior();o=o.createCSS(),t&&n.push(t)}o instanceof ct||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 Et(t,...e){const{styles:i,behaviors:s}=Vt(t,e),n=ct.create(i);return s.length&&n.withBehaviors(...s),n}class Pt extends Rt{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=ct.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 Ft(t,...e){const{styles:i,behaviors:s}=Vt(t,e);return new Pt(i,s)}function jt(t,e,i){return{index:t,removed:e,addedCount:i}}function zt(t,e,s,n,r,o){let l=0,a=0;const h=Math.min(s-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,n,h)),s===t.length&&o===n.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,n,h-l)),r+=l,o-=a,(s-=a)-(e+=l)==0&&o-r==0)return i;if(e===s){const t=jt(e,[],0);for(;r<o;)t.removed.push(n[r++]);return[t]}if(r===o)return[jt(e,[],s-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,s,n,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=jt(f,[],0)),d.addedCount++,f++,d.removed.push(n[p]),p++;break;case 2:void 0===d&&(d=jt(f,[],0)),d.addedCount++,f++;break;case 3:void 0===d&&(d=jt(f,[],0)),d.removed.push(n[p]),p++}return void 0!==d&&u.push(d),u}const Mt=Array.prototype.push;function It(t,e,i,s){const n=jt(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);Mt.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);Mt.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 _t(t,e){let i=[];const s=function(t){const e=[];for(let i=0,s=t.length;i<s;i++){const s=t[i];It(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(zt(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 Lt=!1;function qt(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 Ht extends m{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,t.$fastController=this}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.needsQueue&&(this.needsQueue=!1,d.queueUpdate(this))}reset(t){this.oldCollection=t,this.needsQueue&&(this.needsQueue=!1,d.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?_t(this.source,t):zt(this.source,0,this.source.length,e,0,e.length);this.notify(i)}}function Dt(){if(Lt)return;Lt=!0,T.setArrayObserverFactory(t=>new Ht(t));const t=Array.prototype,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(jt(this.length,[i],0)),i},t.push=function(){const t=i.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(qt(jt(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(jt(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(qt(jt(+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(qt(jt(0,[],arguments.length),this)),t}}class Qt{constructor(t,e){this.target=t,this.propertyName=e}bind(t){t[this.propertyName]=this.target}unbind(){}}function Ut(t){return new M("fast-ref",Qt,t)}function Wt(t,e){const i="function"==typeof e?e:()=>e;return(e,s)=>t(e,s)?i(e,s):null}const Kt=Object.freeze({positioning:!1,recycle:!0});function Jt(t,e,i,s){t.bind(e[i],s)}function Gt(t,e,i,s){const n=Object.create(s);n.index=i,n.length=e.length,t.bind(e[i],n)}class Xt{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=Jt,this.itemsBindingObserver=T.binding(e,this,i),this.templateBindingObserver=T.binding(s,this,n),r.positioning&&(this.bindView=Gt)}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=i);const e=this.itemsObserver,s=this.itemsObserver=T.getNotifier(this.items),n=e!==s;n&&null!==e&&e.unsubscribe(this),(n||t)&&s.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)&&(ot.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 Yt extends j{constructor(t,e,i){super(),this.itemsBinding=t,this.templateBinding=e,this.options=i,this.createPlaceholder=d.createBlockPlaceholder,Dt(),this.isItemsBindingVolatile=T.isVolatileBinding(t),this.isTemplateBindingVolatile=T.isVolatileBinding(e)}createBehavior(t){return new Xt(t,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Zt(t,e,i=Kt){return new Yt(t,"function"==typeof e?e:()=>e,i)}function te(t){return t?function(e,i,s){return 1===e.nodeType&&e.matches(t)}:function(t,e,i){return 1===t.nodeType}}class ee{constructor(t,e){this.target=t,this.options=e,this.source=null}bind(t){const e=this.options.property;this.shouldUpdate=T.getAccessors(t).some(t=>t.name===e),this.source=t,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(i),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 ie extends ee{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 se(t){return"string"==typeof t&&(t={property:t}),new M("fast-slotted",ie,t)}class ne extends ee{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 re(t){return"string"==typeof t&&(t={property:t}),new M("fast-children",ne,t)}class oe{constructor(t){this.path=t}}const le=new Set,ae=Object.freeze({register(t){le.add(t)},unregister(t){le.delete(t)}}),he=/^([a-z][a-z0-9+\-.]*:)?\/\//i,ce=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:Ie.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&&he.test(t)?location.href=t:(history.pushState({},document.title,t),e&&ce.path.trigger(t))},replace(t,e=!0){t&&he.test(t)?location.href=t:(history.replaceState({},document.title,t),e&&ce.path.trigger(t))},trigger(t){const e=new oe(t);for(const t of le)t.enqueue(e)}}),name:Object.freeze({generateRoute(e,i,s={}){return t(this,void 0,void 0,(function*(){let t="config"in e?e:Ie.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 ce.name.generateRoute(e,i,s);null!==t&&ce.path.push(t,n)}))},replace(e,i,s={},n=!0){return t(this,void 0,void 0,(function*(){const t=yield ce.name.generateRoute(e,i,s);null!==t&&ce.path.replace(t,n)}))},trigger(e,i,s={}){return t(this,void 0,void 0,(function*(){const t=yield ce.name.generateRoute(e,i,s);null!==t&&ce.path.trigger(t)}))}})});class ue{constructor(){this.queue=[],this.promise=null,this.resolve=null}connect(){this.enqueue(new oe(ce.path.current)),window.addEventListener("popstate",this),ae.register(this)}disconnect(){this.queue=[],this.promise=null,this.resolve=null,window.removeEventListener("popstate",this),ae.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 oe(ce.path.current))}}const de=encodeURIComponent,fe=t=>de(t).replace("%24","$");function pe(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(`${fe(t)}=${de(e[n])}`);else{const i=t+"["+("object"==typeof e[n]&&null!==e[n]?n:"")+"]";s=s.concat(pe(i,e[n]))}else if("object"!=typeof e||i)s.push(`${fe(t)}=${de(e)}`);else for(const i in e)s=s.concat(pe(t+"["+i+"]",e[i]));return s}function ge(t,e){return Array.isArray(t)?(t.push(e),t):void 0!==t?[t,e]:e}function ve(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 me=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(pe(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?ve(e,r,t):e[n]=ge(e[n],t)}else e[n]=!0}return e}}),be=t=>t;class ye{constructor(t,e,i){this.path=t,this.name=e,this.caseSensitive=i}}class Ce{constructor(t,e,i,s){this.route=t,this.paramNames=e,this.paramTypes=i,this.settings=s}get path(){return this.route.path}}class we{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 Se{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 Se(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 xe(t){return null!==t.head.endpoint}function Oe(t,e){return t.compareTo(e)}class Te{constructor(t){this.candidates=[],this.candidates=[new Se([""],[t],[],this)]}get isEmpty(){return 0===this.candidates.length}getSolution(){const t=this.candidates.filter(xe);if(0===t.length)return null;for(const e of t)e.finalize();return t.sort(Oe),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 ke{constructor(){this.names=new Map,this.paths=new Map,this.rootState=new Ne(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 ye(t.path,t.name||"",!0===t.caseSensitive),n=""===i?[""]:i.split("/").filter(Be),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 $e(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 Re(e);a.push(i),l=i.appendTo(l);break}default:{const e=new Ae(t,s.caseSensitive);a.push(e),l=e.appendTo(l);break}}const h=new Ce(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=me.separate(e),s=me.parse(t.queryString);(e=decodeURI(t.path)).startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1));const n=new Te(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]]||be,n=h[e],r=yield s(n);c[e]=r}return new we(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 $e&&!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=me.build(i);return n+=r?"?"+r:"",n}}class Ne{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 Ne(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 Be(t){return t.length>0}class Ae{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 $e{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 Re{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 Ee(t,e){return"command"in e?e.command:"redirect"in e?new Ye(e.redirect):ii.fromDefinition(t,e)}const Pe=t=>{if(null==t)return!1;switch(t.toLowerCase().trim()){case"true":case"yes":case"1":return!0;default:return!1}},Fe={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:Pe,bool:Pe};class je{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 Xe),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 Ye(e.redirect):ii.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 Ee(i,t).createContributor(s,n)}))}}:Ee(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=me.separate(e),i=me.parse(t.queryString);return{route:new we(new Ce(new ye("*","",!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({},Fe),this.converters):Object.assign(Object.assign({},this.owner.parent.routes.aggregateConverters()),this.converters)}}function ze(t){const e=t.parentElement;if(e)return e;{const e=t.getRootNode();if(e.host instanceof HTMLElement)return e.host}return null}function Me(t){let e=t;for(;e=ze(e);)if("$router"in e)return e.$router;return null}const Ie=Object.freeze({getOrCreateFor(t){const e=t.$router;return void 0!==e?e:t.$router=new Le(t)},find:t=>t.$router||Me(t),from(t){class e extends t{constructor(){super(),Ie.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 _e(t){return t instanceof At}class Le{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=Me(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,qe.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 oe(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 qe=Object.freeze({create:t=>Object.create(P,{router:{value:t}})}),He=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 De{constructor(t=null,e=null,i=!0){this.template=t,this.runBeforeCommit=i,this.styles=null==e?null:Array.isArray(e)?ct.create(e):e instanceof ct?e:ct.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){_e(t)&&(t.$fastController.template!==this.template&&(t.$fastController.template=this.template),t.$fastController.styles!==this.styles&&(t.$fastController.styles=this.styles))}}const Qe=Object.freeze({default:new De(ht`<slot></slot>`)});function Ue(t,e){return e in t}const We={lifecycle:!0,parameters:!0};class Ke extends j{constructor(t){super(),this.options=t}createPlaceholder(t){return d.createCustomAttributePlaceholder("fast-navigation-contributor",t)}createBehavior(t){return new Je(t,this.options)}}class Je{constructor(t,e){this.contributor=t,this.options=e,this.router=null}bind(t,e){if(this.options.lifecycle&&(this.router=e.router||Ie.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 Ge(t){return new Ke(Object.assign({},We,t))}class Xe{createContributor(){return t(this,void 0,void 0,(function*(){return{navigate(e){return t(this,void 0,void 0,(function*(){e.cancel()}))}}}))}}class Ye{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 ce.path.replace(n)})))}))}}}))}}function Ze(t){return ht`<${t} ${Ge()}></${t}>`}function ti(t){const e=document.createDocumentFragment();e.appendChild(t);const i=new ot(e,[Ge().createBehavior(t)]);return{create:()=>i}}class ei{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 ii{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 ei(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=xt.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=ti(t);else{if(i=xt.forType(t),!i)throw new Error("Invalid value for element in route config.");e=Ze(i.name)}}else t instanceof HTMLElement?i.factory=e=ti(t):i.factory=e=Ze(t);return e.create()}));const n=new ii(e,s);return i.layout&&(i.layout instanceof lt?n.layout=new De(i.layout):n.layout=i.layout),i.transition&&(n.transition=i.transition),i.title&&(n.title=i.title),n}}class si{constructor(){this.handler=t=>{const{shouldHandleEvent:e,href:i}=this.getEventInfo(t);e&&(t.preventDefault(),ce.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 ni{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*(){Ue(e,this.name)&&(this.routes.push(i),this.routers.push(s),yield e[this.name](this),this.routes.pop(),this.routers.pop())}))}}class ri{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 ni(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 oi{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 li{onUnhandledNavigationMessage(t,e){}onNavigationBegin(t,e,i){}onPhaseBegin(t){}onPhaseEnd(t){}onNavigationEnd(t,e,i){}}class ai{constructor(){this.isConfigured=!1,this.routes=new je(this),this.contributors=[],this.defaultLayout=Qe.default,this.defaultTransition=He.default,this.title="",this.parent=null}createNavigationQueue(){return this.construct(ue)}createLinkHandler(){return this.construct(si)}createNavigationProcess(){return new ri}createEventSink(){return this.construct(li)}createTitleBuilder(){return this.construct(oi)}createRouteRecognizer(){return this.construct(ke)}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=>Ue(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 hi=class extends(Ie.from(At)){};hi=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}([$t("fast-router")],hi);export{e as $global,M as AttachedBehaviorHTMLDirective,bt as AttributeDefinition,G as BindingBehavior,Rt as CSSDirective,ne as ChildrenBehavior,ye as ConfigurableRoute,Nt as Controller,d as DOM,si as DefaultLinkHandler,ri as DefaultNavigationProcess,ue as DefaultNavigationQueue,ke as DefaultRouteRecognizer,Le as DefaultRouter,ct as ElementStyles,Ce as Endpoint,E as ExecutionContext,At as FASTElement,xt as FASTElementDefinition,De as FASTElementLayout,hi as FASTRouter,J as HTMLBindingDirective,j as HTMLDirective,ot as HTMLView,Xe as Ignore,Qe as Layout,ae as NavigationHandler,oe as NavigationMessage,T as Observable,b as PropertyChangeNotifier,me as QueryString,we as RecognizedRoute,Ye as Redirect,Qt as RefBehavior,ii as Render,Xt as RepeatBehavior,Yt as RepeatDirective,ce as Route,je as RouteCollection,Ie as Router,ai as RouterConfiguration,qe as RouterExecutionContext,ie as SlottedBehavior,m as SubscriberSet,z as TargetedHTMLDirective,He as Transition,lt as ViewTemplate,yt as attr,vt as booleanConverter,Ve as childRouteParameter,re as children,nt as compileTemplate,Et as css,Ft as cssPartial,$t as customElement,P as defaultExecutionContext,te as elements,i as emptyArray,Dt as enableArrayObservation,ht as html,_e as isFASTElementHost,Ue as isNavigationPhaseContributor,Ge as navigationContributor,mt as nullableNumberConverter,A as observable,Ut as ref,Zt as repeat,V as setCurrentEvent,se as slotted,$ as volatile,Wt as when};
|
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.2.
|
|
5
|
+
"version": "0.2.12",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Microsoft",
|
|
8
8
|
"url": "https://discord.gg/FcSNfg4"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"prettier": "2.0.2",
|
|
70
70
|
"rollup": "^2.7.6",
|
|
71
71
|
"rollup-plugin-commonjs": "^10.1.0",
|
|
72
|
-
"rollup-plugin-filesize": "^
|
|
72
|
+
"rollup-plugin-filesize": "^9.1.2",
|
|
73
73
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
74
74
|
"rollup-plugin-terser": "^5.3.0",
|
|
75
75
|
"rollup-plugin-transform-tagged-template": "^0.0.3",
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
"webpack": "^4.44.0"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@microsoft/fast-element": "^1.
|
|
86
|
+
"@microsoft/fast-element": "^1.7.0"
|
|
87
87
|
}
|
|
88
88
|
}
|