@mantou/gem 1.7.11 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/dist/gem.es.js +1962 -1689
  4. package/dist/gem.umd.js +52 -54
  5. package/elements/base/dialog.d.ts +0 -11
  6. package/elements/base/dialog.d.ts.map +1 -1
  7. package/elements/base/dialog.js +93 -66
  8. package/elements/base/dialog.js.map +1 -1
  9. package/elements/base/gesture.d.ts +1 -2
  10. package/elements/base/gesture.d.ts.map +1 -1
  11. package/elements/base/gesture.js +157 -96
  12. package/elements/base/gesture.js.map +1 -1
  13. package/elements/base/link.d.ts +5 -5
  14. package/elements/base/link.d.ts.map +1 -1
  15. package/elements/base/link.js +249 -145
  16. package/elements/base/link.js.map +1 -1
  17. package/elements/base/modal-factory.d.ts +147 -139
  18. package/elements/base/modal-factory.d.ts.map +1 -1
  19. package/elements/base/modal-factory.js +84 -25
  20. package/elements/base/modal-factory.js.map +1 -1
  21. package/elements/base/reflect.d.ts +0 -1
  22. package/elements/base/reflect.d.ts.map +1 -1
  23. package/elements/base/reflect.js +83 -38
  24. package/elements/base/reflect.js.map +1 -1
  25. package/elements/base/route.d.ts +12 -24
  26. package/elements/base/route.d.ts.map +1 -1
  27. package/elements/base/route.js +263 -164
  28. package/elements/base/route.js.map +1 -1
  29. package/elements/base/title.d.ts +3 -11
  30. package/elements/base/title.d.ts.map +1 -1
  31. package/elements/base/title.js +110 -59
  32. package/elements/base/title.js.map +1 -1
  33. package/elements/base/unsafe.d.ts +0 -1
  34. package/elements/base/unsafe.d.ts.map +1 -1
  35. package/elements/base/unsafe.js +82 -33
  36. package/elements/base/unsafe.js.map +1 -1
  37. package/elements/base/use.d.ts.map +1 -1
  38. package/elements/base/use.js +95 -47
  39. package/elements/base/use.js.map +1 -1
  40. package/helper/i18n.d.ts +4 -9
  41. package/helper/i18n.d.ts.map +1 -1
  42. package/helper/i18n.js +69 -65
  43. package/helper/i18n.js.map +1 -1
  44. package/helper/logger.js +10 -9
  45. package/helper/logger.js.map +1 -1
  46. package/helper/react-shim.d.ts +15 -0
  47. package/helper/react-shim.d.ts.map +1 -0
  48. package/helper/react-shim.js +56 -0
  49. package/helper/react-shim.js.map +1 -0
  50. package/helper/react-utils.d.ts +15 -0
  51. package/helper/react-utils.d.ts.map +1 -0
  52. package/helper/react-utils.js +50 -0
  53. package/helper/react-utils.js.map +1 -0
  54. package/helper/request.d.ts +17 -7
  55. package/helper/request.d.ts.map +1 -1
  56. package/helper/request.js +103 -53
  57. package/helper/request.js.map +1 -1
  58. package/helper/ssr-shim.d.ts.map +1 -1
  59. package/helper/ssr-shim.js +8 -1
  60. package/helper/ssr-shim.js.map +1 -1
  61. package/helper/theme.d.ts +14 -21
  62. package/helper/theme.d.ts.map +1 -1
  63. package/helper/theme.js +55 -38
  64. package/helper/theme.js.map +1 -1
  65. package/index.d.ts +4 -3
  66. package/index.d.ts.map +1 -1
  67. package/index.js +5 -3
  68. package/index.js.map +1 -1
  69. package/lib/decorators.d.ts +74 -41
  70. package/lib/decorators.d.ts.map +1 -1
  71. package/lib/decorators.js +324 -84
  72. package/lib/decorators.js.map +1 -1
  73. package/lib/directives.d.ts +4 -0
  74. package/lib/directives.d.ts.map +1 -0
  75. package/lib/directives.js +5 -0
  76. package/lib/directives.js.map +1 -0
  77. package/lib/element.d.ts +112 -110
  78. package/lib/element.d.ts.map +1 -1
  79. package/lib/element.js +431 -470
  80. package/lib/element.js.map +1 -1
  81. package/lib/history.d.ts +4 -0
  82. package/lib/history.d.ts.map +1 -1
  83. package/lib/history.js +12 -13
  84. package/lib/history.js.map +1 -1
  85. package/lib/store.d.ts +1 -1
  86. package/lib/store.d.ts.map +1 -1
  87. package/lib/store.js +4 -5
  88. package/lib/store.js.map +1 -1
  89. package/lib/utils.d.ts +3 -43
  90. package/lib/utils.d.ts.map +1 -1
  91. package/lib/utils.js +61 -246
  92. package/lib/utils.js.map +1 -1
  93. package/lib/version.d.ts +1 -1
  94. package/lib/version.d.ts.map +1 -1
  95. package/lib/version.js +2 -1
  96. package/lib/version.js.map +1 -1
  97. package/package.json +12 -11
  98. package/src/dist.ts +3 -2
  99. package/src/elements/base/dialog.ts +10 -20
  100. package/src/elements/base/gesture.ts +16 -14
  101. package/src/elements/base/link.ts +65 -44
  102. package/src/elements/base/modal-factory.ts +14 -14
  103. package/src/elements/base/reflect.ts +24 -32
  104. package/src/elements/base/route.ts +55 -68
  105. package/src/elements/base/title.ts +25 -42
  106. package/src/elements/base/unsafe.ts +12 -21
  107. package/src/elements/base/use.ts +17 -13
  108. package/src/helper/i18n.ts +20 -14
  109. package/src/helper/react-utils.ts +66 -0
  110. package/src/helper/request.ts +122 -53
  111. package/src/helper/ssr-shim.ts +8 -1
  112. package/src/helper/theme.ts +72 -45
  113. package/src/index.ts +6 -4
  114. package/src/lib/decorators.ts +394 -93
  115. package/src/lib/directives.ts +6 -0
  116. package/src/lib/element.ts +473 -499
  117. package/src/lib/history.ts +4 -3
  118. package/src/lib/store.ts +2 -1
  119. package/src/lib/utils.ts +19 -205
  120. package/src/lib/version.ts +2 -1
  121. package/src/test/elements/link.test.ts +1 -1
  122. package/src/test/elements/title.test.ts +1 -0
  123. package/src/test/gem-element/advance.test.ts +72 -49
  124. package/src/test/gem-element/basic.test.ts +37 -50
  125. package/src/test/gem-element/decorators.test.ts +22 -21
  126. package/src/test/gem-element/multi.test.ts +5 -5
  127. package/src/test/utils.test.ts +16 -38
package/dist/gem.es.js CHANGED
@@ -1,59 +1,77 @@
1
- var be = (n, t, e) => {
2
- if (!t.has(n))
3
- throw TypeError("Cannot " + e);
1
+ var xa = Object.defineProperty;
2
+ var wi = (e) => {
3
+ throw TypeError(e);
4
4
  };
5
- var g = (n, t, e) => (be(n, t, "read from private field"), e ? e.call(n) : t.get(n)), P = (n, t, e) => {
6
- if (t.has(n))
7
- throw TypeError("Cannot add the same private member more than once");
8
- t instanceof WeakSet ? t.add(n) : t.set(n, e);
9
- }, F = (n, t, e, s) => (be(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e);
10
- var Ce = (n, t, e) => (be(n, t, "access private method"), e);
11
- const Ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5
+ var Ta = (e, t, n) => t in e ? xa(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var T = (e, t, n) => Ta(e, typeof t != "symbol" ? t + "" : t, n), Wn = (e, t, n) => t.has(e) || wi("Cannot " + n);
7
+ var p = (e, t, n) => (Wn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), b = (e, t, n) => t.has(e) ? wi("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), x = (e, t, n, s) => (Wn(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n), zn = (e, t, n) => (Wn(e, t, "access private method"), n);
8
+ const Oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12
9
  __proto__: null,
13
- get GemElement() {
14
- return A;
10
+ get adoptedStyle() {
11
+ return Hs;
15
12
  },
16
- get SVGTemplateResult() {
17
- return Gn;
13
+ get aria() {
14
+ return An;
18
15
  },
19
- get TemplateResult() {
20
- return _e;
16
+ get async() {
17
+ return pc;
21
18
  },
22
- get defineAttribute() {
23
- return nn;
19
+ get attribute() {
20
+ return G;
24
21
  },
25
- get defineCSSState() {
26
- return rn;
22
+ get boolattribute() {
23
+ return On;
27
24
  },
28
- get defineProperty() {
29
- return Dt;
25
+ get connectStore() {
26
+ return Nn;
30
27
  },
31
- get defineRef() {
32
- return sn;
28
+ get customElement() {
29
+ return fc;
33
30
  },
34
- get directive() {
35
- return we;
31
+ get effect() {
32
+ return $t;
36
33
  },
37
- get guard() {
38
- return Ys;
34
+ get emitter() {
35
+ return ye;
39
36
  },
40
- get html() {
41
- return G;
37
+ get fallback() {
38
+ return lc;
39
+ },
40
+ get globalemitter() {
41
+ return dc;
42
+ },
43
+ get memo() {
44
+ return kr;
45
+ },
46
+ get mounted() {
47
+ return qe;
48
+ },
49
+ get numattribute() {
50
+ return ac;
51
+ },
52
+ get part() {
53
+ return Or;
42
54
  },
43
- get ifDefined() {
44
- return Qn;
55
+ get property() {
56
+ return U;
45
57
  },
46
- get nativeDefineElement() {
47
- return on;
58
+ get shadow() {
59
+ return Ht;
48
60
  },
49
- get render() {
50
- return Kn;
61
+ get slot() {
62
+ return uc;
51
63
  },
52
- get repeat() {
53
- return Js;
64
+ get state() {
65
+ return Ln;
54
66
  },
55
- get svg() {
56
- return Vs;
67
+ get template() {
68
+ return xr;
69
+ },
70
+ get unmounted() {
71
+ return cc;
72
+ },
73
+ get willMount() {
74
+ return Mn;
57
75
  }
58
76
  }, Symbol.toStringTag, { value: "Module" }));
59
77
  /**
@@ -69,10 +87,10 @@ const Ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
69
87
  * subject to an additional IP rights grant found at
70
88
  * http://polymer.github.io/PATENTS.txt
71
89
  */
72
- const Dn = /* @__PURE__ */ new WeakMap(), we = (n) => (...t) => {
73
- const e = n(...t);
74
- return Dn.set(e, !0), e;
75
- }, Wt = (n) => typeof n == "function" && Dn.has(n);
90
+ const ur = /* @__PURE__ */ new WeakMap(), Sn = (e) => (...t) => {
91
+ const n = e(...t);
92
+ return ur.set(n, !0), n;
93
+ }, Ge = (e) => typeof e == "function" && ur.has(e);
76
94
  /**
77
95
  * @license
78
96
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -86,15 +104,15 @@ const Dn = /* @__PURE__ */ new WeakMap(), we = (n) => (...t) => {
86
104
  * subject to an additional IP rights grant found at
87
105
  * http://polymer.github.io/PATENTS.txt
88
106
  */
89
- const wn = typeof window < "u" && window.customElements != null && window.customElements.polyfillWrapFlushCallback !== void 0, qn = (n, t, e = null, s = null) => {
90
- for (; t !== e; ) {
107
+ const yi = typeof window < "u" && window.customElements != null && window.customElements.polyfillWrapFlushCallback !== void 0, dr = (e, t, n = null, s = null) => {
108
+ for (; t !== n; ) {
91
109
  const i = t.nextSibling;
92
- n.insertBefore(t, s), t = i;
110
+ e.insertBefore(t, s), t = i;
93
111
  }
94
- }, Ye = (n, t, e = null) => {
95
- for (; t !== e; ) {
112
+ }, bs = (e, t, n = null) => {
113
+ for (; t !== n; ) {
96
114
  const s = t.nextSibling;
97
- n.removeChild(t), t = s;
115
+ e.removeChild(t), t = s;
98
116
  }
99
117
  };
100
118
  /**
@@ -110,7 +128,7 @@ const wn = typeof window < "u" && window.customElements != null && window.custom
110
128
  * subject to an additional IP rights grant found at
111
129
  * http://polymer.github.io/PATENTS.txt
112
130
  */
113
- const V = {}, _n = {};
131
+ const it = {}, Si = {};
114
132
  /**
115
133
  * @license
116
134
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -124,67 +142,67 @@ const V = {}, _n = {};
124
142
  * subject to an additional IP rights grant found at
125
143
  * http://polymer.github.io/PATENTS.txt
126
144
  */
127
- const et = `{{lit-${String(Math.random()).slice(2)}}}`, Un = `<!--${et}-->`, vn = new RegExp(`${et}|${Un}`), bt = "$lit$";
128
- class ks {
129
- constructor(t, e) {
130
- this.parts = [], this.element = e;
131
- const s = [], i = [], r = document.createTreeWalker(e.content, 133, null, !1);
132
- let o = 0, a = -1, c = 0;
133
- const { strings: h, values: { length: p } } = t;
134
- for (; c < p; ) {
135
- const u = r.nextNode();
136
- if (u === null) {
137
- r.currentNode = i.pop();
145
+ const St = `{{lit-${String(Math.random()).slice(2)}}}`, pr = `<!--${St}-->`, $i = new RegExp(`${St}|${pr}`), we = "$lit$";
146
+ class Ma {
147
+ constructor(t, n) {
148
+ this.parts = [], this.element = n;
149
+ const s = [], i = [], o = document.createTreeWalker(n.content, 133, null, !1);
150
+ let c = 0, a = -1, f = 0;
151
+ const { strings: h, values: { length: m } } = t;
152
+ for (; f < m; ) {
153
+ const r = o.nextNode();
154
+ if (r === null) {
155
+ o.currentNode = i.pop();
138
156
  continue;
139
157
  }
140
- if (a++, u.nodeType === 1) {
141
- if (u.hasAttributes()) {
142
- const S = u.attributes, { length: d } = S;
143
- let m = 0;
144
- for (let f = 0; f < d; f++)
145
- Sn(S[f].name, bt) && m++;
146
- for (; m-- > 0; ) {
147
- const f = h[c], _ = Re.exec(f)[2], v = _.toLowerCase() + bt, H = u.getAttribute(v);
148
- u.removeAttribute(v);
149
- const M = H.split(vn);
150
- this.parts.push({ type: "attribute", index: a, name: _, strings: M }), c += M.length - 1;
158
+ if (a++, r.nodeType === 1) {
159
+ if (r.hasAttributes()) {
160
+ const _ = r.attributes, { length: l } = _;
161
+ let g = 0;
162
+ for (let v = 0; v < l; v++)
163
+ Ei(_[v].name, we) && g++;
164
+ for (; g-- > 0; ) {
165
+ const v = h[f], y = Qn.exec(v)[2], $ = y.toLowerCase() + we, d = r.getAttribute($);
166
+ r.removeAttribute($);
167
+ const S = d.split($i);
168
+ this.parts.push({ type: "attribute", index: a, name: y, strings: S }), f += S.length - 1;
151
169
  }
152
170
  }
153
- u.tagName === "TEMPLATE" && (i.push(u), r.currentNode = u.content);
154
- } else if (u.nodeType === 3) {
155
- const S = u.data;
156
- if (S.indexOf(et) >= 0) {
157
- const d = u.parentNode, m = S.split(vn), f = m.length - 1;
158
- for (let _ = 0; _ < f; _++) {
159
- let v, H = m[_];
160
- if (H === "")
161
- v = U();
171
+ r.tagName === "TEMPLATE" && (i.push(r), o.currentNode = r.content);
172
+ } else if (r.nodeType === 3) {
173
+ const _ = r.data;
174
+ if (_.indexOf(St) >= 0) {
175
+ const l = r.parentNode, g = _.split($i), v = g.length - 1;
176
+ for (let y = 0; y < v; y++) {
177
+ let $, d = g[y];
178
+ if (d === "")
179
+ $ = ot();
162
180
  else {
163
- const M = Re.exec(H);
164
- M !== null && Sn(M[2], bt) && (H = H.slice(0, M.index) + M[1] + M[2].slice(0, -bt.length) + M[3]), v = document.createTextNode(H);
181
+ const S = Qn.exec(d);
182
+ S !== null && Ei(S[2], we) && (d = d.slice(0, S.index) + S[1] + S[2].slice(0, -we.length) + S[3]), $ = document.createTextNode(d);
165
183
  }
166
- d.insertBefore(v, u), this.parts.push({ type: "node", index: ++a });
184
+ l.insertBefore($, r), this.parts.push({ type: "node", index: ++a });
167
185
  }
168
- m[f] === "" ? (d.insertBefore(U(), u), s.push(u)) : u.data = m[f], c += f;
186
+ g[v] === "" ? (l.insertBefore(ot(), r), s.push(r)) : r.data = g[v], f += v;
169
187
  }
170
- } else if (u.nodeType === 8)
171
- if (u.data === et) {
172
- const S = u.parentNode;
173
- (u.previousSibling === null || a === o) && (a++, S.insertBefore(U(), u)), o = a, this.parts.push({ type: "node", index: a }), u.nextSibling === null ? u.data = "" : (s.push(u), a--), c++;
188
+ } else if (r.nodeType === 8)
189
+ if (r.data === St) {
190
+ const _ = r.parentNode;
191
+ (r.previousSibling === null || a === c) && (a++, _.insertBefore(ot(), r)), c = a, this.parts.push({ type: "node", index: a }), r.nextSibling === null ? r.data = "" : (s.push(r), a--), f++;
174
192
  } else {
175
- let S = -1;
176
- for (; (S = u.data.indexOf(et, S + 1)) !== -1; )
177
- this.parts.push({ type: "node", index: -1 }), c++;
193
+ let _ = -1;
194
+ for (; (_ = r.data.indexOf(St, _ + 1)) !== -1; )
195
+ this.parts.push({ type: "node", index: -1 }), f++;
178
196
  }
179
197
  }
180
- for (const u of s)
181
- u.parentNode.removeChild(u);
198
+ for (const r of s)
199
+ r.parentNode.removeChild(r);
182
200
  }
183
201
  }
184
- const Sn = (n, t) => {
185
- const e = n.length - t.length;
186
- return e >= 0 && n.slice(e) === t;
187
- }, Ls = (n) => n.index !== -1, U = () => document.createComment(""), Re = (
202
+ const Ei = (e, t) => {
203
+ const n = e.length - t.length;
204
+ return n >= 0 && e.slice(n) === t;
205
+ }, La = (e) => e.index !== -1, ot = () => document.createComment(""), Qn = (
188
206
  // eslint-disable-next-line no-control-regex
189
207
  /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/
190
208
  );
@@ -201,35 +219,35 @@ const Sn = (n, t) => {
201
219
  * subject to an additional IP rights grant found at
202
220
  * http://polymer.github.io/PATENTS.txt
203
221
  */
204
- class En {
205
- constructor(t, e, s) {
206
- this.__parts = [], this.template = t, this.processor = e, this.options = s;
222
+ class bi {
223
+ constructor(t, n, s) {
224
+ this.__parts = [], this.template = t, this.processor = n, this.options = s;
207
225
  }
208
226
  update(t) {
209
- let e = 0;
227
+ let n = 0;
210
228
  for (const s of this.__parts)
211
- s !== void 0 && s.setValue(t[e]), e++;
229
+ s !== void 0 && s.setValue(t[n]), n++;
212
230
  for (const s of this.__parts)
213
231
  s !== void 0 && s.commit();
214
232
  }
215
233
  _clone() {
216
- const t = wn ? this.template.element.content.cloneNode(!0) : document.importNode(this.template.element.content, !0), e = [], s = this.template.parts, i = document.createTreeWalker(t, 133, null, !1);
217
- let r = 0, o = 0, a, c = i.nextNode();
218
- for (; r < s.length; ) {
219
- if (a = s[r], !Ls(a)) {
220
- this.__parts.push(void 0), r++;
234
+ const t = yi ? this.template.element.content.cloneNode(!0) : document.importNode(this.template.element.content, !0), n = [], s = this.template.parts, i = document.createTreeWalker(t, 133, null, !1);
235
+ let o = 0, c = 0, a, f = i.nextNode();
236
+ for (; o < s.length; ) {
237
+ if (a = s[o], !La(a)) {
238
+ this.__parts.push(void 0), o++;
221
239
  continue;
222
240
  }
223
- for (; o < a.index; )
224
- o++, c.nodeName === "TEMPLATE" && (e.push(c), i.currentNode = c.content), (c = i.nextNode()) === null && (i.currentNode = e.pop(), c = i.nextNode());
241
+ for (; c < a.index; )
242
+ c++, f.nodeName === "TEMPLATE" && (n.push(f), i.currentNode = f.content), (f = i.nextNode()) === null && (i.currentNode = n.pop(), f = i.nextNode());
225
243
  if (a.type === "node") {
226
244
  const h = this.processor.handleTextExpression(this.options);
227
- h.insertAfterNode(c.previousSibling), this.__parts.push(h);
245
+ h.insertAfterNode(f.previousSibling), this.__parts.push(h);
228
246
  } else
229
- this.__parts.push(...this.processor.handleAttributeExpressions(c, a.name, a.strings, this.options));
230
- r++;
247
+ this.__parts.push(...this.processor.handleAttributeExpressions(f, a.name, a.strings, this.options));
248
+ o++;
231
249
  }
232
- return wn && (document.adoptNode(t), customElements.upgrade(t)), t;
250
+ return yi && (document.adoptNode(t), customElements.upgrade(t)), t;
233
251
  }
234
252
  }
235
253
  /**
@@ -245,38 +263,38 @@ class En {
245
263
  * subject to an additional IP rights grant found at
246
264
  * http://polymer.github.io/PATENTS.txt
247
265
  */
248
- const xn = window.trustedTypes && trustedTypes.createPolicy("lit-html", { createHTML: (n) => n }), Ns = ` ${et} `;
249
- class _e {
250
- constructor(t, e, s, i) {
251
- this.strings = t, this.values = e, this.type = s, this.processor = i;
266
+ const Ci = window.trustedTypes && trustedTypes.createPolicy("lit-html", { createHTML: (e) => e }), Na = ` ${St} `;
267
+ class $n {
268
+ constructor(t, n, s, i) {
269
+ this.strings = t, this.values = n, this.type = s, this.processor = i;
252
270
  }
253
271
  /**
254
272
  * Returns a string of HTML used to create a `<template>` element.
255
273
  */
256
274
  getHTML() {
257
275
  const t = this.strings.length - 1;
258
- let e = "", s = !1;
276
+ let n = "", s = !1;
259
277
  for (let i = 0; i < t; i++) {
260
- const r = this.strings[i], o = r.lastIndexOf("<!--");
261
- s = (o > -1 || s) && r.indexOf("-->", o + 1) === -1;
262
- const a = Re.exec(r);
263
- a === null ? e += r + (s ? Ns : Un) : e += r.substr(0, a.index) + a[1] + a[2] + bt + a[3] + et;
278
+ const o = this.strings[i], c = o.lastIndexOf("<!--");
279
+ s = (c > -1 || s) && o.indexOf("-->", c + 1) === -1;
280
+ const a = Qn.exec(o);
281
+ a === null ? n += o + (s ? Na : pr) : n += o.substr(0, a.index) + a[1] + a[2] + we + a[3] + St;
264
282
  }
265
- return e += this.strings[t], e;
283
+ return n += this.strings[t], n;
266
284
  }
267
285
  getTemplateElement() {
268
286
  const t = document.createElement("template");
269
- let e = this.getHTML();
270
- return xn !== void 0 && (e = xn.createHTML(e)), t.innerHTML = e, t;
287
+ let n = this.getHTML();
288
+ return Ci !== void 0 && (n = Ci.createHTML(n)), t.innerHTML = n, t;
271
289
  }
272
290
  }
273
- class Gn extends _e {
291
+ class fr extends $n {
274
292
  getHTML() {
275
293
  return `<svg>${super.getHTML()}</svg>`;
276
294
  }
277
295
  getTemplateElement() {
278
- const t = super.getTemplateElement(), e = t.content, s = e.firstChild;
279
- return e.removeChild(s), qn(e, s.firstChild), t;
296
+ const t = super.getTemplateElement(), n = t.content, s = n.firstChild;
297
+ return n.removeChild(s), dr(n, s.firstChild), t;
280
298
  }
281
299
  }
282
300
  /**
@@ -292,11 +310,11 @@ class Gn extends _e {
292
310
  * subject to an additional IP rights grant found at
293
311
  * http://polymer.github.io/PATENTS.txt
294
312
  */
295
- const Qe = (n) => n === null || !(typeof n == "object" || typeof n == "function"), Ae = (n) => Array.isArray(n) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
296
- !!(n && n[Symbol.iterator]);
297
- class jn {
298
- constructor(t, e, s) {
299
- this.dirty = !0, this.element = t, this.name = e, this.strings = s, this.parts = [];
313
+ const Cs = (e) => e === null || !(typeof e == "object" || typeof e == "function"), Xn = (e) => Array.isArray(e) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
314
+ !!(e && e[Symbol.iterator]);
315
+ class _r {
316
+ constructor(t, n, s) {
317
+ this.dirty = !0, this.element = t, this.name = n, this.strings = s, this.parts = [];
300
318
  for (let i = 0; i < s.length - 1; i++)
301
319
  this.parts[i] = this._createPart();
302
320
  }
@@ -304,52 +322,52 @@ class jn {
304
322
  * Creates a single part. Override this to create a differnt type of part.
305
323
  */
306
324
  _createPart() {
307
- return new Xe(this);
325
+ return new Ps(this);
308
326
  }
309
327
  _getValue() {
310
- const t = this.strings, e = t.length - 1, s = this.parts;
311
- if (e === 1 && t[0] === "" && t[1] === "") {
312
- const r = s[0].value;
313
- if (typeof r == "symbol")
314
- return String(r);
315
- if (typeof r == "string" || !Ae(r))
316
- return r;
328
+ const t = this.strings, n = t.length - 1, s = this.parts;
329
+ if (n === 1 && t[0] === "" && t[1] === "") {
330
+ const o = s[0].value;
331
+ if (typeof o == "symbol")
332
+ return String(o);
333
+ if (typeof o == "string" || !Xn(o))
334
+ return o;
317
335
  }
318
336
  let i = "";
319
- for (let r = 0; r < e; r++) {
320
- i += t[r];
321
- const o = s[r];
322
- if (o !== void 0) {
323
- const a = o.value;
324
- if (Qe(a) || !Ae(a))
337
+ for (let o = 0; o < n; o++) {
338
+ i += t[o];
339
+ const c = s[o];
340
+ if (c !== void 0) {
341
+ const a = c.value;
342
+ if (Cs(a) || !Xn(a))
325
343
  i += typeof a == "string" ? a : String(a);
326
344
  else
327
- for (const c of a)
328
- i += typeof c == "string" ? c : String(c);
345
+ for (const f of a)
346
+ i += typeof f == "string" ? f : String(f);
329
347
  }
330
348
  }
331
- return i += t[e], i;
349
+ return i += t[n], i;
332
350
  }
333
351
  commit() {
334
352
  this.dirty && (this.dirty = !1, this.element.setAttribute(this.name, this._getValue()));
335
353
  }
336
354
  }
337
- class Xe {
355
+ class Ps {
338
356
  constructor(t) {
339
357
  this.value = void 0, this.committer = t;
340
358
  }
341
359
  setValue(t) {
342
- t !== V && (!Qe(t) || t !== this.value) && (this.value = t, Wt(t) || (this.committer.dirty = !0));
360
+ t !== it && (!Cs(t) || t !== this.value) && (this.value = t, Ge(t) || (this.committer.dirty = !0));
343
361
  }
344
362
  commit() {
345
- for (; Wt(this.value); ) {
363
+ for (; Ge(this.value); ) {
346
364
  const t = this.value;
347
- this.value = V, t(this);
365
+ this.value = it, t(this);
348
366
  }
349
- this.value !== V && this.committer.commit();
367
+ this.value !== it && this.committer.commit();
350
368
  }
351
369
  }
352
- class wt {
370
+ class re {
353
371
  constructor(t) {
354
372
  this.value = void 0, this.__pendingValue = void 0, this.options = t;
355
373
  }
@@ -359,7 +377,7 @@ class wt {
359
377
  * This part must be empty, as its contents are not automatically moved.
360
378
  */
361
379
  appendInto(t) {
362
- this.startNode = t.appendChild(U()), this.endNode = t.appendChild(U());
380
+ this.startNode = t.appendChild(ot()), this.endNode = t.appendChild(ot());
363
381
  }
364
382
  /**
365
383
  * Inserts this part after the `ref` node (between `ref` and `ref`'s next
@@ -377,7 +395,7 @@ class wt {
377
395
  * This part must be empty, as its contents are not automatically moved.
378
396
  */
379
397
  appendIntoPart(t) {
380
- t.__insert(this.startNode = U()), t.__insert(this.endNode = U());
398
+ t.__insert(this.startNode = ot()), t.__insert(this.endNode = ot());
381
399
  }
382
400
  /**
383
401
  * Inserts this part after the `ref` part.
@@ -385,7 +403,7 @@ class wt {
385
403
  * This part must be empty, as its contents are not automatically moved.
386
404
  */
387
405
  insertAfterPart(t) {
388
- t.__insert(this.startNode = U()), this.endNode = t.endNode, t.endNode = this.startNode;
406
+ t.__insert(this.startNode = ot()), this.endNode = t.endNode, t.endNode = this.startNode;
389
407
  }
390
408
  setValue(t) {
391
409
  this.__pendingValue = t;
@@ -393,12 +411,12 @@ class wt {
393
411
  commit() {
394
412
  if (this.startNode.parentNode === null)
395
413
  return;
396
- for (; Wt(this.__pendingValue); ) {
397
- const e = this.__pendingValue;
398
- this.__pendingValue = V, e(this);
414
+ for (; Ge(this.__pendingValue); ) {
415
+ const n = this.__pendingValue;
416
+ this.__pendingValue = it, n(this);
399
417
  }
400
418
  const t = this.__pendingValue;
401
- t !== V && (Qe(t) ? t !== this.value && this.__commitText(t) : t instanceof _e ? this.__commitTemplateResult(t) : t instanceof Node ? this.__commitNode(t) : Ae(t) ? this.__commitIterable(t) : t === _n ? (this.value = _n, this.clear()) : this.__commitText(t));
419
+ t !== it && (Cs(t) ? t !== this.value && this.__commitText(t) : t instanceof $n ? this.__commitTemplateResult(t) : t instanceof Node ? this.__commitNode(t) : Xn(t) ? this.__commitIterable(t) : t === Si ? (this.value = Si, this.clear()) : this.__commitText(t));
402
420
  }
403
421
  __insert(t) {
404
422
  this.endNode.parentNode.insertBefore(t, this.endNode);
@@ -407,58 +425,58 @@ class wt {
407
425
  this.value !== t && (this.clear(), this.__insert(t), this.value = t);
408
426
  }
409
427
  __commitText(t) {
410
- const e = this.startNode.nextSibling;
428
+ const n = this.startNode.nextSibling;
411
429
  t = t ?? "";
412
430
  const s = typeof t == "string" ? t : String(t);
413
- e === this.endNode.previousSibling && e.nodeType === 3 ? e.data = s : this.__commitNode(document.createTextNode(s)), this.value = t;
431
+ n === this.endNode.previousSibling && n.nodeType === 3 ? n.data = s : this.__commitNode(document.createTextNode(s)), this.value = t;
414
432
  }
415
433
  __commitTemplateResult(t) {
416
- const e = this.options.templateFactory(t);
417
- if (this.value instanceof En && this.value.template === e)
434
+ const n = this.options.templateFactory(t);
435
+ if (this.value instanceof bi && this.value.template === n)
418
436
  this.value.update(t.values);
419
437
  else {
420
- const s = new En(e, t.processor, this.options), i = s._clone();
438
+ const s = new bi(n, t.processor, this.options), i = s._clone();
421
439
  s.update(t.values), this.__commitNode(i), this.value = s;
422
440
  }
423
441
  }
424
442
  __commitIterable(t) {
425
443
  Array.isArray(this.value) || (this.value = [], this.clear());
426
- const e = this.value;
444
+ const n = this.value;
427
445
  let s = 0, i;
428
- for (const r of t)
429
- i = e[s], i === void 0 && (i = new wt(this.options), e.push(i), s === 0 ? i.appendIntoPart(this) : i.insertAfterPart(e[s - 1])), i.setValue(r), i.commit(), s++;
430
- s < e.length && (e.length = s, this.clear(i && i.endNode));
446
+ for (const o of t)
447
+ i = n[s], i === void 0 && (i = new re(this.options), n.push(i), s === 0 ? i.appendIntoPart(this) : i.insertAfterPart(n[s - 1])), i.setValue(o), i.commit(), s++;
448
+ s < n.length && (n.length = s, this.clear(i && i.endNode));
431
449
  }
432
450
  clear(t = this.startNode) {
433
- Ye(this.startNode.parentNode, t.nextSibling, this.endNode);
451
+ bs(this.startNode.parentNode, t.nextSibling, this.endNode);
434
452
  }
435
453
  }
436
- class Ms {
437
- constructor(t, e, s) {
454
+ class Aa {
455
+ constructor(t, n, s) {
438
456
  if (this.value = void 0, this.__pendingValue = void 0, s.length !== 2 || s[0] !== "" || s[1] !== "")
439
457
  throw new Error("Boolean attributes can only contain a single expression");
440
- this.element = t, this.name = e, this.strings = s;
458
+ this.element = t, this.name = n, this.strings = s;
441
459
  }
442
460
  setValue(t) {
443
461
  this.__pendingValue = t;
444
462
  }
445
463
  commit() {
446
- for (; Wt(this.__pendingValue); ) {
447
- const e = this.__pendingValue;
448
- this.__pendingValue = V, e(this);
464
+ for (; Ge(this.__pendingValue); ) {
465
+ const n = this.__pendingValue;
466
+ this.__pendingValue = it, n(this);
449
467
  }
450
- if (this.__pendingValue === V)
468
+ if (this.__pendingValue === it)
451
469
  return;
452
470
  const t = !!this.__pendingValue;
453
- this.value !== t && (t ? this.element.setAttribute(this.name, "") : this.element.removeAttribute(this.name), this.value = t), this.__pendingValue = V;
471
+ this.value !== t && (t ? this.element.setAttribute(this.name, "") : this.element.removeAttribute(this.name), this.value = t), this.__pendingValue = it;
454
472
  }
455
473
  }
456
- class Os extends jn {
457
- constructor(t, e, s) {
458
- super(t, e, s), this.single = s.length === 2 && s[0] === "" && s[1] === "";
474
+ class Ia extends _r {
475
+ constructor(t, n, s) {
476
+ super(t, n, s), this.single = s.length === 2 && s[0] === "" && s[1] === "";
459
477
  }
460
478
  _createPart() {
461
- return new Rs(this);
479
+ return new Ra(this);
462
480
  }
463
481
  _getValue() {
464
482
  return this.single ? this.parts[0].value : super._getValue();
@@ -467,42 +485,42 @@ class Os extends jn {
467
485
  this.dirty && (this.dirty = !1, this.element[this.name] = this._getValue());
468
486
  }
469
487
  }
470
- class Rs extends Xe {
488
+ class Ra extends Ps {
471
489
  }
472
- let Fn = !1;
490
+ let gr = !1;
473
491
  (() => {
474
492
  try {
475
- const n = {
493
+ const e = {
476
494
  get capture() {
477
- return Fn = !0, !1;
495
+ return gr = !0, !1;
478
496
  }
479
497
  };
480
- window.addEventListener("test", n, n), window.removeEventListener("test", n, n);
498
+ window.addEventListener("test", e, e), window.removeEventListener("test", e, e);
481
499
  } catch {
482
500
  }
483
501
  })();
484
- class As {
485
- constructor(t, e, s) {
486
- this.value = void 0, this.__pendingValue = void 0, this.element = t, this.eventName = e, this.eventContext = s, this.__boundHandleEvent = (i) => this.handleEvent(i);
502
+ class Ha {
503
+ constructor(t, n, s) {
504
+ this.value = void 0, this.__pendingValue = void 0, this.element = t, this.eventName = n, this.eventContext = s, this.__boundHandleEvent = (i) => this.handleEvent(i);
487
505
  }
488
506
  setValue(t) {
489
507
  this.__pendingValue = t;
490
508
  }
491
509
  commit() {
492
- for (; Wt(this.__pendingValue); ) {
493
- const r = this.__pendingValue;
494
- this.__pendingValue = V, r(this);
510
+ for (; Ge(this.__pendingValue); ) {
511
+ const o = this.__pendingValue;
512
+ this.__pendingValue = it, o(this);
495
513
  }
496
- if (this.__pendingValue === V)
514
+ if (this.__pendingValue === it)
497
515
  return;
498
- const t = this.__pendingValue, e = this.value, s = t == null || e != null && (t.capture !== e.capture || t.once !== e.once || t.passive !== e.passive), i = t != null && (e == null || s);
499
- s && this.element.removeEventListener(this.eventName, this.__boundHandleEvent, this.__options), i && (this.__options = Hs(t), this.element.addEventListener(this.eventName, this.__boundHandleEvent, this.__options)), this.value = t, this.__pendingValue = V;
516
+ const t = this.__pendingValue, n = this.value, s = t == null || n != null && (t.capture !== n.capture || t.once !== n.once || t.passive !== n.passive), i = t != null && (n == null || s);
517
+ s && this.element.removeEventListener(this.eventName, this.__boundHandleEvent, this.__options), i && (this.__options = Wa(t), this.element.addEventListener(this.eventName, this.__boundHandleEvent, this.__options)), this.value = t, this.__pendingValue = it;
500
518
  }
501
519
  handleEvent(t) {
502
520
  typeof this.value == "function" ? this.value.call(this.eventContext || this.element, t) : this.value.handleEvent(t);
503
521
  }
504
522
  }
505
- const Hs = (n) => n && (Fn ? { capture: n.capture, passive: n.passive, once: n.once } : n.capture);
523
+ const Wa = (e) => e && (gr ? { capture: e.capture, passive: e.passive, once: e.once } : e.capture);
506
524
  /**
507
525
  * @license
508
526
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -516,7 +534,7 @@ const Hs = (n) => n && (Fn ? { capture: n.capture, passive: n.passive, once: n.o
516
534
  * subject to an additional IP rights grant found at
517
535
  * http://polymer.github.io/PATENTS.txt
518
536
  */
519
- class Ws {
537
+ class za {
520
538
  /**
521
539
  * Create parts for an attribute-position binding, given the event, attribute
522
540
  * name, and string literals.
@@ -526,19 +544,19 @@ class Ws {
526
544
  * @param strings The string literals. There are always at least two strings,
527
545
  * event for fully-controlled bindings with a single expression.
528
546
  */
529
- handleAttributeExpressions(t, e, s, i) {
530
- const r = e[0];
531
- return r === "." ? new Os(t, e.slice(1), s).parts : r === "@" ? [new As(t, e.slice(1), i.eventContext)] : r === "?" ? [new Ms(t, e.slice(1), s)] : new jn(t, e, s).parts;
547
+ handleAttributeExpressions(t, n, s, i) {
548
+ const o = n[0];
549
+ return o === "." ? new Ia(t, n.slice(1), s).parts : o === "@" ? [new Ha(t, n.slice(1), i.eventContext)] : o === "?" ? [new Aa(t, n.slice(1), s)] : new _r(t, n, s).parts;
532
550
  }
533
551
  /**
534
552
  * Create parts for a text-position binding.
535
553
  * @param templateFactory
536
554
  */
537
555
  handleTextExpression(t) {
538
- return new wt(t);
556
+ return new re(t);
539
557
  }
540
558
  }
541
- const Bn = new Ws();
559
+ const mr = new za();
542
560
  /**
543
561
  * @license
544
562
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -552,19 +570,19 @@ const Bn = new Ws();
552
570
  * subject to an additional IP rights grant found at
553
571
  * http://polymer.github.io/PATENTS.txt
554
572
  */
555
- function Is(n) {
556
- let t = bn.get(n.type);
573
+ function Va(e) {
574
+ let t = Pi.get(e.type);
557
575
  t === void 0 && (t = {
558
576
  stringsArray: /* @__PURE__ */ new WeakMap(),
559
577
  keyString: /* @__PURE__ */ new Map()
560
- }, bn.set(n.type, t));
561
- let e = t.stringsArray.get(n.strings);
562
- if (e !== void 0)
563
- return e;
564
- const s = n.strings.join(et);
565
- return e = t.keyString.get(s), e === void 0 && (e = new ks(n, n.getTemplateElement()), t.keyString.set(s, e)), t.stringsArray.set(n.strings, e), e;
566
- }
567
- const bn = /* @__PURE__ */ new Map();
578
+ }, Pi.set(e.type, t));
579
+ let n = t.stringsArray.get(e.strings);
580
+ if (n !== void 0)
581
+ return n;
582
+ const s = e.strings.join(St);
583
+ return n = t.keyString.get(s), n === void 0 && (n = new Ma(e, e.getTemplateElement()), t.keyString.set(s, n)), t.stringsArray.set(e.strings, n), n;
584
+ }
585
+ const Pi = /* @__PURE__ */ new Map();
568
586
  /**
569
587
  * @license
570
588
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -578,9 +596,9 @@ const bn = /* @__PURE__ */ new Map();
578
596
  * subject to an additional IP rights grant found at
579
597
  * http://polymer.github.io/PATENTS.txt
580
598
  */
581
- const Cn = /* @__PURE__ */ new WeakMap(), Kn = (n, t, e) => {
582
- let s = Cn.get(t);
583
- s === void 0 && (Ye(t, t.firstChild), Cn.set(t, s = new wt(Object.assign({ templateFactory: Is }, e))), s.appendInto(t)), s.setValue(n), s.commit();
599
+ const ki = /* @__PURE__ */ new WeakMap(), ks = (e, t, n) => {
600
+ let s = ki.get(t);
601
+ s === void 0 && (bs(t, t.firstChild), ki.set(t, s = new re(Object.assign({ templateFactory: Va }, n))), s.appendInto(t)), s.setValue(e), s.commit();
584
602
  };
585
603
  /**
586
604
  * @license
@@ -596,543 +614,507 @@ const Cn = /* @__PURE__ */ new WeakMap(), Kn = (n, t, e) => {
596
614
  * http://polymer.github.io/PATENTS.txt
597
615
  */
598
616
  typeof window < "u" && (window.litHtmlVersions || (window.litHtmlVersions = [])).push("1.4.1");
599
- const G = (n, ...t) => new _e(n, t, "html", Bn), Vs = (n, ...t) => new Gn(n, t, "svg", Bn), _t = /* @__PURE__ */ new Set();
600
- function I(n) {
601
- typeof n == "function" && (_t.size || globalThis.queueMicrotask(() => {
602
- _t.forEach((t) => t()), _t.clear();
603
- }), _t.delete(n), _t.add(n));
604
- }
605
- const Ht = [];
606
- function Ds() {
607
- for (let n = Ht.length - 1; n >= 0; n--)
608
- Ht[n]();
609
- Ht.length = 0;
610
- }
611
- function Di(n) {
612
- Ht.length || I(Ds), Ht.push(n);
613
- }
614
- function zn(n = "", t = "") {
615
- const { pathname: e, search: s, hash: i } = new URL(t, location.origin + n);
616
- return e + s + decodeURIComponent(i);
617
- }
618
- function Jn(n, t, e, s) {
619
- return n.addEventListener(t, e, s), () => n.removeEventListener(t, e, s);
620
- }
621
- var X, z, Z, Gt, He;
622
- class qs extends EventTarget {
617
+ const at = (e, ...t) => new $n(e, t, "html", mr), Ga = (e, ...t) => new fr(e, t, "svg", mr);
618
+ let _e = /* @__PURE__ */ new Set();
619
+ function Ot(e) {
620
+ typeof e == "function" && (_e.size || globalThis.queueMicrotask(() => {
621
+ const t = _e;
622
+ _e = /* @__PURE__ */ new Set(), t.forEach((n) => n());
623
+ }), _e.delete(e), _e.add(e));
624
+ }
625
+ function vr(e = "", t = "") {
626
+ const { pathname: n, search: s, hash: i } = new URL(t, location.origin + e);
627
+ return n + s + decodeURIComponent(i);
628
+ }
629
+ function wr(e, t, n, s) {
630
+ return e.addEventListener(t, n, s), () => e.removeEventListener(t, n, s);
631
+ }
632
+ var mt, lt, vt, Ke, Zn;
633
+ class Da extends EventTarget {
623
634
  constructor() {
624
635
  super(...arguments);
625
- P(this, Gt);
626
- P(this, X, /* @__PURE__ */ new Map());
627
- P(this, z, void 0);
628
- P(this, Z, void 0);
636
+ b(this, Ke);
637
+ b(this, mt, /* @__PURE__ */ new Map());
638
+ b(this, lt);
639
+ b(this, vt);
629
640
  }
630
641
  get size() {
631
- return g(this, X).size;
642
+ return p(this, mt).size;
632
643
  }
633
644
  get first() {
634
- return g(this, z);
645
+ return p(this, lt);
635
646
  }
636
647
  get last() {
637
- return g(this, Z);
648
+ return p(this, vt);
638
649
  }
639
- isSuperLinkOf(e) {
640
- let s = e.first;
641
- if (!s)
642
- return !0;
650
+ isSuperLinkOf(n) {
651
+ let s = n.first;
652
+ if (!s) return !0;
643
653
  let i = this.find(s.value);
644
654
  for (; i && i.value === s.value; ) {
645
- if (s = s.next, !s)
646
- return !0;
655
+ if (s = s.next, !s) return !0;
647
656
  i = i.next;
648
657
  }
649
658
  return !1;
650
659
  }
651
- find(e) {
652
- return g(this, X).get(e);
660
+ find(n) {
661
+ return p(this, mt).get(n);
653
662
  }
654
663
  // 添加到尾部,已存在时会删除老的项目
655
664
  // 如果是添加第一个,start 事件会在添加前触发,避免处理事件重复的逻辑
656
- add(e) {
657
- g(this, Z) || this.dispatchEvent(new CustomEvent("start"));
658
- const s = Ce(this, Gt, He).call(this, e) || { value: e };
659
- s.prev = g(this, Z), s.prev && (s.prev.next = s), s.next = void 0, F(this, Z, s), g(this, z) || F(this, z, s), g(this, X).set(e, s);
665
+ add(n) {
666
+ p(this, vt) || this.dispatchEvent(new CustomEvent("start"));
667
+ const s = zn(this, Ke, Zn).call(this, n) || { value: n };
668
+ s.prev = p(this, vt), s.prev && (s.prev.next = s), s.next = void 0, x(this, vt, s), p(this, lt) || x(this, lt, s), p(this, mt).set(n, s);
660
669
  }
661
670
  // 删除这个元素后没有其他元素时立即出发 end 事件
662
- delete(e) {
663
- const s = Ce(this, Gt, He).call(this, e);
664
- return g(this, z) || this.dispatchEvent(new CustomEvent("end")), s;
671
+ delete(n) {
672
+ const s = zn(this, Ke, Zn).call(this, n);
673
+ return p(this, lt) || this.dispatchEvent(new CustomEvent("end")), s;
665
674
  }
666
675
  // 获取头部元素
667
676
  // 会从链表删除
668
677
  get() {
669
- const e = g(this, z);
670
- if (e)
671
- return this.delete(e.value), e.value;
678
+ const n = p(this, lt);
679
+ if (n)
680
+ return this.delete(n.value), n.value;
672
681
  }
673
682
  }
674
- X = new WeakMap(), z = new WeakMap(), Z = new WeakMap(), Gt = new WeakSet(), He = function(e) {
675
- const s = g(this, X).get(e);
676
- return s && (s.prev ? s.prev.next = s.next : F(this, z, s.next), s.next ? s.next.prev = s.prev : F(this, Z, s.prev), g(this, X).delete(e)), s;
683
+ mt = new WeakMap(), lt = new WeakMap(), vt = new WeakMap(), Ke = new WeakSet(), Zn = function(n) {
684
+ const s = p(this, mt).get(n);
685
+ return s && (s.prev ? s.prev.next = s.next : x(this, lt, s.next), s.next ? s.next.prev = s.prev : x(this, vt, s.prev), p(this, mt).delete(n)), s;
677
686
  };
678
- class Us extends WeakMap {
687
+ class Fa extends WeakMap {
679
688
  get(t) {
680
- let e = super.get(t);
681
- return e || (e = {}, this.set(t, e)), e;
689
+ let n = super.get(t);
690
+ return n || (n = {}, this.set(t, n)), n;
682
691
  }
683
692
  }
684
- var gt, pe;
685
- class It extends URLSearchParams {
686
- constructor(e) {
687
- super(e);
688
- P(this, gt, (e) => typeof e == "string" ? e : JSON.stringify(e));
689
- P(this, pe, (e) => {
690
- if (!e)
691
- return null;
693
+ var Bt, _n;
694
+ class De extends URLSearchParams {
695
+ constructor(n) {
696
+ super(n);
697
+ b(this, Bt, (n) => typeof n == "string" ? n : JSON.stringify(n));
698
+ b(this, _n, (n) => {
699
+ if (!n) return null;
692
700
  try {
693
- return JSON.parse(e);
701
+ return JSON.parse(n);
694
702
  } catch {
695
703
  return null;
696
704
  }
697
705
  });
698
706
  }
699
707
  // support `{ key: ObjectValue }`
700
- concat(e) {
708
+ concat(n) {
701
709
  let s;
702
- typeof e == "string" ? s = Object.fromEntries(new URLSearchParams(e).entries()) : s = e, Object.entries(s).forEach(([i, r]) => {
703
- this.append(i, g(this, gt).call(this, r));
710
+ typeof n == "string" ? s = Object.fromEntries(new URLSearchParams(n).entries()) : s = n, Object.entries(s).forEach(([i, o]) => {
711
+ this.append(i, p(this, Bt).call(this, o));
704
712
  });
705
713
  }
706
- setAny(e, s) {
714
+ setAny(n, s) {
707
715
  if (Array.isArray(s))
708
- this.delete(e), s.forEach((i) => this.append(e, g(this, gt).call(this, i)));
716
+ this.delete(n), s.forEach((i) => this.append(n, p(this, Bt).call(this, i)));
709
717
  else {
710
- const i = g(this, gt).call(this, s);
711
- i ? this.set(e, i) : this.delete(e);
718
+ const i = p(this, Bt).call(this, s);
719
+ i ? this.set(n, i) : this.delete(n);
712
720
  }
713
721
  }
714
- getAny(e) {
715
- return this.getAnyAll(e)[0];
722
+ getAny(n) {
723
+ return this.getAnyAll(n)[0];
716
724
  }
717
- getAnyAll(e) {
718
- return this.getAll(e).filter((s) => s !== "").map((s) => g(this, pe).call(this, s));
725
+ getAnyAll(n) {
726
+ return this.getAll(n).filter((s) => s !== "").map((s) => p(this, _n).call(this, s));
719
727
  }
720
728
  toString() {
721
- const e = super.toString();
722
- return e ? `?${e}` : "";
729
+ const n = super.toString();
730
+ return n ? `?${n}` : "";
723
731
  }
724
732
  toJSON() {
725
733
  return this.toString();
726
734
  }
727
735
  }
728
- gt = new WeakMap(), pe = new WeakMap();
729
- function Jt(n, ...t) {
730
- return n.reduce((e, s, i) => e + (t[i - 1] ?? "") + s);
731
- }
732
- function qi(n, ...t) {
733
- return Jt(n, ...t);
734
- }
735
- const Yn = Symbol.for("gem@sheetToken");
736
- function Ui(n, t = "") {
737
- const e = new CSSStyleSheet(), s = {};
738
- e.media.mediaText = t;
739
- let i = "";
740
- return typeof n == "string" ? i = n : Object.keys(n).forEach((r) => {
741
- s[r] = `${r}-${ve()}`, i += n[r].styledContent.replace(/&/g, s[r]);
742
- }), e.replaceSync(i), s[Yn] = e, s;
743
- }
744
- function ve(n = 5) {
745
- const t = Math.random().toString(36).slice(2).slice(0, n);
746
- return t.length < n ? t + ve(n - t.length) : t;
747
- }
748
- const Gs = new RegExp(`&.*{((.|
749
- )*)}`, "g");
750
- function Pn(n, t) {
751
- const e = [];
752
- let s = `& {${n.replace(Gs, (i) => (e.push(i), ""))}}` + e.join("");
753
- return s = s.replace(/&/g, t === "class" ? ".&" : "#&"), { styledContent: s, type: t };
754
- }
755
- const Gi = {
756
- class: (n, ...t) => {
757
- const e = Jt(n, ...t);
758
- return Pn(e, "class");
759
- },
760
- id: (n, ...t) => {
761
- const e = Jt(n, ...t);
762
- return Pn(e, "id");
763
- },
764
- keyframes: (n, ...t) => ({ styledContent: `@keyframes & {${Jt(n, ...t)}}`, type: "keyframes" })
765
- };
766
- function j(n) {
767
- return n.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase());
736
+ Bt = new WeakMap(), _n = new WeakMap();
737
+ function xs(e, ...t) {
738
+ return e.reduce((n, s, i) => n + (t[i - 1] ?? "") + s);
768
739
  }
769
- function ot(n) {
770
- return n.replace(/-(.)/g, (t, e) => e.toUpperCase());
740
+ const yr = xs;
741
+ function En(e = 5) {
742
+ const t = Math.random().toString(36).slice(2, 2 + e);
743
+ return t.length < e ? t + En(e - t.length) : t;
771
744
  }
772
- function Ze(n) {
773
- return Object.keys(n).forEach((t) => {
774
- const e = t;
775
- delete n[e];
776
- }), n;
745
+ const Wl = { class: xs };
746
+ function oe(e) {
747
+ return e.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase());
777
748
  }
778
- class tt extends Error {
749
+ function zl(e) {
750
+ return e.replace(/-(.)/g, (t, n) => n.toUpperCase());
751
+ }
752
+ function Ts(e) {
753
+ return Object.keys(e).forEach((t) => {
754
+ delete e[t];
755
+ }), e;
756
+ }
757
+ class yt extends Error {
779
758
  constructor(t) {
780
759
  super(t), this.message = `gem: ${this.message}`;
781
760
  }
782
761
  }
783
- function js(n, t) {
784
- const e = n.length;
785
- if (t.length !== e)
786
- return !0;
787
- for (let s = 0; s < e; s++)
788
- if (n[s] !== t[s])
789
- return !0;
762
+ function qa(e, t) {
763
+ const n = e.length;
764
+ if (t.length !== n) return !0;
765
+ for (let s = 0; s < n; s++)
766
+ if (e[s] !== t[s]) return !0;
790
767
  return !1;
791
768
  }
792
- function Fs(n, t) {
793
- const e = new Set(t);
794
- return n.filter((s) => e.has(s) ? (e.delete(s), !1) : !0);
795
- }
796
- function tn(n, t, e) {
769
+ function Os(e, t, n) {
797
770
  let s = t;
798
- for (const i in n) {
799
- const r = e(i, n[i]);
800
- s += r ? r + t : "";
771
+ for (const i in e) {
772
+ const o = n(i, e[i]);
773
+ s += o ? o + t : "";
801
774
  }
802
775
  return s;
803
776
  }
804
- function ji(n) {
805
- return tn(
806
- n,
777
+ function Vl(e) {
778
+ return Os(
779
+ e,
807
780
  ";",
808
- (t, e) => e || e === 0 ? `${j(t)}:${e}` : ""
781
+ (t, n) => n || n === 0 ? `${oe(t)}:${n}` : ""
809
782
  );
810
783
  }
811
- function Bs(n) {
812
- return tn(n, " ", (t, e) => e ? t : "");
784
+ function Ua(e) {
785
+ return Os(e, " ", (t, n) => n ? t : "");
813
786
  }
814
- const Fi = Bs;
815
- function Bi(n) {
816
- return tn(
817
- n,
787
+ const Gl = Ua;
788
+ function Dl(e) {
789
+ return Os(
790
+ e,
818
791
  ",",
819
- (t, e) => e === !0 || t === e ? t : e ? `${t}:${e}` : ""
792
+ (t, n) => n === !0 || t === n ? t : n ? `${t}:${n}` : ""
820
793
  );
821
794
  }
822
- const Vt = /* @__PURE__ */ new WeakMap();
823
- function Ft(n) {
824
- if (Vt.has(n))
825
- throw new tt("argument error");
826
- return Vt.set(n, /* @__PURE__ */ new Set()), n;
795
+ const ne = /* @__PURE__ */ new WeakMap();
796
+ function bn(e) {
797
+ if (ne.has(e))
798
+ throw new yt("argument error");
799
+ return ne.set(e, /* @__PURE__ */ new Set()), e;
827
800
  }
828
- function nt(n, t) {
829
- var e;
830
- Object.assign(n, t), (e = Vt.get(n)) == null || e.forEach((s) => {
831
- I(s);
801
+ function It(e, t) {
802
+ var n;
803
+ Object.assign(e, t), (n = ne.get(e)) == null || n.forEach((s) => {
804
+ Ot(s);
832
805
  });
833
806
  }
834
- function en(n) {
835
- const t = Ft(n);
836
- return [t, (e) => nt(t, e)];
807
+ function Xe(e) {
808
+ const t = bn(e);
809
+ return [t, (n) => It(t, n)];
837
810
  }
838
- function ct(n, t) {
839
- const e = Vt.get(n);
840
- return e == null || e.add(t), () => {
841
- e == null || e.delete(t);
811
+ function pt(e, t) {
812
+ const n = ne.get(e);
813
+ return n == null || n.add(t), () => {
814
+ n == null || n.delete(t);
842
815
  };
843
816
  }
844
- function Ki(n, t) {
845
- const e = Vt.get(n);
846
- e == null || e.delete(t);
817
+ function Ba(e, t) {
818
+ const n = ne.get(e);
819
+ n == null || n.delete(t);
847
820
  }
848
- const Ks = "1.7.11", zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
821
+ const Ka = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
849
822
  __proto__: null,
850
- version: Ks
851
- }, Symbol.toStringTag, { value: "Module" }));
852
- /**
853
- * @license
854
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
855
- * This code may only be used under the BSD style license found at
856
- * http://polymer.github.io/LICENSE.txt
857
- * The complete set of authors may be found at
858
- * http://polymer.github.io/AUTHORS.txt
859
- * The complete set of contributors may be found at
860
- * http://polymer.github.io/CONTRIBUTORS.txt
861
- * Code distributed by Google as part of the polymer project is also
862
- * subject to an additional IP rights grant found at
863
- * http://polymer.github.io/PATENTS.txt
864
- */
865
- const $n = (n, t) => {
866
- const e = n.startNode.parentNode, s = t === void 0 ? n.endNode : t.startNode, i = e.insertBefore(U(), s);
867
- e.insertBefore(U(), s);
868
- const r = new wt(n.options);
869
- return r.insertAfterNode(i), r;
870
- }, st = (n, t) => (n.setValue(t), n.commit(), n), Pe = (n, t, e) => {
871
- const s = n.startNode.parentNode, i = e ? e.startNode : n.endNode, r = t.endNode.nextSibling;
872
- r !== i && qn(s, t.startNode, r, i);
873
- }, $e = (n) => {
874
- Ye(n.startNode.parentNode, n.startNode, n.endNode.nextSibling);
875
- }, Tn = (n, t, e) => {
876
- const s = /* @__PURE__ */ new Map();
877
- for (let i = t; i <= e; i++)
878
- s.set(n[i], i);
879
- return s;
880
- }, kn = /* @__PURE__ */ new WeakMap(), Ln = /* @__PURE__ */ new WeakMap(), Js = we((n, t, e) => {
881
- let s;
882
- return e === void 0 ? e = t : t !== void 0 && (s = t), (i) => {
883
- if (!(i instanceof wt))
884
- throw new Error("repeat can only be used in text bindings");
885
- const r = kn.get(i) || [], o = Ln.get(i) || [], a = [], c = [], h = [];
886
- let p = 0;
887
- for (const v of n)
888
- h[p] = s ? s(v, p) : p, c[p] = e(v, p), p++;
889
- let u, S, d = 0, m = r.length - 1, f = 0, _ = c.length - 1;
890
- for (; d <= m && f <= _; )
891
- if (r[d] === null)
892
- d++;
893
- else if (r[m] === null)
894
- m--;
895
- else if (o[d] === h[f])
896
- a[f] = st(r[d], c[f]), d++, f++;
897
- else if (o[m] === h[_])
898
- a[_] = st(r[m], c[_]), m--, _--;
899
- else if (o[d] === h[_])
900
- a[_] = st(r[d], c[_]), Pe(i, r[d], a[_ + 1]), d++, _--;
901
- else if (o[m] === h[f])
902
- a[f] = st(r[m], c[f]), Pe(i, r[m], r[d]), m--, f++;
903
- else if (u === void 0 && (u = Tn(h, f, _), S = Tn(o, d, m)), !u.has(o[d]))
904
- $e(r[d]), d++;
905
- else if (!u.has(o[m]))
906
- $e(r[m]), m--;
907
- else {
908
- const v = S.get(h[f]), H = v !== void 0 ? r[v] : null;
909
- if (H === null) {
910
- const M = $n(i, r[d]);
911
- st(M, c[f]), a[f] = M;
912
- } else
913
- a[f] = st(H, c[f]), Pe(i, H, r[d]), r[v] = null;
914
- f++;
915
- }
916
- for (; f <= _; ) {
917
- const v = $n(i, a[_ + 1]);
918
- st(v, c[f]), a[f++] = v;
823
+ StoreListenerMap: ne,
824
+ connect: pt,
825
+ createStore: bn,
826
+ disconnect: Ba,
827
+ updateStore: It,
828
+ useStore: Xe
829
+ }, Symbol.toStringTag, { value: "Module" })), { assign: Vn, defineProperty: ja, setPrototypeOf: Ja } = Object;
830
+ ja(Symbol, "metadata", { value: Symbol.for("Symbol.metadata") });
831
+ const Ms = (e) => typeof e == "function" && e(), Rt = Symbol.for("gem@sheetToken"), Cn = Symbol.for("gem@update"), Pn = "gem-style-boundary", Ls = "gem@render-error", Ya = Cn, Gn = /* @__PURE__ */ new WeakMap(), Sr = /* @__PURE__ */ new WeakMap(), xi = (e) => [...e.querySelectorAll("[data-gem-reflect]")].map((t) => t.target);
832
+ class Qa {
833
+ constructor(t) {
834
+ T(this, "refSelector");
835
+ T(this, "ele");
836
+ T(this, "ref");
837
+ const n = `ref-${En()}`;
838
+ this.refSelector = `[ref=${n}]`, this.ele = t.internals.shadowRoot || t, this.ref = n;
839
+ }
840
+ get element() {
841
+ for (const t of [this.ele, ...xi(this.ele)]) {
842
+ const n = t.querySelector(this.refSelector);
843
+ if (n) return n;
919
844
  }
920
- for (; d <= m; ) {
921
- const v = r[d++];
922
- v !== null && $e(v);
845
+ }
846
+ get elements() {
847
+ return [this.ele, ...xi(this.ele)].map((t) => [...t.querySelectorAll(this.refSelector)]).flat();
848
+ }
849
+ toString() {
850
+ return this.ref;
851
+ }
852
+ }
853
+ let $r;
854
+ var rt;
855
+ class Xa extends CSSStyleSheet {
856
+ constructor() {
857
+ super(...arguments);
858
+ b(this, rt);
859
+ T(this, "cssText", "");
860
+ }
861
+ get element() {
862
+ return p(this, rt) || (x(this, rt, document.createElement("style")), p(this, rt).textContent = this.cssText, p(this, rt).dataset.gemStyle = ""), p(this, rt);
863
+ }
864
+ replaceSync(n) {
865
+ this.cssText = n, p(this, rt) && (p(this, rt).textContent = n), super.replaceSync(n);
866
+ }
867
+ }
868
+ rt = new WeakMap();
869
+ var Mt, je, Kt, jt;
870
+ class Za {
871
+ constructor(t = "") {
872
+ b(this, Mt, "");
873
+ b(this, je, "");
874
+ // 不需要 GC
875
+ b(this, Kt, /* @__PURE__ */ new Map());
876
+ b(this, jt, /* @__PURE__ */ new Map());
877
+ x(this, je, t);
878
+ }
879
+ setContent(t) {
880
+ x(this, Mt, t);
881
+ }
882
+ getStyle(t) {
883
+ var o;
884
+ const n = t && !((o = t.internals) != null && o.shadowRoot), s = n ? t.constructor : this;
885
+ if (!p(this, Kt).has(s)) {
886
+ const c = new Xa({ media: p(this, je) });
887
+ p(this, Kt).set(s, c);
923
888
  }
924
- kn.set(i, a), Ln.set(i, h);
925
- };
926
- });
927
- /**
928
- * @license
929
- * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
930
- * This code may only be used under the BSD style license found at
931
- * http://polymer.github.io/LICENSE.txt
932
- * The complete set of authors may be found at
933
- * http://polymer.github.io/AUTHORS.txt
934
- * The complete set of contributors may be found at
935
- * http://polymer.github.io/CONTRIBUTORS.txt
936
- * Code distributed by Google as part of the polymer project is also
937
- * subject to an additional IP rights grant found at
938
- * http://polymer.github.io/PATENTS.txt
939
- */
940
- const Te = /* @__PURE__ */ new WeakMap(), Ys = we((n, t) => (e) => {
941
- const s = Te.get(e);
942
- if (Array.isArray(n)) {
943
- if (Array.isArray(s) && s.length === n.length && n.every((i, r) => i === s[r]))
944
- return;
945
- } else if (s === n && (n !== void 0 || Te.has(e)))
946
- return;
947
- e.setValue(t()), Te.set(e, Array.isArray(n) ? Array.from(n) : n);
948
- });
949
- /**
950
- * @license
951
- * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
952
- * This code may only be used under the BSD style license found at
953
- * http://polymer.github.io/LICENSE.txt
954
- * The complete set of authors may be found at
955
- * http://polymer.github.io/AUTHORS.txt
956
- * The complete set of contributors may be found at
957
- * http://polymer.github.io/CONTRIBUTORS.txt
958
- * Code distributed by Google as part of the polymer project is also
959
- * subject to an additional IP rights grant found at
960
- * http://polymer.github.io/PATENTS.txt
961
- */
962
- const ke = /* @__PURE__ */ new WeakMap(), Qn = we((n) => (t) => {
963
- const e = ke.get(t);
964
- if (n === void 0 && t instanceof Xe) {
965
- if (e !== void 0 || !ke.has(t)) {
966
- const s = t.committer.name;
967
- t.committer.element.removeAttribute(s);
889
+ const i = p(this, Kt).get(s);
890
+ if (!p(this, jt).has(i)) {
891
+ let c = p(this, Mt), a = "";
892
+ n && (a = `@scope (${t.tagName}) to (:state(${Pn}) > *)`, c = `${a}{ ${c} }`), i.replaceSync(c), p(this, jt).set(i, a);
968
893
  }
969
- } else
970
- n !== e && t.setValue(n);
971
- ke.set(t, n);
972
- });
973
- var Xn = (n, t, e) => {
974
- if (!t.has(n))
975
- throw TypeError("Cannot " + e);
976
- }, l = (n, t, e) => (Xn(n, t, "read from private field"), e ? e.call(n) : t.get(n)), w = (n, t, e) => {
977
- if (t.has(n))
978
- throw TypeError("Cannot add the same private member more than once");
979
- t instanceof WeakSet ? t.add(n) : t.set(n, e);
980
- }, k = (n, t, e, s) => (Xn(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), ft, Ct, Y, Pt, B, $t, K, Q, Yt, Qt, We, Ie, Ve, Xt, De, Zt, it, qe, te, ee, ne;
981
- function Qs() {
982
- }
983
- function Le(n) {
984
- typeof n == "function" && n();
985
- }
986
- const ce = new qs(), Ue = (n = performance.now()) => {
987
- if (performance.now() > n + 16)
988
- return requestAnimationFrame(Ue);
989
- const t = ce.get();
990
- t && (t(), Ue(n));
894
+ return i;
895
+ }
896
+ // 一般用于主题更新,不支持 layer
897
+ updateStyle() {
898
+ p(this, jt).forEach((t, n) => {
899
+ n.replaceSync(t ? `${t}{${p(this, Mt)}}` : p(this, Mt));
900
+ });
901
+ }
902
+ }
903
+ Mt = new WeakMap(), je = new WeakMap(), Kt = new WeakMap(), jt = new WeakMap();
904
+ function kn(e, t) {
905
+ const n = t ? e : "", s = t || e, i = new Za(n), o = { [Rt]: i };
906
+ let c = "";
907
+ return typeof s == "string" ? c = s : Object.keys(s).forEach((a) => {
908
+ const f = a === "$";
909
+ o[a] = f || a.includes("-") ? a : `${a}-${En()}`, c += `${f ? ":scope,:host" : `.${o[a]}`} {${s[a]}}`;
910
+ }), i.setContent(c), o;
911
+ }
912
+ const Ti = (e, t, n) => {
913
+ let s = !1;
914
+ t.forEach((i) => {
915
+ const o = e.get(i) || 0;
916
+ s || (s = n === 1 && o === 0 || n === -1 && o === 1), e.set(i, o + n);
917
+ }), s && Ot(Sr.get(e));
918
+ }, tc = (e, t) => {
919
+ const n = e.getRootNode();
920
+ if (!Gn.has(n)) {
921
+ const i = /* @__PURE__ */ new Map();
922
+ Gn.set(n, i), Sr.set(i, () => {
923
+ const o = n.adoptedStyleSheets.filter((c) => !i.has(c));
924
+ i.forEach((c, a) => c && o.push(a)), n.adoptedStyleSheets = o.reverse();
925
+ });
926
+ }
927
+ const s = Gn.get(n);
928
+ return Ti(s, t, 1), () => Ti(s, t, -1);
991
929
  };
992
- ce.addEventListener("start", () => I(Ue));
993
- const Kt = Symbol("constructor"), he = Symbol("init"), Zn = Symbol("update"), ts = class Tt extends HTMLElement {
994
- constructor(t = {}) {
995
- super(), w(this, Ct, void 0), w(this, Y, void 0), w(this, Pt, void 0), w(this, B, void 0), w(this, $t, void 0), w(this, K, void 0), w(this, Q, void 0), w(this, Yt, void 0), this.setState = (i) => {
996
- if (!this.state)
997
- throw new tt("`state` not initialized");
998
- Object.assign(this.state, i), I(l(this, it));
999
- }, w(this, Qt, (i) => {
1000
- i == null || i.forEach((r) => {
1001
- const { callback: o, getDep: a, values: c, preCallback: h } = r, p = a == null ? void 0 : a();
1002
- (!a || !c || js(c, p)) && (Le(h), r.preCallback = o(p, c), r.values = p);
1003
- });
1004
- }), w(this, We, () => {
1005
- l(this, Qt).call(this, l(this, K));
1006
- }), w(this, Ie, () => {
1007
- l(this, Qt).call(this, l(this, Q));
1008
- }), this.effect = (i, r) => {
1009
- l(this, K) || k(this, K, []);
1010
- const o = {
1011
- callback: i,
1012
- getDep: r,
1013
- initialized: l(this, B),
1014
- inConstructor: this[Kt]
1015
- };
1016
- l(this, B) && (o.values = r == null ? void 0 : r(), o.preCallback = i(o.values)), l(this, K).push(o);
1017
- }, this.memo = (i, r) => {
1018
- l(this, Q) || k(this, Q, []), l(this, Q).push({
1019
- callback: i,
1020
- getDep: r,
1021
- inConstructor: this[Kt]
1022
- });
1023
- }, w(this, Ve, () => {
1024
- var i;
1025
- (i = l(this, K)) == null || i.forEach((r) => {
1026
- const { callback: o, getDep: a, initialized: c } = r;
1027
- c || (r.values = a == null ? void 0 : a(), r.preCallback = o(r.values), r.initialized = !0);
930
+ let Ns;
931
+ function Oi(e) {
932
+ e == null || e.forEach((t) => {
933
+ const { callback: n, getDep: s, values: i, preCallback: o } = t, c = s == null ? void 0 : s();
934
+ (!s || !i || qa(i, c)) && (Ms(o), t.preCallback = n(c, i), t.values = c, t.initialized = !0);
935
+ });
936
+ }
937
+ function Mi(e) {
938
+ return e.filter((t) => (Ms(t.preCallback), t.initialized = !1, t.values = void 0, t.fixed));
939
+ }
940
+ let As;
941
+ const Ft = new Da(), ts = (e = performance.now()) => {
942
+ if (performance.now() > e + 16) return requestAnimationFrame(ts);
943
+ const t = Ft.get();
944
+ t && (t(), ts(e));
945
+ };
946
+ Ft.addEventListener("start", () => Ot(ts));
947
+ let Dn;
948
+ var Jt, Yt, J, ht, Lt, wt, Qt, ut, Xt, Zt, Je, st, Vt, es, gn, mn, Ye, te, Nt, vn, wn, yn, Qe, ee;
949
+ const qt = class qt extends HTMLElement {
950
+ constructor() {
951
+ super();
952
+ b(this, st);
953
+ b(this, Yt);
954
+ b(this, J);
955
+ b(this, ht, []);
956
+ b(this, Lt, []);
957
+ b(this, wt, []);
958
+ b(this, Qt);
959
+ b(this, ut);
960
+ // not in constructor 的近似值
961
+ b(this, Xt);
962
+ b(this, Zt);
963
+ b(this, Je);
964
+ /**
965
+ * 每次更新完检查依赖,执行对应的副作用回调
966
+ * */
967
+ b(this, gn, () => {
968
+ Oi(p(this, ht));
969
+ });
970
+ b(this, mn, () => {
971
+ Oi(p(this, Lt));
972
+ });
973
+ /**
974
+ * - 条件渲染
975
+ * - 不提供 `render` 时显示子内容
976
+ * - 返回 `null` 时渲染空的子内容
977
+ * - 返回 `undefined` 时不会更新现有内容
978
+ * */
979
+ b(this, Ye, (n) => {
980
+ try {
981
+ x(this, Zt, !0), p(this, mn).call(this);
982
+ const s = p(this, Yt) === this, i = n ? n.render() : s ? void 0 : at`<slot></slot>`;
983
+ if (x(this, Zt, !1), i === void 0) return;
984
+ ks(i, p(this, Yt));
985
+ } catch (s) {
986
+ this.dispatchEvent(new CustomEvent(Ls, { bubbles: !0, composed: !0, detail: s }));
987
+ }
988
+ });
989
+ b(this, te, () => {
990
+ const n = p(this, st, es);
991
+ p(this, ut) && // 当有渲染函数,但是没一个符合条件时跳过
992
+ (n || !p(this, wt).length) && (p(this, Ye).call(this, n), Ot(p(this, gn)));
993
+ });
994
+ b(this, Nt, () => {
995
+ p(this, st, Vt).noBlocking ? Ft.add(p(this, te)) : p(this, te).call(this);
996
+ });
997
+ b(this, vn, () => {
998
+ const { adoptedStyleSheets: n = [] } = p(this, st, Vt), { shadowRoot: s, sheets: i } = p(this, J), o = n.map((c) => c[Rt].getStyle(this));
999
+ if (s)
1000
+ s.adoptedStyleSheets = o.concat(i);
1001
+ else
1002
+ return this.prepend(...i.map((c) => c.element)), tc(this, o);
1003
+ });
1004
+ /**
1005
+ * 元素挂载后执行还未初始化的副作用
1006
+ * */
1007
+ b(this, wn, () => {
1008
+ var n;
1009
+ (n = p(this, ht)) == null || n.forEach((s) => {
1010
+ const { callback: i, getDep: o, initialized: c } = s;
1011
+ c || (s.values = o == null ? void 0 : o(), s.preCallback = i(s.values), s.initialized = !0);
1028
1012
  });
1029
- }), w(this, Xt, () => {
1030
- l(this, Ie).call(this);
1031
- const i = l(this, Ct) === this, r = this.render ? this.render() : i ? void 0 : G`<slot></slot>`;
1032
- r !== void 0 && Kn(r, l(this, Ct));
1033
- }), w(this, De, () => this.shouldUpdate ? this.shouldUpdate() : !0), w(this, Zt, () => {
1034
- l(this, B) && l(this, De).call(this) && (l(this, Xt).call(this), I(l(this, qe)), I(l(this, We)));
1035
- }), w(this, it, () => {
1036
- l(this, $t) ? ce.add(l(this, Zt)) : l(this, Zt).call(this);
1037
- }), this.update = () => {
1038
- I(l(this, it));
1039
- }, w(this, qe, () => {
1040
- var i;
1041
- (i = this.updated) == null || i.call(this);
1042
- }), w(this, te, void 0), w(this, ee, () => {
1043
- var o, a, c;
1044
- if (l(this, Pt)) {
1045
- k(this, Pt, !1);
1013
+ });
1014
+ b(this, yn, () => {
1015
+ var n;
1016
+ this.willMount && this.memo(this.willMount.bind(this), () => []), this.mounted && this.effect(this.mounted.bind(this), () => []), this.updated && this.effect((s, i) => i && this.updated.apply(this)), this.unmounted && this.effect(
1017
+ () => this.unmounted.bind(this),
1018
+ () => []
1019
+ ), !p(this, wt).length && this.render && p(this, wt).push({ render: this.render.bind(this), condition: (n = this.shouldUpdate) == null ? void 0 : n.bind(this) });
1020
+ });
1021
+ b(this, Qe);
1022
+ b(this, ee, async () => {
1023
+ if (p(this, Qt)) {
1024
+ x(this, Qt, !1);
1046
1025
  return;
1047
1026
  }
1048
- Reflect.set(this, Kt, !1), (o = this.willMount) == null || o.call(this);
1049
- const { observedStores: i, rootElement: r } = this.constructor;
1050
- if (k(this, te, i == null ? void 0 : i.map((h) => ct(h, l(this, it)))), l(this, Xt).call(this), k(this, B, !0), k(this, Yt, (a = this.mounted) == null ? void 0 : a.call(this)), l(this, Ve).call(this), r && this.isConnected && ((c = this.getRootNode().host) == null ? void 0 : c.tagName) !== r.toUpperCase())
1051
- throw new tt("not allow current root type");
1052
- }), w(this, ne, (i) => i == null ? void 0 : i.filter((r) => (Le(r.preCallback), r.initialized = !1, r.inConstructor))), I(() => Reflect.set(this, he, !1)), Reflect.set(this, Kt, !0), Reflect.set(this, he, !0), Reflect.set(this, Zn, () => {
1053
- l(this, B) && I(l(this, it));
1054
- }), k(this, $t, t.isAsync), k(this, Ct, t.isLight ? this : this.attachShadow({
1055
- mode: t.mode || "open",
1056
- delegatesFocus: t.delegatesFocus,
1057
- slotAssignment: t.slotAssignment
1058
- }));
1059
- let e;
1060
- this.effect(
1061
- ([i = !1]) => {
1062
- if (e === void 0 && (e = this.hasAttribute("tabindex")), this.internals.ariaDisabled = String(i), t.focusable && !e && (this.tabIndex = -Number(i)), (t.focusable || t.delegatesFocus) && i)
1063
- return Jn(this, "click", (r) => r.isTrusted && r.stopImmediatePropagation(), {
1027
+ p(this, yn).call(this);
1028
+ const { observedStores: n } = p(this, st, Vt);
1029
+ x(this, Xt, !0), x(this, Qe, n == null ? void 0 : n.map((s) => pt(s, p(this, Nt)))), p(this, Ye).call(this, p(this, st, es)), x(this, ut, !0), x(this, Je, p(this, vn).call(this)), await Promise.resolve(), p(this, wn).call(this);
1030
+ });
1031
+ /**
1032
+ * @helper
1033
+ * 记录副作用回调和值;
1034
+ * 回调到返回值如果是函数将再卸载时执行;
1035
+ * 第一次执行时 `oldDeps` 为空;
1036
+ *
1037
+ * ```js
1038
+ * class App extends GemElement {
1039
+ * mounted() {
1040
+ * this.effect(callback, () => [this.attrName]);
1041
+ * }
1042
+ * }
1043
+ * ```
1044
+ * */
1045
+ T(this, "effect", (n, s) => {
1046
+ const i = {
1047
+ callback: n,
1048
+ getDep: s,
1049
+ initialized: p(this, ut),
1050
+ fixed: !p(this, Xt)
1051
+ };
1052
+ p(this, ut) && (i.values = s == null ? void 0 : s(), i.preCallback = n(i.values)), p(this, ht).push(i);
1053
+ });
1054
+ /**
1055
+ * @helper
1056
+ * 在 `render` 前执行回调;
1057
+ * 和 `effect` 一样接受依赖数组参数,在 `constructor` 中使用;
1058
+ * 第一次执行时 `oldDeps` 为空;
1059
+ *
1060
+ * ```js
1061
+ * class App extends GemElement {
1062
+ * constructor() {
1063
+ * super();
1064
+ * this.memo(() => {
1065
+ * this.a = exec(this.attrName);
1066
+ * }), () => [this.attrName]);
1067
+ * }
1068
+ * }
1069
+ * ```
1070
+ * */
1071
+ T(this, "memo", (n, s) => {
1072
+ p(this, Lt).push({
1073
+ callback: n,
1074
+ getDep: s,
1075
+ fixed: !p(this, Xt)
1076
+ });
1077
+ });
1078
+ /**
1079
+ * @helper
1080
+ * async
1081
+ */
1082
+ T(this, "update", () => Ot(p(this, Nt)));
1083
+ Dn = this;
1084
+ const { mode: n, serializable: s, delegatesFocus: i, slotAssignment: o, aria: c } = p(this, st, Vt), { focusable: a, ...f } = c || {};
1085
+ x(this, Yt, n ? this.attachShadow({ mode: n, serializable: s, delegatesFocus: i, slotAssignment: o }) : this), x(this, J, this.attachInternals()), p(this, J).stateList = [], p(this, J).sheets = [], Vn(p(this, J), f), n || p(this, J).states.add(Pn);
1086
+ let h;
1087
+ p(this, ht).push({
1088
+ fixed: !0,
1089
+ getDep: () => [this.disabled],
1090
+ callback: ([m = !1]) => {
1091
+ if (h === void 0 && (h = this.hasAttribute("tabindex")), p(this, J).ariaDisabled = String(m), a && !h && (this.tabIndex = -Number(m)), (a || i) && m)
1092
+ return wr(this, "click", (r) => r.isTrusted && r.stopImmediatePropagation(), {
1064
1093
  capture: !0
1065
1094
  });
1066
- },
1067
- () => [Reflect.get(this, "disabled")]
1068
- );
1069
- const { adoptedStyleSheets: s } = new.target;
1070
- if (s) {
1071
- const i = s.map((r) => r[Yn] || r);
1072
- this.shadowRoot ? this.shadowRoot.adoptedStyleSheets = i : this.effect(
1073
- () => {
1074
- const r = this.getRootNode();
1075
- return r.adoptedStyleSheets = [...r.adoptedStyleSheets, ...i], () => {
1076
- r.adoptedStyleSheets = Fs(r.adoptedStyleSheets, i);
1077
- };
1078
- },
1079
- () => []
1080
- );
1081
- }
1082
- }
1083
- get internals() {
1084
- if (!l(this, Y)) {
1085
- k(this, Y, this.attachInternals());
1086
- try {
1087
- l(this, Y).states.add("foo"), l(this, Y).states.delete("foo");
1088
- } catch {
1089
- Reflect.defineProperty(l(this, Y), "states", {
1090
- value: {
1091
- has: (t) => ot(t) in this.dataset,
1092
- add: (t) => this.dataset[ot(t)] = "",
1093
- delete: (t) => delete this.dataset[ot(t)]
1094
- }
1095
- });
1096
1095
  }
1097
- }
1098
- return l(this, Y);
1096
+ });
1099
1097
  }
1100
- /**
1101
- * @private
1102
- * @final
1103
- * use `effect`
1104
- */
1105
- attributeChangedCallback() {
1106
- return l(this, B) && I(l(this, it)), l(Tt, ft);
1098
+ [Ya]() {
1099
+ p(this, ut) && Ot(p(this, Nt));
1107
1100
  }
1108
- closestElement(t) {
1109
- const e = typeof t == "function", s = typeof t == "string" && t.toUpperCase(), i = (r) => {
1110
- const o = r.parentElement || r.getRootNode().host;
1111
- if (!o)
1112
- return null;
1113
- if (e) {
1114
- if (o.constructor === t)
1115
- return o;
1116
- } else if (o.tagName === s)
1117
- return o;
1118
- return i(o);
1119
- };
1120
- return i(this);
1101
+ get internals() {
1102
+ return p(this, J);
1121
1103
  }
1122
1104
  /**
1123
1105
  * @private
1124
1106
  * @final
1125
- * use `mounted`; 允许手动调用 `connectedCallback` 以清除装饰器定义的字段
1107
+ * use `mounted`
1126
1108
  */
1127
1109
  connectedCallback() {
1128
- return this.isConnected && l(this, $t) ? ce.add(l(this, ee)) : l(this, ee).call(this), l(Tt, ft);
1110
+ return p(this, st, Vt).noBlocking ? Ft.add(p(this, ee)) : p(this, ee).call(this), p(qt, Jt);
1129
1111
  }
1130
1112
  /**
1131
1113
  * @private
1132
1114
  * @final
1133
1115
  */
1134
1116
  adoptedCallback() {
1135
- return l(Tt, ft);
1117
+ return p(qt, Jt);
1136
1118
  }
1137
1119
  /**
1138
1120
  * @private
@@ -1140,653 +1122,856 @@ const Kt = Symbol("constructor"), he = Symbol("init"), Zn = Symbol("update"), ts
1140
1122
  * use `unmounted`
1141
1123
  */
1142
1124
  disconnectedCallback() {
1143
- var t, e;
1125
+ var n;
1144
1126
  if (this.isConnected) {
1145
- k(this, Pt, !0);
1127
+ x(this, Qt, !0);
1146
1128
  return;
1147
1129
  }
1148
- return k(this, B, !1), (t = l(this, te)) == null || t.forEach((s) => s()), Le(l(this, Yt)), (e = this.unmounted) == null || e.call(this), k(this, K, l(this, ne).call(this, l(this, K))), k(this, Q, l(this, ne).call(this, l(this, Q))), l(Tt, ft);
1130
+ return Ft.delete(p(this, ee)), Ft.delete(p(this, te)), x(this, ut, !1), (n = p(this, Qe)) == null || n.forEach((s) => s()), x(this, ht, Mi(p(this, ht))), x(this, Lt, Mi(p(this, Lt))), Ms(p(this, Je)), p(qt, Jt);
1149
1131
  }
1150
1132
  };
1151
- ft = /* @__PURE__ */ new WeakMap();
1152
- Ct = /* @__PURE__ */ new WeakMap();
1153
- Y = /* @__PURE__ */ new WeakMap();
1154
- Pt = /* @__PURE__ */ new WeakMap();
1155
- B = /* @__PURE__ */ new WeakMap();
1156
- $t = /* @__PURE__ */ new WeakMap();
1157
- K = /* @__PURE__ */ new WeakMap();
1158
- Q = /* @__PURE__ */ new WeakMap();
1159
- Yt = /* @__PURE__ */ new WeakMap();
1160
- Qt = /* @__PURE__ */ new WeakMap();
1161
- We = /* @__PURE__ */ new WeakMap();
1162
- Ie = /* @__PURE__ */ new WeakMap();
1163
- Ve = /* @__PURE__ */ new WeakMap();
1164
- Xt = /* @__PURE__ */ new WeakMap();
1165
- De = /* @__PURE__ */ new WeakMap();
1166
- Zt = /* @__PURE__ */ new WeakMap();
1167
- it = /* @__PURE__ */ new WeakMap();
1168
- qe = /* @__PURE__ */ new WeakMap();
1169
- te = /* @__PURE__ */ new WeakMap();
1170
- ee = /* @__PURE__ */ new WeakMap();
1171
- ne = /* @__PURE__ */ new WeakMap();
1172
- w(ts, ft, Symbol());
1173
- let A = ts;
1174
- const le = new Us();
1175
- function nn(n, t, e) {
1176
- const { booleanAttributes: s, numberAttributes: i } = n.constructor;
1177
- Object.defineProperty(n, t, {
1178
- configurable: !0,
1179
- get() {
1180
- if (!(he in this))
1181
- return;
1182
- const o = this.getAttribute(e);
1183
- return s != null && s.has(e) ? o !== null : i != null && i.has(e) ? Number(o) : o || "";
1184
- },
1185
- set(r) {
1186
- const o = this, a = le.get(this), c = a[t], h = o.getAttribute(e);
1187
- if (this[he] && h !== null && !c)
1188
- return;
1189
- a[t] = !0;
1190
- const p = s == null ? void 0 : s.has(e);
1191
- r == null ? o.removeAttribute(e) : p ? o.toggleAttribute(e, !!r) : h !== String(r) && o.setAttribute(e, String(r));
1192
- }
1193
- });
1133
+ Jt = new WeakMap(), Yt = new WeakMap(), J = new WeakMap(), ht = new WeakMap(), Lt = new WeakMap(), wt = new WeakMap(), Qt = new WeakMap(), ut = new WeakMap(), Xt = new WeakMap(), Zt = new WeakMap(), Je = new WeakMap(), st = new WeakSet(), Vt = function() {
1134
+ return this.constructor[Symbol.metadata];
1135
+ }, es = function() {
1136
+ return p(this, wt).find((n) => !n.condition || n.condition());
1137
+ }, gn = new WeakMap(), mn = new WeakMap(), Ye = new WeakMap(), te = new WeakMap(), Nt = new WeakMap(), vn = new WeakMap(), wn = new WeakMap(), yn = new WeakMap(), Qe = new WeakMap(), ee = new WeakMap(), // 禁止覆盖自定义元素原生生命周期方法
1138
+ // https://github.com/microsoft/TypeScript/issues/21388#issuecomment-934345226
1139
+ b(qt, Jt, Symbol()), Ns = (n) => {
1140
+ const s = Dn, i = (o) => {
1141
+ Vn(i, o), p(s, Zt) || Ot(p(s, Nt));
1142
+ };
1143
+ return Ja(i, null), delete i.name, delete i.length, p(s, J).stateList.push(i), Vn(i, n), i;
1144
+ }, $r = () => new Qa(Dn), As = (n, s) => p(n, wt).push(s);
1145
+ let B = qt;
1146
+ const ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1147
+ __proto__: null,
1148
+ BoundaryCSSState: Pn,
1149
+ GemElement: B,
1150
+ RenderErrorEvent: Ls,
1151
+ SVGTemplateResult: fr,
1152
+ SheetToken: Rt,
1153
+ TemplateResult: $n,
1154
+ UpdateToken: Cn,
1155
+ createCSSSheet: kn,
1156
+ get createRef() {
1157
+ return $r;
1158
+ },
1159
+ get createState() {
1160
+ return Ns;
1161
+ },
1162
+ get createTemplate() {
1163
+ return As;
1164
+ },
1165
+ directive: Sn,
1166
+ html: at,
1167
+ render: ks,
1168
+ svg: Ga
1169
+ }, Symbol.toStringTag, { value: "Module" })), nc = "0.0.0", sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1170
+ __proto__: null,
1171
+ version: nc
1172
+ }, Symbol.toStringTag, { value: "Module" })), { deleteProperty: ic, getOwnPropertyDescriptor: Er, defineProperty: xn } = Reflect, { getPrototypeOf: Pt, assign: br } = Object, Li = new Fa();
1173
+ function Et(e, t, n) {
1174
+ const s = e.metadata;
1175
+ if (!Er(s, t)) {
1176
+ const i = new Set(s[t]);
1177
+ i.delete(n), xn(s, t, {
1178
+ value: [...i]
1179
+ });
1180
+ }
1181
+ s[t].push(n);
1182
+ }
1183
+ function Tn(e, t) {
1184
+ const { value: n } = Er(e, t);
1185
+ ic(e, t), e[t] = n;
1194
1186
  }
1195
- const Nn = Symbol("event handle");
1196
- function Dt(n, t, e, s) {
1197
- Object.defineProperty(n, t, {
1187
+ const Fe = /* @__PURE__ */ new WeakMap(), { setAttribute: Cr, toggleAttribute: rc, removeAttribute: Pr } = Element.prototype;
1188
+ B.prototype.setAttribute = function(e, t) {
1189
+ var s;
1190
+ const n = (s = Fe.get(Pt(this))) == null ? void 0 : s.get(e);
1191
+ if (!n) return Cr.call(this, e, t);
1192
+ this[n] = t;
1193
+ };
1194
+ B.prototype.removeAttribute = function(e) {
1195
+ var n;
1196
+ const t = (n = Fe.get(Pt(this))) == null ? void 0 : n.get(e);
1197
+ if (!t) return Pr.call(this, e);
1198
+ this[t] = null;
1199
+ };
1200
+ B.prototype.toggleAttribute = function(e, t) {
1201
+ var s;
1202
+ const n = (s = Fe.get(Pt(this))) == null ? void 0 : s.get(e);
1203
+ return n ? this[n] = t ?? !this.hasAttribute(e) : rc.call(this, e, t);
1204
+ };
1205
+ function oc() {
1206
+ }
1207
+ const Ni = Symbol("event handle");
1208
+ function Is(e, t, { attr: n, attrType: s, event: i, eventOptions: o } = {}) {
1209
+ xn(e, t, {
1198
1210
  configurable: !0,
1199
1211
  get() {
1200
- const i = le.get(this)[t];
1201
- return i || !e ? i : (this[t] = Qs, this[t]);
1212
+ const c = Li.get(this)[t];
1213
+ return i && !c ? (this[t] = oc, this[t]) : c;
1202
1214
  },
1203
- set(i) {
1204
- const r = this, o = le.get(r);
1205
- i !== o[t] && (e ? (o[t] = i != null && i[Nn] ? i : (a, c) => {
1206
- const h = new CustomEvent(e, { ...c, ...s, detail: a });
1207
- r.dispatchEvent(h), i(a, c);
1208
- }, Reflect.set(o[t], Nn, !0)) : (o[t] = i, this[Zn]()));
1215
+ set(c) {
1216
+ const a = this, f = Li.get(a);
1217
+ n && (c = s === Boolean && c === "" ? !0 : s(c || ""), c ? Cr.call(this, n, s === Boolean ? "" : c) : Pr.call(this, n)), c !== f[t] && (i ? (f[t] = c != null && c[Ni] ? c : (h, m) => {
1218
+ const r = new CustomEvent(i, { ...m, ...o, detail: h });
1219
+ a.dispatchEvent(r), c(h, m);
1220
+ }, f[t][Ni] = !0) : (f[t] = c, this[Cn]()));
1209
1221
  }
1210
1222
  });
1211
1223
  }
1212
- function sn(n, t, e) {
1213
- Object.defineProperty(n, t, {
1214
- configurable: !0,
1215
- get() {
1216
- const s = le.get(this);
1217
- let i = s[t];
1218
- if (!i) {
1219
- const r = this, o = r.shadowRoot || r;
1220
- i = {
1221
- get ref() {
1222
- return e;
1223
- },
1224
- get element() {
1225
- const a = [...o.querySelectorAll("[data-gem-reflect]")].map((c) => c.target);
1226
- for (const c of [o, ...a]) {
1227
- const h = c.querySelector(`[ref=${e}]`);
1228
- if (h)
1229
- return h;
1230
- }
1231
- }
1232
- }, s[t] = i;
1233
- }
1234
- return i;
1224
+ function Rs(e, t) {
1225
+ const n = e.name, s = oe(n);
1226
+ return e.addInitializer(function() {
1227
+ const i = Pt(this);
1228
+ if (!i.hasOwnProperty(n)) {
1229
+ Et(e, "observedAttributes", s), Is(i, n, { attr: s, attrType: t });
1230
+ const o = Fe.get(i) || /* @__PURE__ */ new Map();
1231
+ o.set(s, n), Fe.set(i, o);
1235
1232
  }
1236
- });
1233
+ Tn(this, n);
1234
+ }), function(i) {
1235
+ return this.getAttribute(s) ?? i;
1236
+ };
1237
+ }
1238
+ function G(e, t) {
1239
+ return Rs(t, String);
1240
+ }
1241
+ function On(e, t) {
1242
+ return Rs(t, Boolean);
1237
1243
  }
1238
- function rn(n, t, e) {
1239
- Object.defineProperty(n, t, {
1244
+ function ac(e, t) {
1245
+ return Rs(t, Number);
1246
+ }
1247
+ function U(e, t) {
1248
+ const n = t.name;
1249
+ return t.addInitializer(function() {
1250
+ const s = Pt(this);
1251
+ s.hasOwnProperty(n) || (Et(t, "observedProperties", n), Is(s, n)), Tn(this, n);
1252
+ }), function(s) {
1253
+ return this[n] ?? s;
1254
+ };
1255
+ }
1256
+ function kr(e) {
1257
+ return function(t, n) {
1258
+ const { addInitializer: s, name: i, access: o, kind: c } = n;
1259
+ s(function() {
1260
+ const a = e && (() => e(this));
1261
+ if (c === "getter") {
1262
+ if (n.private) throw new yt("not support");
1263
+ this.memo(() => xn(this, i, { configurable: !0, value: o.get(this) }), a);
1264
+ } else
1265
+ this.memo(o.get(this).bind(this), a);
1266
+ });
1267
+ };
1268
+ }
1269
+ function $t(e) {
1270
+ return function(t, { addInitializer: n, access: s }) {
1271
+ n(function() {
1272
+ this.effect(s.get(this).bind(this), e && (() => e(this)));
1273
+ });
1274
+ };
1275
+ }
1276
+ function cc() {
1277
+ return function(e, { addInitializer: t, access: n }) {
1278
+ t(function() {
1279
+ this.effect(
1280
+ () => n.get(this).bind(this),
1281
+ () => []
1282
+ );
1283
+ });
1284
+ };
1285
+ }
1286
+ function Mn() {
1287
+ return kr(() => []);
1288
+ }
1289
+ function qe() {
1290
+ return $t(() => []);
1291
+ }
1292
+ function xr(e) {
1293
+ return function(t, { addInitializer: n, access: s }) {
1294
+ n(function() {
1295
+ As(this, {
1296
+ render: s.get(this).bind(this),
1297
+ condition: e && (() => e(this))
1298
+ });
1299
+ });
1300
+ };
1301
+ }
1302
+ function lc() {
1303
+ return function(e, { addInitializer: t, access: n }) {
1304
+ t(function() {
1305
+ this.addEventListener(Ls, ({ detail: s }) => {
1306
+ ks(n.get(this).apply(this, [s]), this.internals.shadowRoot || this);
1307
+ });
1308
+ });
1309
+ };
1310
+ }
1311
+ function hc(e, t, n) {
1312
+ xn(e, t, {
1240
1313
  configurable: !0,
1241
1314
  get() {
1242
1315
  const s = this, { states: i } = s.internals;
1243
- return i == null ? void 0 : i.has(e);
1316
+ return i == null ? void 0 : i.has(n);
1244
1317
  },
1245
1318
  set(s) {
1246
- const i = this, { states: r } = i.internals;
1247
- s ? r == null || r.add(e) : r == null || r.delete(e);
1319
+ const i = this, { states: o } = i.internals;
1320
+ s ? o == null || o.add(n) : o == null || o.delete(n);
1248
1321
  }
1249
1322
  });
1250
1323
  }
1251
- const on = customElements.define.bind(customElements);
1252
- customElements.define = (n, t, e) => {
1253
- if (t.prototype instanceof A) {
1254
- const { observedAttributes: s, observedProperties: i, defineEvents: r, defineCSSStates: o, defineRefs: a } = t;
1255
- s == null || s.forEach((c) => nn(t.prototype, ot(c), c)), i == null || i.forEach((c) => Dt(t.prototype, c)), r == null || r.forEach((c) => Dt(t.prototype, ot(c), c)), o == null || o.forEach((c) => rn(t.prototype, ot(c), c)), a == null || a.forEach((c) => sn(t.prototype, ot(c), c));
1256
- }
1257
- on(n, t, e);
1258
- };
1259
- window.__GEM_DEVTOOLS__HOOK__ && Object.assign(window.__GEM_DEVTOOLS__HOOK__, { ...Ts, ...zs });
1260
- function D(n, t, e, s = !1) {
1261
- const i = n.constructor, r = i[t];
1262
- i.hasOwnProperty(t) || Object.defineProperty(i, t, {
1263
- value: s ? new Set(r) : r ? Array.from(r) : []
1264
- }), i[t][s ? "add" : "push"](e);
1265
- }
1266
- function zi(n, t) {
1267
- const e = `${j(t)}-${ve()}`;
1268
- D(n, "defineRefs", e), sn(n, t, e);
1269
- }
1270
- function an(n, t, e) {
1271
- D(n, "observedAttributes", e), nn(n, t, e);
1272
- }
1273
- function C(n, t) {
1274
- an(n, t, j(t));
1275
- }
1276
- function es(n, t) {
1277
- const e = j(t);
1278
- D(n, "booleanAttributes", e, !0), an(n, t, e);
1324
+ function Ln(e, t) {
1325
+ t.addInitializer(function() {
1326
+ const n = Pt(this), s = t.name;
1327
+ if (!n.hasOwnProperty(s)) {
1328
+ const i = oe(s);
1329
+ Et(t, "definedCSSStates", i), hc(n, s, i);
1330
+ }
1331
+ Tn(this, s);
1332
+ });
1279
1333
  }
1280
- function Ji(n, t) {
1281
- const e = j(t);
1282
- D(n, "numberAttributes", e, !0), an(n, t, e);
1334
+ function Tr(e, t, n, s) {
1335
+ const i = e.name, o = oe(i);
1336
+ if (e.static)
1337
+ Et(e, n, o);
1338
+ else {
1339
+ const c = Pt(t);
1340
+ c[i] || (c[i] = o, Et(e, n, o));
1341
+ }
1342
+ return s || o;
1283
1343
  }
1284
- function N(n, t) {
1285
- D(n, "observedProperties", t), Dt(n, t);
1344
+ function uc(e, t) {
1345
+ return function(n) {
1346
+ return Tr(t, this, "definedSlots", n);
1347
+ };
1286
1348
  }
1287
- function cn(n, t) {
1288
- const e = j(t);
1289
- D(n, "defineCSSStates", e), rn(n, t, e);
1349
+ function Or(e, t) {
1350
+ return function(n) {
1351
+ return Tr(t, this, "definedParts", n);
1352
+ };
1290
1353
  }
1291
- function Yi(n, t) {
1292
- const e = j(n[t] || t);
1293
- n[t] = e, D(n instanceof A ? n : n.prototype, "defineSlots", e);
1354
+ function ye(e, t) {
1355
+ t.addInitializer(function() {
1356
+ Mr(t, this, t.name);
1357
+ });
1294
1358
  }
1295
- function Xs(n, t) {
1296
- const e = j(n[t] || t);
1297
- n[t] = e, D(n instanceof A ? n : n.prototype, "defineParts", e);
1359
+ function dc(e, t) {
1360
+ t.addInitializer(function() {
1361
+ Mr(t, this, t.name, { bubbles: !0, composed: !0 });
1362
+ });
1298
1363
  }
1299
- function Se(n, t) {
1300
- ns(n, t);
1364
+ function Mr(e, t, n, s) {
1365
+ const i = Pt(t);
1366
+ if (!i.hasOwnProperty(n)) {
1367
+ const o = oe(n);
1368
+ Et(e, "definedEvents", o), Is(i, n, { event: o, eventOptions: s });
1369
+ }
1370
+ Tn(t, n);
1301
1371
  }
1302
- function Qi(n, t) {
1303
- ns(n, t, { bubbles: !0, composed: !0 });
1372
+ function Hs(e) {
1373
+ return function(t, n) {
1374
+ Et(n, "adoptedStyleSheets", e);
1375
+ };
1304
1376
  }
1305
- function ns(n, t, e) {
1306
- const s = j(t);
1307
- D(n, "defineEvents", s), Dt(n, t, s, e);
1377
+ function Nn(e) {
1378
+ return function(t, n) {
1379
+ Et(n, "observedStores", e);
1380
+ };
1308
1381
  }
1309
- function Xi(n) {
1310
- return function(t) {
1311
- D(t.prototype, "adoptedStyleSheets", n);
1382
+ function Ht({
1383
+ mode: e = "open",
1384
+ serializable: t = !0,
1385
+ delegatesFocus: n,
1386
+ slotAssignment: s
1387
+ } = {}) {
1388
+ return function(i, o) {
1389
+ const c = o.metadata;
1390
+ br(c, { mode: e, serializable: t, delegatesFocus: n, slotAssignment: s });
1312
1391
  };
1313
1392
  }
1314
- function hn(n) {
1315
- return function(t) {
1316
- D(t.prototype, "observedStores", n);
1393
+ function pc() {
1394
+ return function(e, t) {
1395
+ const n = t.metadata;
1396
+ n.noBlocking = !0;
1317
1397
  };
1318
1398
  }
1319
- function Zi(n) {
1320
- return function(t) {
1321
- const e = t;
1322
- e.rootElement = n;
1399
+ function An(e) {
1400
+ return function(t, n) {
1401
+ const s = n.metadata;
1402
+ s.aria = { ...s.aria, ...e };
1323
1403
  };
1324
1404
  }
1325
- function tr(n) {
1326
- return function(t) {
1327
- on(n, t);
1405
+ function fc(e) {
1406
+ return function(t, { addInitializer: n }) {
1407
+ n(function() {
1408
+ customElements.define(e, t);
1409
+ });
1328
1410
  };
1329
1411
  }
1330
- const O = window.history, ss = O.pushState.bind(O), is = O.replaceState.bind(O);
1331
- let Zs = 0;
1332
- const ln = () => `${performance.now()}-${++Zs}`, [E, pt] = en({
1412
+ window.__GEM_DEVTOOLS__HOOK__ && !window.__GEM_DEVTOOLS__HOOK__.GemElement && br(window.__GEM_DEVTOOLS__HOOK__, {
1413
+ ...ec,
1414
+ ...Oa,
1415
+ ...Ka,
1416
+ ...sc
1417
+ });
1418
+ const Y = window.history, Lr = Y.pushState.bind(Y), Nr = Y.replaceState.bind(Y);
1419
+ let _c = 0;
1420
+ const Ws = () => `${performance.now()}-${++_c}`, [I, Ut] = Xe({
1333
1421
  $hasCloseHandle: !1,
1334
1422
  $hasOpenHandle: !1,
1335
1423
  $hasShouldCloseHandle: !1,
1336
1424
  $key: ""
1337
- }), $ = /* @__PURE__ */ new Map();
1338
- function rs(n) {
1339
- const { $key: t, $hasCloseHandle: e, $hasOpenHandle: s, $hasShouldCloseHandle: i } = n || {};
1340
- if (E.$key !== t) {
1341
- if (t)
1342
- throw new tt("`$key` is not allowed");
1343
- if (e)
1344
- throw new tt("`$hasCloseHandle` is not allowed");
1345
- if (s)
1346
- throw new tt("`$hasOpenHandle` is not allowed");
1347
- if (i)
1348
- throw new tt("`$hasShouldCloseHandle` is not allowed");
1425
+ }), q = /* @__PURE__ */ new Map();
1426
+ function Ar(e) {
1427
+ const { $key: t, $hasCloseHandle: n, $hasOpenHandle: s, $hasShouldCloseHandle: i } = e || {};
1428
+ if (I.$key !== t) {
1429
+ if (t) throw new yt("`$key` is not allowed");
1430
+ if (n) throw new yt("`$hasCloseHandle` is not allowed");
1431
+ if (s) throw new yt("`$hasOpenHandle` is not allowed");
1432
+ if (i) throw new yt("`$hasShouldCloseHandle` is not allowed");
1349
1433
  }
1350
1434
  }
1351
- function os(n) {
1352
- return R.basePath ? R.basePath + n : n;
1435
+ function Ir(e) {
1436
+ return Q.basePath ? Q.basePath + e : e;
1353
1437
  }
1354
- function Ge(n) {
1355
- return n === R.basePath ? "/" : n.replace(new RegExp(`^${R.basePath}/`), "/");
1438
+ function ns(e) {
1439
+ return e === Q.basePath ? "/" : e.replace(new RegExp(`^${Q.basePath}/`), "/");
1356
1440
  }
1357
- function un() {
1358
- R.dispatchEvent(new CustomEvent("beforechange"));
1441
+ function zs() {
1442
+ Q.dispatchEvent(new CustomEvent("beforechange"));
1359
1443
  }
1360
- function ue(n) {
1361
- const t = $.get(E.$key) || { path: Ge(location.pathname), query: new It() }, e = n.path ? zn(t.path, n.path) : Ge(location.pathname), s = new It(n.query ?? (n.path ? "" : location.search)), i = String(s) !== String(t.query), r = i ? s : t.query, o = e !== t.path || i, a = n.title || (o ? "" : document.title), c = n.close || n.data || n.open || n.shouldClose, h = decodeURIComponent(n.hash ?? (!o && c ? location.hash : ""));
1362
- return { ...n, title: a, path: e, query: r, hash: h };
1444
+ function dn(e) {
1445
+ const t = q.get(I.$key) || { path: ns(location.pathname), query: new De() }, n = e.path ? vr(t.path, e.path) : ns(location.pathname), s = new De(e.query ?? (e.path ? "" : location.search)), i = String(s) !== String(t.query), o = i ? s : t.query, c = n !== t.path || i, a = e.title || (c ? "" : document.title), f = e.close || e.data || e.open || e.shouldClose, h = decodeURIComponent(e.hash ?? (!c && f ? location.hash : ""));
1446
+ return { ...e, title: a, path: n, query: o, hash: h };
1363
1447
  }
1364
- function Mn(n, t) {
1365
- rs(n.data);
1366
- const e = ue(n), { title: s, path: i, query: r, hash: o, close: a, open: c, shouldClose: h, data: p } = e, u = {
1448
+ function Ai(e, t) {
1449
+ Ar(e.data);
1450
+ const n = dn(e), { title: s, path: i, query: o, hash: c, close: a, open: f, shouldClose: h, data: m } = n, r = {
1367
1451
  $hasCloseHandle: !!a,
1368
- $hasOpenHandle: !!c,
1452
+ $hasOpenHandle: !!f,
1369
1453
  $hasShouldCloseHandle: !!h,
1370
- $key: ln(),
1454
+ $key: Ws(),
1371
1455
  $title: s,
1372
- ...p
1456
+ ...m
1373
1457
  };
1374
- $.set(u.$key, e), un(), Ze(E), pt(u);
1375
- const S = os(i) + new It(r) + o, d = decodeURIComponent(location.hash);
1376
- t(u, s, S), d !== o && window.dispatchEvent(new CustomEvent("hashchange"));
1458
+ q.set(r.$key, n), zs(), Ts(I), Ut(r);
1459
+ const _ = Ir(i) + new De(o) + c, l = decodeURIComponent(location.hash);
1460
+ t(r, s, _), l !== c && window.dispatchEvent(new CustomEvent("hashchange"));
1377
1461
  }
1378
- function On(n, t, e, s) {
1379
- rs(n);
1462
+ function Ii(e, t, n, s) {
1463
+ Ar(e);
1380
1464
  const i = {
1381
- $key: ln(),
1465
+ $key: Ws(),
1382
1466
  $title: t,
1383
- ...n || {}
1384
- }, { pathname: r, search: o, hash: a } = new URL(e, location.origin + location.pathname), c = ue({ path: r, query: new It(o), hash: a, title: t, data: n });
1385
- $.set(i.$key, c), un(), Ze(E), pt(i);
1386
- const h = os(r) + c.query + a, p = location.hash;
1387
- s(i, t, h), p !== a && window.dispatchEvent(new CustomEvent("hashchange"));
1467
+ ...e || {}
1468
+ }, { pathname: o, search: c, hash: a } = new URL(n, location.origin + location.pathname), f = dn({ path: o, query: new De(c), hash: a, title: t, data: e });
1469
+ q.set(i.$key, f), zs(), Ts(I), Ut(i);
1470
+ const h = Ir(o) + f.query + a, m = location.hash;
1471
+ s(i, t, h), m !== a && window.dispatchEvent(new CustomEvent("hashchange"));
1388
1472
  }
1389
- const [as, ti] = en({
1473
+ const [Rr, gc] = Xe({
1390
1474
  basePath: ""
1391
1475
  });
1392
- class ei extends EventTarget {
1476
+ class mc extends EventTarget {
1393
1477
  get store() {
1394
- return E;
1478
+ return I;
1395
1479
  }
1396
1480
  get currentKey() {
1397
- return E.$key;
1481
+ return I.$key;
1398
1482
  }
1399
1483
  get basePath() {
1400
- return as.basePath;
1484
+ return Rr.basePath;
1401
1485
  }
1402
1486
  set basePath(t) {
1403
- ti({ basePath: t }), Object.assign($.get(E.$key), { path: Ge(location.pathname) });
1487
+ gc({ basePath: t }), Object.assign(q.get(I.$key), { path: ns(location.pathname) });
1404
1488
  }
1405
1489
  getParams() {
1406
- return $.get(E.$key);
1490
+ return q.get(I.$key);
1407
1491
  }
1408
1492
  updateParams(t) {
1409
- Object.assign($.get(E.$key), t), pt();
1493
+ Object.assign(q.get(I.$key), t), Ut();
1410
1494
  }
1411
1495
  push(t) {
1412
- Mn(t, ss);
1496
+ Ai(t, Lr);
1413
1497
  }
1414
1498
  replace(t) {
1415
- Mn(t, is);
1499
+ Ai(t, Nr);
1416
1500
  }
1417
1501
  pushIgnoreCloseHandle(t) {
1418
- var e, s;
1419
- E.$hasCloseHandle ? ((s = (e = $.get(E.$key)) == null ? void 0 : e.close) == null || s.call(e), this.replace(t)) : this.push(t);
1502
+ var n, s;
1503
+ I.$hasCloseHandle ? ((s = (n = q.get(I.$key)) == null ? void 0 : n.close) == null || s.call(n), this.replace(t)) : this.push(t);
1420
1504
  }
1421
1505
  forward() {
1422
- O.forward();
1506
+ Y.forward();
1423
1507
  }
1424
1508
  back() {
1425
- O.back();
1509
+ Y.back();
1426
1510
  }
1427
1511
  }
1428
- const R = new ei(), [se, ni] = en({ title: "" }), si = { history: R, titleStore: se, basePathStore: as };
1512
+ const Q = new mc(), [rn, vc] = Xe({ defaultTitle: document.title, url: "", title: "" }), wc = { history: Q, titleStore: rn, basePathStore: Rr };
1429
1513
  if (!window._GEMHISTORY) {
1430
- if (window._GEMHISTORY = si, O.pushState = function(t, e, s) {
1431
- On(t, e, s, ss);
1432
- }, O.replaceState = function(t, e, s) {
1433
- On(t, e, s, is);
1514
+ if (window._GEMHISTORY = wc, Y.pushState = function(t, n, s) {
1515
+ Ii(t, n, s, Lr);
1516
+ }, Y.replaceState = function(t, n, s) {
1517
+ Ii(t, n, s, Nr);
1434
1518
  }, window.addEventListener("hashchange", ({ isTrusted: t }) => {
1435
- t && R.replace({ hash: location.hash });
1436
- }), O.state)
1437
- if (O.state.$hasCloseHandle) {
1438
- pt(O.state);
1439
- const t = ue({ title: document.title });
1440
- $.set(E.$key, t), R.back();
1519
+ t && Q.replace({ hash: location.hash });
1520
+ }), Y.state)
1521
+ if (Y.state.$hasCloseHandle) {
1522
+ Ut(Y.state);
1523
+ const t = dn({ title: document.title });
1524
+ q.set(I.$key, t), Q.back();
1441
1525
  } else {
1442
- const t = ue({ title: document.title, hash: location.hash });
1443
- pt({
1444
- $key: ln(),
1445
- ...O.state || {}
1446
- }), $.set(E.$key, t);
1526
+ const t = dn({ title: document.title, hash: location.hash });
1527
+ Ut({
1528
+ $key: Ws(),
1529
+ ...Y.state || {}
1530
+ }), q.set(I.$key, t);
1447
1531
  }
1448
1532
  else {
1449
- const { pathname: t, search: e, hash: s } = location;
1450
- R.replace({ path: t, query: e, hash: s });
1451
- }
1452
- ct(se, () => {
1453
- const t = $.get(E.$key);
1454
- t && (t.title = se.title);
1455
- }), ct(E, () => {
1456
- const { title: t } = R.getParams();
1457
- t !== se.title && ni({ title: t });
1533
+ const { protocol: t, pathname: n, search: s, hash: i } = location;
1534
+ t.startsWith("http") && Q.replace({ path: n, query: s, hash: i });
1535
+ }
1536
+ pt(rn, () => {
1537
+ const t = q.get(I.$key);
1538
+ t && (t.title = rn.title);
1539
+ }), pt(I, () => {
1540
+ const { title: t } = Q.getParams();
1541
+ t !== rn.title && vc({ title: t });
1458
1542
  });
1459
- let n = !1;
1543
+ let e = !1;
1460
1544
  window.addEventListener("popstate", (t) => {
1461
- var r, o;
1462
- const e = t.state;
1463
- if (!(e != null && e.$key))
1545
+ var o, c;
1546
+ const n = t.state;
1547
+ if (!(n != null && n.$key))
1464
1548
  return;
1465
- if (n) {
1466
- n = !1;
1549
+ if (e) {
1550
+ e = !1;
1467
1551
  return;
1468
1552
  }
1469
- if (!$.has(e.$key)) {
1470
- const { pathname: a, search: c, hash: h } = location;
1471
- $.set(e.$key, {
1553
+ if (!q.has(n.$key)) {
1554
+ const { pathname: a, search: f, hash: h } = location;
1555
+ q.set(n.$key, {
1472
1556
  path: a,
1473
- query: new It(c),
1557
+ query: new De(f),
1474
1558
  hash: decodeURIComponent(h),
1475
- title: e.$title,
1559
+ title: n.$title,
1476
1560
  // document.title 是导航前的
1477
- data: e
1561
+ data: n
1478
1562
  });
1479
1563
  }
1480
- const s = E;
1481
- if (parseFloat(e.$key) > parseFloat(s.$key) && e.$hasOpenHandle)
1482
- (o = (r = $.get(e.$key)) == null ? void 0 : r.open) == null || o.call(r);
1564
+ const s = I;
1565
+ if (parseFloat(n.$key) > parseFloat(s.$key) && n.$hasOpenHandle)
1566
+ (c = (o = q.get(n.$key)) == null ? void 0 : o.open) == null || c.call(o);
1483
1567
  else if (s.$hasCloseHandle) {
1484
- const a = $.get(s.$key), c = a == null ? void 0 : a.close, h = a == null ? void 0 : a.shouldClose;
1568
+ const a = q.get(s.$key), f = a == null ? void 0 : a.close, h = a == null ? void 0 : a.shouldClose;
1485
1569
  if (h && !h()) {
1486
- n = !0, R.forward();
1570
+ e = !0, Q.forward();
1487
1571
  return;
1488
1572
  } else
1489
- c ? c() : e.$hasCloseHandle && (n = !0, R.back());
1573
+ f ? f() : n.$hasCloseHandle && (e = !0, Q.back());
1490
1574
  }
1491
- un(), Ze(E), pt(e);
1575
+ zs(), Ts(I), Ut(n);
1492
1576
  });
1493
1577
  }
1494
- const { history: y, titleStore: qt, basePathStore: ii } = window._GEMHISTORY;
1495
- var ri = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, q = (n, t, e, s) => {
1496
- for (var i = s > 1 ? void 0 : s ? oi(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1497
- (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
1498
- return s && i && ri(t, e, i), i;
1499
- }, cs = (n, t, e) => {
1500
- if (!t.has(n))
1501
- throw TypeError("Cannot " + e);
1502
- }, W = (n, t, e) => (cs(n, t, "read from private field"), e ? e.call(n) : t.get(n)), vt = (n, t, e) => {
1503
- if (t.has(n))
1504
- throw TypeError("Cannot add the same private member more than once");
1505
- t instanceof WeakSet ? t.add(n) : t.set(n, e);
1506
- }, Rn = (n, t, e, s) => (cs(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), kt, rt, ut, ie, je, re;
1507
- const hs = "_";
1508
- class ai extends RegExp {
1578
+ const { history: O, titleStore: At, basePathStore: yc } = window._GEMHISTORY;
1579
+ /**
1580
+ * @license
1581
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
1582
+ * This code may only be used under the BSD style license found at
1583
+ * http://polymer.github.io/LICENSE.txt
1584
+ * The complete set of authors may be found at
1585
+ * http://polymer.github.io/AUTHORS.txt
1586
+ * The complete set of contributors may be found at
1587
+ * http://polymer.github.io/CONTRIBUTORS.txt
1588
+ * Code distributed by Google as part of the polymer project is also
1589
+ * subject to an additional IP rights grant found at
1590
+ * http://polymer.github.io/PATENTS.txt
1591
+ */
1592
+ const Ri = (e, t) => {
1593
+ const n = e.startNode.parentNode, s = t === void 0 ? e.endNode : t.startNode, i = n.insertBefore(ot(), s);
1594
+ n.insertBefore(ot(), s);
1595
+ const o = new re(e.options);
1596
+ return o.insertAfterNode(i), o;
1597
+ }, kt = (e, t) => (e.setValue(t), e.commit(), e), Fn = (e, t, n) => {
1598
+ const s = e.startNode.parentNode, i = n ? n.startNode : e.endNode, o = t.endNode.nextSibling;
1599
+ o !== i && dr(s, t.startNode, o, i);
1600
+ }, qn = (e) => {
1601
+ bs(e.startNode.parentNode, e.startNode, e.endNode.nextSibling);
1602
+ }, Hi = (e, t, n) => {
1603
+ const s = /* @__PURE__ */ new Map();
1604
+ for (let i = t; i <= n; i++)
1605
+ s.set(e[i], i);
1606
+ return s;
1607
+ }, Wi = /* @__PURE__ */ new WeakMap(), zi = /* @__PURE__ */ new WeakMap(), Fl = Sn((e, t, n) => {
1608
+ let s;
1609
+ return n === void 0 ? n = t : t !== void 0 && (s = t), (i) => {
1610
+ if (!(i instanceof re))
1611
+ throw new Error("repeat can only be used in text bindings");
1612
+ const o = Wi.get(i) || [], c = zi.get(i) || [], a = [], f = [], h = [];
1613
+ let m = 0;
1614
+ for (const $ of e)
1615
+ h[m] = s ? s($, m) : m, f[m] = n($, m), m++;
1616
+ let r, _, l = 0, g = o.length - 1, v = 0, y = f.length - 1;
1617
+ for (; l <= g && v <= y; )
1618
+ if (o[l] === null)
1619
+ l++;
1620
+ else if (o[g] === null)
1621
+ g--;
1622
+ else if (c[l] === h[v])
1623
+ a[v] = kt(o[l], f[v]), l++, v++;
1624
+ else if (c[g] === h[y])
1625
+ a[y] = kt(o[g], f[y]), g--, y--;
1626
+ else if (c[l] === h[y])
1627
+ a[y] = kt(o[l], f[y]), Fn(i, o[l], a[y + 1]), l++, y--;
1628
+ else if (c[g] === h[v])
1629
+ a[v] = kt(o[g], f[v]), Fn(i, o[g], o[l]), g--, v++;
1630
+ else if (r === void 0 && (r = Hi(h, v, y), _ = Hi(c, l, g)), !r.has(c[l]))
1631
+ qn(o[l]), l++;
1632
+ else if (!r.has(c[g]))
1633
+ qn(o[g]), g--;
1634
+ else {
1635
+ const $ = _.get(h[v]), d = $ !== void 0 ? o[$] : null;
1636
+ if (d === null) {
1637
+ const S = Ri(i, o[l]);
1638
+ kt(S, f[v]), a[v] = S;
1639
+ } else
1640
+ a[v] = kt(d, f[v]), Fn(i, d, o[l]), o[$] = null;
1641
+ v++;
1642
+ }
1643
+ for (; v <= y; ) {
1644
+ const $ = Ri(i, a[y + 1]);
1645
+ kt($, f[v]), a[v++] = $;
1646
+ }
1647
+ for (; l <= g; ) {
1648
+ const $ = o[l++];
1649
+ $ !== null && qn($);
1650
+ }
1651
+ Wi.set(i, a), zi.set(i, h);
1652
+ };
1653
+ });
1654
+ /**
1655
+ * @license
1656
+ * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
1657
+ * This code may only be used under the BSD style license found at
1658
+ * http://polymer.github.io/LICENSE.txt
1659
+ * The complete set of authors may be found at
1660
+ * http://polymer.github.io/AUTHORS.txt
1661
+ * The complete set of contributors may be found at
1662
+ * http://polymer.github.io/CONTRIBUTORS.txt
1663
+ * Code distributed by Google as part of the polymer project is also
1664
+ * subject to an additional IP rights grant found at
1665
+ * http://polymer.github.io/PATENTS.txt
1666
+ */
1667
+ const Un = /* @__PURE__ */ new WeakMap(), ql = Sn((e, t) => (n) => {
1668
+ const s = Un.get(n);
1669
+ if (Array.isArray(e)) {
1670
+ if (Array.isArray(s) && s.length === e.length && e.every((i, o) => i === s[o]))
1671
+ return;
1672
+ } else if (s === e && (e !== void 0 || Un.has(n)))
1673
+ return;
1674
+ n.setValue(t()), Un.set(n, Array.isArray(e) ? Array.from(e) : e);
1675
+ });
1676
+ /**
1677
+ * @license
1678
+ * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
1679
+ * This code may only be used under the BSD style license found at
1680
+ * http://polymer.github.io/LICENSE.txt
1681
+ * The complete set of authors may be found at
1682
+ * http://polymer.github.io/AUTHORS.txt
1683
+ * The complete set of contributors may be found at
1684
+ * http://polymer.github.io/CONTRIBUTORS.txt
1685
+ * Code distributed by Google as part of the polymer project is also
1686
+ * subject to an additional IP rights grant found at
1687
+ * http://polymer.github.io/PATENTS.txt
1688
+ */
1689
+ const Bn = /* @__PURE__ */ new WeakMap(), Sc = Sn((e) => (t) => {
1690
+ const n = Bn.get(t);
1691
+ if (e === void 0 && t instanceof Ps) {
1692
+ if (n !== void 0 || !Bn.has(t)) {
1693
+ const s = t.committer.name;
1694
+ t.committer.element.removeAttribute(s);
1695
+ }
1696
+ } else e !== n && t.setValue(e);
1697
+ Bn.set(t, e);
1698
+ });
1699
+ var $c = Object.create, Vs = Object.defineProperty, Ec = Object.getOwnPropertyDescriptor, Hr = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), ae = (e) => {
1700
+ throw TypeError(e);
1701
+ }, Wr = (e, t, n) => t in e ? Vs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Vi = (e, t) => Vs(e, "name", { value: t, configurable: !0 }), zr = (e) => [, , , $c((e == null ? void 0 : e[Hr("metadata")]) ?? null)], Vr = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Se = (e) => e !== void 0 && typeof e != "function" ? ae("Function expected") : e, bc = (e, t, n, s, i) => ({ kind: Vr[e], name: t, metadata: s, addInitializer: (o) => n._ ? ae("Already initialized") : i.push(Se(o || null)) }), Gr = (e, t) => Wr(t, Hr("metadata"), e[3]), C = (e, t, n, s) => {
1702
+ for (var i = 0, o = e[t >> 1], c = o && o.length; i < c; i++) t & 1 ? o[i].call(n) : s = o[i].call(n, s);
1703
+ return s;
1704
+ }, H = (e, t, n, s, i, o) => {
1705
+ var c, a, f, h, m, r = t & 7, _ = !!(t & 8), l = !!(t & 16), g = r > 3 ? e.length + 1 : r ? _ ? 1 : 2 : 0, v = Vr[r + 5], y = r > 3 && (e[g - 1] = []), $ = e[g] || (e[g] = []), d = r && (!l && !_ && (i = i.prototype), r < 5 && (r > 3 || !l) && Ec(r < 4 ? i : { get [n]() {
1706
+ return A(this, o);
1707
+ }, set [n](u) {
1708
+ return pn(this, o, u);
1709
+ } }, n));
1710
+ r ? l && r < 4 && Vi(o, (r > 2 ? "set " : r > 1 ? "get " : "") + n) : Vi(i, n);
1711
+ for (var S = s.length - 1; S >= 0; S--)
1712
+ h = bc(r, n, f = {}, e[3], $), r && (h.static = _, h.private = l, m = h.access = { has: l ? (u) => Cc(i, u) : (u) => n in u }, r ^ 3 && (m.get = l ? (u) => (r ^ 1 ? A : Pc)(u, i, r ^ 4 ? o : d.get) : (u) => u[n]), r > 2 && (m.set = l ? (u, k) => pn(u, i, k, r ^ 4 ? o : d.set) : (u, k) => u[n] = k)), a = (0, s[S])(r ? r < 4 ? l ? o : d[v] : r > 4 ? void 0 : { get: d.get, set: d.set } : i, h), f._ = 1, r ^ 4 || a === void 0 ? Se(a) && (r > 4 ? y.unshift(a) : r ? l ? o = a : d[v] = a : i = a) : typeof a != "object" || a === null ? ae("Object expected") : (Se(c = a.get) && (d.get = c), Se(c = a.set) && (d.set = c), Se(c = a.init) && y.unshift(c));
1713
+ return r || Gr(e, i), d && Vs(i, n, d), l ? r ^ 4 ? o : d : i;
1714
+ }, W = (e, t, n) => Wr(e, typeof t != "symbol" ? t + "" : t, n), Gs = (e, t, n) => t.has(e) || ae("Cannot " + n), Cc = (e, t) => Object(t) !== t ? ae('Cannot use the "in" operator on this value') : e.has(t), A = (e, t, n) => (Gs(e, t, "read from private field"), n ? n.call(e) : t.get(e)), j = (e, t, n) => t.has(e) ? ae("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), pn = (e, t, n, s) => (Gs(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n), Pc = (e, t, n) => (Gs(e, t, "access private method"), n), Dr, Fr, qr, Ur, Br, Kr, jr, Jr, Yr, Qr, Xr, Zr, to, eo, no, so, ss, w, xt, Gt, $e, on, is, Ee, an, Ds, Fs, qs, rs, Us, Bs, io, Ks, ro;
1715
+ const oo = "_";
1716
+ class kc extends RegExp {
1509
1717
  constructor(t) {
1510
- let e = 0;
1718
+ let n = 0;
1511
1719
  super(
1512
- `^${t.replace(/((:[^/$]+)|(\*))/g, (s, i) => i === "*" ? `(?<${hs}${e++}>.*)` : `(?<${i.slice(1)}>[^/]+)`)}$`
1720
+ `^${t.replace(/((:[^/$]+)|(\*))/g, (s, i) => i === "*" ? `(?<${oo}${n++}>.*)` : `(?<${i.slice(1)}>[^/]+)`)}$`
1513
1721
  );
1514
1722
  }
1515
1723
  }
1516
- function ls(n, t) {
1724
+ function ao(e, t) {
1517
1725
  if (window.URLPattern) {
1518
- const r = new window.URLPattern({ pathname: n }), o = r.exec({ pathname: t }) || r.exec({ pathname: `${t}/` });
1519
- return o ? o.pathname.groups : null;
1726
+ const o = new window.URLPattern({ pathname: e }), c = o.exec({ pathname: t }) || o.exec({ pathname: `${t}/` });
1727
+ return c ? c.pathname.groups : null;
1520
1728
  }
1521
- const e = new ai(n), s = t.match(e) || `${t}/`.match(e);
1522
- if (!s)
1523
- return null;
1729
+ const n = new kc(e), s = t.match(n) || `${t}/`.match(n);
1730
+ if (!s) return null;
1524
1731
  const i = {};
1525
- return s.groups && Object.entries(s.groups).forEach(([r, o]) => {
1526
- i[r.startsWith(hs) ? r.slice(1) : r] = o;
1732
+ return s.groups && Object.entries(s.groups).forEach(([o, c]) => {
1733
+ i[o.startsWith(oo) ? o.slice(1) : o] = c;
1527
1734
  }), i;
1528
1735
  }
1529
- function dn(n, t) {
1530
- let e = 0, s = n.pattern.replaceAll("*", () => `:${e++}`);
1736
+ function js(e, t) {
1737
+ let n = 0, s = e.pattern.replaceAll("*", () => `:${n++}`);
1531
1738
  const i = t == null ? void 0 : t.params;
1532
- return i && Object.keys(i).forEach((r) => {
1533
- s = s.replace(new RegExp(`:${r}`, "g"), i[r]);
1739
+ return i && Object.keys(i).forEach((o) => {
1740
+ s = s.replace(new RegExp(`:${o}`, "g"), i[o]);
1534
1741
  }), s;
1535
1742
  }
1536
- function ci(n, t) {
1743
+ function xc(e, t) {
1537
1744
  return {
1538
- path: dn(n, t),
1745
+ path: js(e, t),
1539
1746
  ...t
1540
1747
  };
1541
1748
  }
1542
- const Ne = G``, An = /* @__PURE__ */ new Map(), T = class us extends A {
1543
- constructor({ isLight: t, routes: e } = {}) {
1544
- super({ isLight: t }), vt(this, rt), this.trigger = y, this.currentParams = {}, vt(this, kt, void 0), this.state = {
1545
- content: Ne
1546
- }, vt(this, ie, () => {
1547
- if (!this.locationStore)
1548
- return;
1549
- const { path: s, query: i, hash: r, data: o } = y.getParams();
1550
- nt(this.locationStore, {
1551
- path: s,
1749
+ const Kn = at``, Gi = /* @__PURE__ */ new Map();
1750
+ class z extends (ss = B, so = [On], no = [U], eo = [U], to = [U], Zr = [ye], Xr = [ye], Qr = [ye], Yr = [ye], Jr = [U], jr = [U], Kr = [U], Br = [Mn()], Ur = [$t((t) => [t.scrollContainer])], qr = [$t((t) => [t.scrollContainer])], Fr = [$t((t) => {
1751
+ var n;
1752
+ return A(n = t, rs).call(n);
1753
+ })], Dr = [xr((t) => !t.inert)], ss) {
1754
+ constructor() {
1755
+ super(...arguments), j(this, xt), W(this, "transition", C(w, 8, this)), C(w, 11, this), W(this, "routes", C(w, 12, this)), C(w, 15, this), W(this, "locationStore", C(w, 16, this)), C(w, 19, this), W(this, "key", C(w, 20, this)), C(w, 23, this), W(this, "loading", C(w, 24, this)), C(w, 27, this), W(this, "beforeroutechange", C(w, 28, this)), C(w, 31, this), W(this, "routechange", C(w, 32, this)), C(w, 35, this), W(this, "error", C(w, 36, this)), C(w, 39, this), W(this, "scrollContainer", C(w, 40, this)), C(w, 43, this), W(this, "scrollIgnoreHash", C(w, 44, this)), C(w, 47, this), W(this, "trigger", C(w, 48, this, O)), C(w, 51, this), W(this, "currentRoute"), W(this, "currentParams", {}), j(this, $e, Ns({ content: Kn })), j(this, on, () => {
1756
+ if (!this.locationStore) return;
1757
+ const { path: t, query: n, hash: s, data: i } = O.getParams();
1758
+ It(this.locationStore, {
1759
+ path: t,
1552
1760
  params: this.currentParams,
1553
- query: i,
1554
- hash: r,
1555
- data: o
1761
+ query: n,
1762
+ hash: s,
1763
+ data: i
1556
1764
  });
1557
- }), vt(this, je, () => {
1558
- if (!W(this, rt, ut))
1559
- return;
1560
- const s = An.get(y.currentKey);
1561
- s ? W(this, rt, ut).scroll(0, s) : (this.scrollIgnoreHash || !y.getParams().hash) && W(this, rt, ut).scroll(0, 0);
1562
- }), vt(this, re, (s, i, r) => {
1563
- this.beforeroutechange(s), Rn(this, kt, void 0), this.currentRoute = s, this.currentParams = i;
1564
- const o = async () => {
1565
- this.setState({ content: r }), W(this, ie).call(this), await Promise.resolve(), W(this, je).call(this), this.routechange(this.currentRoute);
1765
+ }), j(this, is, () => {
1766
+ if (!A(this, xt, Gt)) return;
1767
+ const t = Gi.get(O.currentKey);
1768
+ t ? A(this, xt, Gt).scroll(0, t) : (this.scrollIgnoreHash || !O.getParams().hash) && A(this, xt, Gt).scroll(0, 0);
1769
+ }), j(this, Ee), j(this, an, (t, n, s) => {
1770
+ this.beforeroutechange(t), pn(this, Ee, void 0), this.currentRoute = t, this.currentParams = n;
1771
+ const i = async () => {
1772
+ A(this, $e).call(this, { content: s }), A(this, on).call(this), await Promise.resolve(), A(this, is).call(this), this.routechange(this.currentRoute);
1566
1773
  };
1567
- this.transition && "startViewTransition" in document ? document.startViewTransition(() => o()) : o();
1568
- }), this.update = () => {
1569
- const { path: s, hash: i, query: r } = this.trigger.getParams(), { route: o, params: a = {} } = us.findRoute(this.routes, s), { redirect: c, content: h, getContent: p } = o || {};
1570
- if (c) {
1571
- this.trigger.replace({
1572
- path: dn({ pattern: c }, { params: a }),
1573
- query: r,
1574
- hash: i
1575
- });
1576
- return;
1577
- }
1578
- this.trigger === y && nt(qt, { title: o == null ? void 0 : o.title });
1579
- const u = h || (p == null ? void 0 : p(a, this.shadowRoot || this));
1580
- if (this.loading(o), u instanceof Promise) {
1581
- Rn(this, kt, u);
1582
- const S = () => W(this, kt) === u;
1583
- u.then((d) => {
1584
- S() && W(this, re).call(this, o, a, d);
1585
- }).catch((d) => {
1586
- S() && this.error(d);
1587
- });
1774
+ this.transition && "startViewTransition" in document ? document.startViewTransition(() => i()) : i();
1775
+ }), j(this, Ds, C(w, 52, this, () => this.internals.states.delete(Pn))), C(w, 55, this), j(this, Fs, C(w, 56, this, () => {
1776
+ if (A(this, xt, Gt))
1777
+ return wr(
1778
+ O,
1779
+ "beforechange",
1780
+ () => Gi.set(O.currentKey, A(this, xt, Gt).scrollTop)
1781
+ );
1782
+ })), C(w, 59, this), j(this, qs, C(w, 60, this, () => pt(this.trigger.store, () => A(this, $e).call(this, {})))), C(w, 63, this), j(this, rs, () => {
1783
+ const { path: t, query: n, hash: s } = this.trigger.getParams();
1784
+ return [this.key, t, n, s];
1785
+ }), j(this, Us, C(w, 64, this, ([t, n], s) => {
1786
+ if (s && t === s[0] && n === s[1]) {
1787
+ A(this, on).call(this);
1588
1788
  return;
1589
1789
  }
1590
- W(this, re).call(this, o, a, u);
1591
- }, this.routes = this.routes || e;
1592
- }
1593
- mounted() {
1594
- this.effect(
1595
- () => {
1596
- if (W(this, rt, ut))
1597
- return Jn(
1598
- y,
1599
- "beforechange",
1600
- () => An.set(y.currentKey, W(this, rt, ut).scrollTop)
1601
- );
1602
- },
1603
- () => [this.scrollContainer]
1604
- ), this.effect(
1605
- // 触发 this.#update
1606
- () => ct(this.trigger.store, () => this.setState({})),
1607
- () => [this.trigger]
1608
- ), this.effect(
1609
- ([t, e], s) => {
1610
- if (s && t === s[0] && e === s[1]) {
1611
- W(this, ie).call(this);
1612
- return;
1613
- }
1614
- this.update();
1615
- },
1616
- () => {
1617
- const { path: t, query: e, hash: s } = this.trigger.getParams();
1618
- return [this.key, t, e, s];
1619
- }
1620
- );
1621
- }
1622
- shouldUpdate() {
1623
- return !this.inert;
1624
- }
1625
- render() {
1626
- const { content: t } = this.state;
1627
- if (t !== void 0)
1628
- return this.shadowRoot ? G`
1790
+ this.update();
1791
+ })), C(w, 67, this), j(this, Bs, C(w, 68, this, () => {
1792
+ const { content: t } = A(this, $e);
1793
+ if (t !== void 0)
1794
+ return this.shadowRoot ? at`
1629
1795
  <style>
1630
1796
  :host(:where(:not([hidden]))),
1631
1797
  :not(:defined) {
1632
1798
  display: contents;
1633
1799
  }
1634
1800
  </style>
1635
- ${t === Ne ? G`<slot></slot>` : t}
1636
- ` : t === Ne ? void 0 : G`${t}`;
1801
+ ${t === Kn ? at`<slot></slot>` : t}
1802
+ ` : t === Kn ? void 0 : at`${t}`;
1803
+ })), C(w, 71, this), W(this, "update", () => {
1804
+ const { path: t, hash: n, query: s } = this.trigger.getParams(), { route: i, params: o = {} } = Ue.findRoute(this.routes, t), { redirect: c, content: a, getContent: f } = i || {};
1805
+ if (c) {
1806
+ this.trigger.replace({
1807
+ path: js({ pattern: c }, { params: o }),
1808
+ query: s,
1809
+ hash: n
1810
+ });
1811
+ return;
1812
+ }
1813
+ this.trigger === O && (location.href !== At.url || i != null && i.title) && It(At, { url: location.href, title: i == null ? void 0 : i.title });
1814
+ const h = a || (f == null ? void 0 : f(o, this.shadowRoot || this));
1815
+ if (this.loading(i), h instanceof Promise) {
1816
+ pn(this, Ee, h);
1817
+ const m = () => A(this, Ee) === h;
1818
+ h.then((r) => {
1819
+ m() && A(this, an).call(this, i, o, r);
1820
+ }).catch((r) => {
1821
+ m() && this.error(r);
1822
+ });
1823
+ return;
1824
+ }
1825
+ A(this, an).call(this, i, o, h);
1826
+ });
1637
1827
  }
1638
- };
1639
- kt = /* @__PURE__ */ new WeakMap();
1640
- rt = /* @__PURE__ */ new WeakSet();
1641
- ut = function() {
1828
+ }
1829
+ w = zr(ss);
1830
+ xt = /* @__PURE__ */ new WeakSet();
1831
+ Gt = function() {
1642
1832
  return typeof this.scrollContainer == "function" ? this.scrollContainer() : this.scrollContainer;
1643
1833
  };
1644
- ie = /* @__PURE__ */ new WeakMap();
1645
- je = /* @__PURE__ */ new WeakMap();
1646
- re = /* @__PURE__ */ new WeakMap();
1647
- T.createLocationStore = () => {
1648
- const { path: n, query: t, hash: e, data: s } = y.getParams();
1649
- return Ft({ path: n, query: t, hash: e, data: s, params: {} });
1650
- };
1651
- T.findRoute = (n = [], t) => {
1652
- let e = null, s;
1653
- n instanceof Array ? s = n : s = Object.values(n);
1834
+ $e = /* @__PURE__ */ new WeakMap();
1835
+ on = /* @__PURE__ */ new WeakMap();
1836
+ is = /* @__PURE__ */ new WeakMap();
1837
+ Ee = /* @__PURE__ */ new WeakMap();
1838
+ an = /* @__PURE__ */ new WeakMap();
1839
+ Ds = /* @__PURE__ */ new WeakMap();
1840
+ Fs = /* @__PURE__ */ new WeakMap();
1841
+ qs = /* @__PURE__ */ new WeakMap();
1842
+ rs = /* @__PURE__ */ new WeakMap();
1843
+ Us = /* @__PURE__ */ new WeakMap();
1844
+ Bs = /* @__PURE__ */ new WeakMap();
1845
+ H(w, 5, "transition", so, z);
1846
+ H(w, 5, "routes", no, z);
1847
+ H(w, 5, "locationStore", eo, z);
1848
+ H(w, 5, "key", to, z);
1849
+ H(w, 5, "loading", Zr, z);
1850
+ H(w, 5, "beforeroutechange", Xr, z);
1851
+ H(w, 5, "routechange", Qr, z);
1852
+ H(w, 5, "error", Yr, z);
1853
+ H(w, 5, "scrollContainer", Jr, z);
1854
+ H(w, 5, "scrollIgnoreHash", jr, z);
1855
+ H(w, 5, "trigger", Kr, z);
1856
+ H(w, 21, "#unBoundary", Br, Ds);
1857
+ H(w, 21, "#rememberScrollPosition", Ur, Fs);
1858
+ H(w, 21, "#connectTriggerStore", qr, qs);
1859
+ H(w, 21, "#updateContent", Fr, Us);
1860
+ H(w, 21, "#content", Dr, Bs);
1861
+ Gr(w, z);
1862
+ W(z, "createLocationStore", () => {
1863
+ const { path: e, query: t, hash: n, data: s } = O.getParams();
1864
+ return bn({ path: e, query: t, hash: n, data: s, params: {} });
1865
+ });
1866
+ W(z, "findRoute", (e = [], t) => {
1867
+ let n = null, s;
1868
+ e instanceof Array ? s = e : s = Object.values(e);
1654
1869
  for (const i of s)
1655
1870
  if (i.pattern === "*")
1656
- e = i;
1871
+ n = i;
1657
1872
  else {
1658
- const r = ls(i.pattern, t);
1659
- if (r)
1660
- return { route: i, params: r };
1873
+ const o = ao(i.pattern, t);
1874
+ if (o)
1875
+ return { route: i, params: o };
1661
1876
  }
1662
- return { route: e };
1663
- };
1664
- q([
1665
- es
1666
- ], T.prototype, "transition", 2);
1667
- q([
1668
- N
1669
- ], T.prototype, "routes", 2);
1670
- q([
1671
- N
1672
- ], T.prototype, "locationStore", 2);
1673
- q([
1674
- N
1675
- ], T.prototype, "key", 2);
1676
- q([
1677
- Se
1678
- ], T.prototype, "loading", 2);
1679
- q([
1680
- Se
1681
- ], T.prototype, "beforeroutechange", 2);
1682
- q([
1683
- Se
1684
- ], T.prototype, "routechange", 2);
1685
- q([
1686
- Se
1687
- ], T.prototype, "error", 2);
1688
- q([
1689
- N
1690
- ], T.prototype, "scrollContainer", 2);
1691
- q([
1692
- N
1693
- ], T.prototype, "scrollIgnoreHash", 2);
1694
- q([
1695
- N
1696
- ], T.prototype, "trigger", 2);
1697
- let ds = T;
1698
- class hi extends ds {
1699
- constructor(t = {}) {
1700
- super({ ...t, isLight: !0 });
1701
- }
1702
- }
1703
- var li = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, b = (n, t, e, s) => {
1704
- for (var i = s > 1 ? void 0 : s ? ui(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1705
- (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
1706
- return s && i && li(t, e, i), i;
1707
- }, di = (n, t, e) => {
1708
- if (!t.has(n))
1709
- throw TypeError("Cannot " + e);
1710
- }, J = (n, t, e) => (di(n, t, "read from private field"), e ? e.call(n) : t.get(n)), St = (n, t, e) => {
1711
- if (t.has(n))
1712
- throw TypeError("Cannot add the same private member more than once");
1713
- t instanceof WeakSet ? t.add(n) : t.set(n, e);
1714
- }, dt, Lt, Fe, fs, Be, Ke, ze;
1715
- function Hn(n) {
1716
- return !n.startsWith("/");
1717
- }
1718
- let x = class extends A {
1877
+ return { route: n };
1878
+ });
1879
+ io = [Ht()];
1880
+ class Ue extends (ro = z) {
1881
+ }
1882
+ Ks = zr(ro);
1883
+ Ue = H(Ks, 0, "GemRouteElement", io, Ue);
1884
+ C(Ks, 1, Ue);
1885
+ var Tc = Object.create, Js = Object.defineProperty, Oc = Object.getOwnPropertyDescriptor, co = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), ce = (e) => {
1886
+ throw TypeError(e);
1887
+ }, lo = (e, t, n) => t in e ? Js(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Di = (e, t) => Js(e, "name", { value: t, configurable: !0 }), ho = (e) => [, , , Tc((e == null ? void 0 : e[co("metadata")]) ?? null)], uo = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], be = (e) => e !== void 0 && typeof e != "function" ? ce("Function expected") : e, Mc = (e, t, n, s, i) => ({ kind: uo[e], name: t, metadata: s, addInitializer: (o) => n._ ? ce("Already initialized") : i.push(be(o || null)) }), Lc = (e, t) => lo(t, co("metadata"), e[3]), P = (e, t, n, s) => {
1888
+ for (var i = 0, o = e[t >> 1], c = o && o.length; i < c; i++) t & 1 ? o[i].call(n) : s = o[i].call(n, s);
1889
+ return s;
1890
+ }, N = (e, t, n, s, i, o) => {
1891
+ var c, a, f, h, m, r = t & 7, _ = !!(t & 8), l = !!(t & 16), g = r > 3 ? e.length + 1 : r ? _ ? 1 : 2 : 0, v = uo[r + 5], y = r > 3 && (e[g - 1] = []), $ = e[g] || (e[g] = []), d = r && (!l && !_ && (i = i.prototype), r < 5 && (r > 3 || !l) && Oc(r < 4 ? i : { get [n]() {
1892
+ return nt(this, o);
1893
+ }, set [n](u) {
1894
+ return Fi(this, o, u);
1895
+ } }, n));
1896
+ r ? l && r < 4 && Di(o, (r > 2 ? "set " : r > 1 ? "get " : "") + n) : Di(i, n);
1897
+ for (var S = s.length - 1; S >= 0; S--)
1898
+ h = Mc(r, n, f = {}, e[3], $), r && (h.static = _, h.private = l, m = h.access = { has: l ? (u) => Nc(i, u) : (u) => n in u }, r ^ 3 && (m.get = l ? (u) => (r ^ 1 ? nt : Ac)(u, i, r ^ 4 ? o : d.get) : (u) => u[n]), r > 2 && (m.set = l ? (u, k) => Fi(u, i, k, r ^ 4 ? o : d.set) : (u, k) => u[n] = k)), a = (0, s[S])(r ? r < 4 ? l ? o : d[v] : r > 4 ? void 0 : { get: d.get, set: d.set } : i, h), f._ = 1, r ^ 4 || a === void 0 ? be(a) && (r > 4 ? y.unshift(a) : r ? l ? o = a : d[v] = a : i = a) : typeof a != "object" || a === null ? ce("Object expected") : (be(c = a.get) && (d.get = c), be(c = a.set) && (d.set = c), be(c = a.init) && y.unshift(c));
1899
+ return r || Lc(e, i), d && Js(i, n, d), l ? r ^ 4 ? o : d : i;
1900
+ }, D = (e, t, n) => lo(e, typeof t != "symbol" ? t + "" : t, n), Ys = (e, t, n) => t.has(e) || ce("Cannot " + n), Nc = (e, t) => Object(t) !== t ? ce('Cannot use the "in" operator on this value') : e.has(t), nt = (e, t, n) => (Ys(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Dt = (e, t, n) => t.has(e) ? ce("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), Fi = (e, t, n, s) => (Ys(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n), Ac = (e, t, n) => (Ys(e, t, "access private method"), n), po, fo, _o, go, mo, vo, wo, yo, So, $o, Eo, bo, Co, os, Po, E, _t, Ce, ko, Qs, as, cs, Xs, ls, xo, To, Oo, hs, Mo, X, Zs;
1901
+ function qi(e) {
1902
+ return !e.startsWith("/");
1903
+ }
1904
+ const Ic = kn(yr`
1905
+ :host {
1906
+ /* link default style */
1907
+ cursor: pointer;
1908
+ color: blue;
1909
+ text-decoration: underline;
1910
+ }
1911
+ a {
1912
+ all: unset;
1913
+ display: contents;
1914
+ }
1915
+ a:visited {
1916
+ color: unset;
1917
+ }
1918
+ `);
1919
+ Po = [Nn(yc), Hs(Ic), Ht(), An({ focusable: !0 })];
1920
+ class R extends (os = B, Co = [G], bo = [G], Eo = [G], $o = [G], So = [G], yo = [G], wo = [On], vo = [U], mo = [U], go = [U], _o = [U], fo = [Or], po = [qe()], os) {
1719
1921
  constructor() {
1720
- super({ focusable: !0 }), St(this, dt), St(this, Fe), St(this, Be, async () => {
1721
- var i;
1722
- const n = this.getLocationString();
1723
- if (!n)
1724
- return;
1725
- if (Hn(n))
1922
+ super(...arguments), P(E, 5, this), Dt(this, _t), D(this, "href", P(E, 8, this)), P(E, 11, this), D(this, "target", P(E, 12, this)), P(E, 15, this), D(this, "path", P(E, 16, this)), P(E, 19, this), D(this, "query", P(E, 20, this)), P(E, 23, this), D(this, "hash", P(E, 24, this)), P(E, 27, this), D(this, "hint", P(E, 28, this)), P(E, 31, this), D(this, "preload", P(E, 32, this)), P(E, 35, this), D(this, "route", P(E, 36, this)), P(E, 39, this), D(this, "options", P(E, 40, this)), P(E, 43, this), D(this, "routeOptions", P(E, 44, this)), P(E, 47, this), D(this, "prepare", P(E, 48, this)), P(E, 51, this), D(this, "link", P(E, 52, this)), P(E, 55, this), Dt(this, Qs, async () => {
1923
+ var o;
1924
+ const t = this.getLocationString();
1925
+ if (!t) return;
1926
+ if (qi(t))
1726
1927
  switch (this.target) {
1727
1928
  case "_self":
1728
- window.location.href = n;
1929
+ window.location.href = t;
1729
1930
  return;
1730
1931
  case "_parent":
1731
- window.parent.location.href = n;
1932
+ window.parent.location.href = t;
1732
1933
  return;
1733
1934
  case "_top":
1734
- window.top.location.href = n;
1935
+ window.top.location.href = t;
1735
1936
  return;
1736
1937
  default:
1737
- window.open(n);
1938
+ window.open(t);
1738
1939
  return;
1739
1940
  }
1740
- const { path: t, query: e, hash: s } = y.getParams();
1741
- if (t + e + s !== n)
1742
- if (await ((i = this.prepare) == null ? void 0 : i.call(this)), this.route)
1743
- y.pushIgnoreCloseHandle({
1744
- ...ci(this.route, J(this, dt, Lt)),
1745
- title: this.route.title || this.docTitle
1746
- });
1941
+ const { path: n, query: s, hash: i } = O.getParams();
1942
+ if (n + s + i !== t)
1943
+ if (await ((o = this.prepare) == null ? void 0 : o.call(this)), this.route)
1944
+ O.pushIgnoreCloseHandle(xc(this.route, nt(this, _t, Ce)));
1747
1945
  else if (this.href) {
1748
- const { pathname: r, search: o, hash: a } = new URL(n, location.origin);
1749
- y.pushIgnoreCloseHandle({
1750
- path: r,
1751
- query: o,
1752
- hash: a,
1753
- title: this.docTitle
1946
+ const c = new URL(t, location.origin);
1947
+ O.pushIgnoreCloseHandle({
1948
+ path: c.pathname,
1949
+ query: c.search,
1950
+ hash: c.hash
1754
1951
  });
1755
1952
  } else
1756
- y.pushIgnoreCloseHandle({
1953
+ O.pushIgnoreCloseHandle({
1757
1954
  path: this.path,
1758
1955
  query: this.query,
1759
- hash: this.hash,
1760
- title: this.docTitle
1956
+ hash: this.hash
1761
1957
  });
1762
- }), St(this, Ke, (n) => {
1763
- n.preventDefault();
1764
- }), St(this, ze, () => {
1765
- const n = this.getLocationString();
1766
- return Hn(n) ? n : new URL(y.basePath + n, location.origin).toString();
1767
- }), this.addEventListener("click", J(this, Be));
1958
+ }), Dt(this, as, (t) => {
1959
+ t.preventDefault();
1960
+ }), Dt(this, cs, () => {
1961
+ const t = this.getLocationString();
1962
+ return qi(t) ? t : new URL(O.basePath + t, location.origin).toString();
1963
+ }), Dt(this, Xs, () => {
1964
+ var t, n, s;
1965
+ (t = this.route) == null || t.content, (s = (n = this.route) == null ? void 0 : n.getContent) == null || s.call(n, {}, this.shadowRoot);
1966
+ });
1768
1967
  }
1769
1968
  render() {
1770
- return G`
1771
- <style>
1772
- :host {
1773
- /* link default style */
1774
- cursor: pointer;
1775
- color: blue;
1776
- text-decoration: underline;
1777
- }
1778
- a {
1779
- all: unset;
1780
- display: contents;
1781
- }
1782
- a:visited {
1783
- color: unset;
1784
- }
1785
- </style>
1969
+ return at`
1786
1970
  <a
1787
1971
  part=${this.link}
1788
- @click=${J(this, Ke)}
1789
- href=${Qn(J(this, Fe, fs) === "off" ? void 0 : J(this, ze).call(this))}
1972
+ @click=${nt(this, as)}
1973
+ href=${Sc(nt(this, _t, ko) === "off" ? void 0 : nt(this, cs).call(this))}
1974
+ tabindex="-1"
1790
1975
  >
1791
1976
  <slot></slot>
1792
1977
  </a>
@@ -1796,313 +1981,323 @@ let x = class extends A {
1796
1981
  * 如果该元素是外部链接返回 URL,否则返回路径(不包含 basePath)
1797
1982
  */
1798
1983
  getLocationString() {
1799
- var n, t;
1984
+ var t, n;
1800
1985
  if (this.route) {
1801
- const e = ((n = J(this, dt, Lt)) == null ? void 0 : n.query) || "", s = ((t = J(this, dt, Lt)) == null ? void 0 : t.hash) || "";
1802
- return dn(this.route, J(this, dt, Lt)) + e + s;
1986
+ const s = ((t = nt(this, _t, Ce)) == null ? void 0 : t.query) || "", i = ((n = nt(this, _t, Ce)) == null ? void 0 : n.hash) || "";
1987
+ return js(this.route, nt(this, _t, Ce)) + s + i;
1803
1988
  } else {
1804
- const e = this.href || this.path + this.query + this.hash, { path: s, query: i } = y.getParams();
1805
- return e.startsWith("#") ? `${s}${i}${e}` : e.startsWith("?") ? `${s}${e}` : e.startsWith(".") ? zn(s, e) : e;
1989
+ const s = this.href || this.path + this.query + this.hash, { path: i, query: o } = O.getParams();
1990
+ return s.startsWith("#") ? `${i}${o}${s}` : s.startsWith("?") ? `${i}${s}` : s.startsWith(".") ? vr(i, s) : s;
1806
1991
  }
1807
1992
  }
1808
- };
1809
- dt = /* @__PURE__ */ new WeakSet();
1810
- Lt = function() {
1993
+ }
1994
+ E = ho(os);
1995
+ _t = /* @__PURE__ */ new WeakSet();
1996
+ Ce = function() {
1811
1997
  return this.routeOptions || this.options;
1812
1998
  };
1813
- Fe = /* @__PURE__ */ new WeakSet();
1814
- fs = function() {
1999
+ ko = function() {
1815
2000
  return this.hint || "on";
1816
2001
  };
1817
- Be = /* @__PURE__ */ new WeakMap();
1818
- Ke = /* @__PURE__ */ new WeakMap();
1819
- ze = /* @__PURE__ */ new WeakMap();
1820
- b([
1821
- C
1822
- ], x.prototype, "href", 2);
1823
- b([
1824
- C
1825
- ], x.prototype, "target", 2);
1826
- b([
1827
- C
1828
- ], x.prototype, "path", 2);
1829
- b([
1830
- C
1831
- ], x.prototype, "query", 2);
1832
- b([
1833
- C
1834
- ], x.prototype, "hash", 2);
1835
- b([
1836
- C
1837
- ], x.prototype, "docTitle", 2);
1838
- b([
1839
- C
1840
- ], x.prototype, "hint", 2);
1841
- b([
1842
- N
1843
- ], x.prototype, "route", 2);
1844
- b([
1845
- N
1846
- ], x.prototype, "options", 2);
1847
- b([
1848
- N
1849
- ], x.prototype, "routeOptions", 2);
1850
- b([
1851
- N
1852
- ], x.prototype, "prepare", 2);
1853
- b([
1854
- Xs
1855
- ], x.prototype, "link", 2);
1856
- x = b([
1857
- hn(ii)
1858
- ], x);
1859
- let Ut = class extends x {
1860
- constructor() {
1861
- super(), this.effect(() => {
1862
- const { path: n, query: t, hash: e } = y.getParams(), s = this.pattern && ls(this.pattern, n);
1863
- this.active = !!s || n + t + e === this.getLocationString();
1864
- });
1865
- }
2002
+ Qs = /* @__PURE__ */ new WeakMap();
2003
+ as = /* @__PURE__ */ new WeakMap();
2004
+ cs = /* @__PURE__ */ new WeakMap();
2005
+ Xs = /* @__PURE__ */ new WeakMap();
2006
+ ls = function() {
2007
+ this.addEventListener("click", nt(this, Qs)), this.addEventListener("pointerenter", nt(this, Xs));
1866
2008
  };
1867
- b([
1868
- C
1869
- ], Ut.prototype, "pattern", 2);
1870
- b([
1871
- cn
1872
- ], Ut.prototype, "active", 2);
1873
- Ut = b([
1874
- hn(y.store)
1875
- ], Ut);
1876
- customElements.define("gem-link", x);
1877
- customElements.define("gem-active-link", Ut);
1878
- customElements.define("gem-route", ds);
1879
- customElements.define("gem-light-route", hi);
1880
- var fi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fn = (n, t, e, s) => {
1881
- for (var i = s > 1 ? void 0 : s ? pi(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1882
- (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
1883
- return s && i && fi(t, e, i), i;
2009
+ ls = N(E, 17, "#init", po, _t, ls);
2010
+ N(E, 5, "href", Co, R);
2011
+ N(E, 5, "target", bo, R);
2012
+ N(E, 5, "path", Eo, R);
2013
+ N(E, 5, "query", $o, R);
2014
+ N(E, 5, "hash", So, R);
2015
+ N(E, 5, "hint", yo, R);
2016
+ N(E, 5, "preload", wo, R);
2017
+ N(E, 5, "route", vo, R);
2018
+ N(E, 5, "options", mo, R);
2019
+ N(E, 5, "routeOptions", go, R);
2020
+ N(E, 5, "prepare", _o, R);
2021
+ N(E, 5, "link", fo, R);
2022
+ R = N(E, 0, "GemLinkElement", Po, R);
2023
+ P(E, 1, R);
2024
+ Mo = [Nn(O.store)];
2025
+ class se extends (hs = R, Oo = [G], To = [Ln], xo = [$t()], hs) {
2026
+ constructor() {
2027
+ super(...arguments), D(this, "pattern", P(X, 8, this)), P(X, 11, this), D(this, "active", P(X, 12, this)), P(X, 15, this), Dt(this, Zs, P(X, 16, this, () => {
2028
+ const { path: t, query: n, hash: s } = O.getParams(), i = this.pattern && ao(this.pattern, t);
2029
+ this.active = !!i || t + n + s === this.getLocationString();
2030
+ })), P(X, 19, this);
2031
+ }
2032
+ }
2033
+ X = ho(hs);
2034
+ Zs = /* @__PURE__ */ new WeakMap();
2035
+ N(X, 5, "pattern", Oo, se);
2036
+ N(X, 5, "active", To, se);
2037
+ N(X, 21, "#updateState", xo, Zs);
2038
+ se = N(X, 0, "GemActiveLinkElement", Mo, se);
2039
+ P(X, 1, se);
2040
+ customElements.define("gem-link", R);
2041
+ customElements.define("gem-active-link", se);
2042
+ customElements.define("gem-route", Ue);
2043
+ customElements.define("gem-light-route", z);
2044
+ var Rc = Object.create, ti = Object.defineProperty, Hc = Object.getOwnPropertyDescriptor, Lo = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), le = (e) => {
2045
+ throw TypeError(e);
2046
+ }, No = (e, t, n) => t in e ? ti(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Ui = (e, t) => ti(e, "name", { value: t, configurable: !0 }), Wc = (e) => [, , , Rc((e == null ? void 0 : e[Lo("metadata")]) ?? null)], Ao = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Pe = (e) => e !== void 0 && typeof e != "function" ? le("Function expected") : e, zc = (e, t, n, s, i) => ({ kind: Ao[e], name: t, metadata: s, addInitializer: (o) => n._ ? le("Already initialized") : i.push(Pe(o || null)) }), Vc = (e, t) => No(t, Lo("metadata"), e[3]), tt = (e, t, n, s) => {
2047
+ for (var i = 0, o = e[t >> 1], c = o && o.length; i < c; i++) t & 1 ? o[i].call(n) : s = o[i].call(n, s);
2048
+ return s;
2049
+ }, he = (e, t, n, s, i, o) => {
2050
+ var c, a, f, h, m, r = t & 7, _ = !!(t & 8), l = !!(t & 16), g = r > 3 ? e.length + 1 : r ? _ ? 1 : 2 : 0, v = Ao[r + 5], y = r > 3 && (e[g - 1] = []), $ = e[g] || (e[g] = []), d = r && (!l && !_ && (i = i.prototype), r < 5 && (r > 3 || !l) && Hc(r < 4 ? i : { get [n]() {
2051
+ return us(this, o);
2052
+ }, set [n](u) {
2053
+ return Bi(this, o, u);
2054
+ } }, n));
2055
+ r ? l && r < 4 && Ui(o, (r > 2 ? "set " : r > 1 ? "get " : "") + n) : Ui(i, n);
2056
+ for (var S = s.length - 1; S >= 0; S--)
2057
+ h = zc(r, n, f = {}, e[3], $), r && (h.static = _, h.private = l, m = h.access = { has: l ? (u) => Gc(i, u) : (u) => n in u }, r ^ 3 && (m.get = l ? (u) => (r ^ 1 ? us : Dc)(u, i, r ^ 4 ? o : d.get) : (u) => u[n]), r > 2 && (m.set = l ? (u, k) => Bi(u, i, k, r ^ 4 ? o : d.set) : (u, k) => u[n] = k)), a = (0, s[S])(r ? r < 4 ? l ? o : d[v] : r > 4 ? void 0 : { get: d.get, set: d.set } : i, h), f._ = 1, r ^ 4 || a === void 0 ? Pe(a) && (r > 4 ? y.unshift(a) : r ? l ? o = a : d[v] = a : i = a) : typeof a != "object" || a === null ? le("Object expected") : (Pe(c = a.get) && (d.get = c), Pe(c = a.set) && (d.set = c), Pe(c = a.init) && y.unshift(c));
2058
+ return r || Vc(e, i), d && ti(i, n, d), l ? r ^ 4 ? o : d : i;
2059
+ }, ke = (e, t, n) => No(e, typeof t != "symbol" ? t + "" : t, n), ei = (e, t, n) => t.has(e) || le("Cannot " + n), Gc = (e, t) => Object(t) !== t ? le('Cannot use the "in" operator on this value') : e.has(t), us = (e, t, n) => (ei(e, t, "read from private field"), n ? n.call(e) : t.get(e)), jn = (e, t, n) => t.has(e) ? le("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), Bi = (e, t, n, s) => (ei(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n), Dc = (e, t, n) => (ei(e, t, "access private method"), n), Io, Ro, Ho, Wo, zo, ds, Vo, L, ni, ps, si;
2060
+ let Ki = 0;
2061
+ const ji = (e) => {
2062
+ clearTimeout(Ki), Ki = window.setTimeout(() => document.title = e);
1884
2063
  };
1885
- const de = document.title;
1886
- let Je = "";
1887
- const gi = () => document.title = Je;
1888
- function ps(n, t = "", e = "") {
1889
- const s = qt.title || n;
1890
- s && s !== de ? (Nt.title = s, Je = t + Nt.title + e) : (Nt.title = de, Je = Nt.title), I(gi);
1891
- }
1892
- ct(qt, ps);
1893
- const mi = `${de} | `, yi = ` - ${de}`, ht = class gs extends A {
2064
+ function Fc(e, t = "", n = "") {
2065
+ const s = At.title || e;
2066
+ s && s !== At.defaultTitle ? (xe.title = s, ji(t + xe.title + n)) : (xe.title = At.defaultTitle, ji(xe.title));
2067
+ }
2068
+ Vo = [Ht()];
2069
+ let bt = class Go extends (ds = B, zo = [G], Wo = [G], Ho = [On], Ro = [$t((t) => [t.inert])], Io = [qe()], ds) {
1894
2070
  constructor() {
1895
- super(), this.mounted = () => {
1896
- this.effect(
1897
- () => !this.inert && ct(qt, this.update),
1898
- () => [this.inert]
1899
- );
1900
- }, new MutationObserver(() => this.update()).observe(this, {
1901
- characterData: !0,
1902
- childList: !0,
1903
- subtree: !0
2071
+ super(...arguments), ke(this, "prefix", tt(L, 8, this)), tt(L, 11, this), ke(this, "suffix", tt(L, 12, this)), tt(L, 15, this), ke(this, "inert", tt(L, 16, this)), tt(L, 19, this), jn(this, ni, tt(L, 20, this, () => !this.inert && pt(At, this.update))), tt(L, 23, this), jn(this, ps, new MutationObserver(() => this.update())), jn(this, si, tt(L, 24, this, () => {
2072
+ us(this, ps).observe(this, { characterData: !0, childList: !0, subtree: !0 });
2073
+ })), tt(L, 27, this), ke(this, "render", () => {
2074
+ var t;
2075
+ return Fc((t = this.textContent) == null ? void 0 : t.trim(), this.prefix, this.suffix), at`${Go.title}`;
1904
2076
  });
1905
2077
  }
1906
2078
  static setTitle(t) {
1907
- nt(qt, { title: t });
1908
- }
1909
- render() {
1910
- var t;
1911
- return ps((t = this.textContent) == null ? void 0 : t.trim(), this.prefix, this.suffix), G`${gs.title}`;
2079
+ It(At, { title: t });
1912
2080
  }
1913
2081
  };
1914
- ht.title = document.title;
1915
- ht.defaultPrefix = mi;
1916
- ht.defaultSuffix = yi;
1917
- fn([
1918
- C
1919
- ], ht.prototype, "prefix", 2);
1920
- fn([
1921
- C
1922
- ], ht.prototype, "suffix", 2);
1923
- fn([
1924
- es
1925
- ], ht.prototype, "inert", 2);
1926
- let Nt = ht;
1927
- customElements.define("gem-title", Nt);
1928
- var wi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, Ee = (n, t, e, s) => {
1929
- for (var i = s > 1 ? void 0 : s ? _i(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1930
- (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
1931
- return s && i && wi(t, e, i), i;
1932
- };
1933
- const Wn = /* @__PURE__ */ new Map();
1934
- var jt;
1935
- class Bt extends A {
2082
+ L = Wc(ds);
2083
+ ni = /* @__PURE__ */ new WeakMap();
2084
+ ps = /* @__PURE__ */ new WeakMap();
2085
+ si = /* @__PURE__ */ new WeakMap();
2086
+ he(L, 5, "prefix", zo, bt);
2087
+ he(L, 5, "suffix", Wo, bt);
2088
+ he(L, 5, "inert", Ho, bt);
2089
+ he(L, 21, "#connectStore", Ro, ni);
2090
+ he(L, 21, "#obTextContent", Io, si);
2091
+ bt = he(L, 0, "GemTitleElement", Vo, bt);
2092
+ ke(bt, "title", document.title);
2093
+ tt(L, 1, bt);
2094
+ let xe = bt;
2095
+ customElements.define("gem-title", xe);
2096
+ var qc = Object.create, ii = Object.defineProperty, Uc = Object.getOwnPropertyDescriptor, Do = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), ue = (e) => {
2097
+ throw TypeError(e);
2098
+ }, Fo = (e, t, n) => t in e ? ii(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Ji = (e, t) => ii(e, "name", { value: t, configurable: !0 }), Bc = (e) => [, , , qc((e == null ? void 0 : e[Do("metadata")]) ?? null)], qo = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Te = (e) => e !== void 0 && typeof e != "function" ? ue("Function expected") : e, Kc = (e, t, n, s, i) => ({ kind: qo[e], name: t, metadata: s, addInitializer: (o) => n._ ? ue("Already initialized") : i.push(Te(o || null)) }), jc = (e, t) => Fo(t, Do("metadata"), e[3]), ct = (e, t, n, s) => {
2099
+ for (var i = 0, o = e[t >> 1], c = o && o.length; i < c; i++) t & 1 ? o[i].call(n) : s = o[i].call(n, s);
2100
+ return s;
2101
+ }, Ze = (e, t, n, s, i, o) => {
2102
+ var c, a, f, h, m, r = t & 7, _ = !!(t & 8), l = !!(t & 16), g = r > 3 ? e.length + 1 : r ? _ ? 1 : 2 : 0, v = qo[r + 5], y = r > 3 && (e[g - 1] = []), $ = e[g] || (e[g] = []), d = r && (!l && !_ && (i = i.prototype), r < 5 && (r > 3 || !l) && Uc(r < 4 ? i : { get [n]() {
2103
+ return fs(this, o);
2104
+ }, set [n](u) {
2105
+ return Yi(this, o, u);
2106
+ } }, n));
2107
+ r ? l && r < 4 && Ji(o, (r > 2 ? "set " : r > 1 ? "get " : "") + n) : Ji(i, n);
2108
+ for (var S = s.length - 1; S >= 0; S--)
2109
+ h = Kc(r, n, f = {}, e[3], $), r && (h.static = _, h.private = l, m = h.access = { has: l ? (u) => Jc(i, u) : (u) => n in u }, r ^ 3 && (m.get = l ? (u) => (r ^ 1 ? fs : Qc)(u, i, r ^ 4 ? o : d.get) : (u) => u[n]), r > 2 && (m.set = l ? (u, k) => Yi(u, i, k, r ^ 4 ? o : d.set) : (u, k) => u[n] = k)), a = (0, s[S])(r ? r < 4 ? l ? o : d[v] : r > 4 ? void 0 : { get: d.get, set: d.set } : i, h), f._ = 1, r ^ 4 || a === void 0 ? Te(a) && (r > 4 ? y.unshift(a) : r ? l ? o = a : d[v] = a : i = a) : typeof a != "object" || a === null ? ue("Object expected") : (Te(c = a.get) && (d.get = c), Te(c = a.set) && (d.set = c), Te(c = a.init) && y.unshift(c));
2110
+ return r || jc(e, i), d && ii(i, n, d), l ? r ^ 4 ? o : d : i;
2111
+ }, en = (e, t, n) => Fo(e, typeof t != "symbol" ? t + "" : t, n), ri = (e, t, n) => t.has(e) || ue("Cannot " + n), Jc = (e, t) => Object(t) !== t ? ue('Cannot use the "in" operator on this value') : e.has(t), fs = (e, t, n) => (ri(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Yc = (e, t, n) => t.has(e) ? ue("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), Yi = (e, t, n, s) => (ri(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n), Qc = (e, t, n) => (ri(e, t, "access private method"), n), Uo, Bo, Ko, jo, _s, Jo, V, gs;
2112
+ const Xc = kn(yr`
2113
+ :host(:where(:not([hidden]))) {
2114
+ position: relative;
2115
+ display: inline-flex;
2116
+ align-items: center;
2117
+ }
2118
+ svg {
2119
+ width: 100%;
2120
+ height: 100%;
2121
+ }
2122
+ `), Qi = /* @__PURE__ */ new Map();
2123
+ Jo = [Ht(), Hs(Xc)];
2124
+ class Ct extends (_s = B, jo = [G], Ko = [U], Bo = [U], Uo = [Ln], _s) {
1936
2125
  constructor() {
1937
- super(...arguments);
1938
- P(this, jt, void 0);
1939
- F(this, jt, () => {
1940
- const e = this.element || (this.selector ? (this.root || document).querySelector(this.selector) : null);
1941
- if (typeof e == "string") {
1942
- let s = Wn.get(e);
1943
- return s || (s = document.createElement("template"), s.innerHTML = e, Wn.set(e, s)), s.content.cloneNode(!0);
1944
- } else
1945
- return e instanceof HTMLTemplateElement ? e.content.cloneNode(!0) : e == null ? void 0 : e.cloneNode(!0);
2126
+ super(...arguments), en(this, "selector", ct(V, 8, this)), ct(V, 11, this), en(this, "root", ct(V, 12, this)), ct(V, 15, this), en(this, "element", ct(V, 16, this)), ct(V, 19, this), en(this, "active", ct(V, 20, this)), ct(V, 23, this), Yc(this, gs, () => {
2127
+ const t = this.element || (this.selector ? (this.root || document).querySelector(this.selector) : null);
2128
+ if (typeof t == "string") {
2129
+ let n = Qi.get(t);
2130
+ return n || (n = document.createElement("template"), n.innerHTML = t, Qi.set(t, n)), n.content.cloneNode(!0);
2131
+ } else return t instanceof HTMLTemplateElement ? t.content.cloneNode(!0) : t == null ? void 0 : t.cloneNode(!0);
1946
2132
  });
1947
2133
  }
1948
2134
  render() {
1949
- return G`
1950
- <style>
1951
- :host(:where(:not([hidden]))) {
1952
- position: relative;
1953
- display: inline-flex;
1954
- align-items: center;
1955
- }
1956
- svg {
1957
- width: 100%;
1958
- height: 100%;
1959
- }
1960
- </style>
1961
- ${g(this, jt).call(this)}
2135
+ return at`
2136
+ ${fs(this, gs).call(this)}
1962
2137
  <slot></slot>
1963
2138
  `;
1964
2139
  }
1965
2140
  }
1966
- jt = new WeakMap();
1967
- Ee([
1968
- C
1969
- ], Bt.prototype, "selector", 2);
1970
- Ee([
1971
- N
1972
- ], Bt.prototype, "root", 2);
1973
- Ee([
1974
- N
1975
- ], Bt.prototype, "element", 2);
1976
- Ee([
1977
- cn
1978
- ], Bt.prototype, "active", 2);
1979
- customElements.define("gem-use", Bt);
1980
- var vi = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, ms = (n, t, e, s) => {
1981
- for (var i = s > 1 ? void 0 : s ? Si(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1982
- (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
1983
- return s && i && vi(t, e, i), i;
1984
- };
1985
- class pn extends A {
2141
+ V = Bc(_s);
2142
+ gs = /* @__PURE__ */ new WeakMap();
2143
+ Ze(V, 5, "selector", jo, Ct);
2144
+ Ze(V, 5, "root", Ko, Ct);
2145
+ Ze(V, 5, "element", Bo, Ct);
2146
+ Ze(V, 5, "active", Uo, Ct);
2147
+ Ct = Ze(V, 0, "GemUseElement", Jo, Ct);
2148
+ ct(V, 1, Ct);
2149
+ customElements.define("gem-use", Ct);
2150
+ var Zc = Object.create, oi = Object.defineProperty, tl = Object.getOwnPropertyDescriptor, Yo = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), tn = (e) => {
2151
+ throw TypeError(e);
2152
+ }, Qo = (e, t, n) => t in e ? oi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Xi = (e, t) => oi(e, "name", { value: t, configurable: !0 }), el = (e) => [, , , Zc((e == null ? void 0 : e[Yo("metadata")]) ?? null)], Xo = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Oe = (e) => e !== void 0 && typeof e != "function" ? tn("Function expected") : e, nl = (e, t, n, s, i) => ({ kind: Xo[e], name: t, metadata: s, addInitializer: (o) => n._ ? tn("Already initialized") : i.push(Oe(o || null)) }), sl = (e, t) => Qo(t, Yo("metadata"), e[3]), Me = (e, t, n, s) => {
2153
+ for (var i = 0, o = e[t >> 1], c = o && o.length; i < c; i++) t & 1 ? o[i].call(n) : s = o[i].call(n, s);
2154
+ return s;
2155
+ }, ai = (e, t, n, s, i, o) => {
2156
+ var c, a, f, h, m, r = t & 7, _ = !!(t & 8), l = !!(t & 16), g = r > 3 ? e.length + 1 : r ? _ ? 1 : 2 : 0, v = Xo[r + 5], y = r > 3 && (e[g - 1] = []), $ = e[g] || (e[g] = []), d = r && (!l && !_ && (i = i.prototype), r < 5 && (r > 3 || !l) && tl(r < 4 ? i : { get [n]() {
2157
+ return tr(this, o);
2158
+ }, set [n](u) {
2159
+ return er(this, o, u);
2160
+ } }, n));
2161
+ r ? l && r < 4 && Xi(o, (r > 2 ? "set " : r > 1 ? "get " : "") + n) : Xi(i, n);
2162
+ for (var S = s.length - 1; S >= 0; S--)
2163
+ h = nl(r, n, f = {}, e[3], $), r && (h.static = _, h.private = l, m = h.access = { has: l ? (u) => il(i, u) : (u) => n in u }, r ^ 3 && (m.get = l ? (u) => (r ^ 1 ? tr : rl)(u, i, r ^ 4 ? o : d.get) : (u) => u[n]), r > 2 && (m.set = l ? (u, k) => er(u, i, k, r ^ 4 ? o : d.set) : (u, k) => u[n] = k)), a = (0, s[S])(r ? r < 4 ? l ? o : d[v] : r > 4 ? void 0 : { get: d.get, set: d.set } : i, h), f._ = 1, r ^ 4 || a === void 0 ? Oe(a) && (r > 4 ? y.unshift(a) : r ? l ? o = a : d[v] = a : i = a) : typeof a != "object" || a === null ? tn("Object expected") : (Oe(c = a.get) && (d.get = c), Oe(c = a.set) && (d.set = c), Oe(c = a.init) && y.unshift(c));
2164
+ return r || sl(e, i), d && oi(i, n, d), l ? r ^ 4 ? o : d : i;
2165
+ }, Zi = (e, t, n) => Qo(e, typeof t != "symbol" ? t + "" : t, n), ci = (e, t, n) => t.has(e) || tn("Cannot " + n), il = (e, t) => Object(t) !== t ? tn('Cannot use the "in" operator on this value') : e.has(t), tr = (e, t, n) => (ci(e, t, "read from private field"), n ? n.call(e) : t.get(e)), er = (e, t, n, s) => (ci(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n), rl = (e, t, n) => (ci(e, t, "access private method"), n), Zo, ta, ms, ea, dt;
2166
+ ea = [Ht()];
2167
+ class ie extends (ms = B, ta = [G], Zo = [G], ms) {
1986
2168
  constructor() {
1987
- super(), this.effect(
1988
- () => {
1989
- this.shadowRoot && (this.shadowRoot.innerHTML = `
1990
- <style>
1991
- :host(:where(:not([hidden]))) {
1992
- display: contents;
1993
- }
1994
- ${this.contentcss}
1995
- </style>
1996
- ${this.content}
1997
- `);
1998
- },
1999
- () => [this.content, this.contentcss]
2000
- );
2169
+ super(...arguments), Zi(this, "content", Me(dt, 8, this)), Me(dt, 11, this), Zi(this, "contentcss", Me(dt, 12, this)), Me(dt, 15, this);
2001
2170
  }
2002
2171
  render() {
2172
+ this.shadowRoot.innerHTML = xs`
2173
+ <style>
2174
+ :host(:where(:not([hidden]))) {
2175
+ display: contents;
2176
+ }
2177
+ ${this.contentcss}
2178
+ </style>
2179
+ ${this.content}
2180
+ `;
2003
2181
  }
2004
2182
  }
2005
- ms([
2006
- C
2007
- ], pn.prototype, "content", 2);
2008
- ms([
2009
- C
2010
- ], pn.prototype, "contentcss", 2);
2011
- customElements.define("gem-unsafe", pn);
2012
- var Ei = Object.defineProperty, xi = Object.getOwnPropertyDescriptor, ys = (n, t, e, s) => {
2013
- for (var i = s > 1 ? void 0 : s ? xi(t, e) : t, r = n.length - 1, o; r >= 0; r--)
2014
- (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
2015
- return s && i && Ei(t, e, i), i;
2016
- };
2017
- const bi = "gem-reflect-start", ws = "gem-reflect-end", In = (n) => new Comment(n), Ci = (n) => {
2183
+ dt = el(ms);
2184
+ ai(dt, 5, "content", ta, ie);
2185
+ ai(dt, 5, "contentcss", Zo, ie);
2186
+ ie = ai(dt, 0, "GemUnsafeElement", ea, ie);
2187
+ Me(dt, 1, ie);
2188
+ customElements.define("gem-unsafe", ie);
2189
+ var ol = Object.create, li = Object.defineProperty, al = Object.getOwnPropertyDescriptor, na = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), de = (e) => {
2190
+ throw TypeError(e);
2191
+ }, sa = (e, t, n) => t in e ? li(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, nr = (e, t) => li(e, "name", { value: t, configurable: !0 }), cl = (e) => [, , , ol((e == null ? void 0 : e[na("metadata")]) ?? null)], ia = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Le = (e) => e !== void 0 && typeof e != "function" ? de("Function expected") : e, ll = (e, t, n, s, i) => ({ kind: ia[e], name: t, metadata: s, addInitializer: (o) => n._ ? de("Already initialized") : i.push(Le(o || null)) }), ra = (e, t) => sa(t, na("metadata"), e[3]), ft = (e, t, n, s) => {
2192
+ for (var i = 0, o = e[t >> 1], c = o && o.length; i < c; i++) t & 1 ? o[i].call(n) : s = o[i].call(n, s);
2193
+ return s;
2194
+ }, In = (e, t, n, s, i, o) => {
2195
+ var c, a, f, h, m, r = t & 7, _ = !!(t & 8), l = !!(t & 16), g = r > 3 ? e.length + 1 : r ? _ ? 1 : 2 : 0, v = ia[r + 5], y = r > 3 && (e[g - 1] = []), $ = e[g] || (e[g] = []), d = r && (!l && !_ && (i = i.prototype), r < 5 && (r > 3 || !l) && al(r < 4 ? i : { get [n]() {
2196
+ return gt(this, o);
2197
+ }, set [n](u) {
2198
+ return vs(this, o, u);
2199
+ } }, n));
2200
+ r ? l && r < 4 && nr(o, (r > 2 ? "set " : r > 1 ? "get " : "") + n) : nr(i, n);
2201
+ for (var S = s.length - 1; S >= 0; S--)
2202
+ h = ll(r, n, f = {}, e[3], $), r && (h.static = _, h.private = l, m = h.access = { has: l ? (u) => hl(i, u) : (u) => n in u }, r ^ 3 && (m.get = l ? (u) => (r ^ 1 ? gt : ul)(u, i, r ^ 4 ? o : d.get) : (u) => u[n]), r > 2 && (m.set = l ? (u, k) => vs(u, i, k, r ^ 4 ? o : d.set) : (u, k) => u[n] = k)), a = (0, s[S])(r ? r < 4 ? l ? o : d[v] : r > 4 ? void 0 : { get: d.get, set: d.set } : i, h), f._ = 1, r ^ 4 || a === void 0 ? Le(a) && (r > 4 ? y.unshift(a) : r ? l ? o = a : d[v] = a : i = a) : typeof a != "object" || a === null ? de("Object expected") : (Le(c = a.get) && (d.get = c), Le(c = a.set) && (d.set = c), Le(c = a.init) && y.unshift(c));
2203
+ return r || ra(e, i), d && li(i, n, d), l ? r ^ 4 ? o : d : i;
2204
+ }, sr = (e, t, n) => sa(e, typeof t != "symbol" ? t + "" : t, n), hi = (e, t, n) => t.has(e) || de("Cannot " + n), hl = (e, t) => Object(t) !== t ? de('Cannot use the "in" operator on this value') : e.has(t), gt = (e, t, n) => (hi(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Wt = (e, t, n) => t.has(e) ? de("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), vs = (e, t, n, s) => (hi(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n), ul = (e, t, n) => (hi(e, t, "access private method"), n), oa, aa, ca, la, ws, F, ys, ha, ui, cn, Ss, Ne, di;
2205
+ const dl = "gem-reflect-start", ua = "gem-reflect-end", ir = (e) => new Comment(e), pl = (e) => {
2018
2206
  const t = [];
2019
- let e = n;
2020
- for (; e && (t.push(e), e.nodeValue !== ws); )
2021
- e = e.nextSibling;
2207
+ let n = e;
2208
+ for (; n && (t.push(n), n.nodeValue !== ua); )
2209
+ n = n.nextSibling;
2022
2210
  return t;
2023
2211
  };
2024
- var ge, _s;
2025
- class gn extends A {
2212
+ class Rn extends (ws = B, la = [G], ca = [U], aa = [Mn()], oa = [$t((t) => [t.target])], ws) {
2026
2213
  constructor() {
2027
- super({ isLight: !0 });
2028
- P(this, ge);
2029
- this.target = document.head, this.effect(
2030
- () => {
2031
- this.hidden = !0, this.dataset.gemReflect = "";
2032
- },
2033
- () => []
2034
- );
2035
- const e = In(bi), s = In(ws);
2036
- let i;
2037
- this.effect(
2038
- () => ((i || [e, ...this.childNodes, s]).forEach((r, o, a) => {
2039
- const c = a[o - 1];
2040
- c ? c.after(r) : this.target[g(this, ge, _s)](r);
2041
- }), () => {
2042
- i = Ci(e), i.forEach((r) => r.remove());
2043
- }),
2044
- () => [this.target]
2045
- );
2046
- }
2047
- }
2048
- ge = new WeakSet(), _s = function() {
2214
+ super(...arguments), Wt(this, ys), sr(this, "method", ft(F, 8, this)), ft(F, 11, this), sr(this, "target", ft(F, 12, this, document.head)), ft(F, 15, this), Wt(this, ui, ft(F, 16, this, () => {
2215
+ this.hidden = !0, this.dataset.gemReflect = "";
2216
+ })), ft(F, 19, this), Wt(this, cn, ir(dl)), Wt(this, Ss, ir(ua)), Wt(this, Ne), Wt(this, di, ft(F, 20, this, () => ((gt(this, Ne) || [gt(this, cn), ...this.childNodes, gt(this, Ss)]).forEach((t, n, s) => {
2217
+ const i = s[n - 1];
2218
+ i ? i.after(t) : this.target[gt(this, ys, ha)](t);
2219
+ }), () => {
2220
+ vs(this, Ne, pl(gt(this, cn))), gt(this, Ne).forEach((t) => t.remove());
2221
+ }))), ft(F, 23, this);
2222
+ }
2223
+ }
2224
+ F = cl(ws);
2225
+ ys = /* @__PURE__ */ new WeakSet();
2226
+ ha = function() {
2049
2227
  return this.method || "append";
2050
2228
  };
2051
- ys([
2052
- C
2053
- ], gn.prototype, "method", 2);
2054
- ys([
2055
- N
2056
- ], gn.prototype, "target", 2);
2057
- customElements.define("gem-reflect", gn);
2058
- const zt = Symbol("open mark");
2059
- function er(n) {
2060
- var t;
2061
- const e = Symbol();
2062
- return t = class extends A {
2229
+ ui = /* @__PURE__ */ new WeakMap();
2230
+ cn = /* @__PURE__ */ new WeakMap();
2231
+ Ss = /* @__PURE__ */ new WeakMap();
2232
+ Ne = /* @__PURE__ */ new WeakMap();
2233
+ di = /* @__PURE__ */ new WeakMap();
2234
+ In(F, 5, "method", la, Rn);
2235
+ In(F, 5, "target", ca, Rn);
2236
+ In(F, 21, "#init", aa, ui);
2237
+ In(F, 21, "#changeTarget", oa, di);
2238
+ ra(F, Rn);
2239
+ customElements.define("gem-reflect", Rn);
2240
+ var fl = Object.create, pi = Object.defineProperty, _l = Object.getOwnPropertyDescriptor, da = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), pe = (e) => {
2241
+ throw TypeError(e);
2242
+ }, pa = (e, t, n) => t in e ? pi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, rr = (e, t) => pi(e, "name", { value: t, configurable: !0 }), gl = (e) => [, , , fl((e == null ? void 0 : e[da("metadata")]) ?? null)], fa = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Ae = (e) => e !== void 0 && typeof e != "function" ? pe("Function expected") : e, ml = (e, t, n, s, i) => ({ kind: fa[e], name: t, metadata: s, addInitializer: (o) => n._ ? pe("Already initialized") : i.push(Ae(o || null)) }), vl = (e, t) => pa(t, da("metadata"), e[3]), ge = (e, t, n, s) => {
2243
+ for (var i = 0, o = e[t >> 1], c = o && o.length; i < c; i++) t & 1 ? o[i].call(n) : s = o[i].call(n, s);
2244
+ return s;
2245
+ }, Jn = (e, t, n, s, i, o) => {
2246
+ var c, a, f, h, m, r = t & 7, _ = !!(t & 8), l = !!(t & 16), g = r > 3 ? e.length + 1 : r ? _ ? 1 : 2 : 0, v = fa[r + 5], y = r > 3 && (e[g - 1] = []), $ = e[g] || (e[g] = []), d = r && (!l && !_ && (i = i.prototype), r < 5 && (r > 3 || !l) && _l(r < 4 ? i : { get [n]() {
2247
+ return or(this, o);
2248
+ }, set [n](u) {
2249
+ return cr(this, o, u);
2250
+ } }, n));
2251
+ r ? l && r < 4 && rr(o, (r > 2 ? "set " : r > 1 ? "get " : "") + n) : rr(i, n);
2252
+ for (var S = s.length - 1; S >= 0; S--)
2253
+ h = ml(r, n, f = {}, e[3], $), r && (h.static = _, h.private = l, m = h.access = { has: l ? (u) => wl(i, u) : (u) => n in u }, r ^ 3 && (m.get = l ? (u) => (r ^ 1 ? or : yl)(u, i, r ^ 4 ? o : d.get) : (u) => u[n]), r > 2 && (m.set = l ? (u, k) => cr(u, i, k, r ^ 4 ? o : d.set) : (u, k) => u[n] = k)), a = (0, s[S])(r ? r < 4 ? l ? o : d[v] : r > 4 ? void 0 : { get: d.get, set: d.set } : i, h), f._ = 1, r ^ 4 || a === void 0 ? Ae(a) && (r > 4 ? y.unshift(a) : r ? l ? o = a : d[v] = a : i = a) : typeof a != "object" || a === null ? pe("Object expected") : (Ae(c = a.get) && (d.get = c), Ae(c = a.set) && (d.set = c), Ae(c = a.init) && y.unshift(c));
2254
+ return r || vl(e, i), d && pi(i, n, d), l ? r ^ 4 ? o : d : i;
2255
+ }, nn = (e, t, n) => pa(e, typeof t != "symbol" ? t + "" : t, n), fi = (e, t, n) => t.has(e) || pe("Cannot " + n), wl = (e, t) => Object(t) !== t ? pe('Cannot use the "in" operator on this value') : e.has(t), or = (e, t, n) => (fi(e, t, "read from private field"), n ? n.call(e) : t.get(e)), ar = (e, t, n) => t.has(e) ? pe("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), cr = (e, t, n, s) => (fi(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n), yl = (e, t, n) => (fi(e, t, "access private method"), n);
2256
+ const sn = Symbol("open mark");
2257
+ function Ul(e) {
2258
+ var t, n, s, i, o, c, a;
2259
+ const f = Symbol();
2260
+ i = [Ht(), An({ role: "alertdialog", ariaModal: "true" })];
2261
+ let h = class _a extends (s = B, n = [qe()], t = [qe()], s) {
2063
2262
  constructor() {
2064
- super(), this.label = "", this.internals.role = "alertdialog", this.internals.ariaModal = "true";
2263
+ super(...arguments), nn(this, "label", ""), ar(this, c, ge(o, 8, this, () => pt(O.store, this.update))), ge(o, 11, this), ar(this, a, ge(o, 12, this, () => pt(_a.store, this.update))), ge(o, 15, this);
2065
2264
  }
2066
2265
  /**@final */
2067
2266
  static get isOpen() {
2068
- return this.store[zt];
2069
- }
2070
- /**@final */
2071
- static get observedStores() {
2072
- return [y.store, this.store];
2267
+ return this.store[sn];
2073
2268
  }
2074
2269
  /**
2075
2270
  * @final
2076
2271
  * 自带 100ms 延迟,以允许在其他 Dialog 的 `shouldClose` 中调用此方法;
2077
2272
  * 浏览器 history 为异步 API,需要设置较长延迟;
2078
2273
  */
2079
- static open(s) {
2080
- const i = new this();
2081
- this.instance = i, this.inertStore = [...document.body.children].filter((o) => !o.inert), this.inertStore.forEach((o) => o.inert = !0), document.body.append(i);
2082
- const r = () => nt(this.store, { [zt]: !0, ...s });
2274
+ static open(_) {
2275
+ const l = new this();
2276
+ this.instance = l, this.inertStore = [...document.body.children].filter((v) => !v.inert), this.inertStore.forEach((v) => v.inert = !0), document.body.append(l);
2277
+ const g = () => It(this.store, { [sn]: !0, ..._ });
2083
2278
  return setTimeout(() => {
2084
- r(), y.push({
2085
- title: i.label,
2086
- open: r,
2279
+ g(), O.push({
2280
+ title: l.label,
2281
+ open: g,
2087
2282
  close: this.closeHandle.bind(this),
2088
2283
  shouldClose: this.shouldClose.bind(this)
2089
2284
  });
2090
- }, 100), e;
2285
+ }, 100), f;
2091
2286
  }
2092
2287
  /**
2093
2288
  * @final
2094
2289
  * UI 中执行关闭
2095
2290
  */
2096
2291
  static close() {
2097
- return y.back(), e;
2292
+ return O.back(), f;
2098
2293
  }
2099
2294
  /**
2100
2295
  * @final
2101
2296
  * history 中自动调用
2102
2297
  */
2103
2298
  static closeHandle() {
2104
- var s;
2105
- return this.inertStore.forEach((i) => i.inert = !1), (s = this.instance) == null || s.remove(), nt(this.store, { [zt]: !1, ...n }), e;
2299
+ var _;
2300
+ return this.inertStore.forEach((l) => l.inert = !1), (_ = this.instance) == null || _.remove(), It(this.store, { [sn]: !1, ...e }), f;
2106
2301
  }
2107
2302
  /**
2108
2303
  * 由于要操作浏览器历史记录,所以没有设计为 Promise;
@@ -2110,194 +2305,184 @@ function er(n) {
2110
2305
  static shouldClose() {
2111
2306
  return !0;
2112
2307
  }
2113
- }, t.inertStore = [], t.instance = null, /**
2114
- * @final
2115
- * modal 状态,包括内容,是否已经确认关闭等属性
2116
- */
2117
- t.store = Ft({
2118
- [zt]: !1,
2119
- ...n
2120
- }), t;
2121
- }
2122
- var Pi = Object.defineProperty, $i = Object.getOwnPropertyDescriptor, mn = (n, t, e, s) => {
2123
- for (var i = s > 1 ? void 0 : s ? $i(t, e) : t, r = n.length - 1, o; r >= 0; r--)
2124
- (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
2125
- return s && i && Pi(t, e, i), i;
2126
- }, vs = (n, t, e) => {
2127
- if (!t.has(n))
2128
- throw TypeError("Cannot " + e);
2129
- }, lt = (n, t, e) => (vs(n, t, "read from private field"), e ? e.call(n) : t.get(n)), Me = (n, t, e) => {
2130
- if (t.has(n))
2131
- throw TypeError("Cannot add the same private member more than once");
2132
- t instanceof WeakSet ? t.add(n) : t.set(n, e);
2133
- }, Oe = (n, t, e, s) => (vs(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), Mt, Ot, Rt;
2134
- const Et = Symbol();
2135
- let fe = class extends A {
2308
+ };
2309
+ return o = gl(s), c = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), Jn(o, 21, "#connectHistory", n, c), Jn(o, 21, "#connectStore", t, a), h = Jn(o, 0, "ModalElement", i, h), nn(h, "inertStore", []), nn(h, "instance", null), nn(h, "store", bn({
2310
+ [sn]: !1,
2311
+ ...e
2312
+ })), ge(o, 1, h), h;
2313
+ }
2314
+ var Sl = Object.create, _i = Object.defineProperty, $l = Object.getOwnPropertyDescriptor, ga = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), fe = (e) => {
2315
+ throw TypeError(e);
2316
+ }, ma = (e, t, n) => t in e ? _i(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, lr = (e, t) => _i(e, "name", { value: t, configurable: !0 }), El = (e) => [, , , Sl((e == null ? void 0 : e[ga("metadata")]) ?? null)], va = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Ie = (e) => e !== void 0 && typeof e != "function" ? fe("Function expected") : e, bl = (e, t, n, s, i) => ({ kind: va[e], name: t, metadata: s, addInitializer: (o) => n._ ? fe("Already initialized") : i.push(Ie(o || null)) }), Cl = (e, t) => ma(t, ga("metadata"), e[3]), Tt = (e, t, n, s) => {
2317
+ for (var i = 0, o = e[t >> 1], c = o && o.length; i < c; i++) t & 1 ? o[i].call(n) : s = o[i].call(n, s);
2318
+ return s;
2319
+ }, Hn = (e, t, n, s, i, o) => {
2320
+ var c, a, f, h, m, r = t & 7, _ = !!(t & 8), l = !!(t & 16), g = r > 3 ? e.length + 1 : r ? _ ? 1 : 2 : 0, v = va[r + 5], y = r > 3 && (e[g - 1] = []), $ = e[g] || (e[g] = []), d = r && (!l && !_ && (i = i.prototype), r < 5 && (r > 3 || !l) && $l(r < 4 ? i : { get [n]() {
2321
+ return et(this, o);
2322
+ }, set [n](u) {
2323
+ return Ve(this, o, u);
2324
+ } }, n));
2325
+ r ? l && r < 4 && lr(o, (r > 2 ? "set " : r > 1 ? "get " : "") + n) : lr(i, n);
2326
+ for (var S = s.length - 1; S >= 0; S--)
2327
+ h = bl(r, n, f = {}, e[3], $), r && (h.static = _, h.private = l, m = h.access = { has: l ? (u) => Pl(i, u) : (u) => n in u }, r ^ 3 && (m.get = l ? (u) => (r ^ 1 ? et : kl)(u, i, r ^ 4 ? o : d.get) : (u) => u[n]), r > 2 && (m.set = l ? (u, k) => Ve(u, i, k, r ^ 4 ? o : d.set) : (u, k) => u[n] = k)), a = (0, s[S])(r ? r < 4 ? l ? o : d[v] : r > 4 ? void 0 : { get: d.get, set: d.set } : i, h), f._ = 1, r ^ 4 || a === void 0 ? Ie(a) && (r > 4 ? y.unshift(a) : r ? l ? o = a : d[v] = a : i = a) : typeof a != "object" || a === null ? fe("Object expected") : (Ie(c = a.get) && (d.get = c), Ie(c = a.set) && (d.set = c), Ie(c = a.init) && y.unshift(c));
2328
+ return r || Cl(e, i), d && _i(i, n, d), l ? r ^ 4 ? o : d : i;
2329
+ }, me = (e, t, n) => ma(e, typeof t != "symbol" ? t + "" : t, n), gi = (e, t, n) => t.has(e) || fe("Cannot " + n), Pl = (e, t) => Object(t) !== t ? fe('Cannot use the "in" operator on this value') : e.has(t), et = (e, t, n) => (gi(e, t, "read from private field"), n ? n.call(e) : t.get(e)), zt = (e, t, n) => t.has(e) ? fe("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), Ve = (e, t, n, s) => (gi(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n), kl = (e, t, n) => (gi(e, t, "access private method"), n), wa, ya, Sa, $s, $a, Z, Re, He, We, Es, ln, mi;
2330
+ const Yn = Symbol();
2331
+ $a = [Nn(O.store), An({ role: "dialog", ariaModal: "true" })];
2332
+ class Be extends ($s = B, Sa = [G], ya = [Ln], wa = [Mn()], $s) {
2136
2333
  constructor() {
2137
- super(), Me(this, Mt, void 0), Me(this, Ot, void 0), Me(this, Rt, []), this.closeHandle = () => {
2138
- var n;
2139
- return this.inert = !0, lt(this, Rt).forEach((t) => t.inert = !1), lt(this, Mt) ? lt(this, Mt).before(this) : lt(this, Ot) && ((n = lt(this, Ot)) == null || n.appendChild(this)), this.dispatchEvent(new CustomEvent("close")), this.opened = !1, Et;
2140
- }, this.openHandle = () => (this.hidden = !1, this.inert = !1, Oe(this, Mt, this.nextSibling), Oe(this, Ot, this.parentElement || this.getRootNode()), Oe(this, Rt, [...document.body.children].filter((n) => !n.inert)), lt(this, Rt).forEach((n) => n.inert = !0), document.body.append(this), this.dispatchEvent(new CustomEvent("open")), this.opened = !0, Et), this.open = () => {
2334
+ super(...arguments), me(this, "label", Tt(Z, 8, this)), Tt(Z, 11, this), me(this, "opened", Tt(Z, 12, this)), Tt(Z, 15, this), zt(this, Re), zt(this, He), zt(this, We, []), zt(this, Es, () => {
2335
+ var t;
2336
+ this.inert = !0, et(this, We).forEach((n) => n.inert = !1), et(this, Re) ? et(this, Re).before(this) : et(this, He) && ((t = et(this, He)) == null || t.appendChild(this)), this.dispatchEvent(new CustomEvent("close")), this.opened = !1;
2337
+ }), zt(this, ln, () => {
2338
+ this.hidden = !1, this.inert = !1, Ve(this, Re, this.nextSibling), Ve(this, He, this.parentElement || this.getRootNode()), Ve(this, We, [...document.body.children].filter((t) => !t.inert)), et(this, We).forEach((t) => t.inert = !0), document.body.append(this), this.dispatchEvent(new CustomEvent("open")), this.opened = !0;
2339
+ }), zt(this, mi, Tt(Z, 16, this, () => this.inert = !0)), Tt(Z, 19, this), me(this, "open", () => {
2141
2340
  if (!this.opened)
2142
- return this.openHandle(), y.push({
2341
+ return et(this, ln).call(this), O.push({
2143
2342
  title: this.label,
2144
- open: this.openHandle,
2145
- close: this.closeHandle,
2343
+ open: et(this, ln),
2344
+ close: et(this, Es),
2146
2345
  shouldClose: this.shouldClose
2147
- }), Et;
2148
- }, this.close = () => (y.back(), Et), this.forceClose = () => (this.opened = !1, setTimeout(this.close, 100), Et), this.effect(
2149
- () => this.inert = !0,
2150
- () => []
2151
- ), this.internals.role = "dialog", this.internals.ariaModal = "true";
2346
+ }), Yn;
2347
+ }), me(this, "close", () => (O.back(), Yn)), me(this, "forceClose", () => (this.opened = !1, setTimeout(this.close, 100), Yn));
2152
2348
  }
2153
2349
  shouldClose() {
2154
2350
  return !0;
2155
2351
  }
2156
- };
2157
- Mt = /* @__PURE__ */ new WeakMap();
2158
- Ot = /* @__PURE__ */ new WeakMap();
2159
- Rt = /* @__PURE__ */ new WeakMap();
2160
- mn([
2161
- C
2162
- ], fe.prototype, "label", 2);
2163
- mn([
2164
- cn
2165
- ], fe.prototype, "opened", 2);
2166
- fe = mn([
2167
- hn(y.store)
2168
- ], fe);
2169
- const Ss = /* @__PURE__ */ new WeakMap();
2170
- function Ti(n) {
2171
- return Ss.get(n);
2172
- }
2173
- const Es = /* @__PURE__ */ new WeakMap();
2174
- function nr(n) {
2175
- return Es.get(n);
2176
- }
2177
- const xs = /* @__PURE__ */ new WeakMap();
2178
- function ki(n) {
2179
- const t = ve(), e = document.createElement("style"), s = Ft(n), i = {}, r = {};
2180
- Es.set(i, r), Ss.set(i, s);
2181
- const o = () => Object.keys(s).forEach((h) => {
2182
- r[h] || (r[h] = `--${j(h)}-${t}`, i[h] = `var(${r[h]})`);
2183
- });
2184
- xs.set(i, o), o();
2185
- const a = () => `:root, :host {${Object.keys(s).reduce((h, p) => h + `${r[p]}:${s[p]};`, "")}}`, c = () => e.textContent = a();
2186
- return ct(s, c), c(), (document.head || document.documentElement).append(e), i;
2187
- }
2188
- function Li(n, t) {
2189
- nt(Ti(n), t), xs.get(n)();
2190
2352
  }
2191
- function sr(n) {
2192
- const t = ki(n);
2193
- return [t, (e) => Li(t, e)];
2194
- }
2195
- class Ni {
2353
+ Z = El($s);
2354
+ Re = /* @__PURE__ */ new WeakMap();
2355
+ He = /* @__PURE__ */ new WeakMap();
2356
+ We = /* @__PURE__ */ new WeakMap();
2357
+ Es = /* @__PURE__ */ new WeakMap();
2358
+ ln = /* @__PURE__ */ new WeakMap();
2359
+ mi = /* @__PURE__ */ new WeakMap();
2360
+ Hn(Z, 5, "label", Sa, Be);
2361
+ Hn(Z, 5, "opened", ya, Be);
2362
+ Hn(Z, 21, "#init", wa, mi);
2363
+ Be = Hn(Z, 0, "GemDialogBaseElement", $a, Be);
2364
+ Tt(Z, 1, Be);
2365
+ class xl {
2196
2366
  constructor(t) {
2197
- this.info = (...e) => {
2198
- console.log(`[${this._type}]:`, ...e);
2199
- }, this.warn = (...e) => {
2200
- console.warn(`[${this._type}]:`, ...e);
2201
- }, this.error = (...e) => {
2202
- console.error(`[${this._type}]:`, ...e);
2203
- }, this._type = t;
2204
- }
2205
- }
2206
- const Mi = new Ni("GEM"), Oi = /\$\d(?:<[^>]*>)?/, Ri = /\$(\d)(<([^>]*)>)?/g, Ai = 3;
2207
- function Hi(n, ...t) {
2208
- const e = n.split(Oi), s = [];
2367
+ T(this, "_type");
2368
+ T(this, "info", (...t) => {
2369
+ console.log(`[${this._type}]:`, ...t);
2370
+ });
2371
+ T(this, "warn", (...t) => {
2372
+ console.warn(`[${this._type}]:`, ...t);
2373
+ });
2374
+ T(this, "error", (...t) => {
2375
+ console.error(`[${this._type}]:`, ...t);
2376
+ });
2377
+ this._type = t;
2378
+ }
2379
+ }
2380
+ const Tl = new xl("GEM"), Ol = /\$\d(?:<[^>]*>)?/, Ml = /\$(\d)(<([^>]*)>)?/g, Ll = 3;
2381
+ function Nl(e, ...t) {
2382
+ const n = e.split(Ol), s = [];
2209
2383
  let i;
2210
- for (; i = Ri.exec(n); ) {
2211
- const r = i[Ai], o = Number(i[1]) - 1, a = t[o];
2212
- s.push(typeof a == "function" ? a(r) : a);
2384
+ for (; i = Ml.exec(e); ) {
2385
+ const o = i[Ll], c = Number(i[1]) - 1, a = t[c];
2386
+ s.push(typeof a == "function" ? a(o) : a);
2213
2387
  }
2214
- return G(e, ...s);
2388
+ return at(n, ...s);
2215
2389
  }
2216
- const xt = /* @__PURE__ */ new Set();
2217
- var mt, oe, me, bs, ye, Cs, at, At, yt, ae;
2218
- const yn = class yn {
2390
+ const ve = /* @__PURE__ */ new Set();
2391
+ var M, hn, Ea, ba, ze, un;
2392
+ const vi = class vi {
2219
2393
  constructor(t) {
2220
- P(this, mt);
2221
- P(this, me);
2222
- P(this, ye);
2223
- P(this, at);
2224
- P(this, yt);
2225
- if (this.cachePrefix = "gem-i18n", this.replace = ({ path: i }) => this.setLanguage(i), this.getParams = () => ({ path: this.currentLanguage }), !t.resources[t.fallbackLanguage])
2226
- throw new tt("i18n: fallbackLanguage invalid");
2227
- this.store = Ft(this), Object.assign(this, t);
2228
- let e = g(this, me, bs) || this.currentLanguage || g(this, ye, Cs);
2394
+ b(this, M);
2395
+ T(this, "resources");
2396
+ T(this, "fallbackLanguage");
2397
+ T(this, "currentLanguage");
2398
+ T(this, "cache");
2399
+ T(this, "cachePrefix", "gem-i18n");
2400
+ T(this, "urlParamsType");
2401
+ T(this, "urlParamsName");
2402
+ T(this, "onChange");
2403
+ // 兼容 `<gem-route>`
2404
+ T(this, "replace", ({ path: t }) => this.setLanguage(t));
2405
+ T(this, "getParams", () => ({ path: this.currentLanguage }));
2406
+ if (!t.resources[t.fallbackLanguage])
2407
+ throw new yt("i18n: fallbackLanguage invalid");
2408
+ Object.assign(this, t);
2409
+ let n = p(this, M, Ea) || this.currentLanguage || p(this, M, ba);
2229
2410
  const s = document.querySelector(`[type*=${this.cachePrefix}]`);
2230
2411
  if (s)
2231
2412
  try {
2232
2413
  const i = JSON.parse(s.textContent || "");
2233
- e = i.currentLanguage, this.resources[i.currentLanguage] = i.currentLanguagePack;
2414
+ n = i.currentLanguage, this.resources[i.currentLanguage] = i.currentLanguagePack;
2234
2415
  } catch {
2235
2416
  }
2236
- e ? (F(this, yt, e, ae), this.setLanguage(e)) : this.resetLanguage();
2417
+ n ? (x(this, M, n, un), this.setLanguage(n)) : this.resetLanguage();
2237
2418
  }
2238
- get(t, ...e) {
2239
- const s = this.resources[this.currentLanguage], i = this.resources[this.fallbackLanguage], r = s[t] || i[t], o = (r == null ? void 0 : r.message) || r || `[${t}]`;
2240
- return e.length ? Hi(o, ...e) : o;
2419
+ get(t, ...n) {
2420
+ const s = this.resources[this.currentLanguage], i = this.resources[this.fallbackLanguage], o = s[t] || i[t], c = (o == null ? void 0 : o.message) || o || `[${t}]`;
2421
+ return n.length ? Nl(c, ...n) : c;
2241
2422
  }
2242
2423
  detectLanguage() {
2243
- const t = Object.keys(this.resources), e = navigator.languages.map((s) => s.replace(/-(.*)/, (i) => i.toUpperCase()));
2244
- for (const s of e) {
2245
- const i = t.find((r) => r === s || s.startsWith(`${r}-`));
2246
- if (i)
2247
- return i;
2424
+ const t = Object.keys(this.resources), n = navigator.languages.map((s) => s.replace(/-(.*)/, (i) => i.toUpperCase()));
2425
+ for (const s of n) {
2426
+ const i = t.find((o) => o === s || s.startsWith(`${o}-`));
2427
+ if (i) return i;
2248
2428
  }
2249
2429
  return this.fallbackLanguage;
2250
2430
  }
2251
2431
  async setLanguage(t) {
2252
- g(this, at, At) && xt.forEach(async (i) => await i.setLanguage(t));
2253
- let e;
2432
+ var o, c;
2433
+ p(this, M, ze) && ve.forEach(async (a) => await a.setLanguage(t));
2434
+ let n;
2254
2435
  const s = this.resources[t];
2255
2436
  if (!s)
2256
- return Mi.warn(`${this.cachePrefix}: not found \`${t}\``), this.resetLanguage();
2437
+ return Tl.warn(`${this.cachePrefix}: not found \`${t}\``), this.resetLanguage();
2257
2438
  if (typeof s == "string") {
2258
- const i = `${this.cachePrefix}:`, r = `${i}${s}`, o = localStorage.getItem(r), a = async () => {
2259
- const c = await (await fetch(s)).json();
2439
+ const a = `${this.cachePrefix}:`, f = `${a}${s}`, h = localStorage.getItem(f), m = async () => {
2440
+ const r = await (await fetch(s)).json();
2260
2441
  if (this.cache) {
2261
- for (let h = 0; h < localStorage.length; h++) {
2262
- const p = localStorage.key(h);
2263
- p.startsWith(i) && localStorage.removeItem(p);
2442
+ for (let _ = 0; _ < localStorage.length; _++) {
2443
+ const l = localStorage.key(_);
2444
+ l.startsWith(a) && localStorage.removeItem(l);
2264
2445
  }
2265
- localStorage.setItem(r, JSON.stringify(c));
2446
+ localStorage.setItem(f, JSON.stringify(r));
2266
2447
  }
2267
- return c;
2448
+ return r;
2268
2449
  };
2269
- if (o)
2450
+ if (h)
2270
2451
  try {
2271
- e = JSON.parse(o);
2452
+ n = JSON.parse(h);
2272
2453
  } catch {
2273
- e = await a();
2454
+ n = await m();
2274
2455
  }
2275
2456
  else
2276
- e = await a();
2457
+ n = await m();
2277
2458
  } else
2278
- e = s;
2279
- return this.resources[t] = e, nt(this.store), t !== this.currentLanguage && F(this, yt, t, ae), this.cache === !0 && this.setCache(), t;
2459
+ n = s;
2460
+ this.resources[t] = n;
2461
+ const i = [document.documentElement];
2462
+ for (; i.length; ) {
2463
+ const a = i.pop();
2464
+ (o = a[Cn]) == null || o.call(a), (c = a.shadowRoot) != null && c.firstElementChild && i.push(a.shadowRoot.firstElementChild), a.firstElementChild && i.push(a.firstElementChild), a.nextElementSibling && i.push(a.nextElementSibling);
2465
+ }
2466
+ return t !== this.currentLanguage && x(this, M, t, un), this.cache === !0 && this.setCache(), t;
2280
2467
  }
2281
2468
  resetLanguage() {
2282
- return g(this, at, At) && xt.forEach((t) => t.resetLanguage()), F(this, yt, this.fallbackLanguage, ae), this.cache && localStorage.removeItem(g(this, mt, oe)), this.setLanguage(this.detectLanguage());
2469
+ return p(this, M, ze) && ve.forEach((t) => t.resetLanguage()), x(this, M, this.fallbackLanguage, un), this.cache && localStorage.removeItem(p(this, M, hn)), this.setLanguage(this.detectLanguage());
2283
2470
  }
2284
2471
  // 一般用在 `onChange` 中
2285
2472
  setCache() {
2286
- g(this, at, At) && xt.forEach((t) => t.setCache()), localStorage.setItem(g(this, mt, oe), this.currentLanguage);
2473
+ p(this, M, ze) && ve.forEach((t) => t.setCache()), localStorage.setItem(p(this, M, hn), this.currentLanguage);
2287
2474
  }
2288
- createSubModule(t, e) {
2289
- const s = new yn({
2290
- resources: e,
2475
+ createSubModule(t, n) {
2476
+ const s = new vi({
2477
+ resources: n,
2291
2478
  cachePrefix: `${this.cachePrefix}-${t}`,
2292
2479
  currentLanguage: this.currentLanguage,
2293
2480
  fallbackLanguage: this.fallbackLanguage,
2294
2481
  cache: this.cache
2295
2482
  });
2296
- return xt.add(s), s;
2483
+ return ve.add(s), s;
2297
2484
  }
2298
2485
  /**
2299
- * prepare: @connectStore(i18n.store)
2300
- *
2301
2486
  * @example
2302
2487
  *
2303
2488
  * html`
@@ -2313,225 +2498,313 @@ const yn = class yn {
2313
2498
  };
2314
2499
  }
2315
2500
  };
2316
- mt = new WeakSet(), oe = function() {
2501
+ M = new WeakSet(), hn = function() {
2317
2502
  return `${this.cachePrefix}:current`;
2318
- }, me = new WeakSet(), bs = function() {
2319
- const { hostname: t, pathname: e, search: s } = location, i = t.split(".");
2503
+ }, Ea = function() {
2504
+ const { hostname: t, pathname: n, search: s } = location, i = t.split(".");
2320
2505
  switch (this.urlParamsType) {
2321
2506
  case "ccTLD":
2322
2507
  return i.pop();
2323
2508
  case "gTLD":
2324
2509
  return i.shift();
2325
2510
  case "path":
2326
- return e.split("/")[1];
2511
+ return n.split("/")[1];
2327
2512
  default:
2328
- const r = this.urlParamsName && new URLSearchParams(s).get(this.urlParamsName) || "";
2329
- return r in this.resources ? r : "";
2330
- }
2331
- }, ye = new WeakSet(), Cs = function() {
2332
- return this.cache && localStorage.getItem(g(this, mt, oe)) || "";
2333
- }, at = new WeakSet(), At = function() {
2334
- return !xt.has(this);
2335
- }, yt = new WeakSet(), ae = function(t) {
2336
- var e;
2337
- g(this, at, At) && (document.documentElement.lang = t), this.currentLanguage = t, (e = this.onChange) == null || e.call(this, t);
2338
- };
2339
- let Vn = yn;
2340
- const Wi = {
2341
- headers: {
2342
- "Content-Type": "application/json"
2343
- }
2513
+ const o = this.urlParamsName && new URLSearchParams(s).get(this.urlParamsName) || "";
2514
+ return o in this.resources ? o : "";
2515
+ }
2516
+ }, ba = function() {
2517
+ return this.cache && localStorage.getItem(p(this, M, hn)) || "";
2518
+ }, ze = function() {
2519
+ return !ve.has(this);
2520
+ }, un = function(t) {
2521
+ var n;
2522
+ p(this, M, ze) && (document.documentElement.lang = t), this.currentLanguage = t, (n = this.onChange) == null || n.call(this, t);
2344
2523
  };
2345
- async function xe(n, t = {}) {
2346
- const e = await fetch(n, {
2347
- ...Wi,
2348
- ...t
2349
- });
2350
- if (e.status === 0)
2351
- throw new Error("Request fail");
2352
- if (e.status >= 500)
2353
- throw new Error(e.statusText);
2354
- try {
2355
- const s = await e.json();
2356
- if (e.status >= 400)
2357
- throw new Error((s == null ? void 0 : s.message) || e.statusText, { cause: s });
2358
- return s;
2359
- } catch {
2360
- throw new Error("Server error");
2361
- }
2362
- }
2363
- const Ii = Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array())).constructor;
2364
- function Ps(n) {
2365
- return n instanceof FormData || n instanceof Blob || n instanceof Ii || n instanceof URLSearchParams || n instanceof ReadableStream || n instanceof ArrayBuffer ? n : typeof n == "object" ? JSON.stringify(n) : n;
2366
- }
2367
- function $s(n, t) {
2368
- const { origin: e, pathname: s, search: i } = new URL(n, location.origin), r = new URLSearchParams(t).toString();
2369
- return `${e}${s}${i ? `${i}&` : r ? "?" : ""}${r}`;
2370
- }
2371
- function ir(n, t) {
2372
- return xe($s(n, t), { method: "GET" });
2373
- }
2374
- function rr(n, t) {
2375
- return xe($s(n, t), { method: "DELETE" });
2376
- }
2377
- function or(n, t) {
2378
- return xe(n, { method: "PUT", body: Ps(t) });
2379
- }
2380
- function ar(n, t) {
2381
- return xe(n, { method: "POST", body: Ps(t) });
2382
- }
2383
- const L = (n) => window.matchMedia(n).matches, cr = {
2524
+ let hr = vi;
2525
+ const K = (e) => window.matchMedia(e).matches, Bl = {
2384
2526
  PRINT: "print",
2385
2527
  get isPrint() {
2386
- return L(this.PRINT);
2528
+ return K(this.PRINT);
2387
2529
  },
2388
2530
  HOVER: "(hover: hover)",
2389
2531
  get isHover() {
2390
- return L(this.HOVER);
2532
+ return K(this.HOVER);
2391
2533
  },
2392
2534
  PWA: "(display-mode: standalone)",
2393
2535
  // PWA: '(display-mode: browser)', // debugging
2394
2536
  get isPWA() {
2395
- return L(this.PWA);
2537
+ return K(this.PWA);
2396
2538
  },
2397
2539
  MOTION_REDUCE: "(prefers-reduced-motion: reduce)",
2398
2540
  get isMotionReduce() {
2399
- return L(this.MOTION_REDUCE);
2541
+ return K(this.MOTION_REDUCE);
2400
2542
  },
2401
2543
  DATA_REDUCE: "(prefers-reduced-data: reduce)",
2402
2544
  get isDataReduce() {
2403
- return L(this.DATA_REDUCE);
2545
+ return K(this.DATA_REDUCE);
2404
2546
  },
2405
2547
  WATCH: "(width < 320px)",
2406
2548
  get isWatch() {
2407
- return L(this.WATCH);
2549
+ return K(this.WATCH);
2408
2550
  },
2409
2551
  SMALL_PHONE: "(320px <= width <= 480px) and (height <= 640px)",
2410
2552
  get isSmallPhone() {
2411
- return L(this.SMALL_PHONE);
2553
+ return K(this.SMALL_PHONE);
2412
2554
  },
2413
2555
  PHONE: "(320px <= width <= 480px)",
2414
2556
  get isPhone() {
2415
- return L(this.PHONE);
2557
+ return K(this.PHONE);
2416
2558
  },
2417
2559
  PHONE_LANDSCAPE: "(480px < width < 960px) and (orientation: landscape)",
2418
2560
  // PHONE_LANDSCAPE: '(480px < width < 960px)',
2419
2561
  get isPhoneLandscape() {
2420
- return L(this.PHONE_LANDSCAPE);
2562
+ return K(this.PHONE_LANDSCAPE);
2421
2563
  },
2422
2564
  // Widget
2423
2565
  SHORT: "(width >= 480px) and (height <= 320px)",
2424
2566
  get isShort() {
2425
- return L(this.SHORT);
2567
+ return K(this.SHORT);
2426
2568
  },
2427
2569
  // 1280 x 850
2428
2570
  // 1024 x 768
2429
2571
  TABLET: "(480px < width <= 1280px)",
2430
2572
  get isTablet() {
2431
- return L(this.TABLET);
2573
+ return K(this.TABLET);
2432
2574
  },
2433
2575
  // 1366x768
2434
2576
  DESKTOP: "(width > 1280px) and (orientation: landscape)",
2435
2577
  get isDesktop() {
2436
- return L(this.DESKTOP);
2578
+ return K(this.DESKTOP);
2437
2579
  },
2438
2580
  // 1920x1080
2439
2581
  WIDTHSCREEN: "(width >= 1920px) and (orientation: landscape)",
2440
2582
  get isWidthScreen() {
2441
- return L(this.WIDTHSCREEN);
2442
- }
2443
- };
2583
+ return K(this.WIDTHSCREEN);
2584
+ }
2585
+ }, Al = Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array())).constructor;
2586
+ function Il(e = {}) {
2587
+ const {
2588
+ origin: t = location.origin,
2589
+ base: n = "",
2590
+ appendHeaders: s = () => ({}),
2591
+ transformInput: i = (r) => r,
2592
+ transformOutput: o = (r) => r,
2593
+ ...c
2594
+ } = e, a = (r) => r instanceof FormData || r instanceof Blob || r instanceof Al || r instanceof URLSearchParams || r instanceof ReadableStream || r instanceof ArrayBuffer ? r : typeof r == "object" ? JSON.stringify(r) : r, f = (r, _) => {
2595
+ if (new URL(r, location.origin).pathname !== r)
2596
+ throw new yt("`path` format is incorrect");
2597
+ const l = new URLSearchParams(_).toString();
2598
+ return `${t}${n}${r}${l ? "?" : ""}${l}`;
2599
+ }, h = (r) => {
2600
+ if (!r) return {};
2601
+ if (r instanceof Headers) return Object.fromEntries(r);
2602
+ const _ = Array.isArray(r) ? r : Object.entries(r);
2603
+ return Object.fromEntries(_.map(([l, g]) => [l.toLowerCase(), g]));
2604
+ }, m = async (r, _ = {}) => {
2605
+ const l = new Request(r, {
2606
+ ...c,
2607
+ ..._,
2608
+ headers: new Headers({
2609
+ "content-type": "application/json",
2610
+ ...h(c.headers),
2611
+ ...h(_.headers)
2612
+ })
2613
+ }), g = await fetch(l);
2614
+ if (g.status === 0) throw new Error("Request fail");
2615
+ if (g.status >= 500) throw new Error(g.statusText);
2616
+ const v = l.headers.get("content-type"), y = g.status >= 400;
2617
+ try {
2618
+ let $;
2619
+ if (v.includes("json") ? $ = await g.json() : v.includes("octet-stream") ? $ = await g.arrayBuffer() : $ = await g.text(), y) throw new Error(g.statusText, { cause: $ });
2620
+ return o($, l);
2621
+ } catch {
2622
+ throw new Error("Parse error");
2623
+ }
2624
+ };
2625
+ return {
2626
+ request: m,
2627
+ get(r, _) {
2628
+ const l = i(_);
2629
+ return m(f(r, l), {
2630
+ method: "GET",
2631
+ headers: s(l)
2632
+ });
2633
+ },
2634
+ del(r, _) {
2635
+ const l = i(_);
2636
+ return m(f(r, l), {
2637
+ method: "DELETE",
2638
+ headers: s(l)
2639
+ });
2640
+ },
2641
+ put(r, _) {
2642
+ const l = i(_);
2643
+ return m(f(r), {
2644
+ method: "PUT",
2645
+ headers: s(l),
2646
+ body: a(l)
2647
+ });
2648
+ },
2649
+ post(r, _) {
2650
+ const l = i(_);
2651
+ return m(f(r), {
2652
+ method: "POST",
2653
+ headers: s(l),
2654
+ body: a(l)
2655
+ });
2656
+ }
2657
+ };
2658
+ }
2659
+ const { request: Kl, del: jl, get: Jl, post: Yl, put: Ql } = Il(), Ca = /* @__PURE__ */ new WeakMap(), Pa = /* @__PURE__ */ new WeakMap();
2660
+ function Xl(e) {
2661
+ return Ca.get(e);
2662
+ }
2663
+ function ka(e) {
2664
+ return Pa.get(e);
2665
+ }
2666
+ function fn(e, t = {}) {
2667
+ const n = En(), s = kn({})[Rt], [i, o] = Xe(e), c = new Proxy(
2668
+ { [Rt]: s },
2669
+ {
2670
+ get(f, h) {
2671
+ if (!f[h]) {
2672
+ const [m, r, _] = h.match(/^(\w*Color)(\d+)$/) || [];
2673
+ r && (f[h] = `oklch(from ${f[r]} calc(l - ${(Number(_) - 400) / 1e3}) c h)`);
2674
+ }
2675
+ return f[h];
2676
+ }
2677
+ }
2678
+ );
2679
+ Pa.set(c, t), Ca.set(c, i);
2680
+ const a = () => {
2681
+ let f = "";
2682
+ Object.keys(i).forEach((h) => {
2683
+ t[h] || (t[h] = `--${oe(h)}-${n}`, c[h] = `var(${t[h]})`), f += `${t[h]}:${i[h]};`;
2684
+ }), s.setContent(`:scope,:host{${f}}`);
2685
+ };
2686
+ return a(), pt(i, () => {
2687
+ a(), s.updateStyle();
2688
+ }), [c, o];
2689
+ }
2690
+ function Rl(e) {
2691
+ return fn(e);
2692
+ }
2693
+ function Zl(e) {
2694
+ const t = Rl(e);
2695
+ return document.adoptedStyleSheets.push(t[0][Rt].getStyle()), t;
2696
+ }
2697
+ function th(e, t) {
2698
+ return fn(t, ka(e));
2699
+ }
2700
+ function eh(e) {
2701
+ const [t] = fn(e), n = ka(t);
2702
+ return [t, (i) => (o, { addInitializer: c, access: a }) => {
2703
+ c(function() {
2704
+ const [f, h] = fn({ ...e }, n);
2705
+ this.internals.sheets.push(f[Rt].getStyle(this)), this.memo(() => h(a.get(this).apply(this)), i && (() => i(this)));
2706
+ });
2707
+ }];
2708
+ }
2444
2709
  export {
2445
- Ut as GemActiveLinkElement,
2446
- fe as GemDialogBaseElement,
2447
- A as GemElement,
2448
- tt as GemError,
2449
- hi as GemLightRouteElement,
2450
- x as GemLinkElement,
2451
- gn as GemReflectElement,
2452
- ds as GemRouteElement,
2453
- Nt as GemTitleElement,
2454
- pn as GemUnsafeElement,
2455
- Bt as GemUseElement,
2456
- Vn as I18n,
2457
- qs as LinkedList,
2458
- mi as PREFIX,
2459
- Us as PropProxyMap,
2460
- It as QueryString,
2461
- yi as SUFFIX,
2462
- Gn as SVGTemplateResult,
2463
- Yn as SheetToken,
2464
- Vt as StoreListenerMap,
2465
- _e as TemplateResult,
2466
- zn as absoluteLocation,
2467
- Jn as addListener,
2468
- I as addMicrotask,
2469
- Di as addMicrotaskToStack,
2470
- Xi as adoptedStyle,
2471
- C as attribute,
2472
- ii as basePathStore,
2473
- es as boolattribute,
2474
- j as camelToKebabCase,
2475
- Bs as classMap,
2476
- Ze as cleanObject,
2477
- ct as connect,
2478
- hn as connectStore,
2479
- Ui as createCSSSheet,
2480
- ci as createHistoryParams,
2481
- er as createModalClass,
2482
- dn as createPath,
2483
- Ft as createStore,
2484
- ki as createTheme,
2485
- qi as css,
2486
- tr as customElement,
2487
- Wi as defaultReqInit,
2488
- nn as defineAttribute,
2489
- rn as defineCSSState,
2490
- Dt as defineProperty,
2491
- sn as defineRef,
2492
- rr as del,
2493
- we as directive,
2494
- Ki as disconnect,
2495
- Se as emitter,
2496
- Bi as exportPartsMap,
2497
- ir as get,
2498
- nr as getThemeProps,
2499
- Ti as getThemeStore,
2500
- Qi as globalemitter,
2501
- Ys as guard,
2502
- y as history,
2503
- G as html,
2504
- Qn as ifDefined,
2505
- js as isArrayChange,
2506
- ot as kebabToCamelCase,
2507
- ls as matchPath,
2508
- cr as mediaQuery,
2509
- on as nativeDefineElement,
2510
- Ji as numattribute,
2511
- tn as objectMapToString,
2512
- Xs as part,
2513
- Fi as partMap,
2514
- ar as post,
2515
- N as property,
2516
- or as put,
2517
- ve as randomStr,
2518
- Jt as raw,
2519
- zi as refobject,
2520
- Fs as removeItems,
2521
- Kn as render,
2522
- Js as repeat,
2523
- xe as request,
2524
- Zi as rootElement,
2525
- Yi as slot,
2526
- Hi as splice,
2527
- cn as state,
2528
- ji as styleMap,
2529
- Gi as styled,
2530
- Vs as svg,
2531
- qt as titleStore,
2532
- nt as updateStore,
2533
- Li as updateTheme,
2534
- en as useStore,
2535
- sr as useTheme,
2536
- Ks as version
2710
+ Pn as BoundaryCSSState,
2711
+ se as GemActiveLinkElement,
2712
+ Be as GemDialogBaseElement,
2713
+ B as GemElement,
2714
+ yt as GemError,
2715
+ z as GemLightRouteElement,
2716
+ R as GemLinkElement,
2717
+ Rn as GemReflectElement,
2718
+ Ue as GemRouteElement,
2719
+ xe as GemTitleElement,
2720
+ ie as GemUnsafeElement,
2721
+ Ct as GemUseElement,
2722
+ hr as I18n,
2723
+ Da as LinkedList,
2724
+ xl as Logger,
2725
+ Fa as PropProxyMap,
2726
+ De as QueryString,
2727
+ Ls as RenderErrorEvent,
2728
+ fr as SVGTemplateResult,
2729
+ Rt as SheetToken,
2730
+ ne as StoreListenerMap,
2731
+ $n as TemplateResult,
2732
+ Cn as UpdateToken,
2733
+ vr as absoluteLocation,
2734
+ wr as addListener,
2735
+ Ot as addMicrotask,
2736
+ Hs as adoptedStyle,
2737
+ An as aria,
2738
+ pc as async,
2739
+ G as attribute,
2740
+ yc as basePathStore,
2741
+ On as boolattribute,
2742
+ oe as camelToKebabCase,
2743
+ Ua as classMap,
2744
+ Ts as cleanObject,
2745
+ pt as connect,
2746
+ Nn as connectStore,
2747
+ kn as createCSSSheet,
2748
+ xc as createHistoryParams,
2749
+ Ul as createModalClass,
2750
+ js as createPath,
2751
+ $r as createRef,
2752
+ Ns as createState,
2753
+ bn as createStore,
2754
+ As as createTemplate,
2755
+ yr as css,
2756
+ fc as customElement,
2757
+ jl as del,
2758
+ Sn as directive,
2759
+ Ba as disconnect,
2760
+ $t as effect,
2761
+ ye as emitter,
2762
+ Dl as exportPartsMap,
2763
+ lc as fallback,
2764
+ Jl as get,
2765
+ ka as getThemeProps,
2766
+ Xl as getThemeStore,
2767
+ dc as globalemitter,
2768
+ ql as guard,
2769
+ O as history,
2770
+ at as html,
2771
+ Sc as ifDefined,
2772
+ Il as initRequest,
2773
+ qa as isArrayChange,
2774
+ zl as kebabToCamelCase,
2775
+ Tl as logger,
2776
+ ao as matchPath,
2777
+ Bl as mediaQuery,
2778
+ kr as memo,
2779
+ qe as mounted,
2780
+ ac as numattribute,
2781
+ Os as objectMapToString,
2782
+ Or as part,
2783
+ Gl as partMap,
2784
+ Yl as post,
2785
+ U as property,
2786
+ Ql as put,
2787
+ En as randomStr,
2788
+ xs as raw,
2789
+ ks as render,
2790
+ Fl as repeat,
2791
+ Kl as request,
2792
+ Ht as shadow,
2793
+ uc as slot,
2794
+ Nl as splice,
2795
+ Ln as state,
2796
+ Vl as styleMap,
2797
+ Wl as styled,
2798
+ Ga as svg,
2799
+ xr as template,
2800
+ At as titleStore,
2801
+ cc as unmounted,
2802
+ It as updateStore,
2803
+ eh as useDecoratorTheme,
2804
+ th as useOverrideTheme,
2805
+ Rl as useScopedTheme,
2806
+ Xe as useStore,
2807
+ Zl as useTheme,
2808
+ nc as version,
2809
+ Mn as willMount
2537
2810
  };